feat(wms): 新增实际库区支持及优化库存统计功能

添加实际库区相关字段和逻辑,支持在仓库结构中切换真实库区和逻辑库位
优化库存统计图表展示,新增矩形树图、柱状图和饼图三种可视化方式
重构钻取表格组件,支持显示实际库区信息并优化表单校验规则
移除饼图图例注释并调整表单字段顺序
This commit is contained in:
砂糖
2025-11-03 17:06:38 +08:00
parent ffbe9e181a
commit 36568c2d3c
6 changed files with 683 additions and 32 deletions

View File

@@ -1,6 +1,7 @@
<template>
<el-tree
v-loading="loading"
:data="treeData"
:props="treeProps"
node-key="warehouseId"
@@ -14,32 +15,57 @@
<script>
import { listWarehouse } from '@/api/wms/warehouse';
import { listActualWarehouse } from '@/api/wms/actualWarehouse';
export default {
name: "WarehouseTree",
props: {
treeProps: {
type: Object,
default: () => ({
children: 'children',
label: 'warehouseName',
isLeaf: () => false
})
}
warehouseType: {
type: String,
default: 'real'
},
},
data() {
return {
treeData: []
treeData: [],
loading: true,
treeProps: {
children: 'children',
label: 'warehouseLabel',
isLeaf: () => false
}
};
},
created() {
this.getWarehouseTree();
watch: {
warehouseType: {
handler(newVal, oldVal) {
this.getWarehouseTree()
},
immediate: true
}
},
methods: {
getWarehouseTree() {
listWarehouse().then(response => {
this.treeData = [{ warehouseName: '全部', value: undefined }, ...this.handleTree(response.data, 'warehouseId', 'parentId')];
});
this.loading = true;
if (this.warehouseType === 'real') {
listActualWarehouse({ pageSize: 1000 }).then(response => {
this.treeData = response.rows.map(item => ({
...item,
warehouseLabel: item.actualWarehouseName
}))
this.loading = false;
// this.treeData = [{ warehouseName: '全部', value: undefined }, ...this.handleTree(response.rows, 'warehouseId', 'parentId')];
});
} else {
listWarehouse().then(response => {
this.treeData = response.data.map(item => ({
...item,
warehouseLabel: item.warehouseName
}))
this.loading = false;
// this.treeData = [{ warehouseName: '全部', value: undefined }, ...this.handleTree(response.data, 'warehouseId', 'parentId')];
});
}
},
handleTree(data, id, parentId) {
const cloneData = JSON.parse(JSON.stringify(data));