基本配置修改 优化
This commit is contained in:
parent
c6b51fea1a
commit
1f0a7cabfb
|
|
@ -387,6 +387,7 @@ export default {
|
||||||
parentId: undefined,
|
parentId: undefined,
|
||||||
treeAreaOptions:[],//区域树
|
treeAreaOptions:[],//区域树
|
||||||
batchIds:[],
|
batchIds:[],
|
||||||
|
multipleSelection:[],
|
||||||
openEdit:false,
|
openEdit:false,
|
||||||
editForm:{
|
editForm:{
|
||||||
materialTypeName:"",
|
materialTypeName:"",
|
||||||
|
|
@ -605,18 +606,26 @@ export default {
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
this.$modal
|
if (Number(row.hasInventory) === 1) {
|
||||||
|
this.$modal.msgWarning("该物料仍有库存,无法删除!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$modal
|
||||||
.confirm("是否确认删除数据项?")
|
.confirm("是否确认删除数据项?")
|
||||||
.then(function () {
|
.then(() => {
|
||||||
return removeMaterialApi({"materialId":row.materialId});
|
// 使用箭头函数保持 this 上下文
|
||||||
|
return removeMaterialApi({ materialId: row.materialId });
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess("删除成功");
|
||||||
this.getList();
|
this.getList();
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {
|
||||||
|
// 用户取消或异常
|
||||||
|
});
|
||||||
},
|
},
|
||||||
handleSelectionChange(selection){
|
handleSelectionChange(selection){
|
||||||
|
this.multipleSelection = selection
|
||||||
this.batchIds = []
|
this.batchIds = []
|
||||||
this.batchIds = selection.map((item) => item.materialId)
|
this.batchIds = selection.map((item) => item.materialId)
|
||||||
this.editForm.categoryNames = "";
|
this.editForm.categoryNames = "";
|
||||||
|
|
@ -626,7 +635,13 @@ export default {
|
||||||
},
|
},
|
||||||
// 批量删除
|
// 批量删除
|
||||||
handleBatchDel(){
|
handleBatchDel(){
|
||||||
console.log(this.batchIds)
|
// 检查是否存在仍有库存的物料
|
||||||
|
const hasInventoryItems = this.multipleSelection.filter(item => Number(item.hasInventory) === 1);
|
||||||
|
if (hasInventoryItems.length > 0) {
|
||||||
|
const names = hasInventoryItems.map(item => item.materialName || item.materialId).join("、");
|
||||||
|
this.$modal.msgWarning(`以下物料仍有库存,无法删除原料名称:${names}的数据`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
removeMaterialApi({"materialId":this.batchIds.join(",")}).then(response => {
|
removeMaterialApi({"materialId":this.batchIds.join(",")}).then(response => {
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess("删除成功");
|
||||||
this.$refs.multipleTable.clearSelection()
|
this.$refs.multipleTable.clearSelection()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue