feat(仓库管理): 优化仓库树组件和产品类型显示
调整仓库树组件逻辑,使用两级树结构并修改节点属性 增加产品类型列宽度以更好显示内容 修改实际仓库管理页面,允许新增顶级节点并优化表单逻辑 在库存列表中添加产品/原材料信息映射逻辑
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
<template>
|
||||
<el-tree v-loading="loading" :data="treeData" :props="treeProps" node-key="warehouseId" highlight-current
|
||||
@node-click="handleNodeClick" :expand-on-click-node="false"
|
||||
:lazy="this.warehouseType === 'real'" :load="loadChildren" class="stock-tree" />
|
||||
<div>
|
||||
<el-tree key="warehouseTree" v-loading="loading" :data="treeData" :props="treeProps" node-key="actualWarehouseId" highlight-current
|
||||
@node-click="handleNodeClick" :expand-on-click-node="false" class="stock-tree" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listWarehouse } from '@/api/wms/warehouse';
|
||||
import { listActualWarehouse } from '@/api/wms/actualWarehouse';
|
||||
// import { listActualWarehouse } from '@/api/wms/actualWarehouse';
|
||||
import { treeActualWarehouseTwoLevel } from '@/api/wms/actualWarehouse';
|
||||
|
||||
export default {
|
||||
name: "WarehouseTree",
|
||||
@@ -22,8 +24,8 @@ export default {
|
||||
loading: true,
|
||||
treeProps: {
|
||||
children: 'children',
|
||||
label: 'warehouseLabel',
|
||||
isLeaf: () => false
|
||||
label: 'actualWarehouseName',
|
||||
isLeaf: 'isLeaf'
|
||||
}
|
||||
};
|
||||
},
|
||||
@@ -37,33 +39,30 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
loadChildren(node, resolve) {
|
||||
console.log(node);
|
||||
if (this.warehouseType !== 'real') {
|
||||
return;
|
||||
}
|
||||
if (node.level === 0) {
|
||||
// resolve(this.handleTree(this.treeData, 'warehouseId', 'parentId'));
|
||||
} else {
|
||||
listActualWarehouse({ parentId: node.data.actualWarehouseId }).then(response => {
|
||||
resolve(response.data.map(item => ({
|
||||
...item,
|
||||
warehouseLabel: item.actualWarehouseName
|
||||
})));
|
||||
resolve(response.data);
|
||||
});
|
||||
}
|
||||
},
|
||||
getWarehouseTree() {
|
||||
this.loading = true;
|
||||
if (this.warehouseType === 'real') {
|
||||
listActualWarehouse({ parentId: 0 }).then(response => {
|
||||
this.treeData = response.data.map(item => ({
|
||||
...item,
|
||||
warehouseLabel: item.actualWarehouseName
|
||||
}))
|
||||
treeActualWarehouseTwoLevel().then(response => {
|
||||
this.treeData = response.data
|
||||
this.loading = false;
|
||||
});
|
||||
} else {
|
||||
listWarehouse().then(response => {
|
||||
this.treeData = response.data.map(item => ({
|
||||
...item,
|
||||
warehouseLabel: item.warehouseName
|
||||
actualWarehouseId: item.warehouseId,
|
||||
actualWarehouseName: item.warehouseName
|
||||
}))
|
||||
this.loading = false;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user