|
|
|
|
@ -24,17 +24,17 @@ |
|
|
|
|
</template> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<!-- prop 格式:数组名[索引].字段名 --> |
|
|
|
|
<el-form-item :prop="`tableData[${scope.$index}].wcId`" :rules="formRules.wcId"> |
|
|
|
|
<el-form-item :prop="`tableData[${scope.$index}].caId`" :rules="formRules.caId"> |
|
|
|
|
<el-select |
|
|
|
|
v-model="scope.row.wcId" |
|
|
|
|
v-model="scope.row.caId" |
|
|
|
|
placeholder="请选择" |
|
|
|
|
style="width: 100%" |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in wcData" |
|
|
|
|
v-for="item in abilityData" |
|
|
|
|
:key="item.id" |
|
|
|
|
:value="item.id" |
|
|
|
|
:label="item.wcName" |
|
|
|
|
:label="item.caName" |
|
|
|
|
></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
@ -46,29 +46,29 @@ |
|
|
|
|
<span><i style="color: red">*</i>单批面积</span> |
|
|
|
|
</template> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<el-form-item :prop="`tableData[${scope.$index}].batchNo`" :rules="formRules.batchNo"> |
|
|
|
|
<el-input-number v-model="scope.row.batchNo" controls-position="right" style="width:99%;"></el-input-number> |
|
|
|
|
<el-form-item :prop="`tableData[${scope.$index}].area`" :rules="formRules.area"> |
|
|
|
|
<el-input-number v-model="scope.row.area" :min="0" controls-position="right" style="width:99%;"></el-input-number> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column align="center" label="零件号" width="200"> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<el-form-item :prop="`tableData[${scope.$index}].partcode`" :rules="formRules.partcode"> |
|
|
|
|
<el-input v-model="scope.row.partcode"></el-input> |
|
|
|
|
<el-form-item :prop="`tableData[${scope.$index}].partCode`" :rules="formRules.partCode"> |
|
|
|
|
<el-input v-model="scope.row.partCode"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column align="center" label="单件面积" width="200"> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<el-form-item :prop="`tableData[${scope.$index}].area`" :rules="formRules.area"> |
|
|
|
|
<el-input-number v-model="scope.row.area" controls-position="right" style="width:99%;"></el-input-number> |
|
|
|
|
<el-form-item :prop="`tableData[${scope.$index}].singletonArea`" :rules="formRules.singletonArea"> |
|
|
|
|
<el-input-number v-model="scope.row.singletonArea" :min="0" controls-position="right" style="width:99%;"></el-input-number> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column align="center" label="描述" > |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<el-form-item :prop="`tableData[${scope.$index}].remark`" :rules="formRules.remark"> |
|
|
|
|
<el-input v-model="scope.row.remark" ></el-input> |
|
|
|
|
<el-form-item :prop="`tableData[${scope.$index}].describe`" :rules="formRules.describe"> |
|
|
|
|
<el-input v-model="scope.row.describe" ></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
@ -84,6 +84,8 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import {addBat,updateBat} from "@/api/basicData/bigBatch" |
|
|
|
|
import {getProcessAbility} from "@/api/basicData/outsourcingAssignmentControl" |
|
|
|
|
export default { |
|
|
|
|
props:{ |
|
|
|
|
showDialog:{ |
|
|
|
|
@ -97,6 +99,10 @@ export default { |
|
|
|
|
moldAddMore:{ |
|
|
|
|
type:Boolean, |
|
|
|
|
default:false |
|
|
|
|
}, |
|
|
|
|
checkRow:{ |
|
|
|
|
type:Object, |
|
|
|
|
default:()=>{} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
data(){ |
|
|
|
|
@ -106,26 +112,69 @@ export default { |
|
|
|
|
form:{ |
|
|
|
|
tableData:[] |
|
|
|
|
}, |
|
|
|
|
formRules:{} |
|
|
|
|
formRules:{ |
|
|
|
|
// 表格数据数组的整体校验(可选:如最少1行数据) |
|
|
|
|
tableData: [ |
|
|
|
|
{ |
|
|
|
|
required: true, |
|
|
|
|
message: '请至少添加一行数据', |
|
|
|
|
trigger: 'submit', |
|
|
|
|
type: 'array' // 明确类型为数组 |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
validator: (rule, value, callback) => { |
|
|
|
|
if (value.length === 0) { |
|
|
|
|
callback(new Error('请至少添加一行数据')); |
|
|
|
|
} else { |
|
|
|
|
callback(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
trigger: 'submit' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
// 数组中每一项的 wcId 字段校验 |
|
|
|
|
caId: [ |
|
|
|
|
{ required: true, message: '请选择工艺能力', trigger: ['change', 'submit'] } |
|
|
|
|
], |
|
|
|
|
area: [ |
|
|
|
|
{ required: true, message: '请填写单批面积', trigger: ['change', 'submit'] } |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
abilityData:[], |
|
|
|
|
rowDetail:{} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
created(){ |
|
|
|
|
this.openShow = this.showDialog |
|
|
|
|
this.getAbility() |
|
|
|
|
if(this.title == '新增'){ |
|
|
|
|
if(this.form.tableData.length === 0){ |
|
|
|
|
this.addTable() |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
this.rowDetail = JSON.parse(JSON.stringify(this.checkRow)) |
|
|
|
|
this.rowDetail.caId = this.rowDetail.caId.toString() |
|
|
|
|
console.log('this.rowDetail',this.rowDetail) |
|
|
|
|
this.form.tableData.push(this.rowDetail) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods:{ |
|
|
|
|
getAbility(){ |
|
|
|
|
getProcessAbility().then(res =>{ |
|
|
|
|
this.abilityData = res.data.data |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
selectChange(list, row) { |
|
|
|
|
row._select = !row._select; |
|
|
|
|
}, |
|
|
|
|
addTable(){ |
|
|
|
|
this.form.tableData.push({ |
|
|
|
|
_select:false, |
|
|
|
|
wcId: '', |
|
|
|
|
batchNo: '', |
|
|
|
|
caId: '', |
|
|
|
|
area: null, |
|
|
|
|
singletonArea:null, |
|
|
|
|
partCode:'', |
|
|
|
|
describe:'' |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 删除选中行 |
|
|
|
|
@ -157,7 +206,21 @@ export default { |
|
|
|
|
const { _select, ...validData } = row; // 剔除选择状态字段 |
|
|
|
|
return validData; |
|
|
|
|
}); |
|
|
|
|
this.closeDialog(true) |
|
|
|
|
if(this.title == '新增'){ |
|
|
|
|
addBat(submitData).then(res =>{ |
|
|
|
|
if(res.data.code == 200){ |
|
|
|
|
this.$message.success('新增成功'); |
|
|
|
|
this.closeDialog(true) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
updateBat(submitData[0]).then(res =>{ |
|
|
|
|
if(res.data.code == 200){ |
|
|
|
|
this.$message.success('修改成功') |
|
|
|
|
this.closeDialog(true) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
closeDialog(val) { |
|
|
|
|
|