|
|
@@ -11,7 +11,7 @@ import { MdiDelete, MdiDetail, MdiEdit } from '@vben/icons';
|
|
|
import { ElMessage, ElMessageBox, ElTag } from 'element-plus';
|
|
|
|
|
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
|
-import { deleteMenuApi, getMenuListApi } from '#/api/menu';
|
|
|
+import { deleteMenuApi, getMenuListApi, initPermissionApi } from '#/api/menu';
|
|
|
import { $t } from '#/locales';
|
|
|
|
|
|
import MenuForm from './form.vue';
|
|
|
@@ -210,6 +210,22 @@ async function handleDelete(row: any) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/* 初始化权限 */
|
|
|
+async function handleInitPermission() {
|
|
|
+ try {
|
|
|
+ await ElMessageBox.confirm('确认要初始化权限吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ });
|
|
|
+ await initPermissionApi();
|
|
|
+ ElMessage.success('初始化成功');
|
|
|
+ gridApi.reload();
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
function handleFinish() {
|
|
|
gridApi.reload();
|
|
|
}
|
|
|
@@ -219,6 +235,9 @@ function handleFinish() {
|
|
|
<Page auto-content-height>
|
|
|
<Grid table-title="菜单列表">
|
|
|
<template #toolbar-tools>
|
|
|
+ <el-button type="warning" @click="handleInitPermission">
|
|
|
+ 初始化权限
|
|
|
+ </el-button>
|
|
|
<el-button type="primary" @click="handleCreate"> 新增 </el-button>
|
|
|
</template>
|
|
|
<template #action="{ row }">
|