diff --git a/src/api/systerm.ts b/src/api/systerm.ts
index 58e3fd1..7d71c2f 100644
--- a/src/api/systerm.ts
+++ b/src/api/systerm.ts
@@ -1,11 +1,26 @@
import createAxios from '@/utils/request'
// 菜单修改
-export function updateMenu(params:anyObj) {
+export function updateMenu(params: anyObj) {
return createAxios({
url: '/user-boot/function/update',
method: 'PUT',
- data:params
+ data: params
+ })
+}
+
+export function addMenu(params: anyObj) {
+ return createAxios({
+ url: '/user-boot/function/add',
+ method: 'POST',
+ data: params
+ })
+}
+
+export function delMenu(id: string) {
+ return createAxios({
+ url: '/user-boot/function/delete?id=' + id,
+ method: 'delete'
})
}
diff --git a/src/views/auth/menu/index.vue b/src/views/auth/menu/index.vue
index 4ecbdf8..218c37c 100644
--- a/src/views/auth/menu/index.vue
+++ b/src/views/auth/menu/index.vue
@@ -17,6 +17,7 @@ import Table from '@/components/table/index.vue'
import TableHeader from '@/components/table/header/index.vue'
import popupForm from './popupForm.vue'
import { useNavTabs } from '@/stores/navTabs'
+import { delMenu } from '@/api/systerm'
defineOptions({
name: 'auth/menu'
@@ -63,11 +64,27 @@ const tableStore = new TableStore({
confirmButtonType: 'danger',
title: '确定删除该菜单吗?'
},
- click: row => {}
+ click: row => {
+ delMenu(row.id).then(() => {
+ tableStore.index()
+ })
+ }
}
]
}
- ]
+ ],
+ loadCallback:()=>{
+ // 过滤数组中type等于1的数据,children下钻
+ const filterData = (arr:any[])=>{
+ return arr.filter((item:any)=>{
+ if (item.children.length) {
+ item.children = filterData(item.children)
+ }
+ return item.type != 1
+ })
+ }
+ tableStore.table.data = filterData(tableStore.table.data)
+ }
})
provide('tableStore', tableStore)
diff --git a/src/views/auth/menu/popupForm.vue b/src/views/auth/menu/popupForm.vue
index 434871d..71f5999 100644
--- a/src/views/auth/menu/popupForm.vue
+++ b/src/views/auth/menu/popupForm.vue
@@ -1,57 +1,57 @@
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-