From 6666ce5526b1ed17f5c3906c94620cad586745a5 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期五, 28 六月 2024 17:01:39 +0800
Subject: [PATCH] 优化代码

---
 src/views/system/menu/index.vue |   35 ++++++++++++++++-------------------
 1 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue
index 2e702ef..1df5fb9 100644
--- a/src/views/system/menu/index.vue
+++ b/src/views/system/menu/index.vue
@@ -69,7 +69,7 @@
                <dict-tag :options="sys_normal_disable" :value="scope.row.status" />
             </template>
          </el-table-column>
-         <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime">
+         <el-table-column label="鍒涘缓鏃堕棿" align="center" width="160" prop="createTime">
             <template #default="scope">
                <span>{{ parseTime(scope.row.createTime) }}</span>
             </template>
@@ -96,7 +96,6 @@
                         value-key="menuId"
                         placeholder="閫夋嫨涓婄骇鑿滃崟"
                         check-strictly
-                        :render-after-expand="false"
                      />
                   </el-form-item>
                </el-col>
@@ -114,12 +113,10 @@
                      <el-popover
                         placement="bottom-start"
                         :width="540"
-                        v-model:visible="showChooseIcon"
                         trigger="click"
-                        @show="showSelectIcon"
                      >
                         <template #reference>
-                           <el-input v-model="form.icon" placeholder="鐐瑰嚮閫夋嫨鍥炬爣" @blur="showSelectIcon" v-click-outside="hideSelectIcon" readonly>
+                           <el-input v-model="form.icon" placeholder="鐐瑰嚮閫夋嫨鍥炬爣" @blur="showSelectIcon" readonly>
                               <template #prefix>
                                  <svg-icon
                                     v-if="form.icon"
@@ -131,7 +128,7 @@
                               </template>
                            </el-input>
                         </template>
-                        <icon-select ref="iconSelectRef" @selected="selected" />
+                        <icon-select ref="iconSelectRef" @selected="selected" :active-icon="form.icon" />
                      </el-popover>
                   </el-form-item>
                </el-col>
@@ -247,7 +244,7 @@
                      </el-radio-group>
                   </el-form-item>
                </el-col>
-               <el-col :span="12" v-if="form.menuType != 'F'">
+               <el-col :span="12">
                   <el-form-item>
                      <template #label>
                         <span>
@@ -282,7 +279,6 @@
 import { addMenu, delMenu, getMenu, listMenu, updateMenu } from "@/api/system/menu";
 import SvgIcon from "@/components/SvgIcon";
 import IconSelect from "@/components/IconSelect";
-import { ClickOutside as vClickOutside } from 'element-plus'
 
 const { proxy } = getCurrentInstance();
 const { sys_show_hide, sys_normal_disable } = proxy.useDict("sys_show_hide", "sys_normal_disable");
@@ -295,7 +291,6 @@
 const menuOptions = ref([]);
 const isExpandAll = ref(false);
 const refreshTable = ref(true);
-const showChooseIcon = ref(false);
 const iconSelectRef = ref(null);
 
 const data = reactive({
@@ -321,6 +316,7 @@
     loading.value = false;
   });
 }
+
 /** 鏌ヨ鑿滃崟涓嬫媺鏍戠粨鏋� */
 function getTreeselect() {
   menuOptions.value = [];
@@ -330,11 +326,13 @@
     menuOptions.value.push(menu);
   });
 }
+
 /** 鍙栨秷鎸夐挳 */
 function cancel() {
   open.value = false;
   reset();
 }
+
 /** 琛ㄥ崟閲嶇疆 */
 function reset() {
   form.value = {
@@ -351,33 +349,28 @@
   };
   proxy.resetForm("menuRef");
 }
+
 /** 灞曠ず涓嬫媺鍥炬爣 */
 function showSelectIcon() {
   iconSelectRef.value.reset();
-  showChooseIcon.value = true;
 }
+
 /** 閫夋嫨鍥炬爣 */
 function selected(name) {
   form.value.icon = name;
-  showChooseIcon.value = false;
 }
-/** 鍥炬爣澶栧眰鐐瑰嚮闅愯棌涓嬫媺鍒楄〃 */
-function hideSelectIcon(event) {
-  var elem = event.relatedTarget || event.srcElement || event.target || event.currentTarget;
-  var className = elem.className;
-  if (className !== "el-input__inner") {
-    showChooseIcon.value = false;
-  }
-}
+
 /** 鎼滅储鎸夐挳鎿嶄綔 */
 function handleQuery() {
   getList();
 }
+
 /** 閲嶇疆鎸夐挳鎿嶄綔 */
 function resetQuery() {
   proxy.resetForm("queryRef");
   handleQuery();
 }
+
 /** 鏂板鎸夐挳鎿嶄綔 */
 function handleAdd(row) {
   reset();
@@ -390,6 +383,7 @@
   open.value = true;
   title.value = "娣诲姞鑿滃崟";
 }
+
 /** 灞曞紑/鎶樺彔鎿嶄綔 */
 function toggleExpandAll() {
   refreshTable.value = false;
@@ -398,6 +392,7 @@
     refreshTable.value = true;
   });
 }
+
 /** 淇敼鎸夐挳鎿嶄綔 */
 async function handleUpdate(row) {
   reset();
@@ -408,6 +403,7 @@
     title.value = "淇敼鑿滃崟";
   });
 }
+
 /** 鎻愪氦鎸夐挳 */
 function submitForm() {
   proxy.$refs["menuRef"].validate(valid => {
@@ -428,6 +424,7 @@
     }
   });
 }
+
 /** 鍒犻櫎鎸夐挳鎿嶄綔 */
 function handleDelete(row) {
   proxy.$modal.confirm('鏄惁纭鍒犻櫎鍚嶇О涓�"' + row.menuName + '"鐨勬暟鎹」?').then(function() {

--
Gitblit v1.9.3