✨ feat: 增加仓库的排序,修复展示bug
This commit is contained in:
@@ -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;
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user