feat: 增加仓库的排序,修复展示bug

This commit is contained in:
砂糖
2025-08-07 17:32:16 +08:00
parent 1bfd22a749
commit e28c7f54e8
3 changed files with 43 additions and 11 deletions

View File

@@ -191,7 +191,7 @@ export default {
warehouseCode: undefined,
warehouseName: undefined,
warehouseType: undefined,
sortNo: 0,
sortNo: undefined,
isEnabled: undefined,
},
// 表单参数
@@ -218,7 +218,18 @@ export default {
getList() {
this.loading = true;
listWarehouse(this.queryParams).then(response => {
this.warehouseList = this.handleTree(response.data, "warehouseId", "parentId");
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;
this.loading = false;
});
},