From df1406d0f571972d033dffd6a93fb4b94febeb56 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 24 六月 2025 16:46:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 src/views/archiveManagement/index.vue |  207 ++++++++++++++++++++++++++-------------------------
 1 files changed, 104 insertions(+), 103 deletions(-)

diff --git a/src/views/archiveManagement/index.vue b/src/views/archiveManagement/index.vue
index 7e7c65d..28a4d06 100644
--- a/src/views/archiveManagement/index.vue
+++ b/src/views/archiveManagement/index.vue
@@ -4,84 +4,87 @@
       <div class="left-content">
         <div class="tree-header">
           <h3>鏂囨。绠$悊</h3>
-          <el-button type="primary" size="small" @click="append('')" icon="Plus"
-            >鏂板</el-button
+          <el-button icon="Plus" size="small" type="primary" @click="append('')"
+          >鏂板
+          </el-button
           >
         </div>
 
         <!-- 鎼滅储妗� -->
         <div class="search-box">
           <el-input
-            v-model="filterText"
-            placeholder="杈撳叆鍏抽敭瀛楄繘琛屾悳绱�"
-            size="small"
-            clearable
-            @input="handleFilter"
+              v-model="filterText"
+              clearable
+              placeholder="杈撳叆鍏抽敭瀛楄繘琛屾悳绱�"
+              size="small"
+              @input="handleFilter"
           >
             <template #prefix>
-              <el-icon><Search /></el-icon>
+              <el-icon>
+                <Search/>
+              </el-icon>
             </template>
           </el-input>
         </div>
 
         <div class="tree-container">
           <el-tree
-            ref="treeRef"
-            :data="treeData"
-            :props="props"
-            :filter-node-method="filterNode"
-            :expand-on-click-node="false"
-            :default-expand-all="false"
-            node-key="id"
-            @node-click="handleNodeClick"
-            class="custom-tree"
+              ref="treeRef"
+              :data="treeData"
+              :default-expand-all="false"
+              :expand-on-click-node="false"
+              :filter-node-method="filterNode"
+              :props="props"
+              class="custom-tree"
+              node-key="id"
+              @node-click="handleNodeClick"
           >
             <template #default="{ node, data }">
               <div class="tree-node-content" @dblclick="headerDbClick(data)">
                 <div class="node-icon">
                   <el-icon
-                    v-if="!node.isLeaf"
-                    :class="{ expanded: node.expanded }"
+                      v-if="!node.isLeaf"
+                      :class="{ expanded: node.expanded }"
                   >
-                    <Folder />
+                    <Folder/>
                   </el-icon>
                   <el-icon v-else>
-                    <Document />
+                    <Document/>
                   </el-icon>
                 </div>
 
                 <div class="node-label">
                   <span v-if="!data.isEdit" class="label-text">{{
-                    node.label
-                  }}</span>
+                      node.label
+                    }}</span>
                   <el-input
-                    v-else
-                    :ref="(el) => setInputRef(el, data)"
-                    placeholder="璇疯緭鍏ヨ妭鐐瑰悕绉�"
-                    v-model="newName"
-                    @blur="($event) => handleInputBlur($event, data, node)"
-                    @keyup.enter="
-                      ($event) => handleInputBlur($event, data, node)
+                      v-else
+                      :ref="(el) => setInputRef(el, data)"
+                      v-model="newName"
+                      autofocus
+                      class="tree-input"
+                      placeholder="璇疯緭鍏ヨ妭鐐瑰悕绉�"
+                      size="small"
+                      @blur="(event) => handleInputBlur(event, data, node)"
+                      @keyup.enter="
+                      (event) => handleInputBlur(event, data, node)
                     "
-                    size="small"
-                    class="tree-input"
-                    autofocus
                   />
                 </div>
-                <div class="node-actions" v-show="!data.isEdit">
+                <div v-show="!data.isEdit" class="node-actions">
                   <el-button
-                    link
-                    size="small"
-                    @click.stop="append(data)"
-                    icon="Plus"
-                    title="鏂板瀛愯妭鐐�"
+                      icon="Plus"
+                      link
+                      size="small"
+                      title="鏂板瀛愯妭鐐�"
+                      @click.stop="append(data)"
                   ></el-button>
                   <el-button
