Przeglądaj źródła

完成科室、角色

chenying2100 2 miesięcy temu
rodzic
commit
108a18467f

+ 3 - 0
.cursorindexingignore

@@ -0,0 +1,3 @@
+
+# Don't index SpecStory auto-save files, but allow explicit context inclusion via @ references
+.specstory/**

+ 2 - 0
.specstory/.gitignore

@@ -0,0 +1,2 @@
+# SpecStory explanation file
+/.what-is-this.md

+ 1 - 0
package.json

@@ -37,6 +37,7 @@
     "jsencrypt": "3.3.2",
     "nprogress": "0.2.0",
     "pinia": "3.0.2",
+    "pnpm": "^10.12.2",
     "screenfull": "6.0.2",
     "vue": "3.5.13",
     "vue-cropper": "1.1.1",

+ 18 - 8
src/api/system/dept/index.ts

@@ -2,7 +2,7 @@ import request from '@/utils/request';
 import { AxiosPromise } from 'axios';
 import { DeptForm, DeptQuery, DeptTreeVO, DeptVO } from './types';
 
-// 查询部门列表
+// 查询科室列表
 export const listDept = (query?: DeptQuery) => {
   return request({
     url: '/system/dept/list',
@@ -12,7 +12,7 @@ export const listDept = (query?: DeptQuery) => {
 };
 
 /**
- * 通过deptIds查询部门
+ * 通过deptIds查询科室
  * @param deptIds
  */
 export const optionSelect = (deptIds: (number | string)[]): AxiosPromise<DeptVO[]> => {
@@ -22,7 +22,7 @@ export const optionSelect = (deptIds: (number | string)[]): AxiosPromise<DeptVO[
   });
 };
 
-// 查询部门列表(排除节点)
+// 查询科室列表(排除节点)
 export const listDeptExcludeChild = (deptId: string | number): AxiosPromise<DeptVO[]> => {
   return request({
     url: '/system/dept/list/exclude/' + deptId,
@@ -30,7 +30,7 @@ export const listDeptExcludeChild = (deptId: string | number): AxiosPromise<Dept
   });
 };
 
