From a8d694d5d987892afee5a1bb8f6c01d612e6b2a3 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 14 五月 2026 11:23:23 +0800
Subject: [PATCH] 浪潮 1.入库管理、出库管理添加库位相关字段和逻辑

---
 src/components/PIMTable/PIMTable.vue |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/src/components/PIMTable/PIMTable.vue b/src/components/PIMTable/PIMTable.vue
index f99b1eb..e256832 100644
--- a/src/components/PIMTable/PIMTable.vue
+++ b/src/components/PIMTable/PIMTable.vue
@@ -14,6 +14,10 @@
             :expand-row-keys="expandRowKeys"
             :show-summary="isShowSummary"
             :summary-method="summaryMethod"
+            :default-expand-all="defaultExpandAll"
+            :tree-props="treeProps"
+            :lazy="lazy"
+            :load="load"
             @row-click="rowClick"
             @current-change="currentChange"
             @selection-change="handleSelectionChange"
@@ -316,6 +320,22 @@
       type: [String, Object],
       default: () => ({ width: "100%" }),
     },
+    defaultExpandAll: {
+      type: Boolean,
+      default: false,
+    },
+    treeProps: {
+      type: Object,
+      default: () => ({ children: "children", hasChildren: "hasChildren" }),
+    },
+    lazy: {
+      type: Boolean,
+      default: false,
+    },
+    load: {
+      type: Function,
+      default: null,
+    },
   });
 
   const mergedHeaderCellStyle = computed(() => ({
@@ -326,6 +346,7 @@
   }));
 
   // Data
+  const multipleTable = ref(null);
   const uploadRefs = ref([]);
   const currentFiles = ref({});
   const uploadKeys = ref({});
@@ -499,6 +520,44 @@
   const handleSelectionChange = newSelection => {
     emit("selection-change", newSelection);
   };
+
+  // 灞曞紑/鎶樺彔鏍戝舰鑺傜偣
+  const toggleRowExpansion = (row, expanded) => {
+    multipleTable.value?.toggleRowExpansion(row, expanded);
+  };
+
+  // 灞曞紑鎵�鏈夋爲褰㈣妭鐐�
+  const expandAll = () => {
+    const expandRows = (rows) => {
+      rows?.forEach(row => {
+        if (row[props.treeProps.children]?.length > 0) {
+          multipleTable.value?.toggleRowExpansion(row, true);
+          expandRows(row[props.treeProps.children]);
+        }
+      });
+    };
+    expandRows(props.tableData);
+  };
+
+  // 鎶樺彔鎵�鏈夋爲褰㈣妭鐐�
+  const collapseAll = () => {
+    const collapseRows = (rows) => {
+      rows?.forEach(row => {
+        if (row[props.treeProps.children]?.length > 0) {
+          collapseRows(row[props.treeProps.children]);
+          multipleTable.value?.toggleRowExpansion(row, false);
+        }
+      });
+    };
+    collapseRows(props.tableData);
+  };
+
+  defineExpose({
+    toggleRowExpansion,
+    expandAll,
+    collapseAll,
+    multipleTable
+  });
 </script>
 
 <style scoped lang="scss">

--
Gitblit v1.9.3