refactor(warehouse): 将仓库相关术语统一修改为库位 style(warehouse): 优化库位管理界面表单布局 fix(warehouse): 修复树形组件数据展示问题 新增钢卷状态管理功能,支持在列表中直接修改状态 为钢卷管理添加库位查询条件,优化数据展示逻辑 统一将仓库相关术语修改为库位,保持系统一致性 移除部分无用代码和注释,优化界面布局
76 lines
1.6 KiB
Vue
76 lines
1.6 KiB
Vue
|
|
<template>
|
|
<el-tree
|
|
:data="treeData"
|
|
:props="treeProps"
|
|
node-key="warehouseId"
|
|
highlight-current
|
|
@node-click="handleNodeClick"
|
|
:expand-on-click-node="false"
|
|
:default-expand-all="true"
|
|
class="stock-tree"
|
|
/>
|
|
</template>
|
|
|
|
<script>
|
|
import { listWarehouse } from '@/api/wms/warehouse';
|
|
|
|
export default {
|
|
name: "WarehouseTree",
|
|
props: {
|
|
treeProps: {
|
|
type: Object,
|
|
default: () => ({
|
|
children: 'children',
|
|
label: 'warehouseName',
|
|
isLeaf: () => false
|
|
})
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
treeData: []
|
|
};
|
|
},
|
|
created() {
|
|
this.getWarehouseTree();
|
|
},
|
|
methods: {
|
|
getWarehouseTree() {
|
|
listWarehouse().then(response => {
|
|
this.treeData = [{ warehouseName: '全部', value: undefined }, ...this.handleTree(response.data, 'warehouseId', 'parentId')];
|
|
});
|
|
},
|
|
handleTree(data, id, parentId) {
|
|
const cloneData = JSON.parse(JSON.stringify(data));
|
|
return cloneData.filter(father => {
|
|
const branchArr = cloneData.filter(child => father[id] === child[parentId]);
|
|
if (branchArr.length > 0) father.children = branchArr;
|
|
return father[parentId] === 0 || father[parentId] === null;
|
|
});
|
|
},
|
|
handleNodeClick(node) {
|
|
this.$emit('node-click', node);
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<!-- <style scoped>
|
|
.stock-tree-card {
|
|
height: 100%;
|
|
border: none;
|
|
box-shadow: none;
|
|
}
|
|
.stock-tree-title {
|
|
font-weight: bold;
|
|
font-size: 16px;
|
|
padding: 8px 0;
|
|
}
|
|
.stock-tree {
|
|
min-height: 500px;
|
|
max-height: 80vh;
|
|
overflow-y: auto;
|
|
}
|
|
</style> -->
|