-
+
@@ -12,26 +12,26 @@
-
-
-
-
-
-
+
+
+
+
+
搜索
@@ -61,28 +61,18 @@
-
-
-
-
-
-
- {{ scope.row.isEnabled == 1 ? '启用' : '禁用' }}
-
-
+
+
@@ -92,12 +82,12 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改
-
+ >新增
删除
-
+
-
+
-
-
+
+
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
@@ -155,14 +132,11 @@
import { listActualWarehouse, getActualWarehouse, delActualWarehouse, addActualWarehouse, updateActualWarehouse } from "@/api/wms/actualWarehouse";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
-// import ActualWarehouseSelect from '@/components/ActualWarehouseSelect';
export default {
name: "ActualWarehouse",
- // dicts: ['warehouse_type'],
components: {
- Treeselect,
- // ActualWarehouseSelect
+ Treeselect
},
data() {
return {
@@ -172,10 +146,10 @@ export default {
loading: true,
// 显示搜索条件
showSearch: true,
- // 库位/库区/库位自关联表格数据
- warehouseList: [],
- // 库位/库区/库位自关联树选项
- warehouseOptions: [],
+ // 实际库区/库位自关联表格数据
+ actualWarehouseList: [],
+ // 实际库区/库位自关联树选项
+ actualWarehouseOptions: [],
// 弹出层标题
title: "",
// 是否显示弹出层
@@ -189,7 +163,7 @@ export default {
parentId: undefined,
actualWarehouseCode: undefined,
actualWarehouseName: undefined,
- warehouseType: undefined,
+ actualWarehouseType: undefined,
sortNo: undefined,
isEnabled: undefined,
},
@@ -197,15 +171,6 @@ export default {
form: {},
// 表单校验
rules: {
- actualWarehouseCode: [
- { required: true, message: "库区编码不能为空", trigger: "blur" }
- ],
- actualWarehouseName: [
- { required: true, message: "库区名称不能为空", trigger: "blur" }
- ],
- // warehouseType: [
- // { required: true, message: "类型不能为空", trigger: "change" }
- // ],
}
};
},
@@ -213,27 +178,15 @@ export default {
this.getList();
},
methods: {
- /** 查询库位/库区/库位自关联列表 */
+ /** 查询实际库区/库位自关联列表 */
getList() {
this.loading = true;
- listActualWarehouse({...this.queryParams, pageNum: 1, pageSize: 1000}).then(response => {
- const list = response.rows;
- // const list = this.handleTree(response.data, "warehouseId", "parentId");
- // // 递归遍历list,通过sortNo排序
- const sort = (list) => {
- list.sort((a, b) => a.sortNo - b.sortNo);
- list.forEach(item => {
- if (item.children) {
- sort(item.children);
- }
- });
- };
- sort(list)
- this.warehouseList = list;
+ listActualWarehouse(this.queryParams).then(response => {
+ this.actualWarehouseList = this.handleTree(response.data, "actualWarehouseId", "parentId");
this.loading = false;
});
},
- /** 转换库位/库区/库位自关联数据结构 */
+ /** 转换实际库区/库位自关联数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
@@ -244,15 +197,15 @@ export default {
children: node.children
};
},
- /** 查询库位/库区/库位自关联下拉树结构 */
+ /** 查询实际库区/库位自关联下拉树结构 */
getTreeselect() {
listActualWarehouse().then(response => {
- this.warehouseOptions = [];
+ this.actualWarehouseOptions = [];
const data = { actualWarehouseId: 0, actualWarehouseName: '顶级节点', children: [] };
data.children = this.handleTree(response.data, "actualWarehouseId", "parentId");
- this.warehouseOptions.push(data);
+ this.actualWarehouseOptions.push(data);
});
- },
+ },
// 取消按钮
cancel() {
this.open = false;
@@ -265,9 +218,9 @@ export default {
parentId: null,
actualWarehouseCode: null,
actualWarehouseName: null,
- warehouseType: 1,
- sortNo: null,
- isEnabled: 1,
+ actualWarehouseType: 1,
+ sortNo: 0,
+ isEnabled: null,
delFlag: null,
remark: null,
createTime: null,
@@ -296,7 +249,7 @@ export default {
this.form.parentId = 0;
}
this.open = true;
- this.title = "添加库位/库区/库位自关联";
+ this.title = "添加实际库区/库位自关联";
},
/** 展开/折叠操作 */
toggleExpandAll() {
@@ -318,21 +271,16 @@ export default {
this.loading = false;
this.form = response.data;
this.open = true;
- this.title = "修改库位/库区/库位自关联";
+ this.title = "修改实际库区/库位自关联";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
- this.buttonLoading = true;
- // 处理 parentId 为 0 的情况
- let submitData = { ...this.form };
- if (submitData.parentId === 0) {
- delete submitData.parentId;
- }
+ this.buttonLoading = true;
if (this.form.actualWarehouseId != null) {
- updateActualWarehouse(submitData).then(response => {
+ updateActualWarehouse(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
@@ -340,7 +288,7 @@ export default {
this.buttonLoading = false;
});
} else {
- addActualWarehouse(submitData).then(response => {
+ addActualWarehouse(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
@@ -353,7 +301,7 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
- this.$modal.confirm('是否确认删除库位/库区/库位自关联编号为"' + row.actualWarehouseId + '"的数据项?').then(() => {
+ this.$modal.confirm('是否确认删除实际库区/库位自关联编号为"' + row.actualWarehouseId + '"的数据项?').then(() => {
this.loading = true;
return delActualWarehouse(row.actualWarehouseId);
}).then(() => {