Commit 3ce61b38 authored by xioln's avatar xioln

废品通知单三联背面

parent e4cd04f4
<template>
<table border="1" class="fristTable">
<thead>
<tr>
<td colspan="3">废品原因责任代码</td>
</tr>
</thead>
<tbody>
<tr>
<td class="center">责任者</td>
<td class="center">代码</td>
<td class="center">报废原因</td>
</tr>
<tr>
<td rowspan="5" class="center">人为因素</td>
<td rowspan="5" class="center">01</td>
<td>操作不当</td>
</tr>
<tr>
<td>违反工艺纪律,不按规定要求操作</td>
</tr>
<tr>
<td>疏忽大意</td>
</tr>
<tr>
<td>身体不适</td>
</tr>
<tr>
<td>其它</td>
</tr>
<tr>
<td rowspan="4" class="center">人为因素</td>
<td rowspan="4" class="center">02</td>
<td>加工设备失效,维修不良</td>
</tr>
<tr>
<td>工艺装备失效、计童确认失准</td>
</tr>
<tr>
<td>测量设备失效、计童确认失准</td>
</tr>
<tr>
<td>工具失效、计童确认失准</td>
</tr>
<tr>
<td rowspan="2" class="center">人为因素</td>
<td rowspan="2" class="center">03</td>
<td>提供的材料、成品、标准件、元器件不合格</td>
</tr>
<tr>
<td>错料、混料</td>
</tr>
<tr>
<td rowspan="3" class="center">设计因素</td>
<td rowspan="3" class="center">04</td>
<td>设计图样错误</td>
</tr>
<tr>
<td>设计更改</td>
</tr>
<tr>
<td>设计缺陷</td>
</tr>
<tr>
<td rowspan="2" class="center">工艺因素</td>
<td rowspan="2" class="center">05</td>
<td>工艺文件提供的信息错误或不完全</td>
</tr>
<tr>
<td>解释、指导不当</td>
</tr>
<tr>
<td class="center">环境因素</td>
<td class="center">06</td>
<td>工作环境达不到规定的要求</td>
</tr>
<tr>
<td class="center">管理因素</td>
<td class="center">07</td>
<td>未按规定的管理程 序和要求管理</td>
</tr>
<tr>
<td class="center">自然因素</td>
<td class="center">08</td>
<td>正常损耗( 轮胎磨损,蓄电池橡胶件到寿等)</td>
</tr>
<tr>
<td class="center">其它因素</td>
<td class="center">09</td>
<td>不属上述原因</td>
</tr>
</tbody>
</table>
</template>
<script>
export default {
data() {
return {
disabled: false,
direction: ''
}
},
created() {},
methods: {
// 打开弹出框
open() {
this.visible = true
}
}
}
</script>
<style lang="scss">
.fristTable {
width: 560px;
margin: 0 20px;
thead {
line-height: 50px;
text-align: center;
font-weight: 700;
}
tbody{
line-height: 32px;
tr{
td:last-child{
width: 60%;
text-indent: 20px;
}
}
.center{
text-align: center;
}
}
}
</style>
<template>
<section>
<el-form ref="form" :model="form" :rules="rules">
<table border="1" class="threeTable">
<thead>
<tr>
<td colspan="3">材料补偿领取卡片</td>
</tr>
</thead>
<tbody>
<tr>
<td class="center" colspan="2">项目</td>
<td class="center">数值</td>
</tr>
<tr>
<td
class="center"
:class="{ technologist: !technologist }"
colspan="2"
>
零件图号
</td>
<td class="input">
<el-form-item prop="portCarNumber">
<el-input
v-model="form.portCarNumber"
clearable
:disabled="technologist || (disabled && !technologist)"
placeholder="请输入"
/>
</el-form-item>
</td>
</tr>
<tr>
<td
class="center"
colspan="2"
:class="{ technologist: !technologist }"
>
材料名称
</td>
<td class="input">
<el-form-item prop="clmc">
<el-input
v-model="form.clmc"
clearable
:disabled="technologist || (disabled && !technologist)"
placeholder="请输入"
/>
</el-form-item>
</td>
</tr>
<tr>
<td
class="center"
colspan="2"
:class="{ technologist: !technologist }"
>
材料牌号
</td>
<td class="input">
<el-form-item prop="clph">
<el-input
v-model="form.clph"
clearable
:disabled="technologist || (disabled && !technologist)"
placeholder="请输入"
/>
</el-form-item>
</td>
</tr>
<tr>
<td
class="center"
colspan="2"
:class="{ technologist: !technologist }"
>
材料规格
</td>
<td class="input">
<el-form-item prop="spec">
<el-input
v-model="form.spec"
clearable
:disabled="technologist || (disabled && !technologist)"
placeholder="请输入"
/>
</el-form-item>
</td>
</tr>
<tr>
<td rowspan="4" class="center">材料损失</td>
<td class="center" :class="{ costEstimator: !costEstimator }">
单件定额
</td>
<td class="input">
<el-form-item prop="quota">
<el-input
v-model="form.quota"
clearable
type="Number"
min="0"
placeholder="请输入"
/>
<!-- :disabled="costEstimator || (disabled && !costEstimator)" -->
</el-form-item>
</td>
</tr>
<tr>
<td class="center" :class="{ costEstimator: !costEstimator }">
消耗总数
</td>
<td class="input">
<el-form-item prop="consumeCount">
<el-input
v-model="form.consumeCount"
clearable
type="Number"
min="0"
placeholder="请输入"
/>
<!-- :disabled="costEstimator || (disabled && !costEstimator)" -->
</el-form-item>
</td>
</tr>
<tr>
<td class="center" :class="{ costEstimator: !costEstimator }">
单位价格
</td>
<td class="input">
<el-form-item prop="price">
<el-input
v-model="form.price"
clearable
type="Number"
min="0"
placeholder="请输入"
/>
<!-- :disabled="costEstimator || (disabled && !costEstimator)" -->
</el-form-item>
</td>
</tr>
<tr>
<td class="center" :class="{ costEstimator: !costEstimator }">
损失价值
</td>
<td class="input">
<el-form-item prop="lossValue">
<el-input
v-model="form.lossValue"
clearable
type="Number"
min="0"
placeholder="请输入"
/>
<!-- :disabled="costEstimator || (disabled && !costEstimator)" -->
</el-form-item>
</td>
</tr>
<tr>
<td
class="center"
colspan="2"
:class="{ costEstimator: !costEstimator }"
>
辅助材料损失价值
</td>
<td class="input">
<el-form-item prop="subMaterialLossValue">
<el-input
v-model="form.subMaterialLossValue"
clearable
placeholder="请输入"
type="Number"
min="0"
/>
<!-- :disabled="costEstimator || (disabled && !costEstimator)" -->
</el-form-item>
</td>
</tr>
<tr>
<td
class="center"
colspan="2"
:class="{ costEstimator: !costEstimator }"
>
合计损失总值
</td>
<td class="input">
<el-form-item prop="totalLossValue">
<el-input
v-model="form.totalLossValue"
clearable
type="Number"
min="0"
placeholder="请输入"
/>
<!-- :disabled="costEstimator || (disabled && !costEstimator)" -->
</el-form-item>
</td>
</tr>
<tr>
<td
class="center"
colspan="2"
:class="{ technologist: !technologist }"
>
拆卸废品时间/件
</td>
<td class="input">
<el-form-item prop="disassemblyDate">
<el-input
v-model="form.disassemblyDate"
clearable
type="Number"
:disabled="technologist || (disabled && !technologist)"
min="0"
placeholder="请输入"
/>
</el-form-item>
</td>
</tr>
<tr class="signature">
<td colspan="3">
<div>
<el-form-item prop="clsign">
<label for="">材料定额员:</label>
<el-input
v-model="form.clsign"
clearable
:disabled="disabled"
class="material-quota-officer"
/>
<!-- <span class="material-quota-officer" contenteditable="true" /> -->
</el-form-item>
</div>
<div>
<el-form-item prop="gysign">
<label for="">工艺员:</label>
<el-input
v-model="form.gysign"
clearable
:disabled="disabled"
class="technologists"
/>
<!-- <span class="technologist" contenteditable="true" /> -->
</el-form-item>
</div>
</td>
</tr>
</tbody>
</table>
</el-form>
<div class="table-btn">
<el-button
type="primary"
size="small"
:disabled="disab"
@click="save"
>确定</el-button>
<el-button
size="small"
:disabled="disab"
@click="handleClose"
>取消</el-button>
</div>
</section>
</template>
<script>
export default {
data() {
return {
item: {},
disabled: true,
disab: false,
rules: {},
form: {
portCarNumber: '', // 零件图号
clmc: '', // 材料名称
clph: '', // 材料牌号
spec: '', // 材料规格
quota: '', // 单件定额
consumeCount: '', // 消耗总数
lossValue: '', // 损失价值
price: '', // 单位价格
subMaterialLossValue: '', // 辅助材料损失价值
totalLossValue: '', // 合计损失总值
clsign: '', // 材料定额员
gysign: '', // 工艺员
disassemblyDate: ''// 拆卸废品时间/件
},
// 工艺员
technologist: true,
// 成本核算员
costEstimator: true
}
},
computed: {
lossValue: {
get() {
if (this.form.consumeCount && this.form.price) {
return this.form.consumeCount * this.form.price
}
// if (this.form.lossValue && this.form.subMaterialLossValue) {
// return Number(this.form.lossValue) + Number(this.form.subMaterialLossValue)
// }
return ''
}
}
},
watch: {
item: {
handler(val) {
this.$refs.form && this.$refs['form'].resetFields()
if (val) {
this.item = val
this.$set(this.form, 'gysign', val.assigneeName)
Object.keys(this.form).forEach((key) => {
Object.keys(val.primaryBusinessObject).forEach((key2) => {
if (key === key2) {
if (val.primaryBusinessObject[key2]) {
this.$set(this.form, key, val.primaryBusinessObject[key2])
}
}
})
})
}
},
deep: true
},
lossValue: {
handler(v) {
if (v) {
this.form.lossValue = v
if (this.form.subMaterialLossValue) {
this.form.totalLossValue = Number(v) + Number(this.form.subMaterialLossValue)
}
}
},
deep: true
},
'form.subMaterialLossValue': {
handler(v) {
if (v && this.lossValue) {
this.form.totalLossValue = Number(v) + Number(this.lossValue)
}
},
deep: true
}
},
created() {
this.getUserGroup()
},
mounted() {},
methods: {
// 打开弹出框
open(val) {
if (
this.$route.query.name === '我的请求' ||
this.$route.query.name === '办结任务' ||
this.$route.query.name === '已办任务' ||
this.$route.query.name === '废品通知单详情'
) {
this.disabled = true
} else {
this.disabled = false
}
this.$nextTick(() => {
this.visible = true
this.item = val
})
},
// 获取用户群组
getUserGroup() {
const params = {
searchItems: {
children: [{}],
items: [
{
fieldName: 'userId',
operator: 'EQ',
value: localStorage.getItem('userId')
}
],
operator: 'AND'
},
sortItem: [
{
fieldName: 'id',
sortOrder: 'asc'
}
]
}
this.HttpRequest('/UserGroupRef/find/recursion', params, 'post')
.then((res) => {
res.items.content.forEach((item) => {
if (item.groupName === '成本核算员') {
// this.costEstimator = false
this.$nextTick(() => {
// this.$set(this.rules, 'quota', [
// {
// required: true,
// message: '请输入单件定额',
// trigger: 'blur'
// }
// ])
// this.$set(this.rules, 'consumeCount', [
// {
// required: true,
// message: '请输入消耗总数',
// trigger: 'blur'
// }
// ])
// this.$set(this.rules, 'price', [
// {
// required: true,
// message: '请输入单位价格',
// trigger: 'blur'
// }
// ])
// this.$set(this.rules, 'lossValue', [
// {
// required: true,
// message: '请输入损失价值',
// trigger: 'blur'
// }
// ])
// this.$set(this.rules, 'subMaterialLossValue', [
// {
// required: true,
// message: '请输入辅助材料损失价值',
// trigger: 'blur'
// }
// ])
// this.$set(this.rules, 'totalLossValue', [
// {
// required: true,
// message: '请输入合计损失总值',
// trigger: 'blur'
// }
// ])
})
} else if (item.groupName === '工艺员' && this.$route.query.taskKey === 'Activity_067g61s') {
// } else if (item.groupName === '工艺员') {
this.technologist = false
this.$nextTick(() => {
this.$set(this.form, 'gysign', item.userName)
this.$set(this.rules, 'portCarNumber', [
{
required: true,
message: '请输入零件图号',
trigger: 'blur'
}
])
this.$set(this.rules, 'clmc', [
{
required: true,
message: '请输入材料名称',
trigger: 'blur'
}
])
this.$set(this.rules, 'clph', [
{
required: true,
message: '请输入材料牌号',
trigger: 'blur'
}
])
this.$set(this.rules, 'spec', [
{
required: true,
message: '请输入材料规格',
trigger: 'blur'
}
])
this.$set(this.rules, 'disassemblyDate', [
{
required: true,
message: '请输入拆卸废品时间',
trigger: 'blur'
}
])
})
}
})
})
.catch((err) => console.log(err))
.finally(() => {})
},
save() {
this.$refs.form.validate((valid) => {
if (valid) {
this.disab = true
const params = {
id: this.item.pboId,
dxClassname: 'com.tf.mes.vo.prodTask.ScrapNoticeDocVO', // 指定类路径
subTypeName: 'ScrapNoticeDoc', // 指定类型
operator: 'MODIFY', // 增加操作
...this.form
}
this.HttpRequest('/ScrapNoticeDoc/recursion', params, 'post')
.then((res) => {
this.reset('保存')
})
.catch((err) => console.log(err))
.finally(() => {
this.disab = false
})
} else {
this.$utils.showMessageWarning('请完整填写表单')
return false
}
})
},
handleClose() {
this.visible = false
},
// 重置弹出框
reset(message) {
this.visible = false
this.$message({
message: `${message}成功`,
type: 'success'
})
// Object.keys(this.form).forEach(key => {
// this.form[key] = ''
// })
// setTimeout(() => {
// this.$emit('reload')
// }, 500)
},
// 初始化责任人
firstRemoteMethod(query, key) {
if (query !== '') {
const params = {
'indices': [
'User',
'DxUser'
],
'searchItems': {
'items': [
{
'fieldName': 'id',
'operator': 'EQ',
'value': query
}
],
'operator': 'AND'
},
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
]
}
this.HttpRequest('/User/find/recursion', params, 'post')
.then((res) => {
if (res.items.content.length !== 0) {
this.$set(this.form, key, res.items.content[0].userName)
}
})
.catch((err) => {
console.log(err)
})
.finally(() => {})
}
}
}
}
</script>
<style lang="scss">
.threeTable {
width: 560px;
margin: 0 20px;
thead {
line-height: 50px;
text-align: center;
font-weight: 700;
}
tbody {
line-height: 32px;
.input {
input {
border: none;
}
}
.width40 {
width: 56px;
padding: 0 20px;
box-sizing: border-box;
}
.center {
text-align: center;
}
.text-indent {
text-indent: 20px;
}
.signature {
td {
padding: 20px;
box-sizing: border-box;
text-align: right;
line-height: 40px;
}
input {
border: none;
border-bottom: 1px solid #000;
border-radius: 0;
}
.el-input {
width: 150px;
height: 32px;
}
.el-input__inner {
width: 150px;
height: 32px;
}
// .technologist,.material-quota-officer{
// display: inline-block;
// min-width: 150px;
// border-bottom: 1px solid #000;
// text-align: left;
// text-indent: 20px;
// height: 32px;
// }
}
}
}
.technologist,
.costEstimator {
&::before {
content: "*";
color: #f56c6c;
margin-right: 4px;
}
}
.table-btn {
margin-top: 10px;
text-align: center;
}
</style>
<template>
<section>
<el-form ref="form" :model="form" class="demo-ruleForm" :rules="rules">
<table border="1" class="twoTable">
<thead>
<tr>
<td colspan="6">废品损失核算</td>
</tr>
</thead>
<tbody>
<tr>
<td class="center" colspan="2">项目</td>
<td class="center" style="width: 80px">单位</td>
<td class="center">数量</td>
<td class="center">单价</td>
<td class="center">损失价值</td>
</tr>
<tr>
<td rowspan="6" class="width40">本车间损失</td>
<td class="center">材料</td>
<td class="center">材料费</td>
<td class="input">
<el-form-item prop="materialCount">
<el-input
v-model="form.materialCount"
clearable
:disabled="costEstimator || (disabled && !costEstimator)"
min="0"
type="Number"
placeholder="请输入"
@input="thisCount"
/>
</el-form-item>
</td>
<td class="input">
<el-form-item prop="materialCost">
<el-input
v-model="form.materialCost"
clearable
:disabled="costEstimator || (disabled && !costEstimator)"
min="0"
type="Number"
placeholder="请输入"
@input="thisPrice"
/>
</el-form-item>
</td>
<td class="text-indent">
{{ form.materialLossCost }}
<!-- <el-input v-model="form.materialLossCost" min="0" type="Number" @input="thisLoss" /> -->
</td>
</tr>
<tr>
<!-- <td
class="center"
rowspan="2"
:class="{ costEstimator: !costEstimator }"
> -->
<td
class="center"
rowspan="2"
>
本工序工时
</td>
<td class="center">人工费</td>
<td class="input">
<el-form-item prop="curOpCostPCount">
<el-input
v-model="form.curOpCostPCount"
clearable
:disabled="costEstimator || (disabled && !costEstimator)"
min="0"
type="Number"
placeholder="请输入"
@input="thisCount"
/>
</el-form-item>
</td>
<td class="input">
<el-form-item prop="curOpCostP">
<el-input
v-model="form.curOpCostP"
clearable
:disabled="costEstimator || (disabled && !costEstimator)"
min="0"
type="Number"
placeholder="请输入"
@input="thisPrice"
/>
</el-form-item>
</td>
<td class="text-indent">
{{ form.curOpPLossCost }}
<!-- <el-input v-model="form.curOpPLossCost" min="0" type="Number" @input="thisLoss" /> -->
</td>
</tr>
<tr>
<td class="center">制造费</td>
<td class="input">
<el-form-item prop="curOpCostMCount">
<el-input
v-model="form.curOpCostMCount"
clearable
:disabled="costEstimator || (disabled && !costEstimator)"
min="0"
type="Number"
placeholder="请输入"
@input="thisCount"
/>
</el-form-item>
</td>
<td class="input">
<el-form-item prop="curOpCostM">
<el-input
v-model="form.curOpCostM"
clearable
:disabled="costEstimator || (disabled && !costEstimator)"
min="0"
type="Number"
placeholder="请输入"
@input="thisPrice"
/>
</el-form-item>
</td>
<td class="text-indent">
{{ form.curOpMLossCost }}
<!-- <el-input v-model="form.curOpMLossCost" min="0" type="Number" @input="thisLoss" /> -->
</td>
</tr>
<tr>
<td
class="center"
rowspan="2"
>
<!-- <td
class="center"
rowspan="2"
:class="{ costEstimator: !costEstimator && item.primaryBusinessObject==='Activity_144n8lq' }"
> -->
前工序工时
</td>
<td class="center">人工费</td>
<td class="input">
<el-form-item prop="perOpCostPCount">
<el-input
v-model="form.perOpCostPCount"
clearable
:disabled="costEstimator || (disabled && !costEstimator)"
min="0"
type="Number"
placeholder="请输入"
@input="thisCount"
/>
</el-form-item>
</td>
<td class="input">
<el-form-item prop="perOpCostP">
<el-input
v-model="form.perOpCostP"
clearable
:disabled="costEstimator || (disabled && !costEstimator)"
min="0"
type="Number"
placeholder="请输入"
@input="thisPrice"
/>
</el-form-item>
</td>
<td class="text-indent">
{{ form.perOpPLossCost }}
<!-- <el-input v-model="form.perOpPLossCost" min="0" type="Number" @input="thisLoss" /> -->
</td>
</tr>
<tr>
<td class="center">制造费</td>
<td class="input">
<el-form-item prop="perOpCostMCount">
<el-input
v-model="form.perOpCostMCount"
clearable
:disabled="costEstimator || (disabled && !costEstimator)"
min="0"
type="Number"
placeholder="请输入"
@input="thisCount"
/>
</el-form-item>
</td>
<td class="input">
<el-form-item prop="perOpCostM">
<el-input
v-model="form.perOpCostM"
clearable
:disabled="costEstimator || (disabled && !costEstimator)"
min="0"
type="Number"
placeholder="请输入"
@input="thisPrice"
/>
</el-form-item>
</td>
<td class="text-indent">
{{ form.perOpMLossCost }}
<!-- <el-input v-model="form.perOpMLossCost" min="0" type="Number" @input="thisLoss" /> -->
</td>
</tr>
<tr>
<td class="center">合计</td>
<td />
<td class="text-indent">{{ form.curTotalCount }}</td>
<td class="text-indent">{{ form.curTotalCost }}</td>
<td class="text-indent">{{ form.curTotalLossCost }}</td>
</tr>
<tr>
<td rowspan="4" class="width40">外车间损失</td>
<td class="center">材料(零件价格)</td>
<td />
<td class="input">
<el-form-item prop="outMaterialCount">
<el-input
v-model="form.outMaterialCount"
clearable
min="0"
type="Number"
placeholder="请输入"
@input="outCount"
/>
</el-form-item>
</td>
<td class="input">
<el-form-item prop="outMaterialCost">
<el-input
v-model="form.outMaterialCost"
clearable
min="0"
type="Number"
placeholder="请输入"
@input="outPrice"
/>
</el-form-item>
</td>
<td class="text-indent">
{{ form.outMaterialLossCos }}
<!-- <el-input v-model="form.outMaterialLossCos" min="0" type="Number" placeholder="请输入" @input="outLoss" /> -->
</td>
</tr>
<tr>
<td class="center" rowspan="2">工时</td>
<td class="center">人工费</td>
<td class="input">
<el-form-item prop="workHourPCount">
<el-input
v-model="form.workHourPCount"
clearable
min="0"
type="Number"
placeholder="请输入"
@input="outCount"
/>
</el-form-item>
</td>
<td class="input">
<el-form-item prop="workHourPCost">
<el-input
v-model="form.workHourPCost"
clearable
min="0"
type="Number"
placeholder="请输入"
@input="outPrice"
/>
</el-form-item>
</td>
<td class="text-indent">
{{ form.workHourPLossCost }}
<!-- <el-input v-model="form.workHourPLossCost" min="0" type="Number" placeholder="请输入" @input="outLoss" /> -->
</td>
</tr>
<tr>
<td class="center">制造费</td>
<td class="input">
<el-form-item prop="workHourMCount">
<el-input
v-model="form.workHourMCount"
clearable
min="0"
type="Number"
placeholder="请输入"
@input="outCount"
/>
</el-form-item>
</td>
<td class="input">
<el-form-item prop="workHourMCost">
<el-input
v-model="form.workHourMCost"
clearable
min="0"
type="Number"
placeholder="请输入"
@input="outPrice"
/>
</el-form-item>
</td>
<td class="text-indent">
{{ form.workHourMLossCost }}
<!-- <el-input v-model="form.workHourMLossCost" min="0" type="Number" placeholder="请输入" @input="outLoss" /> -->
</td>
</tr>
<tr>
<td class="center">合计</td>
<td />
<td class="text-indent">{{ form.outTotalCount }}</td>
<td class="text-indent">{{ form.outTotalCost }}</td>
<td class="text-indent">{{ form.outTotalLossCost }}</td>
</tr>
<tr>
<td class="center" colspan="2">总计损失</td>
<td colspan="4" class="text-indent">{{ form.totalLossCost }}</td>
</tr>
<tr>
<td
class="center"
colspan="2"
>
<!-- <td
class="center"
colspan="2"
:class="{ costEstimator: !costEstimator }"
> -->
净废品残值
</td>
<td colspan="4" class="input">
<el-form-item prop="scrapValue">
<el-input
v-model="form.scrapValue"
clearable
:disabled="costEstimator || (disabled && !costEstimator)"
min="0"
type="Number"
placeholder="请输入"
/>
<!-- {{ form.scrapValue }} -->
</el-form-item>
</td>
</tr>
<tr>
<td
class="center"
colspan="2"
>
<!-- <td
class="center"
colspan="2"
:class="{ costEstimator: !costEstimator }"
> -->
净损失(元)
</td>
<td colspan="4" class="input">
<el-form-item prop="netLoss">
<el-input
v-model="form.netLoss"
clearable
:disabled="costEstimator || (disabled && !costEstimator)"
min="0"
type="Number"
placeholder="请输入"
/>
<!-- {{ form.netLoss }} -->
</el-form-item>
</td>
</tr>
<tr>
<td class="center" colspan="2">材料费用</td>
<td class="center" colspan="2">工时费用</td>
<td class="center">制造费用</td>
<td class="center">会计核算</td>
</tr>
<tr class="signature">
<td colspan="2">
<p>合计:{{ form.materialF }}</p>
<p class="input">
签字:<el-input clearable placeholder="请输入名字" />
</p>
<p class="input">
日期:<el-input clearable placeholder="请输入日期" />
</p>
</td>
<td colspan="2">
<p>合计:{{ form.workHourF }}</p>
<p class="input">
签字:<el-input clearable placeholder="请输入名字" />
</p>
<p class="input">
日期:<el-input clearable placeholder="请输入日期" />
</p>
</td>
<td>
<p>合计:{{ form.manufactureF }}</p>
<p class="input">
签字:<el-input clearable placeholder="请输入名字" />
</p>
<p class="input">
日期:<el-input clearable placeholder="请输入日期" />
</p>
</td>
<td>
<el-form-item prop="accounts">
<p class="input">
<label>合计:</label><el-input
v-model="form.accounts"
clearable
:disabled="costKeeper || (disabled && !costKeeper)"
placeholder="请输入"
/>
<!-- <label :class="{ costKeeper: !costKeeper }">合计:</label><el-input
v-model="form.accounts"
clearable
:disabled="costKeeper || (disabled && !costKeeper)"
placeholder="请输入"
/> -->
</p>
</el-form-item>
<p class="input">
签字:<el-input clearable placeholder="请输入名字" />
</p>
<p class="input">
日期:<el-input clearable placeholder="请输入日期" />
</p>
</td>
</tr>
</tbody>
</table>
<div class="table-btn">
<el-button
type="primary"
size="small"
:disabled="disab"
@click="save"
>确定</el-button>
<el-button
size="small"
:disabled="disab"
@click="handleClose"
>取消</el-button>
</div>
</el-form>
</section>
</template>
<script>
export default {
data() {
return {
item: {},
disabled: true,
disab: false,
form: {
materialCount: null, // | 材料数量 |
materialCost: null, // | 材料单价 |
materialLossCost: 0, // | 材料损失价值 |
curOpCostPCount: null, // | 本工序工时人工费数量 |
curOpCostP: null, // | 本工序工时人工费单价 |
curOpPLossCost: 0, // | 本工序工时人工损失价值 |
curOpCostMCount: null, // | 本工序工时制造数量 |
curOpCostM: null, // | 本工序工时制造单价 |
curOpMLossCost: 0, // | 本工序工时制造损失价值 |
perOpCostPCount: null, // | 前工序工时人工费数量 |
perOpCostP: null, // | 前工序工时人工费单价 |
perOpPLossCost: 0, // | 前工序工时人工损失价值 |
perOpCostMCount: null, // | 前工序工时制造费数量 |
perOpCostM: null, // | 前工序工时制造费单价 |
perOpMLossCost: 0, // | 前工序工时制造费损失价值 |
curTotalCount: 0, // | 本车间数量合计 |
curTotalCost: 0, // | 本车间单价合计 |
curTotalLossCost: 0, // | 本车间损失合计 |
outMaterialCount: null, // | 外车间材料数量 |
outMaterialCost: null, // | 外车间材料单价 |
outMaterialLossCos: 0, // | 外车间材料损失 |
workHourPCount: null, // | 工时人工数量 |
workHourPCost: null, // | 工时人工单价 |
workHourPLossCost: 0, // | 工时人工损失 |
workHourMCount: null, // | 工时制造数量 |
workHourMCost: null, // | 工时制造单价 |
workHourMLossCost: 0, // | 工时制造损失 |
outTotalCount: 0, // | 外车间数量合计 |
outTotalCost: 0, // | 外车间数单价合计 |
outTotalLossCost: 0, // | 外车间数损失合计 |
totalLossCost: 0, // | 总计损失
scrapValue: null, // | 净废品残值
netLoss: null, // | 净损失(元)
materialF: 0, // 材料费用
workHourF: 0, // 工时费用
manufactureF: 0, // 制造费用
accounts: '' // 会计核算
},
rules: {},
// 成本核算员
costEstimator: false,
// 成本管理员
costKeeper: true
}
},
watch: {
form: {
handler(val) {
var that = this.form
if (that.materialCount && that.materialCost) {
that.materialLossCost =
parseFloat(that.materialCount) * parseFloat(that.materialCost)
} else if (!that.materialCount || !that.materialCost) {
that.materialLossCost = 0
}
if (that.curOpCostPCount && that.curOpCostP) {
that.curOpPLossCost =
parseFloat(that.curOpCostPCount) * parseFloat(that.curOpCostP)
} else if (!that.curOpCostPCount || !that.curOpCostP) {
that.curOpPLossCost = 0
}
if (that.curOpCostM && that.curOpCostMCount) {
that.curOpMLossCost =
parseFloat(that.curOpCostM) * parseFloat(that.curOpCostMCount)
} else if (!that.curOpCostM || !that.curOpCostMCount) {
that.curOpMLossCost = 0
}
if (that.perOpCostPCount && that.perOpCostP) {
that.perOpPLossCost =
parseFloat(that.perOpCostPCount) * parseFloat(that.perOpCostP)
} else if (!that.perOpCostPCount || !that.perOpCostP) {
that.perOpPLossCost = 0
}
if (that.perOpCostMCount && that.perOpCostM) {
that.perOpMLossCost =
parseFloat(that.perOpCostMCount) * parseFloat(that.perOpCostM)
} else if (!that.perOpCostMCount || !that.perOpCostM) {
that.perOpMLossCost = 0
}
if (that.outMaterialCount && that.outMaterialCost) {
that.outMaterialLossCos =
parseFloat(that.outMaterialCount) *
parseFloat(that.outMaterialCost)
} else if (!that.outMaterialCount || !that.outMaterialCost) {
that.outMaterialLossCos = 0
}
if (that.workHourPCount && that.workHourPCost) {
that.workHourPLossCost =
parseFloat(that.workHourPCount) * parseFloat(that.workHourPCost)
} else if (!that.workHourPCount || !that.workHourPCost) {
that.workHourPLossCost = 0
}
if (that.workHourMCount && that.workHourMCost) {
that.workHourMLossCost =
parseFloat(that.workHourMCount) * parseFloat(that.workHourMCost)
} else if (!that.workHourMCount || !that.workHourMCost) {
that.workHourMLossCost = 0
}
if (that.curTotalLossCost) {
that.accounts = parseFloat(that.curTotalLossCost)
} else if (!that.curTotalLossCost) {
that.accounts = 0
}
this.outLoss()
this.thisLoss()
this.thisCount()
this.thisPrice()
this.outPrice()
this.outCount()
that.netLoss = that.totalLossCost = that.curTotalLossCost + that.outTotalLossCost
that.materialF = that.materialLossCost
that.workHourF =
that.curOpPLossCost + that.perOpPLossCost + that.workHourPLossCost
that.manufactureF =
that.curOpMLossCost + that.perOpMLossCost + that.workHourMLossCost
},
deep: true
},
item: {
handler(val) {
this.$refs.form && this.$refs['form'].resetFields()
if (val) {
this.item = val
Object.keys(this.form).forEach((key) => {
Object.keys(val.primaryBusinessObject).forEach((key2) => {
if (key === key2) {
if (val.primaryBusinessObject[key2]) {
this.$set(this.form, key, val.primaryBusinessObject[key2])
}
}
})
})
}
},
deep: true
},
'form.accounts': {
handler(v) {
this.$emit('accounts', v)
},
deep: true
}
},
created() {
},
methods: {
// 打开弹出框
open(val) {
if (
this.$route.query.name === '我的请求' ||
this.$route.query.name === '办结任务' ||
this.$route.query.name === '已办任务' ||
this.$route.query.name === '废品通知单详情'
) {
this.disabled = true
} else {
this.disabled = false
}
this.$nextTick(() => {
this.getUserGroup()
this.visible = true
this.item = val
})
},
// 获取用户群组
getUserGroup() {
const params = {
searchItems: {
children: [{}],
items: [
{
fieldName: 'userId',
operator: 'EQ',
value: localStorage.getItem('userId')
}
],
operator: 'AND'
},
sortItem: [
{
fieldName: 'id',
sortOrder: 'asc'
}
]
}
this.HttpRequest('/UserGroupRef/find/recursion', params, 'post')
.then((res) => {
res.items.content.forEach((item) => {
if (item.groupName === '成本核算员') {
this.costEstimator = false
this.$nextTick(() => {
// this.$set(this.rules, 'materialCount', [
// {
// required: true,
// message: '请输入材料数量',
// trigger: 'blur'
// }
// ])
// this.$set(this.rules, 'materialCost', [
// {
// required: true,
// message: '请输入材料单价',
// trigger: 'blur'
// }
// ])
// this.$set(this.rules, 'curOpCostPCount', [
// {
// required: true,
// message: '请输入本工序工时人工费数量',
// trigger: 'blur'
// }
// ])
// this.$set(this.rules, 'curOpCostP', [
// {
// required: true,
// message: '请输入本工序工时人工费单价',
// trigger: 'blur'
// }
// ])
// this.$set(this.rules, 'curOpCostMCount', [
// {
// required: true,
// message: '请输入本工序工时制造数量',
// trigger: 'blur'
// }
// ])
// this.$set(this.rules, 'curOpCostM', [
// {
// required: true,
// message: '请输入本工序工时制造单价',
// trigger: 'blur'
// }
// ])
// this.$set(this.rules, 'perOpCostPCount', [
// {
// required: true,
// message: '请输入前工序工时人工费数量',
// trigger: 'blur'
// }
// ])
// this.$set(this.rules, 'perOpCostP', [
// {
// required: true,
// message: '请输入前工序工时人工费单价',
// trigger: 'blur'
// }
// ])
// this.$set(this.rules, 'perOpCostMCount', [
// {
// required: true,
// message: '请输入前工序工时制造费数量',
// trigger: 'blur'
// }
// ])
// this.$set(this.rules, 'perOpCostM', [
// {
// required: true,
// message: '请输入前工序工时制造费单价',
// trigger: 'blur'
// }
// ])
// this.$set(this.rules, 'scrapValue', [
// {
// required: true,
// message: '请输入净废品残值',
// trigger: 'blur'
// }
// ])
// this.$set(this.rules, 'netLoss', [
// {
// required: true,
// message: '请输入净损失(元)',
// trigger: 'blur'
// }
// ])
})
} else if (item.groupName === '成本管理员') {
this.costKeeper = false
// this.$set(this.rules, 'accounts', [
// { required: true, message: '请输入合计', trigger: 'blur' }
// ])
}
})
})
.catch((err) => console.log(err))
.finally(() => {})
},
save() {
this.$refs.form.validate((valid) => {
if (valid) {
this.disab = true
const params = {
id: this.item.pboId,
dxClassname: 'com.tf.mes.vo.prodTask.ScrapNoticeDocVO', // 指定类路径
subTypeName: 'ScrapNoticeDoc', // 指定类型
operator: 'MODIFY', // 增加操作
...this.form
}
this.HttpRequest('/ScrapNoticeDoc/recursion', params, 'post')
.then((res) => {
this.reset('保存')
})
.catch((err) => console.log(err))
.finally(() => {
this.disab = false
})
} else {
this.$utils.showMessageWarning('请完整填写表单')
return false
}
})
},
// 本车间数量
thisCount() {
var that = this.form
var totalCount = 0
if (that.materialCount) {
totalCount += parseFloat(that.materialCount)
}
if (that.curOpCostPCount) {
totalCount += parseFloat(that.curOpCostPCount)
}
if (that.curOpCostMCount) {
totalCount += parseFloat(that.curOpCostMCount)
}
if (that.perOpCostPCount) {
totalCount += parseFloat(that.perOpCostPCount)
}
if (that.perOpCostMCount) {
totalCount += parseFloat(that.perOpCostMCount)
}
this.form.curTotalCount = Math.floor(totalCount * 1000) / 1000
},
// 本车间单价
thisPrice() {
var that = this.form
// eslint-disable-next-line no-unused-vars
let totalCount = 0
if (that.materialCost) {
totalCount += parseFloat(that.materialCost)
}
if (that.curOpCostP) {
totalCount += parseFloat(that.curOpCostP)
}
if (that.curOpCostM) {
totalCount += parseFloat(that.curOpCostM)
}
if (that.perOpCostP) {
totalCount += parseFloat(that.perOpCostP)
}
if (that.perOpCostM) {
totalCount += parseFloat(that.perOpCostM)
}
// this.form.curTotalCost = Math.floor(totalCount * 1000) / 1000
this.form.curTotalCount ? this.form.curTotalCost = Math.floor(this.form.curTotalLossCost / this.form.curTotalCount * 1000) / 1000 : this.form.curTotalCost = 0
},
// 本车间损失
thisLoss() {
var that = this.form
var totalCount = 0
if (that.materialLossCost) {
totalCount += parseFloat(that.materialLossCost)
}
if (that.curOpPLossCost) {
totalCount += parseFloat(that.curOpPLossCost)
}
if (that.curOpMLossCost) {
totalCount += parseFloat(that.curOpMLossCost)
}
if (that.perOpPLossCost) {
totalCount += parseFloat(that.perOpPLossCost)
}
if (that.perOpMLossCost) {
totalCount += parseFloat(that.perOpMLossCost)
}
this.form.curTotalLossCost = Math.floor(totalCount * 1000) / 1000
},
// 外车间数量
outCount() {
var that = this.form
var totalCount = 0
if (that.outMaterialCount) {
totalCount += parseFloat(that.outMaterialCount)
}
if (that.workHourPCount) {
totalCount += parseFloat(that.workHourPCount)
}
if (that.workHourMCount) {
totalCount += parseFloat(that.workHourMCount)
}
this.form.outTotalCount = Math.floor(totalCount * 1000) / 1000
},
// 外车间单价
outPrice() {
var that = this.form
var totalCount = 0
if (that.outMaterialCost) {
totalCount += parseFloat(that.outMaterialCost)
}
if (that.workHourPCost) {
totalCount += parseFloat(that.workHourPCost)
}
if (that.workHourMCost) {
totalCount += parseFloat(that.workHourMCost)
}
this.form.outTotalCost = Math.floor(totalCount * 1000) / 1000
},
// 外车间损失
outLoss() {
var that = this.form
var totalCount = 0
if (that.outMaterialLossCos) {
totalCount += parseFloat(that.outMaterialLossCos)
}
if (that.workHourPLossCost) {
totalCount += parseFloat(that.workHourPLossCost)
}
if (that.workHourMLossCost) {
totalCount += parseFloat(that.workHourMLossCost)
}
this.form.outTotalLossCost = Math.floor(totalCount * 1000) / 1000
},
handleClose() {
this.visible = false
},
// 重置弹出框
reset(message) {
this.visible = false
this.$message({
message: `${message}成功`,
type: 'success'
})
// Object.keys(this.form).forEach(key => {
// this.form[key] = ''
// })
// setTimeout(() => {
// this.$emit('reload')
// }, 500)
}
}
}
</script>
<style lang="scss">
.twoTable {
width: 860px;
margin: 0 20px;
.el-drawer__header {
margin-bottom: 0 !important;
}
thead {
line-height: 50px;
text-align: center;
font-weight: 700;
}
tbody {
line-height: 32px;
.input {
input {
border: none;
}
}
.width40 {
width: 56px;
padding: 0 20px;
box-sizing: border-box;
}
.center {
text-align: center;
}
.text-indent {
text-indent: 20px;
}
.signature {
td {
padding: 5px;
box-sizing: border-box;
}
.el-input {
width: 120px;
}
.el-input__inner {
width: 120px;
}
}
}
}
.costKeeper,
.costEstimator {
&::before {
// content: "*";
// color: #f56c6c;
// margin-right: 4px;
}
}
.table-btn {
margin-top: 10px;
text-align: center;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment