From 9057e04efad1b7d61c77a72e5c37a504d0aee935 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期五, 26 九月 2025 09:24:03 +0800
Subject: [PATCH] H5静态化

---
 admin/src/views/system/menu.vue |   75 ++++++++++++++++++++++++++-----------
 1 files changed, 52 insertions(+), 23 deletions(-)

diff --git a/admin/src/views/system/menu.vue b/admin/src/views/system/menu.vue
index 27b05ad..02ab31d 100644
--- a/admin/src/views/system/menu.vue
+++ b/admin/src/views/system/menu.vue
@@ -9,17 +9,17 @@
         <li><el-button @click="sort('bottom')" :loading="isWorking.sort" icon="el-icon-sort-down" v-permissions="['system:menu:sort']">涓嬬Щ</el-button></li>
       </ul>
       <el-table
+          :height="tableHeightNew"
         ref="table"
         v-loading="isWorking.search"
         :data="tableData.list"
-        :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
         row-key="id"
         stripe
         default-expand-all
         @selection-change="handleSelectionChange"
       >
         <el-table-column type="selection" width="55" fixed="left"></el-table-column>
-        <el-table-column prop="name" label="鑿滃崟鍚嶇О"  fixed="left" min-width="160px"></el-table-column>
+        <el-table-column prop="name" label="鑿滃崟鍚嶇О" fixed="left" min-width="160px"></el-table-column>
         <el-table-column prop="icon" label="鍥炬爣" min-width="80px" class-name="table-column-icon">
           <template slot-scope="{row}">
             <i v-if="row.icon != null && row.icon !== ''" :class="{[row.icon]: true}"></i>
@@ -27,7 +27,6 @@
           </template>
         </el-table-column>
         <el-table-column prop="path" label="璁块棶璺緞" min-width="140px"></el-table-column>
-        <el-table-column prop="params" label="鍙傛暟" min-width="120px"></el-table-column>
         <el-table-column prop="remark" label="澶囨敞" min-width="120px"></el-table-column>
         <el-table-column prop="createUser" label="鍒涘缓浜�" min-width="100px">
           <template slot-scope="{row}">{{row.createUserInfo == null ? '' : row.createUserInfo.username}}</template>
@@ -79,7 +78,9 @@
     }
   },
   methods: {
-    // 鏌ヨ鏁版嵁
+    /**
+     * 瑕嗙洊椤电爜鍙樻洿澶勭悊
+     */
     handlePageChange () {
       this.isWorking.search = true
       fetchTree()
@@ -93,7 +94,11 @@
           this.isWorking.search = false
         })
     },
-    // 鎺掑簭
+    /**
+     * 鎺掑簭
+     *
+     * @param direction 鏂瑰悜锛屽彇鍊糩top:涓婄Щ, bottom:涓嬬Щ]
+     */
     sort (direction) {
       if (this.isWorking.sort) {
         return
@@ -146,49 +151,70 @@
           this.isWorking.sort = false
         })
     },
-    // 鍚敤/绂佺敤鑿滃崟
+    /**
+     * 鍚敤/绂佺敤
+     *
+     * @param row 琛屽璞�
+     */
     switchDisabled (row) {
-      if (!row.disabled) {
-        this.__updateMenuStatus(row)
+      const newValue = row.disabled
+      row.disabled = !row.disabled
+      // 寮�鍚�
+      if (!newValue) {
+        this.__updateMenuStatus(row, newValue)
         return
       }
+      // 绂佺敤
       this.$dialog.disableConfirm(`纭绂佺敤 ${row.name} 鑿滃崟鍚楋紵`)
         .then(() => {
-          this.__updateMenuStatus(row)
-        }).catch(() => {
-          row.disabled = !row.disabled
+          this.__updateMenuStatus(row, newValue)
+        })
+        .catch(() => {
         })
     },
-    // 鏌ヨ鐖惰妭鐐�
+    /**
+     * 鏌ヨ鐖惰妭鐐�
+     *
+     * @param id 鑺傜偣ID
+     * @param parent 鍦ㄥ摢涓埗鑺傜偣涓繘琛屾煡鎵�
+     * @returns {null|{children}|*|*|undefined|null}
+     * @private
+     */
     __findParent (id, parent) {
-      if (parent.children === 0) {
+      if (parent.children == null || parent.children.length === 0) {
         return
       }
-      for (const menu of parent.children) {
-        if (menu.id === id) {
+      for (const row of parent.children) {
+        if (row.id === id) {
           return parent
         }
-        if (menu.children.length > 0) {
-          const m = this.__findParent(id, menu)
-          if (m != null) {
-            return m
+        if (row.children.length > 0) {
+          const target = this.__findParent(id, row)
+          if (target != null) {
+            return target
           }
         }
       }
       return null
     },
-    // 淇敼鑿滃崟鐘舵��
-    __updateMenuStatus (row) {
+    /**
+     * 淇敼鑿滃崟鐘舵��
+     *
+     * @param row 琛屽璞�
+     * @param newValue 鏂板��
+     * @private
+     */
+    __updateMenuStatus (row, newValue) {
       updateStatus({
         id: row.id,
         parentId: row.parentId,
-        disabled: row.disabled
+        disabled: newValue
       })
         .then(() => {
+          row.disabled = newValue
           this.$tip.apiSuccess('淇敼鎴愬姛')
         })
         .catch(e => {
-          row.disabled = !row.disabled
           this.$tip.apiFailed(e)
         })
     }
@@ -208,6 +234,9 @@
 .menu-layout {
   /deep/ .table-content {
     margin-top: 0;
+    .table-wrap {
+      padding-bottom: 16px;
+    }
   }
 }
 // 鍥炬爣鍒�

--
Gitblit v1.9.3