From 99f9017c5f3ea3699fccd289a3f41d379ee8a303 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9C=89=E6=9D=A5=E6=8A=80=E6=9C=AF?= <1490493387@qq.com>
Date: Thu, 16 Dec 2021 23:59:15 +0800
Subject: [PATCH] =?UTF-8?q?feat:=E7=82=B9=E5=87=BB=E8=8F=9C=E5=8D=95?=
=?UTF-8?q?=E8=A1=8C=E9=BB=98=E8=AE=A4=E5=9B=9E=E6=98=BE=E7=88=B6=E8=8A=82?=
=?UTF-8?q?=E7=82=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/system/menu/components/Menu.vue | 36 ++++++++++++++++-------
1 file changed, 25 insertions(+), 11 deletions(-)
diff --git a/src/views/system/menu/components/Menu.vue b/src/views/system/menu/components/Menu.vue
index a3b9a384..e58300be 100644
--- a/src/views/system/menu/components/Menu.vue
+++ b/src/views/system/menu/components/Menu.vue
@@ -101,8 +101,8 @@
placeholder="system/user/index"
style="width: 95%"
>
- src/views/
- .vue
+ src/views/
+ .vue
@@ -170,9 +170,7 @@ import {listTableMenus, getMenuDetail, listTreeSelectMenus, addMenu, deleteMenus
import {Search, Plus, Edit, Refresh, Delete} from '@element-plus/icons'
import {ElForm, ElMessage, ElMessageBox} from "element-plus";
import {defineEmits, reactive, ref, unref, onMounted, getCurrentInstance} from "vue";
-
import SvgIcon from '@/components/SvgIcon/index.vue';
-
import TreeSelect from '@/components/TreeSelect/index.vue';
import IconSelect from '@/components/IconSelect/index.vue';
@@ -241,9 +239,9 @@ function handleQuery() {
/**
* 加载菜单下拉树
*/
-function loadTreeSelectMenuOptions() {
+async function loadTreeSelectMenuOptions() {
const menuOptions: any[] = []
- listTreeSelectMenus().then(response => {
+ await listTreeSelectMenus().then(response => {
const menuOption = {id: 0, label: '顶级菜单', children: response.data}
menuOptions.push(menuOption)
state.menuOptions = menuOptions
@@ -266,21 +264,37 @@ function handleSelectionChange(selection: any) {
}
function handleRowClick(row: any) {
+ state.currentRow = JSON.parse(JSON.stringify(row))
emit('menuClick', row)
}
-function handleAdd() {
+async function handleAdd(row: any) {
resetForm()
- loadTreeSelectMenuOptions()
+ await loadTreeSelectMenuOptions()
state.dialog = {
title: '添加菜单',
visible: true,
}
+ console.log('点击新增', row.id)
+ if (row.id) {
+ // 行点击新增
+ state.formData.parentId = row.id
+ state.formData.component = ''
+ } else {
+ if (state.currentRow) {
+ // 工具栏新增
+ state.formData.parentId = state.currentRow.id
+ state.formData.component = ''
+ } else {
+ state.formData.parentId = 0
+ state.formData.component = 'Layout'
+ }
+ }
}
-function handleUpdate(row: any) {
+async function handleUpdate(row: any) {
resetForm()
- loadTreeSelectMenuOptions()
+ await loadTreeSelectMenuOptions()
state.dialog = {
title: '修改菜单',
visible: true