This commit is contained in:
仲么了
2024-01-05 15:14:35 +08:00
parent 379732c7d5
commit ae1ae5b2a7
7 changed files with 263 additions and 268 deletions

View File

@@ -1,15 +1,15 @@
<template>
<div class='default-main'>
<div class="default-main">
<TableHeader>
<template v-slot:operation>
<el-button :icon='Plus' type='primary' @click='addMenu'>添加</el-button>
<el-button :icon="Plus" type="primary" @click="addMenu">添加</el-button>
</template>
</TableHeader>
<Table ref='tableRef' :pagination='false' />
<popupForm ref='popupRef'></popupForm>
<Table ref="tableRef" :pagination="false" />
<popupForm ref="popupRef"></popupForm>
</div>
</template>
<script setup lang='ts'>
<script setup lang="ts">
import { Plus } from '@element-plus/icons-vue'
import { ref, onMounted, provide } from 'vue'
import TableStore from '@/utils/tableStore'
@@ -25,7 +25,7 @@ const tableRef = ref()
const popupRef = ref()
const navTabs = useNavTabs()
const tableStore = new TableStore({
url: '/user-boot/function/getRouteMenu',
url: '/user-boot/function/functionTree',
column: [
{ title: '菜单名称', field: 'title', align: 'left', treeNode: true },
{
@@ -47,7 +47,7 @@ const tableStore = new TableStore({
type: 'primary',
icon: 'el-icon-EditPen',
render: 'tipButton',
click: (row) => {
click: row => {
popupRef.value.open('编辑菜单', row)
}
},
@@ -63,8 +63,7 @@ const tableStore = new TableStore({
confirmButtonType: 'danger',
title: '确定删除该菜单吗?'
},
click: (row) => {
}
click: row => {}
}
]
}
@@ -74,19 +73,7 @@ provide('tableStore', tableStore)
onMounted(() => {
tableStore.table.ref = tableRef.value
// tableStore.index()
const handlerRouter = (arr: any[]) => {
return arr.map((item: any, index: number) => {
if (item.children && item.children.length > 0) {
item.children = handlerRouter(item.children)
}
return {
...item.meta,
...item
}
})
}
tableStore.table.data = handlerRouter(navTabs.state.tabsViewRoutes)
tableStore.index()
tableStore.table.loading = false
})
const addMenu = () => {