只有修改时,才触发接口

This commit is contained in:
ljx 2024-06-03 16:44:29 +08:00
parent 3743974f43
commit 8a152e8cea
1 changed files with 21 additions and 19 deletions

View File

@ -418,26 +418,28 @@ export default {
data: postdata, data: postdata,
useBigInt: true, useBigInt: true,
}).then(() => { // }).then(() => { //
let insertList = []; if(this.isEdit){
let updateList = []; let insertList = [];
let deleteList = this.deleteList; let updateList = [];
let deleteList = this.deleteList;
this.soilQualityMaterialAliasList.forEach(item => {
item.customer_id = this.$mk.toBigInt(item.customer_id);
item.price = Number(item.price);
item.soil_quality_material_id = postdata.id;
if(item.id){
updateList.push(item)
}else if(item.customer_id){
insertList.push(item)
}
})
this.$mk.post({
url: this.actions.SoilQualityMaterialAliasBatchHandle,
data: {insertList,updateList,deleteList},
useBigInt: true,
}).then(() => { //
})
}
this.soilQualityMaterialAliasList.forEach(item => {
item.customer_id = this.$mk.toBigInt(item.customer_id);
item.price = Number(item.price);
item.soil_quality_material_id = postdata.id;
if(item.id){
updateList.push(item)
}else if(item.customer_id){
insertList.push(item)
}
})
this.$mk.post({
url: this.actions.SoilQualityMaterialAliasBatchHandle,
data: {insertList,updateList,deleteList},
useBigInt: true,
}).then(() => { //
})
this.$mk.success("保存成功"); this.$mk.success("保存成功");
if (!this.isEdit) { // if (!this.isEdit) { //
this.back(); this.back();