报工组件修改10

master
zhaoxiaolin 6 months ago
parent ea287e1b45
commit b04d89ae3c

@ -468,7 +468,7 @@
:label="item.title"
:name="item.libId"
>
<el-table v-loading="loading" :data="item.libList" ref="myPOrderTable"
<el-table v-loading="loading" :data="item.libList" ref="myPOrderTable"
@select="pReportSelection"
@select-all="allReportSelection"
:summary-method="getSummaries"
@ -516,8 +516,8 @@
:label="item.title"
:name="item.libId"
>
<el-table v-loading="loading" :data="item.libList" ref="mypConsumeTable"
<el-table v-loading="loading" :data="item.libList" ref="mypConsumeTable"
@select="pConsumeSelection"
@select-all="allConsumeSelection"
>
@ -527,7 +527,7 @@
<el-table-column label="工单编码" width="140" align="left" prop="workorderCode" :show-overflow-tooltip="true" />
<el-table-column label="订单编码" width="130" align="left" prop="workorderCodeSap" :show-overflow-tooltip="true"
:formatter="orderCodeFormate"/>
<el-table-column label="物料编码" width="130" align="left" prop="materialCode" :show-overflow-tooltip="true"
<el-table-column label="物料编码" width="130" align="left" prop="materialCode" :show-overflow-tooltip="true"
:formatter="productCodeFormate"
/>
<el-table-column label="物料名称" width="280" align="left" prop="materialName" :show-overflow-tooltip="true" />
@ -539,10 +539,10 @@
</el-table-column>
<el-table-column label="单位" width="50" align="center" prop="unit"/>
<el-table-column label="反冲标识" align="center" prop="recoil"/>
<el-table-column label="仓库" width="150" align="center" prop="warehouseCode">
<template slot-scope="scope">
<el-select v-model="scope.row.warehouseCode" placeholder="请选择仓库" width="50%"
<el-select v-model="scope.row.warehouseCode" placeholder="请选择仓库" width="50%"
@change="handleEdit(scope.$index,scope.row)"
v-if="scope.row.workorderCodeSap == null||scope.row.attr1"
clearable
@ -570,7 +570,7 @@
<div class="button-container">
<el-button size="mini" type="primary" @click="addConsumeTableRow(item.libList)"></el-button>
</div>
</el-tab-pane>
<!--工单产品bom参考
@ -1228,6 +1228,7 @@ export default {
_this.$modal.msgSuccess("报工成功");
}
_this.loading = false;
_this.getList();
});
}).then(() => {
@ -1247,6 +1248,7 @@ export default {
_this.$modal.msgSuccess("报工撤销成功");
}
_this.loading = false;
_this.getList();
});
}).then(() => {
@ -1287,7 +1289,7 @@ export default {
const allRows = this.pReportRows.concat(selection)
this.pReportRows = allRows.reduce((acc, cur) => {
const hasDuplicate = acc.some(item => item.batch === cur.batch
const hasDuplicate = acc.some(item => item.batch === cur.batch
&& item.workorderCode === cur.workorderCode);
if (!hasDuplicate) {
acc.push(cur);
@ -1313,7 +1315,7 @@ export default {
allReportSelection(selection){
const allRows = this.pReportRows.concat(selection)
this.pReportRows = allRows.reduce((acc, cur) => {
const hasDuplicate = acc.some(item => item.batch === cur.batch
const hasDuplicate = acc.some(item => item.batch === cur.batch
&& item.workorderCode === cur.workorderCode);
if (!hasDuplicate) {
acc.push(cur);
@ -1389,7 +1391,7 @@ export default {
pConsumeSelection(selection, row) {
const allRows = this.pConsumeRows.concat(selection)
this.pConsumeRows = allRows.reduce((acc, cur) => {
const hasDuplicate = acc.some(item => item.materialCode === cur.materialCode
const hasDuplicate = acc.some(item => item.materialCode === cur.materialCode
&& item.workorderCode === cur.workorderCode);
if (!hasDuplicate) {
acc.push(cur);
@ -1416,7 +1418,7 @@ export default {
allConsumeSelection(selection, row) {
const allRows = this.pConsumeRows.concat(selection)
this.pConsumeRows = allRows.reduce((acc, cur) => {
const hasDuplicate = acc.some(item => item.materialCode === cur.materialCode
const hasDuplicate = acc.some(item => item.materialCode === cur.materialCode
&& item.workorderCode === cur.workorderCode);
if (!hasDuplicate) {
acc.push(cur);
@ -1545,16 +1547,26 @@ export default {
//--
deleteBomRow(index, rows) {
this.$modal.confirm('是否确认删除?确认后,不需要点击下方确定,立马删除!').then(function() {
return deleteBomRowNow(rows[index].recordId);
if(rows[index].recordId != null ){
return deleteBomRowNow(rows[index].recordId);
}
}).then(() => {
var newPConsumeRows = [];
this.pConsumeRows.forEach(item=>{
if (item.workorderCode!=rows[index].workorderCode
|| item.materialCode!=rows[index].materialCode) {
newPConsumeRows.push(item)
}
})
this.pConsumeRows = newPConsumeRows;
rows.splice(index, 1);
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
//--
addConsumeTableRow(rows){
debugger
this.consumeList = rows;
if(rows.length==0){
this.$modal.msgError(`上位机尚未填写损耗,不允许提前新增`);
@ -1568,16 +1580,35 @@ export default {
onSelectNewPrepare(obj) {
let sr = this.selectRow[0]
for(let i=0;i<obj.length;i++){
const row = {
workorderCode: obj[i].workorderCode,
materialCode: obj[i].component,
materialName: obj[i].componentName,
quantity: obj[i].quantity,
unit: obj[i].unit,
recoil:"X",
parentOrder:sr.workorderCode
};
this.consumeList.push(row);
if(this.pConsumeRows.length !=0 ){
this.pConsumeRows.forEach(item=>{
if (item.materialCode==obj[i].component) {
this.$modal.msgError("选择物料重复,自动过滤!");
}else{
const row = {
workorderCode: obj[i].workorderCode,
materialCode: obj[i].component,
materialName: obj[i].componentName,
quantity: obj[i].quantity,
unit: obj[i].unit,
recoil:"X",
parentOrder:sr.workorderCode
};
this.consumeList.push(row);
}
})
}else{
const row = {
workorderCode: obj[i].workorderCode,
materialCode: obj[i].component,
materialName: obj[i].componentName,
quantity: obj[i].quantity,
unit: obj[i].unit,
recoil:"X",
parentOrder:sr.workorderCode
};
this.consumeList.push(row);
}
}
}
}

@ -110,7 +110,8 @@ export default {
productCode: '',
component : '',
componentName : '',
productGroupName:''
productGroupName:'',
workorderCode:''
},
selectionRows:[]
};
@ -128,6 +129,7 @@ export default {
},
init(workorderCode){
this.workorderCode = workorderCode;
this.queryParams.workorderCode = this.workorderCode;
this.getList();
},
/** 查询表格列表*/

Loading…
Cancel
Save