mirror of
https://gitee.com/log4j/pig-ui.git
synced 2025-01-03 23:42:23 +08:00
fix: 部门新增不显示问题
This commit is contained in:
parent
ade034e96d
commit
18c0941817
@ -124,7 +124,7 @@ const getDeptData = async () => {
|
||||
depttree().then((res) => {
|
||||
parentData.value = [];
|
||||
const dept = {
|
||||
id: '-1',
|
||||
id: '0',
|
||||
name: '根部门',
|
||||
children: [] as any[],
|
||||
};
|
||||
|
@ -4,15 +4,13 @@
|
||||
<div class="mb15">
|
||||
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
|
||||
<el-form-item :label="$t('sysmenu.name')" prop="menuName">
|
||||
<el-input :placeholder="$t('sysmenu.inputNameTip')" clearable style="max-width: 180px"
|
||||
v-model="state.queryForm.menuName"/>
|
||||
<el-input :placeholder="$t('sysmenu.inputNameTip')" clearable style="max-width: 180px" v-model="state.queryForm.menuName" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList" class="ml10" icon="search" type="primary">
|
||||
{{ $t('common.queryBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="onOpenAddMenu" class="ml10" icon="folder-add" type="primary"
|
||||
v-auth="'sys_menu_add'">
|
||||
<el-button @click="onOpenAddMenu" class="ml10" icon="folder-add" type="primary" v-auth="'sys_menu_add'">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
@ -21,18 +19,16 @@
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
border
|
||||
max-height="450"
|
||||
row-key="path"
|
||||
style="width: 100%"
|
||||
v-loading="state.loading"
|
||||
>
|
||||
<el-table-column :label="$t('sysmenu.name')" fixed prop="name" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('sysmenu.sortOrder')" prop="sortOrder"
|
||||
show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('sysmenu.sortOrder')" prop="sortOrder" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('sysmenu.icon')" prop="icon" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<SvgIcon :name="scope.row.icon"/>
|
||||
<SvgIcon :name="scope.row.icon" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('sysmenu.path')" prop="path" show-overflow-tooltip></el-table-column>
|
||||
@ -49,23 +45,17 @@
|
||||
<el-tag type="success" v-if="scope.row.keepAlive === '1'">开启</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('sysmenu.permission')" :show-overflow-tooltip="true"
|
||||
prop="permission"></el-table-column>
|
||||
<el-table-column :label="$t('sysmenu.permission')" :show-overflow-tooltip="true" prop="permission"></el-table-column>
|
||||
<el-table-column :label="$t('common.action')" show-overflow-tooltip width="200">
|
||||
<template #default="scope">
|
||||
<el-button @click="onOpenAddMenu('add', scope.row)" text type="primary" v-auth="'sys_menu_add'">
|
||||
{{ $t('common.addBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="onOpenEditMenu('edit', scope.row)" text type="primary"
|
||||
v-auth="'sys_menu_edit'">{{ $t('common.editBtn') }}
|
||||
</el-button>
|
||||
<el-button @click="onOpenEditMenu('edit', scope.row)" text type="primary" v-auth="'sys_menu_edit'">{{ $t('common.editBtn') }} </el-button>
|
||||
|
||||
<el-tooltip :content="$t('sysmenu.deleteDisabledTip')"
|
||||
:disabled="!deleteMenuDisabled(scope.row)" placement="top">
|
||||
<el-tooltip :content="$t('sysmenu.deleteDisabledTip')" :disabled="!deleteMenuDisabled(scope.row)" placement="top">
|
||||
<span style="margin-left: 12px">
|
||||
<el-button :disabled="deleteMenuDisabled(scope.row)" @click="onTabelRowDel(scope.row)"
|
||||
text
|
||||
type="primary" v-auth="'sys_menu_del'">
|
||||
<el-button :disabled="deleteMenuDisabled(scope.row)" @click="onTabelRowDel(scope.row)" text type="primary" v-auth="'sys_menu_del'">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
</span>
|
||||
@ -74,45 +64,45 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<MenuDialog @refresh="getDataList()" ref="menuDialogRef"/>
|
||||
<MenuDialog @refresh="getDataList()" ref="menuDialogRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="systemMenu" setup>
|
||||
import {delObj, pageList} from '/@/api/admin/menu';
|
||||
import {BasicTableProps, useTable} from '/@/hooks/table';
|
||||
import {useMessage, useMessageBox} from '/@/hooks/message';
|
||||
// 引入组件
|
||||
const MenuDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
import { delObj, pageList } from '/@/api/admin/menu';
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
||||
// 引入组件
|
||||
const MenuDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
|
||||
// 定义变量内容
|
||||
const menuDialogRef = ref();
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
// 定义变量内容
|
||||
const menuDialogRef = ref();
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
pageList: pageList, // H
|
||||
queryForm: {
|
||||
menuName: '',
|
||||
},
|
||||
isPage: false,
|
||||
});
|
||||
});
|
||||
|
||||
const {getDataList} = useTable(state);
|
||||
const { getDataList } = useTable(state);
|
||||
|
||||
// 打开新增菜单弹窗
|
||||
const onOpenAddMenu = (type: string, row?: any) => {
|
||||
// 打开新增菜单弹窗
|
||||
const onOpenAddMenu = (type: string, row?: any) => {
|
||||
menuDialogRef.value.openDialog(type, row);
|
||||
};
|
||||
// 打开编辑菜单弹窗
|
||||
const onOpenEditMenu = (type: string, row: any) => {
|
||||
};
|
||||
// 打开编辑菜单弹窗
|
||||
const onOpenEditMenu = (type: string, row: any) => {
|
||||
menuDialogRef.value.openDialog(type, row);
|
||||
};
|
||||
};
|
||||
|
||||
//是否禁用删除
|
||||
const deleteMenuDisabled = (row: any) => {
|
||||
//是否禁用删除
|
||||
const deleteMenuDisabled = (row: any) => {
|
||||
return (row.children || []).length > 0;
|
||||
};
|
||||
};
|
||||
|
||||
// 删除当前菜单
|
||||
const onTabelRowDel = (row: any) => {
|
||||
// 删除当前菜单
|
||||
const onTabelRowDel = (row: any) => {
|
||||
useMessageBox()
|
||||
.confirm(`此操作将永久删除:${row.name}`)
|
||||
.then(() => {
|
||||
@ -125,5 +115,5 @@
|
||||
useMessage().error(err.msg);
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user