-// 查询部门详细
+// 查询科室详细
 export const getDept = (deptId: string | number): AxiosPromise<DeptVO> => {
   return request({
     url: '/system/dept/' + deptId,
@@ -38,7 +38,7 @@ export const getDept = (deptId: string | number): AxiosPromise<DeptVO> => {
   });
 };
 
-// 查询部门下拉树结构
+// 查询科室下拉树结构
 export const treeselect = (): AxiosPromise<DeptTreeVO[]> => {
   return request({
     url: '/system/dept/treeselect',
@@ -46,7 +46,7 @@ export const treeselect = (): AxiosPromise<DeptTreeVO[]> => {
   });
 };
 
-// 新增部门
+// 新增科室
 export const addDept = (data: DeptForm) => {
   return request({
     url: '/system/dept',
@@ -55,7 +55,7 @@ export const addDept = (data: DeptForm) => {
   });
 };
 
-// 修改部门
+// 修改科室
 export const updateDept = (data: DeptForm) => {
   return request({
     url: '/system/dept',
@@ -64,10 +64,20 @@ export const updateDept = (data: DeptForm) => {
   });
 };
 
-// 删除部门
+// 删除科室
 export const delDept = (deptId: number | string) => {
   return request({
     url: '/system/dept/' + deptId,
     method: 'delete'
   });
 };
+
+
+// 修改科室状态
+export const changeDeptStatus = (data: DeptForm) => {
+  return request({
+    url: '/system/dept/changeStatus',
+    data: data,
+    method: 'put'
+  });
+};

+ 1 - 1
src/api/system/dept/types.ts

@@ -53,7 +53,7 @@ export interface DeptForm {
   orderNum?: number;
   leader?: string;
   phone?: string;
-  email?: string;
+  remark?: string;
   status?: string;
   delFlag?: string;
   ancestors?: string;

+ 8 - 0
src/api/system/dict/data/index.ts

@@ -9,6 +9,14 @@ export function getDicts(dictType: string): AxiosPromise<DictDataVO[]> {
   });
 }
 
+// 根据字典类型查询字典数据信息
+export function listByType(dictType: string): AxiosPromise<DictDataVO[]> {
+  return request({
+    url: '/system/dict/data/listByType?dictType=' + dictType,
+    method: 'get'
+  });
+}
+
 // 查询字典数据列表
 export function listData(query: DictDataQuery): AxiosPromise<DictDataVO[]> {
   return request({

+ 1 - 0
src/api/system/role/types.ts

@@ -40,6 +40,7 @@ export interface RoleQuery extends PageQuery {
 export interface RoleForm {
   roleName: string;
   roleKey: string;
+  roleType: string;
   roleSort: number;
   status: string;
   menuCheckStrictly: boolean;

+ 2 - 0
src/types/global.d.ts

@@ -27,6 +27,8 @@ declare global {
      * 是否显示
      */
     visible: boolean;
+
+    disabled: boolean;
   }
 
   declare interface UploadOption {

+ 75 - 50
src/views/system/dept/index.vue

@@ -4,17 +4,17 @@
       <div v-show="showSearch" class="mb-[10px]">
         <el-card shadow="hover">
           <el-form ref="queryFormRef" :model="queryParams" :inline="true">
-            <el-form-item label="部门名称" prop="deptName">
-              <el-input v-model="queryParams.deptName" placeholder="请输入部门名称" clearable @keyup.enter="handleQuery" />
+            <el-form-item label="科室名称" prop="deptName">
+              <el-input v-model="queryParams.deptName" placeholder="请输入科室名称" clearable @keyup.enter="handleQuery" />
             </el-form-item>
-            <el-form-item label="类别编码" prop="deptCategory">
-              <el-input v-model="queryParams.deptCategory" placeholder="请输入类别编码" clearable style="width: 240px" @keyup.enter="handleQuery" />
+            <!-- <el-form-item label="科室编码" prop="deptCategory">
+              <el-input v-model="queryParams.deptCategory" placeholder="请输入科室编码" clearable style="width: 240px" @keyup.enter="handleQuery" />
             </el-form-item>
             <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-select>
-            </el-form-item>
+            </el-form-item> -->
             <el-form-item>
               <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
               <el-button icon="Refresh" @click="resetQuery">重置</el-button>
@@ -46,12 +46,12 @@
         :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
         :default-expand-all="isExpandAll"
       >
-        <el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
-        <el-table-column prop="deptCategory" align="center" label="类别编码" width="200"></el-table-column>
-        <el-table-column prop="orderNum" align="center" label="排序" width="200"></el-table-column>
-        <el-table-column prop="status" align="center" label="状态" width="100">
+        <el-table-column prop="deptName" label="科室名称" width="260"></el-table-column>
+        <el-table-column prop="deptCategory" align="center" label="科室编码" width="200"></el-table-column>
+        <el-table-column prop="remark" align="center" label="科室描述" width="200"></el-table-column>
+        <el-table-column prop="status" align="center" label="状态" width="100"> 
           <template #default="scope">
-            <dict-tag :options="sys_normal_disable" :value="scope.row.status" />
+            <el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch>
           </template>
         </el-table-column>
         <el-table-column label="创建时间" align="center" prop="createTime" width="200">
@@ -61,46 +61,47 @@
         </el-table-column>
         <el-table-column fixed="right" align="center" label="操作">
           <template #default="scope">
-            <el-tooltip content="修改" placement="top">
-              <el-button v-hasPermi="['system:dept:edit']" link type="primary" icon="Edit" @click="handleUpdate(scope.row)" />
+            <el-tooltip content="编辑" placement="top">
+              <el-button v-hasPermi="['system:dept:edit']" link type="primary" icon="Edit" @click="handleUpdate(scope.row)">编辑</el-button>
             </el-tooltip>
-            <el-tooltip content="新增" placement="top">
+            <!-- <el-tooltip content="新增" placement="top">
               <el-button v-hasPermi="['system:dept:add']" link type="primary" icon="Plus" @click="handleAdd(scope.row)" />
-            </el-tooltip>
+            </el-tooltip> -->
             <el-tooltip content="删除" placement="top">
-              <el-button v-hasPermi="['system:dept:remove']" link type="primary" icon="Delete" @click="handleDelete(scope.row)" />
+              <el-button v-hasPermi="['system:dept:remove']" link type="primary" icon="Delete" @click="handleDelete(scope.row)" >删除</el-button>
             </el-tooltip>
           </template>
         </el-table-column>
       </el-table>
     </el-card>
 
-    <el-dialog v-model="dialog.visible" :title="dialog.title" destroy-on-close append-to-body width="600px">
+    <el-dialog v-model="dialog.visible" :title="dialog.title" destroy-on-close append-to-body width="700px">
       <el-form ref="deptFormRef" :model="form" :rules="rules" label-width="80px">
         <el-row>
-          <el-col v-if="form.parentId !== 0" :span="24">
-            <el-form-item label="上级部门" prop="parentId">
+          <el-col :span="12">
+            <el-form-item label="科室名称" prop="deptName">
+              <el-input v-model="form.deptName" placeholder="请输入科室名称" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="所属上级" prop="parentId">
               <el-tree-select
                 v-model="form.parentId"
                 :data="deptOptions"
                 :props="{ value: 'deptId', label: 'deptName', children: 'children' } as any"
                 value-key="deptId"
-                placeholder="选择上级部门"
+                placeholder="选择所属上级"
                 check-strictly
               />
             </el-form-item>
           </el-col>
+          
           <el-col :span="12">
-            <el-form-item label="部门名称" prop="deptName">
-              <el-input v-model="form.deptName" placeholder="请输入部门名称" />
+            <el-form-item label="科室编码" prop="deptCategory">
+              <el-input v-model="form.deptCategory" placeholder="请输入科室编码" />
             </el-form-item>
           </el-col>
-          <el-col :span="12">
-            <el-form-item label="类别编码" prop="deptCategory">
-              <el-input v-model="form.deptCategory" placeholder="请输入类别编码" />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
+          <!-- <el-col :span="12">
             <el-form-item label="显示排序" prop="orderNum">
               <el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
             </el-form-item>
@@ -116,17 +117,20 @@
             <el-form-item label="联系电话" prop="phone">
               <el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" />
             </el-form-item>
-          </el-col>
+          </el-col>           -->
           <el-col :span="12">
-            <el-form-item label="邮箱" prop="email">
-              <el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
+            <el-form-item label="状态" prop="status">
+              <el-select v-model="form.status" placeholder="请选择" clearable>
+                <el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
+              </el-select>
+              <!-- <el-radio-group v-model="form.status">
+                <el-radio v-for="dict in sys_normal_disable" :key="dict.value" :value="dict.value">{{ dict.label }}</el-radio>
+              </el-radio-group> -->
             </el-form-item>
           </el-col>
-          <el-col :span="12">
-            <el-form-item label="部门状态">
-              <el-radio-group v-model="form.status">
-                <el-radio v-for="dict in sys_normal_disable" :key="dict.value" :value="dict.value">{{ dict.label }}</el-radio>
-              </el-radio-group>
+          <el-col >
+            <el-form-item label="描述" prop="remark">
+              <el-input v-model="form.remark" placeholder="请输入" maxlength="100" type="textarea" :rows="5"/>
             </el-form-item>
           </el-col>
         </el-row>
@@ -142,7 +146,7 @@
 </template>
 
 <script setup name="Dept" lang="ts">
-import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from '@/api/system/dept';
+import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild,changeDeptStatus } from '@/api/system/dept';
 import { DeptForm, DeptQuery, DeptVO } from '@/api/system/dept/types';
 import { UserVO } from '@/api/system/user/types';
 import { listUserByDeptId } from '@/api/system/user';
@@ -180,7 +184,7 @@ const initFormData: DeptForm = {
   orderNum: 0,
   leader: undefined,
   phone: undefined,
-  email: undefined,
+  remark: undefined,
   status: '0'
 };
 const initData: PageData<DeptForm, DeptQuery> = {
@@ -193,11 +197,11 @@ const initData: PageData<DeptForm, DeptQuery> = {
     status: undefined
   },
   rules: {
-    parentId: [{ required: true, message: '上级部门不能为空', trigger: 'blur' }],
-    deptName: [{ required: true, message: '部门名称不能为空', trigger: 'blur' }],
-    orderNum: [{ required: true, message: '显示排序不能为空', trigger: 'blur' }],
-    email: [{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }],
-    phone: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '请输入正确的手机号码', trigger: 'blur' }]
+    // parentId: [{ required: true, message: '所属上级不能为空', trigger: 'blur' }],
+    deptName: [{ required: true, message: '科室名称不能为空', trigger: 'blur' }],
+    deptCategory: [{ required: true, message: '科室编码不能为空', trigger: 'blur' }],
+    status: [{ required: true, message: '状态不能为空', trigger: ['blur', 'change'] }],
+    // phone: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '请输入正确的手机号码', trigger: 'blur' }]
   }
 };
 const data = reactive<PageData<DeptForm, DeptQuery>>(initData);
@@ -215,7 +219,7 @@ const getList = async () => {
   loading.value = false;
 };
 
-/** 查询当前部门的所有用户 */
+/** 查询当前科室的所有用户 */
 async function getDeptAllUser(deptId: any) {
   if (deptId !== null && deptId !== '' && deptId !== undefined) {
     const res = await listUserByDeptId(deptId);
@@ -262,22 +266,40 @@ const handleAdd = async (row?: DeptVO) => {
   reset();
   const res = await listDept();
   const data = proxy?.handleTree<DeptOptionsType>(res.data, 'deptId');
-  if (data) {
+  if (data) {    
     deptOptions.value = data;
     if (row && row.deptId) {
       form.value.parentId = row?.deptId;
     }
     dialog.visible = true;
-    dialog.title = '添加部门';
+    dialog.title = '添加科室';
+  }
+};
+
+/** 角色状态修改 */
+const handleStatusChange = async (row: DeptVO) => {
+  const text = row.status === '0' ? '启用' : '停用';
+  try {
+    await proxy?.$modal.confirm('确认要"' + text + '""' + row.deptName + '"科室吗?');
+    let param=ref<DeptForm>({
+      deptId: row.deptId,
+      status: row.status
+    });
+    await changeDeptStatus(param.value);
+    proxy?.$modal.msgSuccess(text + '成功');
+  } catch {
+    row.status = row.status === '0' ? '1' : '0';
   }
 };
 
 /** 修改按钮操作 */
-const handleUpdate = async (row: DeptVO) => {
+const handleUpdate = async (row: DeptVO) => {  
   reset();
-  //查询当前部门所有用户
+  //查询当前科室所有用户
   getDeptAllUser(row.deptId);
   const res = await getDept(row.deptId);
+  const item= res.data;  
+  item.parentId = item.parentId==0?null:item.parentId;
   form.value = res.data;
   const response = await listDeptExcludeChild(row.deptId);
   const data = proxy?.handleTree<DeptOptionsType>(response.data, 'deptId');
@@ -293,13 +315,16 @@ const handleUpdate = async (row: DeptVO) => {
     }
   }
   dialog.visible = true;
-  dialog.title = '修改部门';
+  dialog.title = '修改科室';
 };
 /** 提交按钮 */
 const submitForm = () => {
   deptFormRef.value?.validate(async (valid: boolean) => {
     if (valid) {
-      form.value.deptId ? await updateDept(form.value) : await addDept(form.value);
+      let param=ref<DeptForm>();
+      Object.assign(param,form);
+      param.value.parentId=param.value.parentId?param.value.parentId:0;
+      param.value.deptId ? await updateDept(param.value) : await addDept(param.value);
       proxy?.$modal.msgSuccess('操作成功');
       dialog.visible = false;
       await getList();

+ 89 - 32
src/views/system/role/index.vue

@@ -3,13 +3,13 @@
     <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
       <div v-show="showSearch" class="mb-[10px]">
         <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-input v-model="queryParams.roleName" placeholder="请输入角色名称" clearable @keyup.enter="handleQuery" />
             </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-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" />
@@ -42,15 +42,15 @@
           <el-col :span="1.5">
             <el-button v-hasPermi="['system:role:add']" type="primary" plain icon="Plus" @click="handleAdd()">新增</el-button>
           </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-col>
           <el-col :span="1.5">
             <el-button v-hasPermi="['system:role:delete']" type="danger" plain :disabled="ids.length === 0" @click="handleDelete()">删除</el-button>
           </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-col>
+          </el-col> -->
           <right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
         </el-row>
       </template>
@@ -58,33 +58,37 @@
       <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 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="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">
           <template #default="scope">
             <el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch>
           </template>
         </el-table-column>
-        <el-table-column label="创建时间" align="center" prop="createTime">
+        <el-table-column label="创建时间" align="center" prop="createTime" width="180">
           <template #default="scope">
             <span>{{ proxy.parseTime(scope.row.createTime) }}</span>
           </template>
         </el-table-column>
 
-        <el-table-column fixed="right" label="操作" width="180">
+        <el-table-column fixed="right" label="操作" >
           <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 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 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 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>
           </template>
         </el-table-column>
@@ -99,35 +103,40 @@
       />
     </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-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">
           <template #label>
             <span>
               <el-tooltip content="控制器中定义的权限字符,如:@SaCheckRole('admin')" placement="top">
                 <el-icon><question-filled /></el-icon>
               </el-tooltip>
-              权限字符
+              角色编码
             </span>
           </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 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 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-group>
         </el-form-item>
         <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"
             class="tree-border"
             :data="menuOptions"
@@ -135,11 +144,11 @@
             node-key="id"
             :check-strictly="!form.menuCheckStrictly"
             empty-text="加载中,请稍候"
-            :props="{ label: 'label', children: 'children' } as any"
+            :props="{ label: 'label', children: 'children' ,'disabled':(data,node)=>dialog.disabled} as any"
           ></el-tree>
         </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>
       <template #footer>
@@ -156,7 +165,7 @@
         <el-form-item label="角色名称">
           <el-input v-model="form.roleName" :disabled="true" />
         </el-form-item>
-        <el-form-item label="权限字符">
+        <el-form-item label="角色编码">
           <el-input v-model="form.roleKey" :disabled="true" />
         </el-form-item>
         <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 { RoleVO, RoleForm, RoleQuery, DeptTreeOption } from '@/api/system/role/types';
 import { MenuTreeOption, RoleMenuTree } from '@/api/system/menu/types';
+import { listByType } from '@/api/system/dict/data';
+ 
 
 const router = useRouter();
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@@ -239,6 +250,7 @@ const initForm: RoleForm = {
   status: '0',
   roleName: '',
   roleKey: '',
+  roleType: '',
   menuCheckStrictly: true,
   deptCheckStrictly: true,
   remark: '',
@@ -247,6 +259,8 @@ const initForm: RoleForm = {
   deptIds: []
 };
 
+const roleTypeOptions = ref([]);
+
 const data = reactive<PageData<RoleForm, RoleQuery>>({
   form: { ...initForm },
   queryParams: {
@@ -266,7 +280,30 @@ const { form, queryParams, rules } = toRefs(data);
 
 const dialog = reactive<DialogOption>({
   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();
   getMenuTreeselect();
   dialog.visible = true;
+  dialog.disabled = false;
   dialog.title = '添加角色';
 };
+
 /** 修改角色 */
 const handleUpdate = async (row?: RoleVO) => {
   reset();
@@ -382,12 +421,30 @@ const handleUpdate = async (row?: RoleVO) => {
   const res = await getRoleMenuTreeselect(roleId);
   dialog.title = '修改角色';
   dialog.visible = true;
+  dialog.disabled = false;
   res.checkedKeys.forEach((v) => {
     nextTick(() => {
       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查询菜单树结构 */
 const getRoleMenuTreeselect = (roleId: string | number) => {
   return roleMenuTreeselect(roleId).then((res): RoleMenuTree => {