This commit is contained in:
parent
4be4beda2d
commit
59b28d141e
|
|
@ -22,8 +22,12 @@
|
|||
<a-button @click="pageUnapproved" :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 :disabled="!this.getDataId()" @click="pagePrint">打印</a-button>
|
||||
<a-button @click="pageComplete" :disabled="!this.getDataId() || pageStatus != 'approved'">完成</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 class="voucher-toolbar-right">
|
||||
<a-button-group>
|
||||
|
|
@ -229,7 +233,7 @@ export default {
|
|||
titleAlign: 'right',
|
||||
|
||||
// 表单校验规则
|
||||
rules: {
|
||||
rules: {
|
||||
|
||||
start_time: [
|
||||
{ required: true, message: '请输入预计开始日期' }
|
||||
|
|
@ -302,6 +306,7 @@ export default {
|
|||
pageInit() {
|
||||
|
||||
this.pageStatus = '';
|
||||
this.deletedDetailsData = [];
|
||||
// 获取路由的id参数
|
||||
let dataId = this.getDataId();
|
||||
// 如果有id参数,说明是编辑模式
|
||||
|
|
@ -326,7 +331,7 @@ export default {
|
|||
if (a.data[detailDataFieldName].start_time) {
|
||||
a.data[detailDataFieldName].start_time = new Date(a.data[detailDataFieldName].start_time * 1000);
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.options.formOptions.data = a.data[detailDataFieldName];
|
||||
|
||||
|
|
@ -334,7 +339,7 @@ export default {
|
|||
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.$forceUpdate()
|
||||
|
|
@ -410,28 +415,71 @@ export default {
|
|||
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) {
|
||||
item.production_order_id = this.getDataId_BigInt();
|
||||
}
|
||||
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.production_num = parseInt(item.production_num);
|
||||
item.batch_num = parseInt(item.batch_num);
|
||||
|
||||
})
|
||||
|
||||
if (!postdata.production_order_materials || !postdata.production_order_materials.length) {
|
||||
this.$mk.error(`数据行为空`);
|
||||
return;
|
||||
console.log(ds)
|
||||
|
||||
|
||||
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 });
|
||||
|
||||
|
|
@ -551,7 +599,7 @@ export default {
|
|||
return;
|
||||
}
|
||||
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: '弃审中...',
|
||||
data: {
|
||||
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() {
|
||||
this.dataId = null;
|
||||
this.pageInit();
|
||||
|
|
@ -668,6 +762,9 @@ export default {
|
|||
},
|
||||
beforeEditMethod({ column, row }) {
|
||||
|
||||
if(this.pageStatus == "approved"){
|
||||
return false;
|
||||
}
|
||||
if (row.SourceTableID && column.field != "Quantity") {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -684,6 +781,9 @@ export default {
|
|||
}
|
||||
},
|
||||
beforeEditEvent({ column, row }) {
|
||||
if(this.pageStatus == "approved"){
|
||||
return false;
|
||||
}
|
||||
if (row.SourceTableID && column.field != "Quantity") {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue