mirror of
https://gitee.com/log4j/pig-ui.git
synced 2024-12-23 05:40:20 +08:00
feat: 禁用功能增加tip 提示
This commit is contained in:
parent
0fd375fe26
commit
0fafbd4226
@ -21,7 +21,8 @@ export default {
|
||||
inputSystemFlagTip: 'input systemFlag',
|
||||
inputDelFlagTip: 'input delFlag',
|
||||
inputTenantIdTip: 'input tenantId',
|
||||
dictItem: 'dict item'
|
||||
dictItem: 'dict item',
|
||||
deleteDisabledTip: 'system data cannot be deleted ',
|
||||
},
|
||||
dictItem: {
|
||||
index: 'index',
|
||||
|
@ -24,7 +24,8 @@ export default {
|
||||
inputSystemFlagTip: '请输入字典类型',
|
||||
inputDelFlagTip: '请输入 delFlag',
|
||||
inputTenantIdTip: '请输入所属租户',
|
||||
dictItem: '字典项'
|
||||
dictItem: '字典项',
|
||||
deleteDisabledTip: '系统内置数据不能删除',
|
||||
},
|
||||
dictItem: {
|
||||
index: '序号',
|
||||
|
@ -54,10 +54,17 @@
|
||||
|
||||
<el-table-column label="操作" width="200">
|
||||
<template #default="scope">
|
||||
<el-button text type="primary" @click="onOpenEditDic('edit', scope.row)">修改</el-button>
|
||||
<el-button text type="primary" :disabled="scope.row.systemFlag !== '1'"
|
||||
@click="handleDelete([scope.row.id])">删除</el-button>
|
||||
<el-button text type="primary" @click="showDictITem(scope.row)">字典项</el-button>
|
||||
<el-button text type="primary" @click="onOpenEditDic('edit', scope.row)">修改</el-button>
|
||||
<el-tooltip :content="$t('sysdict.deleteDisabledTip')" :disabled="scope.row.systemFlag === 1"
|
||||
placement="top">
|
||||
<span style="margin-left: 12px">
|
||||
<el-button text type="primary" :disabled="scope.row.systemFlag !== 1"
|
||||
@click="handleDelete([scope.row.id])">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -28,5 +28,6 @@ export default {
|
||||
inputDelFlagTip: 'input delFlag',
|
||||
inputTenantIdTip: 'input tenantId',
|
||||
inputEmbeddedTip: 'input embedded',
|
||||
deleteDisabledTip: 'menu inclusion subordinates cannot be deleted',
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ export default {
|
||||
inputKeepAliveTip: '请选择是否缓冲',
|
||||
inputMenuTypeTip: '请选择菜单类型',
|
||||
inputEmbeddedTip: '请选择是否内嵌',
|
||||
deleteDisabledTip: '菜单包含下级不能删除',
|
||||
},
|
||||
|
||||
}
|
||||
|
@ -14,12 +14,13 @@
|
||||
<el-table :data="state.dataList" v-loading="state.loading" style="width: 100%" row-key="path"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
|
||||
<el-table-column prop="name" :label="$t('sysmenu.name')" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column prop="sortOrder" :label="$t('sysmenu.sortOrder')" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column prop="sortOrder" :label="$t('sysmenu.sortOrder')"
|
||||
show-overflow-tooltip></el-table-column>
|
||||
<el-table-column prop="icon" :label="$t('sysmenu.icon')" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<SvgIcon :name="scope.row.icon" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #default="scope">
|
||||
<SvgIcon :name="scope.row.icon" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="path" :label="$t('sysmenu.path')" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column :label="$t('sysmenu.menuType')" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
@ -43,9 +44,16 @@
|
||||
}}</el-button>
|
||||
<el-button text type="primary" @click="onOpenEditMenu('edit', scope.row)"
|
||||
v-auth="'sys_menu_edit'">{{ $t('common.editBtn') }}</el-button>
|
||||
<el-button text type="primary" @click="onTabelRowDel(scope.row)" v-auth="'sys_menu_del'">{{
|
||||
$t('common.delBtn')
|
||||
}}</el-button>
|
||||
|
||||
<el-tooltip :content="$t('sysmenu.deleteDisabledTip')"
|
||||
:disabled="!deleteMenuDisabled(scope.row)" placement="top">
|
||||
<span style="margin-left: 12px">
|
||||
<el-button text type="primary" :disabled="deleteMenuDisabled(scope.row)"
|
||||
@click="onTabelRowDel(scope.row)" v-auth="'sys_menu_del'">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -63,7 +71,7 @@ import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
const MenuDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
|
||||
// 定义变量内容
|
||||
const menuDialogRef = ref<InstanceType<typeof MenuDialog>>();
|
||||
const menuDialogRef = ref();
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
pageList: pageList, // H
|
||||
queryForm: {
|
||||
@ -72,7 +80,6 @@ const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
isPage: false
|
||||
});
|
||||
|
||||
|
||||
const {
|
||||
getDataList,
|
||||
} = useTable(state)
|
||||
@ -85,16 +92,22 @@ const onOpenAddMenu = (type: string) => {
|
||||
const onOpenEditMenu = (type: string, row: RouteRecordRaw) => {
|
||||
menuDialogRef.value.openDialog(type, row);
|
||||
};
|
||||
// 删除当前行
|
||||
|
||||
//是否禁用删除
|
||||
const deleteMenuDisabled = (row: any) => {
|
||||
return (row.children || []).length > 0
|
||||
}
|
||||
|
||||
// 删除当前菜单
|
||||
const onTabelRowDel = (row: any) => {
|
||||
useMessageBox().confirm(`此操作将永久删除路由:${row.name}`)
|
||||
.then(() => {
|
||||
delObj(row.id).then(() => {
|
||||
useMessage().success('删除成功');
|
||||
getDataList()
|
||||
})
|
||||
|
||||
}).catch((err: any) => {
|
||||
useMessage().error(err.msg)
|
||||
});
|
||||
})
|
||||
.catch(() => { });
|
||||
};
|
||||
</script>
|
||||
|
@ -58,11 +58,16 @@
|
||||
$t('common.editBtn')
|
||||
}}
|
||||
</el-button>
|
||||
<el-button text :disabled="scope.row.systemFlag === '1'" type="primary"
|
||||
@click="handleDelete([scope.row.publicId])">{{
|
||||
$t('common.delBtn')
|
||||
}}
|
||||
</el-button>
|
||||
|
||||
<el-tooltip :content="$t('sysdict.deleteDisabledTip')" :disabled="scope.row.systemFlag === 1"
|
||||
placement="top">
|
||||
<span style="margin-left: 12px">
|
||||
<el-button text type="primary" :disabled="scope.row.systemFlag !== 1"
|
||||
@click="handleDelete([scope.row.publicId])">
|
||||
{{ $t('common.delBtn') }}
|
||||
</el-button>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
Loading…
Reference in New Issue
Block a user