-                    link
-                    size="small"
-                    @click.stop="remove(node, data)"
-                    icon="Delete"
-                    title="鍒犻櫎"
+                      icon="Delete"
+                      link
+                      size="small"
+                      title="鍒犻櫎"
+                      @click.stop="remove(node, data)"
                   ></el-button>
                 </div>
               </div>
@@ -92,71 +95,64 @@
     </div>
     <div class="right">
       <el-row :gutter="24">
-        <el-col :span="2" :offset="20"
-          ><el-button :icon="Delete" type="danger" @click="delHandler">鍒犻櫎</el-button></el-col
+        <el-col :offset="20" :span="2"
+        >
+          <el-button :icon="Delete" type="danger" @click="delHandler">鍒犻櫎</el-button>
+        </el-col
         >
         <el-col :span="2"
-          ><el-button
-            :icon="Plus"
-            type="primary"
-            @click="add"
-            :disabled="!tableData.length"
-            >鏂板</el-button
-          ></el-col
+        >
+          <el-button
+              :disabled="!tableSwitch"
+              :icon="Plus"
+              type="primary"
+              @click="add"
+          >鏂板
+          </el-button
+          >
+        </el-col
         >
       </el-row>
       <ETable
-        :maxHeight="1200"
-        :loading="loading"
-        :table-data="tableData"
-        :columns="columns"
-        @selection-change="handleSelectionChange"
-        @edit="handleEdit"
-        :show-selection="true"
-        :border="true"
+          :border="true"
+          :columns="columns"
+          :loading="loading"
+          :maxHeight="1200"
+          :show-selection="true"
+          :table-data="tableData"
+          @edit="handleEdit"
+          @selection-change="handleSelectionChange"
       >
       </ETable>
       <Pagination
-        :total="total"
-        :page="queryParams.current"
-        :limit="queryParams.pageSize"
-        :show-total="true"
-        @pagination="handlePageChange"
-        :layout="'total, prev, pager, next, jumper'"
+          :layout="'total, prev, pager, next, jumper'"
+          :limit="queryParams.pageSize"
+          :page="queryParams.current"
+          :show-total="true"
+          :total="total"
+          @pagination="handlePageChange"
       ></Pagination>
     </div>
     <archiveDialog
-      v-model:centerDialogVisible="dialogVisible"
-      @centerDialogVisible="centerDialogVisible"
-      :row="row"
-      @submitForm="submitForm"
-      ref="archiveDialogs"
+        ref="archiveDialogs"
+        v-model:centerDialogVisible="dialogVisible"
+        :row="row"
+        @centerDialogVisible="centerDialogVisible"
+        @submitForm="submitForm"
 
     >
     </archiveDialog>
   </el-card>
 </template>
 <script setup>
-import { onMounted, ref, nextTick, reactive } from "vue";
+import {nextTick, onMounted, reactive, ref} from "vue";
 import ETable from "@/components/Table/ETable.vue";
-import { ElButton, ElInput, ElIcon, ElMessage } from "element-plus";
+import {ElButton, ElIcon, ElInput, ElMessage} from "element-plus";
 import archiveDialog from "./mould/archiveDialog.vue";
 import Pagination from "@/components/Pagination/index.vue";
-import {
-  Plus,
-  Search,
-  Folder,
-  Document,
-  Delete,
-} from "@element-plus/icons-vue";
-import {
-  getTree,
-  addOrEditTree,
-  delTree,
-  getArchiveList,
-  addOrEditArchive,
-  delArchive,
-} from "@/api/archiveManagement";
+import {Delete, Document, Folder, Plus, Search,} from "@element-plus/icons-vue";
+import {addOrEditTree, delArchive, delTree, getArchiveList, getTree,} from "@/api/archiveManagement";
+
 const dialogVisible = ref(false); // 鎺у埗褰掓。瀵硅瘽妗嗘樉绀�
 const loading = ref(false);
 const tableData = ref([]);
