|
|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<app-view>
|
|
|
- <app-table ref="tableRef" :data="routerStore.userRoutes" v-model:columns="columns" row-key="resourceCode">
|
|
|
+ <app-table ref="tableRef" :data="dataList" v-model:columns="columns" row-key="resourceCode">
|
|
|
<template #headerLeft>
|
|
|
<div>
|
|
|
<el-button icon="Plus" @click="showComponent('edit')">新增</el-button>
|
|
|
@@ -15,15 +15,16 @@
|
|
|
<el-button size="small" icon="Delete" circle @click="showComponent('delete', row)" />
|
|
|
</template>
|
|
|
</app-table>
|
|
|
- <component ref="componentRef" v-bind="{ record }" :is="componentMap.get(componentId)"
|
|
|
- @closed="closeComponent" v-if="componentId" />
|
|
|
+ <component ref="componentRef" v-bind="{ record }" :is="componentMap.get(componentId)" @closed="closeComponent"
|
|
|
+ v-if="componentId" />
|
|
|
</app-view>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { shallowRef, defineAsyncComponent } from 'vue'
|
|
|
import { useComponent } from '@/hooks/component'
|
|
|
-import { useRouterStore } from '@/stores'
|
|
|
+import { useRequest } from '@/hooks/request'
|
|
|
+import { getAllMenus } from '@/services/api/user'
|
|
|
import AppTable from '@pc/components/base/table/index.vue'
|
|
|
|
|
|
const componentMap = new Map<string, unknown>([
|
|
|
@@ -31,14 +32,13 @@ const componentMap = new Map<string, unknown>([
|
|
|
['delete', defineAsyncComponent(() => import('./components/delete/index.vue'))], // 删除
|
|
|
])
|
|
|
|
|
|
-const routerStore = useRouterStore()
|
|
|
const record = shallowRef<Model.MenusRsp>()
|
|
|
const tableRef = shallowRef()
|
|
|
const isRowExpansion = shallowRef(false)
|
|
|
|
|
|
-const { componentRef, componentId, openComponent, closeComponent } = useComponent(() => {
|
|
|
- routerStore.getUserRoutes()
|
|
|
-})
|
|
|
+const { componentRef, componentId, openComponent, closeComponent } = useComponent(() => run())
|
|
|
+
|
|
|
+const { dataList, run } = useRequest(getAllMenus)
|
|
|
|
|
|
const columns = shallowRef([
|
|
|
{ field: 'title', label: '菜单', align: 'left' },
|
|
|
@@ -67,6 +67,6 @@ const tableExpandAll = () => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- toggleRowExpansionAll(routerStore.userRoutes)
|
|
|
+ toggleRowExpansionAll(dataList.value)
|
|
|
}
|
|
|
</script>
|