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 | 28 +++++++++++++--------------- 1 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index 271a021..1df5fb9 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -113,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" @@ -281,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"); @@ -294,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({ @@ -320,6 +316,7 @@ loading.value = false; }); } + /** 鏌ヨ鑿滃崟涓嬫媺鏍戠粨鏋� */ function getTreeselect() { menuOptions.value = []; @@ -329,11 +326,13 @@ menuOptions.value.push(menu); }); } + /** 鍙栨秷鎸夐挳 */ function cancel() { open.value = false; reset(); } + /** 琛ㄥ崟閲嶇疆 */ function reset() { form.value = { @@ -350,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(); @@ -389,6 +383,7 @@ open.value = true; title.value = "娣诲姞鑿滃崟"; } + /** 灞曞紑/鎶樺彔鎿嶄綔 */ function toggleExpandAll() { refreshTable.value = false; @@ -397,6 +392,7 @@ refreshTable.value = true; }); } + /** 淇敼鎸夐挳鎿嶄綔 */ async function handleUpdate(row) { reset(); @@ -407,6 +403,7 @@ title.value = "淇敼鑿滃崟"; }); } + /** 鎻愪氦鎸夐挳 */ function submitForm() { proxy.$refs["menuRef"].validate(valid => { @@ -427,6 +424,7 @@ } }); } + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { proxy.$modal.confirm('鏄惁纭鍒犻櫎鍚嶇О涓�"' + row.menuName + '"鐨勬暟鎹」?').then(function() { -- Gitblit v1.9.3