@@ -167,9 +163,9 @@
 const treeRef = ref(); // 鏍戠粍浠跺紩鐢�
 const total = ref(0); // 鎬昏褰曟暟
 const columns = [
-  { prop: "name", label: "鍚嶇О", minWidth: 180 },
-  { prop: "type", label: "绫诲瀷", minWidth: 120 },
-  { prop: "status", label: "鐘舵��", minWidth: 100 },
+  {prop: "name", label: "鍚嶇О", minWidth: 180},
+  {prop: "type", label: "绫诲瀷", minWidth: 120},
+  {prop: "status", label: "鐘舵��", minWidth: 100},
 ];
 const selectedRows = reactive([]); // 瀛樺偍閫変腑琛屾暟鎹�
 const handleSelectionChange = (selection) => {
@@ -192,7 +188,6 @@
 };
 const submitForm = async (res) => {
   if (res && res.code === 200) {
-    ElMessage.success("鎿嶄綔鎴愬姛");
     // 鍒锋柊鍒楄〃鏁版嵁
     await getArchiveListData();
   } else {
@@ -201,8 +196,10 @@
 }
 const centerDialogVisible = (val) => {
 };
+const tableSwitch = ref(false);
 // 澶勭悊鑺傜偣鐐瑰嚮
-const handleNodeClick = async (data) => {
+const handleNodeClick = (data) => {
+  tableSwitch.value = true;
   // 鍒囨崲鑺傜偣鏃堕噸缃埌绗竴椤�
   queryParams.current = 1;
   queryParams.treeId = data.id;
@@ -217,7 +214,7 @@
   archiveDialogs.value.initForm(); // 閲嶇疆琛ㄥ崟
 };
 // 澶勭悊鍒嗛〉鍙樺寲
-const handlePageChange = ({ page }) => {
+const handlePageChange = ({page}) => {
   queryParams.current = page;
   // pageSize 鍥哄畾涓�20锛屼笉鍐嶄粠鍙傛暟涓幏鍙�
   getArchiveListData();
@@ -238,7 +235,6 @@
       total.value = 0;
       return;
     }
-
     tableData.value = res.data?.records || res.data || [];
     total.value = res.data?.total || 0;
     // 纭繚鍒嗛〉鍙傛暟姝g‘鏇存柊
@@ -262,7 +258,7 @@
   }
   try {
     const ids = selectedRows.map((row) => row.id);
-    const { code, msg } = await delArchive(ids);
+    const {code, msg} = await delArchive(ids);
     if (code !== 200) {
       ElMessage.warning("鍒犻櫎澶辫触: " + msg);
     } else {
@@ -303,6 +299,7 @@
 // 澶勭悊杈撳叆妗嗗け鐒�
 const handleInputBlur = async (event, comeTreeData, node) => {
   if (!comeTreeData.isEdit) return; // 濡傛灉涓嶆槸缂栬緫鐘舵�侊紝鐩存帴杩斿洖
+  console.log("handleInputBlur", event, comeTreeData, node);
   if (event.relatedTarget && event.relatedTarget.tagName === "BUTTON") {
     return;
   }
@@ -344,7 +341,7 @@
   if (!data || !data.id) {
     return;
   }
-  let { code, msg } = await delTree([data.id]);
+  let {code, msg} = await delTree([data.id]);
   if (code !== 200) {
     ElMessage.warning("鍒犻櫎澶辫触, " + msg);
   } else {
@@ -378,9 +375,9 @@
     const isExpanded = node?.expanded; // 濡傛灉鏈夊瓙绾т笖鏈睍寮�锛屽厛灞曞紑鑺傜偣
     if (hasChildren && !isExpanded) {
       if (
-        treeRef.value &&
-        treeRef.value.store &&
-        treeRef.value.store.nodesMap[nodeKey]
+          treeRef.value &&
+          treeRef.value.store &&
+          treeRef.value.store.nodesMap[nodeKey]
       ) {
         treeRef.value.store.nodesMap[nodeKey].expanded = true;
       }
@@ -439,7 +436,7 @@
   }
 };
 </script>
-<style scoped lang="scss">
+<style lang="scss" scoped>
 .custom-tree-node {
   flex: 1;
   display: flex;
@@ -630,11 +627,13 @@
     }
   }
 }
+
 .el-card {
   width: calc(100% - 40px);
   height: calc(100vh - 130px);
   margin: 20px;
   box-sizing: border-box;
+
   .left {
     width: 30%;
     height: calc(100vh - 160px);
@@ -651,13 +650,15 @@
       flex-direction: column;
     }
   }
+
   .right {
     width: 70%;
     height: calc(100vh - 160px);
-    padding: 0px 10px;
+    padding: 0 10px;
     float: left;
   }
 }
+
 .archive-management-card {
   margin: 0;
 }

--
Gitblit v1.9.3