|
@@ -3,13 +3,13 @@
|
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
|
<div v-show="showSearch" class="mb-[10px]">
|
|
<div v-show="showSearch" class="mb-[10px]">
|
|
<el-card shadow="hover">
|
|
<el-card shadow="hover">
|
|
- <el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
|
|
|
|
|
+ <el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
|
|
|
+ <el-form-item label="角色编码" prop="roleKey">
|
|
|
|
+ <el-input v-model="queryParams.roleKey" placeholder="请输入角色编码" clearable @keyup.enter="handleQuery" />
|
|
|
|
+ </el-form-item>
|
|
<el-form-item label="角色名称" prop="roleName">
|
|
<el-form-item label="角色名称" prop="roleName">
|
|
<el-input v-model="queryParams.roleName" placeholder="请输入角色名称" clearable @keyup.enter="handleQuery" />
|
|
<el-input v-model="queryParams.roleName" placeholder="请输入角色名称" clearable @keyup.enter="handleQuery" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="权限字符" prop="roleKey">
|
|
|
|
- <el-input v-model="queryParams.roleKey" placeholder="请输入权限字符" clearable @keyup.enter="handleQuery" />
|
|
|
|
- </el-form-item>
|
|
|
|
<el-form-item label="状态" prop="status">
|
|
<el-form-item label="状态" prop="status">
|
|
<el-select v-model="queryParams.status" placeholder="角色状态" clearable>
|
|
<el-select v-model="queryParams.status" placeholder="角色状态" clearable>
|
|
<el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
<el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
@@ -42,15 +42,15 @@
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
<el-button v-hasPermi="['system:role:add']" type="primary" plain icon="Plus" @click="handleAdd()">新增</el-button>
|
|
<el-button v-hasPermi="['system:role:add']" type="primary" plain icon="Plus" @click="handleAdd()">新增</el-button>
|
|
</el-col>
|
|
</el-col>
|
|
- <el-col :span="1.5">
|
|
|
|
|
|
+ <!-- <el-col :span="1.5">
|
|
<el-button v-hasPermi="['system:role:edit']" type="success" plain :disabled="single" icon="Edit" @click="handleUpdate()">修改</el-button>
|
|
<el-button v-hasPermi="['system:role:edit']" type="success" plain :disabled="single" icon="Edit" @click="handleUpdate()">修改</el-button>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
<el-button v-hasPermi="['system:role:delete']" type="danger" plain :disabled="ids.length === 0" @click="handleDelete()">删除</el-button>
|
|
<el-button v-hasPermi="['system:role:delete']" type="danger" plain :disabled="ids.length === 0" @click="handleDelete()">删除</el-button>
|
|
</el-col>
|
|
</el-col>
|
|
- <el-col :span="1.5">
|
|
|
|
|
|
+ <el-col :span="1.5">
|
|
<el-button v-hasPermi="['system:role:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
|
<el-button v-hasPermi="['system:role:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
|
- </el-col>
|
|
|
|
|
|
+ </el-col> -->
|
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
|
</el-row>
|
|
</el-row>
|
|
</template>
|
|
</template>
|
|
@@ -58,33 +58,37 @@
|
|
<el-table ref="roleTableRef" border v-loading="loading" :data="roleList" @selection-change="handleSelectionChange">
|
|
<el-table ref="roleTableRef" border v-loading="loading" :data="roleList" @selection-change="handleSelectionChange">
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column v-if="false" label="角色编号" prop="roleId" width="120" />
|
|
<el-table-column v-if="false" label="角色编号" prop="roleId" width="120" />
|
|
|
|
+ <el-table-column label="角色编码" prop="roleKey" :show-overflow-tooltip="true" width="200" />
|
|
<el-table-column label="角色名称" prop="roleName" :show-overflow-tooltip="true" width="150" />
|
|
<el-table-column label="角色名称" prop="roleName" :show-overflow-tooltip="true" width="150" />
|
|
- <el-table-column label="权限字符" prop="roleKey" :show-overflow-tooltip="true" width="200" />
|
|
|
|
- <el-table-column label="显示顺序" prop="roleSort" width="100" />
|
|
|
|
|
|
+ <el-table-column label="角色类型" prop="roleTypeName" :show-overflow-tooltip="true" width="150" />
|
|
|
|
+ <el-table-column label="角色描述" prop="remark" :show-overflow-tooltip="true" width="300" />
|
|
<el-table-column label="状态" align="center" width="100">
|
|
<el-table-column label="状态" align="center" width="100">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch>
|
|
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="创建时间" align="center" prop="createTime">
|
|
|
|
|
|
+ <el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
|
|
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column fixed="right" label="操作" width="180">
|
|
|
|
|
|
+ <el-table-column fixed="right" label="操作" >
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- <el-tooltip v-if="scope.row.roleId !== 1" content="修改" placement="top">
|
|
|
|
- <el-button v-hasPermi="['system:role:edit']" link type="primary" icon="Edit" @click="handleUpdate(scope.row)"></el-button>
|
|
|
|
|
|
+ <el-tooltip v-if="scope.row.roleId !== 1" content="编辑" placement="top">
|
|
|
|
+ <el-button v-hasPermi="['system:role:edit']" link type="primary" icon="Edit" @click="handleUpdate(scope.row)">编辑</el-button>
|
|
|
|
+ </el-tooltip>
|
|
|
|
+ <el-tooltip v-if="scope.row.roleId !== 1" content="详情" placement="top">
|
|
|
|
+ <el-button v-hasPermi="['system:role:edit']" link type="primary" icon="View" @click="handleView(scope.row)">详情</el-button>
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
<el-tooltip v-if="scope.row.roleId !== 1" content="删除" placement="top">
|
|
<el-tooltip v-if="scope.row.roleId !== 1" content="删除" placement="top">
|
|
- <el-button v-hasPermi="['system:role:remove']" link type="primary" icon="Delete" @click="handleDelete(scope.row)"></el-button>
|
|
|
|
|
|
+ <el-button v-hasPermi="['system:role:remove']" link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
<el-tooltip v-if="scope.row.roleId !== 1" content="数据权限" placement="top">
|
|
<el-tooltip v-if="scope.row.roleId !== 1" content="数据权限" placement="top">
|
|
- <el-button v-hasPermi="['system:role:edit']" link type="primary" icon="CircleCheck" @click="handleDataScope(scope.row)"></el-button>
|
|
|
|
|
|
+ <el-button v-hasPermi="['system:role:edit']" link type="primary" icon="CircleCheck" @click="handleDataScope(scope.row)">数据权限</el-button>
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
<el-tooltip v-if="scope.row.roleId !== 1" content="分配用户" placement="top">
|
|
<el-tooltip v-if="scope.row.roleId !== 1" content="分配用户" placement="top">
|
|
- <el-button v-hasPermi="['system:role:edit']" link type="primary" icon="User" @click="handleAuthUser(scope.row)"></el-button>
|
|
|
|
|
|
+ <el-button v-hasPermi="['system:role:edit']" link type="primary" icon="User" @click="handleAuthUser(scope.row)">分配用户</el-button>
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -99,35 +103,40 @@
|
|
/>
|
|
/>
|
|
</el-card>
|
|
</el-card>
|
|
|
|
|
|
- <el-dialog v-model="dialog.visible" :title="dialog.title" width="500px" append-to-body>
|
|
|
|
|
|
+ <el-dialog v-model="dialog.visible" :title="dialog.title" width="700px" append-to-body>
|
|
<el-form ref="roleFormRef" :model="form" :rules="rules" label-width="100px">
|
|
<el-form ref="roleFormRef" :model="form" :rules="rules" label-width="100px">
|
|
<el-form-item label="角色名称" prop="roleName">
|
|
<el-form-item label="角色名称" prop="roleName">
|
|
- <el-input v-model="form.roleName" placeholder="请输入角色名称" />
|
|
|
|
- </el-form-item>
|
|
|
|
|
|
+ <el-input v-model="form.roleName" placeholder="请输入角色名称" :disabled="dialog.disabled"/>
|
|
|
|
+ </el-form-item>
|
|
<el-form-item prop="roleKey">
|
|
<el-form-item prop="roleKey">
|
|
<template #label>
|
|
<template #label>
|
|
<span>
|
|
<span>
|
|
<el-tooltip content="控制器中定义的权限字符,如:@SaCheckRole('admin')" placement="top">
|
|
<el-tooltip content="控制器中定义的权限字符,如:@SaCheckRole('admin')" placement="top">
|
|
<el-icon><question-filled /></el-icon>
|
|
<el-icon><question-filled /></el-icon>
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
- 权限字符
|
|
|
|
|
|
+ 角色编码
|
|
</span>
|
|
</span>
|
|
</template>
|
|
</template>
|
|
- <el-input v-model="form.roleKey" placeholder="请输入权限字符" />
|
|
|
|
|
|
+ <el-input v-model="form.roleKey" placeholder="请输入权限字符" :disabled="dialog.disabled"/>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="角色类型" prop="roleType">
|
|
|
|
+ <el-select v-model="form.roleType" placeholder="请选择角色类型" :disabled="dialog.disabled">
|
|
|
|
+ <el-option v-for="item in roleTypeOptions" :key="item.id" :label="item.label" :value="item.value" />
|
|
|
|
+ </el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="角色顺序" prop="roleSort">
|
|
<el-form-item label="角色顺序" prop="roleSort">
|
|
- <el-input-number v-model="form.roleSort" controls-position="right" :min="0" />
|
|
|
|
|
|
+ <el-input-number v-model="form.roleSort" controls-position="right" :min="0" :disabled="dialog.disabled"/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="状态">
|
|
<el-form-item label="状态">
|
|
- <el-radio-group v-model="form.status">
|
|
|
|
|
|
+ <el-radio-group v-model="form.status" :disabled="dialog.disabled">
|
|
<el-radio v-for="dict in sys_normal_disable" :key="dict.value" :value="dict.value">{{ dict.label }}</el-radio>
|
|
<el-radio v-for="dict in sys_normal_disable" :key="dict.value" :value="dict.value">{{ dict.label }}</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="菜单权限">
|
|
<el-form-item label="菜单权限">
|
|
- <el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox>
|
|
|
|
- <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选</el-checkbox>
|
|
|
|
- <el-checkbox v-model="form.menuCheckStrictly" @change="handleCheckedTreeConnect($event, 'menu')">父子联动</el-checkbox>
|
|
|
|
- <el-tree
|
|
|
|
|
|
+ <el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')" :disabled="dialog.disabled">展开/折叠</el-checkbox>
|
|
|
|
+ <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')" :disabled="dialog.disabled">全选/全不选</el-checkbox>
|
|
|
|
+ <el-checkbox v-model="form.menuCheckStrictly" @change="handleCheckedTreeConnect($event, 'menu')" :disabled="dialog.disabled">父子联动</el-checkbox>
|
|
|
|
+ <el-tree
|
|
ref="menuRef"
|
|
ref="menuRef"
|
|
class="tree-border"
|
|
class="tree-border"
|
|
:data="menuOptions"
|
|
:data="menuOptions"
|
|
@@ -135,11 +144,11 @@
|
|
node-key="id"
|
|
node-key="id"
|
|
:check-strictly="!form.menuCheckStrictly"
|
|
:check-strictly="!form.menuCheckStrictly"
|
|
empty-text="加载中,请稍候"
|
|
empty-text="加载中,请稍候"
|
|
- :props="{ label: 'label', children: 'children' } as any"
|
|
|
|
|
|
+ :props="{ label: 'label', children: 'children' ,'disabled':(data,node)=>dialog.disabled} as any"
|
|
></el-tree>
|
|
></el-tree>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="备注">
|
|
|
|
- <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
|
|
|
|
|
+ <el-form-item label="备注">
|
|
|
|
+ <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" :disabled="dialog.disabled" maxlength="160" :rows="5"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
<template #footer>
|
|
<template #footer>
|
|
@@ -156,7 +165,7 @@
|
|
<el-form-item label="角色名称">
|
|
<el-form-item label="角色名称">
|
|
<el-input v-model="form.roleName" :disabled="true" />
|
|
<el-input v-model="form.roleName" :disabled="true" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="权限字符">
|
|
|
|
|
|
+ <el-form-item label="角色编码">
|
|
<el-input v-model="form.roleKey" :disabled="true" />
|
|
<el-input v-model="form.roleKey" :disabled="true" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="权限范围">
|
|
<el-form-item label="权限范围">
|
|
@@ -196,6 +205,8 @@ import { addRole, changeRoleStatus, dataScope, delRole, getRole, listRole, updat
|
|
import { roleMenuTreeselect, treeselect as menuTreeselect } from '@/api/system/menu/index';
|
|
import { roleMenuTreeselect, treeselect as menuTreeselect } from '@/api/system/menu/index';
|
|
import { RoleVO, RoleForm, RoleQuery, DeptTreeOption } from '@/api/system/role/types';
|
|
import { RoleVO, RoleForm, RoleQuery, DeptTreeOption } from '@/api/system/role/types';
|
|
import { MenuTreeOption, RoleMenuTree } from '@/api/system/menu/types';
|
|
import { MenuTreeOption, RoleMenuTree } from '@/api/system/menu/types';
|
|
|
|
+import { listByType } from '@/api/system/dict/data';
|
|
|
|
+
|
|
|
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
@@ -239,6 +250,7 @@ const initForm: RoleForm = {
|
|
status: '0',
|
|
status: '0',
|
|
roleName: '',
|
|
roleName: '',
|
|
roleKey: '',
|
|
roleKey: '',
|
|
|
|
+ roleType: '',
|
|
menuCheckStrictly: true,
|
|
menuCheckStrictly: true,
|
|
deptCheckStrictly: true,
|
|
deptCheckStrictly: true,
|
|
remark: '',
|
|
remark: '',
|
|
@@ -247,6 +259,8 @@ const initForm: RoleForm = {
|
|
deptIds: []
|
|
deptIds: []
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+const roleTypeOptions = ref([]);
|
|
|
|
+
|
|
const data = reactive<PageData<RoleForm, RoleQuery>>({
|
|
const data = reactive<PageData<RoleForm, RoleQuery>>({
|
|
form: { ...initForm },
|
|
form: { ...initForm },
|
|
queryParams: {
|
|
queryParams: {
|
|
@@ -266,7 +280,30 @@ const { form, queryParams, rules } = toRefs(data);
|
|
|
|
|
|
const dialog = reactive<DialogOption>({
|
|
const dialog = reactive<DialogOption>({
|
|
visible: false,
|
|
visible: false,
|
|
- title: ''
|
|
|
|
|
|
+ title: '',
|
|
|
|
+ disabled: false
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 查询角色类型列表
|
|
|
|
+ */
|
|
|
|
+const getRoleTypeList = () => {
|
|
|
|
+ loading.value = true;
|
|
|
|
+ listByType('hospital_role_type').then((res) => {
|
|
|
|
+ let id=0;
|
|
|
|
+ res.data.hospital_role_type.forEach((item) => {
|
|
|
|
+ roleTypeOptions.value.push({
|
|
|
|
+ label: item.dictLabel,
|
|
|
|
+ id: id++,
|
|
|
|
+ value: parseInt(item.dictValue)
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ loading.value = false;
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+onMounted(() => {
|
|
|
|
+ getRoleTypeList();
|
|
});
|
|
});
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -370,8 +407,10 @@ const handleAdd = () => {
|
|
reset();
|
|
reset();
|
|
getMenuTreeselect();
|
|
getMenuTreeselect();
|
|
dialog.visible = true;
|
|
dialog.visible = true;
|
|
|
|
+ dialog.disabled = false;
|
|
dialog.title = '添加角色';
|
|
dialog.title = '添加角色';
|
|
};
|
|
};
|
|
|
|
+
|
|
/** 修改角色 */
|
|
/** 修改角色 */
|
|
const handleUpdate = async (row?: RoleVO) => {
|
|
const handleUpdate = async (row?: RoleVO) => {
|
|
reset();
|
|
reset();
|
|
@@ -382,12 +421,30 @@ const handleUpdate = async (row?: RoleVO) => {
|
|
const res = await getRoleMenuTreeselect(roleId);
|
|
const res = await getRoleMenuTreeselect(roleId);
|
|
dialog.title = '修改角色';
|
|
dialog.title = '修改角色';
|
|
dialog.visible = true;
|
|
dialog.visible = true;
|
|
|
|
+ dialog.disabled = false;
|
|
res.checkedKeys.forEach((v) => {
|
|
res.checkedKeys.forEach((v) => {
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
menuRef.value?.setChecked(v, true, false);
|
|
menuRef.value?.setChecked(v, true, false);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
+/** 详情角色 */
|
|
|
|
+const handleView = async (row?: RoleVO) => {
|
|
|
|
+ reset();
|
|
|
|
+ const roleId = row?.roleId || ids.value[0];
|
|
|
|
+ const { data } = await getRole(roleId);
|
|
|
|
+ Object.assign(form.value, data);
|
|
|
|
+ form.value.roleSort = Number(form.value.roleSort);
|
|
|
|
+ const res = await getRoleMenuTreeselect(roleId);
|
|
|
|
+ dialog.title = '修改角色';
|
|
|
|
+ dialog.visible = true;
|
|
|
|
+ dialog.disabled = true;
|
|
|
|
+ res.checkedKeys.forEach((v) => {
|
|
|
|
+ nextTick(() => {
|
|
|
|
+ menuRef.value?.setChecked(v, true, false);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+};
|
|
/** 根据角色ID查询菜单树结构 */
|
|
/** 根据角色ID查询菜单树结构 */
|
|
const getRoleMenuTreeselect = (roleId: string | number) => {
|
|
const getRoleMenuTreeselect = (roleId: string | number) => {
|
|
return roleMenuTreeselect(roleId).then((res): RoleMenuTree => {
|
|
return roleMenuTreeselect(roleId).then((res): RoleMenuTree => {
|