报工组件修改10

yangwl
zhaoxiaolin 6 months ago
parent ea287e1b45
commit b04d89ae3c

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

Loading…
Cancel
Save