基本配置修改 优化

This commit is contained in:
lizhenhua 2025-08-07 11:04:49 +08:00
parent c6b51fea1a
commit 1f0a7cabfb
1 changed files with 21 additions and 6 deletions

View File

@ -387,6 +387,7 @@ export default {
parentId: undefined,
treeAreaOptions:[],//
batchIds:[],
multipleSelection:[],
openEdit:false,
editForm:{
materialTypeName:"",
@ -604,19 +605,27 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
handleDelete(row) {
if (Number(row.hasInventory) === 1) {
this.$modal.msgWarning("该物料仍有库存,无法删除!");
return;
}
this.$modal
.confirm("是否确认删除数据项?")
.then(function () {
return removeMaterialApi({"materialId":row.materialId});
.then(() => {
// 使 this
return removeMaterialApi({ materialId: row.materialId });
})
.then(() => {
this.$modal.msgSuccess("删除成功");
this.getList();
})
.catch(() => {});
.catch(() => {
//
});
},
handleSelectionChange(selection){
this.multipleSelection = selection
this.batchIds = []
this.batchIds = selection.map((item) => item.materialId)
this.editForm.categoryNames = "";
@ -626,7 +635,13 @@ export default {
},
//
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 => {
this.$modal.msgSuccess("删除成功");
this.$refs.multipleTable.clearSelection()