|
@@ -302,6 +302,11 @@
|
|
|
<el-button type="text" v-else @click="addShelf(row, $index)"
|
|
<el-button type="text" v-else @click="addShelf(row, $index)"
|
|
|
>添加货架</el-button
|
|
>添加货架</el-button
|
|
|
>
|
|
>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- <el-button type="text" v-if="!row.isEdit" @click="editArea(row, $index)"
|
|
|
|
|
+ >编辑</el-button
|
|
|
|
|
+ > -->
|
|
|
|
|
+
|
|
|
<el-button type="text" @click="remove1($index, row)"
|
|
<el-button type="text" @click="remove1($index, row)"
|
|
|
>删除库区</el-button
|
|
>删除库区</el-button
|
|
|
>
|
|
>
|
|
@@ -826,6 +831,7 @@
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
|
|
+ editType: '',
|
|
|
warehouseDefinition_isRegular,
|
|
warehouseDefinition_isRegular,
|
|
|
warehouseDefinition_areaType,
|
|
warehouseDefinition_areaType,
|
|
|
warehouseDefinition_areaAttribute,
|
|
warehouseDefinition_areaAttribute,
|
|
@@ -994,9 +1000,10 @@
|
|
|
let kqArr = [];
|
|
let kqArr = [];
|
|
|
for (const key in warehouseAreasSaveList) {
|
|
for (const key in warehouseAreasSaveList) {
|
|
|
kqArr.push({
|
|
kqArr.push({
|
|
|
- // id: warehouseAreasSaveList[key].id,
|
|
|
|
|
|
|
+ id: warehouseAreasSaveList[key].id,
|
|
|
name: warehouseAreasSaveList[key].name,
|
|
name: warehouseAreasSaveList[key].name,
|
|
|
code: warehouseAreasSaveList[key].code,
|
|
code: warehouseAreasSaveList[key].code,
|
|
|
|
|
+ isEdit: false,
|
|
|
extInfo: [
|
|
extInfo: [
|
|
|
{
|
|
{
|
|
|
areaType: warehouseAreasSaveList[key].type,
|
|
areaType: warehouseAreasSaveList[key].type,
|
|
@@ -1524,9 +1531,14 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.$confirm(`是否删除这个货架?`).then(async () => {
|
|
this.$confirm(`是否删除这个货架?`).then(async () => {
|
|
|
|
|
+ // 删除前统计该库区的货架数量
|
|
|
|
|
+ const beforeCount = this.areaForm.areaGoodsshelvesList.filter(
|
|
|
|
|
+ (item) => item.reservoirAreaCode === reservoirAreaCode
|
|
|
|
|
+ ).length;
|
|
|
|
|
+
|
|
|
if (id) {
|
|
if (id) {
|
|
|
- const res = await warehouseDefinition.isDelete(id);
|
|
|
|
|
- if (res == 1) {
|
|
|
|
|
|
|
+ const res = await warehouseDefinition.isGoodsshelvesCanDelete(id);
|
|
|
|
|
+ if (res) {
|
|
|
this.areaForm.areaGoodsshelvesList =
|
|
this.areaForm.areaGoodsshelvesList =
|
|
|
this.areaForm.areaGoodsshelvesList.filter(
|
|
this.areaForm.areaGoodsshelvesList.filter(
|
|
|
(item) => item.code !== code
|
|
(item) => item.code !== code
|
|
@@ -1535,9 +1547,11 @@
|
|
|
this.areaForm.allocationReqList.filter(
|
|
this.areaForm.allocationReqList.filter(
|
|
|
(item) => item.goodsShelvesCode !== code
|
|
(item) => item.goodsShelvesCode !== code
|
|
|
);
|
|
);
|
|
|
|
|
+ // 更新对应库区的货架数量
|
|
|
|
|
+ this.updateAreaSubCount(reservoirAreaCode, beforeCount);
|
|
|
this.$message.warning('已在本地删除,保存之后生效!');
|
|
this.$message.warning('已在本地删除,保存之后生效!');
|
|
|
} else {
|
|
} else {
|
|
|
- this.$message.warning('此数据可能有关联数据,暂时无法删除!');
|
|
|
|
|
|
|
+ this.$message.warning('该货架已上架产品,无法删除。');
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
this.areaForm.areaGoodsshelvesList =
|
|
this.areaForm.areaGoodsshelvesList =
|
|
@@ -1548,18 +1562,38 @@
|
|
|
this.areaForm.allocationReqList.filter(
|
|
this.areaForm.allocationReqList.filter(
|
|
|
(item) => item.goodsShelvesCode !== code
|
|
(item) => item.goodsShelvesCode !== code
|
|
|
);
|
|
);
|
|
|
-
|
|
|
|
|
|
|
+ // 更新对应库区的货架数量
|
|
|
|
|
+ this.updateAreaSubCount(reservoirAreaCode, beforeCount);
|
|
|
this.$message.success('删除成功!');
|
|
this.$message.success('删除成功!');
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+ updateAreaSubCount(reservoirAreaCode, beforeCount) {
|
|
|
|
|
+ // 删除后统计该库区的货架数量
|
|
|
|
|
+ const afterCount = this.areaForm.areaGoodsshelvesList.filter(
|
|
|
|
|
+ (item) => item.reservoirAreaCode === reservoirAreaCode
|
|
|
|
|
+ ).length;
|
|
|
|
|
+ // 更新库区的货架数量
|
|
|
|
|
+ const areaIndex = this.areaForm.warehouseAreasSaveList.findIndex(
|
|
|
|
|
+ (item) => item.code === reservoirAreaCode
|
|
|
|
|
+ );
|
|
|
|
|
+ if (areaIndex !== -1) {
|
|
|
|
|
+ this.areaForm.warehouseAreasSaveList[areaIndex].subCount = afterCount;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ editArea(row, index) {
|
|
|
|
|
+ this.editType = 'edit';
|
|
|
|
|
+ row.isEdit = true;
|
|
|
|
|
+ this.$set(this.areaForm.warehouseAreasSaveList[index], 'isEdit', true);
|
|
|
|
|
+ console.log('editArea~~', row, index, this.areaForm.warehouseAreasSaveList[index]);
|
|
|
|
|
+ },
|
|
|
remove1(index, { id, code }) {
|
|
remove1(index, { id, code }) {
|
|
|
console.log('remove1~~', index, id, code);
|
|
console.log('remove1~~', index, id, code);
|
|
|
this.$confirm(`是否删除这个库区`)
|
|
this.$confirm(`是否删除这个库区`)
|
|
|
.then(async () => {
|
|
.then(async () => {
|
|
|
if (id) {
|
|
if (id) {
|
|
|
- const res = await warehouseDefinition.isDelete(id);
|
|
|
|
|
- if (res == 1) {
|
|
|
|
|
|
|
+ const res = await warehouseDefinition.isAreaCanDelete(id);
|
|
|
|
|
+ if (res) {
|
|
|
this.areaForm.warehouseAreasSaveList.splice(index, 1);
|
|
this.areaForm.warehouseAreasSaveList.splice(index, 1);
|
|
|
this.areaForm.areaGoodsshelvesList =
|
|
this.areaForm.areaGoodsshelvesList =
|
|
|
this.areaForm.areaGoodsshelvesList.filter(
|
|
this.areaForm.areaGoodsshelvesList.filter(
|
|
@@ -1571,7 +1605,7 @@
|
|
|
);
|
|
);
|
|
|
this.$message.warning('已在本地删除,保存之后生效!');
|
|
this.$message.warning('已在本地删除,保存之后生效!');
|
|
|
} else {
|
|
} else {
|
|
|
- this.$message.warning('此数据可能有关联数据,暂时无法删除!');
|
|
|
|
|
|
|
+ this.$message.warning('该库区已上架产品,无法删除。');
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
this.areaForm.warehouseAreasSaveList.splice(index, 1);
|
|
this.areaForm.warehouseAreasSaveList.splice(index, 1);
|
|
@@ -1628,6 +1662,7 @@
|
|
|
this.areaForm.warehouseAreasSaveList.splice(index, 1);
|
|
this.areaForm.warehouseAreasSaveList.splice(index, 1);
|
|
|
},
|
|
},
|
|
|
addArea() {
|
|
addArea() {
|
|
|
|
|
+ this.editType = 'add';
|
|
|
const pre =
|
|
const pre =
|
|
|
this.areaForm.warehouseAreasSaveList[
|
|
this.areaForm.warehouseAreasSaveList[
|
|
|
this.areaForm.warehouseAreasSaveList.length - 1
|
|
this.areaForm.warehouseAreasSaveList.length - 1
|