优化商品信息批量编辑的逻辑

This commit is contained in:
季圣华
2023-07-23 23:07:10 +08:00
parent 0c25fbd663
commit e1e1fc83f5
2 changed files with 25 additions and 16 deletions

View File

@@ -381,7 +381,11 @@
} else {
let ids = "";
for (let a = 0; a < this.selectedRowKeys.length; a++) {
ids += this.selectedRowKeys[a] + ",";
if(a === this.selectedRowKeys.length-1) {
ids += this.selectedRowKeys[a]
} else {
ids += this.selectedRowKeys[a] + ','
}
}
this.$refs.batchSetInfoModalForm.edit(ids);
this.$refs.batchSetInfoModalForm.title = "批量编辑";

View File

@@ -124,20 +124,23 @@
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true
let formData = Object.assign(this.model, values)
if(JSON.stringify(formData) === '{}') {
that.$message.warning('抱歉,请输入要批量编辑的内容!')
that.confirmLoading = false
return
}
if(formData.enableSerialNumber === '1' && formData.enableBatchNumber === '1' ) {
that.$message.warning('抱歉,序列号和批号只能选择一项!')
that.confirmLoading = false
return
}
let idList = that.materialIds?that.materialIds.split(','):[]
that.$confirm({
title: "确认操作",
content: "是否操作选中的" + idList.length + "条数据?",
onOk: function () {
that.confirmLoading = true
let paramObj = {
ids: this.materialIds,
ids: that.materialIds,
material: JSON.stringify(formData)
}
batchUpdateMaterial(paramObj).then((res)=>{
@@ -152,6 +155,8 @@
})
}
})
}
})
},
handleCancel () {
this.close()