This commit is contained in:
xielue 2023-06-14 22:40:32 +08:00
parent 4be4beda2d
commit 59b28d141e
1 changed files with 112 additions and 12 deletions

View File

@ -22,8 +22,12 @@
<a-button @click="pageUnapproved" :disabled="!this.getDataId() || pageStatus != 'approved'">弃审</a-button> <a-button @click="pageUnapproved" :disabled="!this.getDataId() || pageStatus != 'approved'">弃审</a-button>
<a-button @click="pageVoucherDelete" :disabled="!this.getDataId() || pageStatus == 'approved'">删除</a-button> <a-button @click="pageVoucherDelete" :disabled="!this.getDataId() || pageStatus == 'approved'">删除</a-button>
<a-button :disabled="!this.getDataId()" @click="pageExport">导出</a-button> <a-button @click="pageComplete" :disabled="!this.getDataId() || pageStatus != 'approved'">完成</a-button>
<a-button :disabled="!this.getDataId()" @click="pagePrint">打印</a-button>
<a-button @click="pageClose" :disabled="!this.getDataId() || pageStatus != 'approved'">关闭</a-button>
<a-button :disabled="!this.getDataId()" @click="pageExport" v-if="false">导出</a-button>
<a-button :disabled="!this.getDataId()" @click="pagePrint" v-if="false">打印</a-button>
</div> </div>
<div class="voucher-toolbar-right"> <div class="voucher-toolbar-right">
<a-button-group> <a-button-group>
@ -229,7 +233,7 @@ export default {
titleAlign: 'right', titleAlign: 'right',
// //
rules: { rules: {
start_time: [ start_time: [
{ required: true, message: '请输入预计开始日期' } { required: true, message: '请输入预计开始日期' }
@ -302,6 +306,7 @@ export default {
pageInit() { pageInit() {
this.pageStatus = ''; this.pageStatus = '';
this.deletedDetailsData = [];
// id // id
let dataId = this.getDataId(); let dataId = this.getDataId();
// id // id
@ -326,7 +331,7 @@ export default {
if (a.data[detailDataFieldName].start_time) { if (a.data[detailDataFieldName].start_time) {
a.data[detailDataFieldName].start_time = new Date(a.data[detailDataFieldName].start_time * 1000); a.data[detailDataFieldName].start_time = new Date(a.data[detailDataFieldName].start_time * 1000);
} }
this.options.formOptions.data = a.data[detailDataFieldName]; this.options.formOptions.data = a.data[detailDataFieldName];
@ -334,7 +339,7 @@ export default {
this.pageStatus = 'approved'; this.pageStatus = 'approved';
} }
this.detailsData = a.dta[detailDataFieldName].production_order_materials || []; this.detailsData = JSON.parse(JSON.stringify(a.data[detailDataFieldName].production_order_materials || [])) ;
this.detailsDataInit(); this.detailsDataInit();
this.$forceUpdate() this.$forceUpdate()
@ -410,28 +415,71 @@ export default {
postdata.id = this.getDataId_BigInt(); postdata.id = this.getDataId_BigInt();
} }
postdata.production_order_materials = JSONbig.parse(JSONbig.stringify(this.detailsData)); let ds = JSONbig.parse(JSONbig.stringify(this.detailsData));
postdata.production_order_materials = postdata.production_order_materials.filter(item => item.materials_id); ds = ds.filter(item => item.materials_id);
if (!ds.length) {
this.$mk.error(`数据行为空`);
return;
}
postdata.production_order_materials.forEach(item => { ds.forEach(item => {
if (this.dataId) { if (this.dataId) {
item.production_order_id = this.getDataId_BigInt(); item.production_order_id = this.getDataId_BigInt();
} }
delete item._X_ROW_KEY; delete item._X_ROW_KEY;
if(item.id){
item.id = this.$mk.toBigInt(item.id);
}
item.materials_id = this.$mk.toBigInt(item.materials_id); item.materials_id = this.$mk.toBigInt(item.materials_id);
item.production_num = parseInt(item.production_num); item.production_num = parseInt(item.production_num);
item.batch_num = parseInt(item.batch_num); item.batch_num = parseInt(item.batch_num);
}) })
if (!postdata.production_order_materials || !postdata.production_order_materials.length) { console.log(ds)
this.$mk.error(`数据行为空`);
return;
if (this.dataId) {
postdata.production_order_materials = {
insertList:[],
updateList:[],
deleteList:[]
};
ds.forEach(item=>{
if(item.id){
postdata.production_order_materials.updateList.push(item);
}
else{
postdata.production_order_materials.insertList.push(item);
}
});
this.deletedDetailsData.forEach(item=>{
postdata.production_order_materials.deleteList.push(item);
})
} else {
postdata.production_order_materials = ds;
} }
delete postdata.production_order_association_order;
delete postdata.reorder_staff;
delete postdata.update;
delete postdata.create;
delete postdata.production_department;
delete postdata.audit_staff_appoint;
// //
this.$mk.formatFormData({ data: postdata, rules: this.options.formOptions.items }); this.$mk.formatFormData({ data: postdata, rules: this.options.formOptions.items });
@ -551,7 +599,7 @@ export default {
return; return;
} }
this.$mk.post({ this.$mk.post({
url: `${BASE_URL.BASE_URL}//MesProductionOrder/v1/mes/production/order/cancelApprove`, url: `${BASE_URL.BASE_URL}/MesProductionOrder/v1/mes/production/order/cancelApprove`,
loading: '弃审中...', loading: '弃审中...',
data: { data: {
id: this.getDataId_BigInt(), id: this.getDataId_BigInt(),
@ -568,6 +616,52 @@ export default {
} }
}); });
}, },
pageComplete() {
let dataId = this.getDataId();
if (!dataId) {
return;
}
this.$mk.post({
url: `${BASE_URL.BASE_URL}/MesProductionOrder/v1/mes/production/order/complete`,
loading: '操作中...',
data: {
id: this.getDataId_BigInt(),
audit_remark: ''
},
useBigInt: true
}).then(a => {
if (a.code == "200") {
this.$mk.success(a.msg || "操作成功");
this.pageInit();
} else {
this.$mk.error(a.msg);
}
});
},
pageClose() {
let dataId = this.getDataId();
if (!dataId) {
return;
}
this.$mk.post({
url: `${BASE_URL.BASE_URL}/MesProductionOrder/v1/mes/production/order/close`,
loading: '操作中...',
data: {
id: this.getDataId_BigInt(),
audit_remark: ''
},
useBigInt: true
}).then(a => {
if (a.code == "200") {
this.$mk.success(a.msg || "操作成功");
this.pageInit();
} else {
this.$mk.error(a.msg);
}
});
},
pageVoucherAdd() { pageVoucherAdd() {
this.dataId = null; this.dataId = null;
this.pageInit(); this.pageInit();
@ -668,6 +762,9 @@ export default {
}, },
beforeEditMethod({ column, row }) { beforeEditMethod({ column, row }) {
if(this.pageStatus == "approved"){
return false;
}
if (row.SourceTableID && column.field != "Quantity") { if (row.SourceTableID && column.field != "Quantity") {
return false; return false;
} }
@ -684,6 +781,9 @@ export default {
} }
}, },
beforeEditEvent({ column, row }) { beforeEditEvent({ column, row }) {
if(this.pageStatus == "approved"){
return false;
}
if (row.SourceTableID && column.field != "Quantity") { if (row.SourceTableID && column.field != "Quantity") {
return false; return false;
} }