wuguojie 1 год назад
Родитель
Сommit
5b9da8c66b

+ 7 - 6
src/api/modules/role.ts

@@ -1,10 +1,11 @@
 import { ApiInstance } from '../type'
 interface roleData {
   name: string;
-  desc: string;
+  remark: string;
   system: string,
   permsId: number[],
-  perms: string[]
+  perms: string[],
+  [key: string]: any
 }
 const roleApi = (axiosInstance: ApiInstance) => ({
   // 新增角色
@@ -20,15 +21,15 @@ const roleApi = (axiosInstance: ApiInstance) => ({
   roleUpdate:(data: roleData) => axiosInstance.post('userRole/roleUpdate', data,{}),
 
   //角色删除检测
-  roleDeleteValid:(data: roleData) => axiosInstance.post('userRole/roleDeleteValid', data,{}),
+  roleDeleteValid:(data: { id: string }) => axiosInstance.post('userRole/roleDeleteValid', data,{}),
 
   //角色删除检测
-  roleDelete:(data: roleData) => axiosInstance.post('userRole/roleDelete', data,{}),
+  roleDelete:(data: { id: string }) => axiosInstance.post('userRole/roleDelete', data,{}),
 
   //配置路由
   updateConfig:(data: any) => axiosInstance.post('system/updateConfig', data,{})
-  
- 
+
+
 })
 
 export default roleApi

+ 3 - 1
src/components/Table/index.vue

@@ -11,6 +11,7 @@
         style="width: 100%"
         row-key="id"
         :tree-props="props.treeProps"
+        :height="props.height"
         @selection-change="selectChange"
         @select-all="selectAllChange"
       >
@@ -108,7 +109,8 @@ interface Props{
   showSelect: boolean;
   showIndex: boolean;
   showOperation:boolean;
-  treeProps:{}
+  treeProps:{},
+  height?: string | number,
 }
 const props = withDefaults(defineProps<Props>(),{
   showOperation:true,

+ 13 - 13
src/views/personnel/institutionManage.vue

@@ -82,8 +82,8 @@
       </Table>
     </div>
 
-    
-    <setDept 
+
+    <setDept
     :dialogVisible="deptDialogVisible"
       :dept-list="tableData"
       :dept-ids="deptIdList"
@@ -124,7 +124,7 @@ const defaultProps = {
 const deptDialogVisible=ref(false)
 const deptIdList=ref([])
 function setDeptUser(item:any){
-  
+
   deptIdList.value=[item.id]
   deptDialogVisible.value=true
 }
@@ -138,7 +138,7 @@ function manySetDeptUser(){
   }else{
     ElMessage.warning("请选择机构后,再进行设置负责人")
   }
- 
+
 }
 
 function confirmCharge(){
@@ -261,19 +261,19 @@ const getList = (item: PageInfo) => {
 const checkTableIdList=ref([])
 //表格选择事件
 function selectAllChange(list:any){
- 
+
   checkTableIdList.value=list
 }
 
 function selectChange(list:any){
- 
+
   checkTableIdList.value=list
 }
 //添加子机构
 
 const isDisabledId = ref("");
 const addChild = (item: any) => {
-  
+  console.log(123, item)
   router.push({
     path:'/personnel/institution/institutionEdit',
     query:{
@@ -281,10 +281,10 @@ const addChild = (item: any) => {
       id:item.id
     }
   })
-  
+
 };
 const editor = (item: any) => {
- 
+
   router.push({
     path:'/personnel/institution/institutionEdit',
     query:{
@@ -293,7 +293,7 @@ const editor = (item: any) => {
     }
   })
 
-  
+
 };
 const del = (item: any) => {
   // ElPopconfirm('是否确认')
@@ -428,7 +428,7 @@ const getInstitutionList = () => {
 
     // }
     tableData.value = res.data;
-   
+
   });
   // pageInfo.pageSize=item.pageSize
 };
@@ -438,7 +438,7 @@ const memberList=ref([])
 const getAllMemberList = () => {
   // pageInfo.pageNum=item.pageNum
   api.userApi.AllMemberList({}).then((res:any) => {
-    
+
     if(res.code===200)
     memberList.value=res.data
   });
@@ -482,7 +482,7 @@ const confirm = async (formEl: FormInstance | undefined) => {
 
           })
           .then((res) => {
-            
+
             if (res.code === 200) {
               ElMessage.success("操作成功");
               dialogVisible.value = false;

+ 36 - 38
src/views/personnel/memberManagement.vue

@@ -10,7 +10,7 @@
       <div style="display: flex;justify-content: space-between;margin: 10px 0;">
         <!-- <el-button type="primary" link @click="$router.push({path:'/personnel/institution'})">机构管理</el-button> -->
         <el-button type="primary" link @click="expandTree">
-        
+
           {{ isExpand?'全部收起':'全部展开' }}
         </el-button>
       </div>
@@ -47,14 +47,13 @@
       </el-tree>
     </div>
     <div class="member-main">
-      
-
       <Table
         :tableData="tableData"
         :columns="columns"
         :showIndex="false"
         :showSelect="true"
         :pageInfo="pageInfo"
+        :height="700"
         @getList="getList"
         @select-all-change="selectAllChange"
         @select-change="selectChange"
@@ -104,8 +103,8 @@
           <el-dropdown placement="bottom-start">
             <span class="el-dropdown-link"> 更 多 </span>
             <template #dropdown>
-              
-                
+
+
                 <el-dropdown-item v-on:click="changeDept(scope)"
                   >变更机构</el-dropdown-item
                 >
@@ -114,8 +113,8 @@
                   >资源转移</el-dropdown-item
                 >
                 <el-dropdown-item v-on:click="delUser(scope)">删除</el-dropdown-item>
-            
-           
+
+
             </template>
           </el-dropdown>
         </template>
@@ -174,14 +173,12 @@
       </template>
     </el-dialog>
     <setDept
-    
       :dialogVisible="deptDialogVisible"
       :dept-list="deptTreeData"
       :dept-ids="[deptItem.id]"
       @close-dialog="confirmDialogInfo"
       :title="title"
       @cancel-dialog="deptDialogVisible=false"
-      
     ></setDept>
     <el-dialog
       v-model="changeDeptDialog"
@@ -227,11 +224,9 @@
         </div>
       </template>
     </el-dialog>
-    
-
     <!-- <el-dialog v-model="dialogVisible" title="基本信息" width="800" draggable> -->
       <!-- <addOperation @closeDialog="closeAddOperation"></addOperation> -->
-      
+
     <!-- </el-dialog> -->
   </div>
 </template>
@@ -263,8 +258,8 @@ onMounted(async () => {
   getInstitutionList();
   getUserList()
   statusList.value = await getDictItems({ dictCode: "person_status" });
-  
- 
+
+
 });
 
 //状态字典
@@ -321,7 +316,7 @@ function treeClickTable(node: any) {
 const isExpand=ref(false)
 function expandTree(){
   // console.log(treeRef.value)
-  
+
 
   isExpand.value=!isExpand.value
   // treeRef.value!.defaultExpandAll=!isExpand.value;
@@ -384,9 +379,9 @@ const rules = reactive<FormRules<RuleForm>>({
 // import TestTable from "@/components/Table/index.vue";
 
 interface Page {
-   
-   [key: string]: any 
-   
+
+   [key: string]: any
+
 }
 const tableData = ref<Page>([])
 const columns = [
@@ -404,8 +399,8 @@ const columns = [
           comType=item.label
         }
       })
-        
-      
+
+
 
       return () => h("div", {}, comType);
     },
@@ -449,11 +444,13 @@ const getList = (item: PageInfo) => {
 const getUserList= () => {
   api.userApi.memberList({
     ...pageInfo,
+    pages: pageInfo.pageNum,
+    size: pageInfo.pageSize,
     deptId:deptItem.value.id,
     status:status.value,
     isMember:1
   }).then((res:any)=>{
-    
+
     if(res.code===200){
       tableData.value=res.data.records
       pageInfo.total=res.data.total
@@ -461,7 +458,7 @@ const getUserList= () => {
   })
 };
 const editor = (item: any) => {
- 
+
   router.push({
     path:"/personnel/member/memberMessage",
     query:{
@@ -473,8 +470,8 @@ const editor = (item: any) => {
 };
 const router=useRouter()
 const add = (formEl: FormInstance | undefined) => {
-  
-  
+
+
   router.push({
     path:"/personnel/member/memberEdit"
   })
@@ -494,10 +491,10 @@ const addChild = (item: any) => {
       id:item.id
     }
   })
-  
+
 };
 const editorInstitution = (item: any) => {
- 
+
  router.push({
    path:'/personnel/institution/institutionEdit',
    query:{
@@ -506,7 +503,7 @@ const editorInstitution = (item: any) => {
    }
  })
 
- 
+
 };
 const del = (item: any) => {
   // ElPopconfirm('是否确认')
@@ -517,7 +514,7 @@ const del = (item: any) => {
     center:true
   })
     .then(() => {
-      
+
       api.institutionApi
         .institutionDel({
           id: item.id,
@@ -536,7 +533,7 @@ const del = (item: any) => {
 
 
 const append = (data: Tree) => {
-  
+
   // const newChild = { id: id++, label: 'testtest', children: [] }
   if (!data.children) {
     data.children = [];
@@ -559,7 +556,7 @@ const deptDialogVisible=ref(false)
 const changeDeptDialog = ref(false);
 const operationForm=ref({})
 function changeDept(item:any) {
-  
+
   operationForm.value=item.operationData.row
   api.userApi
     .checkChangeDept({
@@ -649,7 +646,7 @@ function delUser(item:any) {
             api.userApi
               .userDelete({
                 ids: [operationForm.value.id],
-                
+
               })
               .then((res: any) => {
                 if(res.code==200){
@@ -687,7 +684,7 @@ function delsUser() {
           .then((res: any) => {
             if(res.code==200){
               ElMessage.success(res.msg)
-              
+
             }
           });
         // console.log(123);
@@ -695,8 +692,8 @@ function delsUser() {
       .catch(() => {
         ElMessage.warning("用户取消操作");
       });
-      
-    
+
+
 }
 
 //确认弹框提交信息
@@ -773,12 +770,12 @@ function resign(item:any) {
 const checkTableIdList=ref([])
 //表格选择事件
 function selectAllChange(list:any){
- 
+
   checkTableIdList.value=list
 }
 
 function selectChange(list:any){
- 
+
   checkTableIdList.value=list
 }
 
@@ -787,10 +784,10 @@ const deptIdList=ref([])
 const title=ref('')
 function manySetDeptUser(){
   title.value='设置负责人'
- 
+
   deptIdList.value=checkTableIdList.value
   deptDialogVisible.value=true
-  
+
 
 }
 
@@ -812,6 +809,7 @@ function manySetDeptUser(){
 .member {
   background: #fff;
   width: 100%;
+  height: calc(100vh - 120px);
   // height: 100%;
   // padding: 20px;
   box-sizing: border-box;

+ 25 - 13
src/views/personnel/modules/addOperation.vue

@@ -32,7 +32,7 @@
             <el-row :gutter="24">
               <el-col :span="12">
                 <el-form-item prop="roleIds" label="角色">
-                  
+
                   <el-select
                     v-model="operationForm.roleIds"
                     placeholder="请选择性别"
@@ -95,6 +95,7 @@
                     type="date"
                     placeholder="请选择"
                     value-format="YYYY-MM-DD"
+                    :disabled-date="disabledDateStart"
                     style="width: 100%"
                   />
                 </el-form-item>
@@ -106,6 +107,7 @@
                     type="date"
                     placeholder="请选择"
                     value-format="YYYY-MM-DD"
+                    :disabled-date="disabledDateEnd"
                     style="width: 100%"
                   />
                 </el-form-item>
@@ -663,7 +665,7 @@
           </template>
         </el-descriptions-item>
       </el-descriptions>
-      <div style="display: flex; justify-content: flex-end">
+      <div style="display: flex; justify-content: center">
         <el-button @click="router.back()">取消</el-button>
         <el-button type="primary" @click="onSubmit(OperationFormRef, 1)"
           >确定</el-button
@@ -728,21 +730,21 @@ onMounted(async () => {
       if (res.code === 200) {
         operationForm.value = res.data;
         let formData = res.data
-        
+
         if(formData.fileList) {
-          
-          
+
+
           let sfz1 = formData.fileList.find(item => item.fileType == 'sfz1')
           let sfz2 = formData.fileList.find(item => item.fileType == 'sfz2')
-          
+
           let qualification = formData.fileList.find(item => item.fileType == 'bankCard')
           let contractImg = formData.fileList.find(item => item.fileType == 'contract')
           let applicantImg = formData.fileList.find(item => item.fileType == 'applicant')
           let salaryTable = formData.fileList.find(item => item.fileType == 'salaryTable')
           let leaveTable = formData.fileList.find(item => item.fileType == 'leaveTable')
-         
-         
-         
+
+
+
 
           if(sfz1) {
             operationForm.value.sfz1 = sfz1.id
@@ -798,6 +800,16 @@ onMounted(async () => {
       }
     });
 });
+
+// 证件有效期始限制条件
+const disabledDateStart = (time: Date) => {
+  return time.getTime() > Date.now() - 8.64e7
+}
+// 证件有效期止限制条件
+const disabledDateEnd = (time: Date) => {
+  return time.getTime() < new Date(operationForm.value.identityTimeStart) - 8.64e7
+}
+
 const areaOptins = ref([]);
 const areaProps = ref({
   value: "areaCode",
@@ -986,7 +998,7 @@ const uploadImage = (file, type) => {
   // params.append("multipartFile", files);
   // params.append("type", "image");
   api.areaApi.fileUpload(params).then((res: any) => {
-   
+
     if (res.code === 200) {
       switch (type) {
         case 1:
@@ -1150,7 +1162,7 @@ const onSubmit = async (OperationFormRef: FormInstance, type: number) => {
   }
   await OperationFormRef.validate((valid) => {
     if (valid) {
-      
+
       if(!route.query.id){
       api.operationApi.addOperation({
         ...operationForm.value,
@@ -1166,7 +1178,7 @@ const onSubmit = async (OperationFormRef: FormInstance, type: number) => {
         applicant:applicantId.value,
         salaryTable:salaryTable.value,
         leaveTable:leaveTable.value,
-        
+
       }).then((res:any) => {
         // console.log(123, res);
         if(res.code===200){
@@ -1190,7 +1202,7 @@ const onSubmit = async (OperationFormRef: FormInstance, type: number) => {
         salaryTable:salaryTable.value,
         leaveTable:leaveTable.value,
         id:operationForm.value.id
-        
+
       }).then((res:any) => {
         // console.log(123, res);
         if(res.code===200){

+ 3 - 3
src/views/personnel/modules/editInstitution.vue

@@ -153,7 +153,7 @@ onMounted(() => {
         }
       });
   }else{
-    // form.parentId=[route.query.id]
+    form.parentId= route.query.id
   }
 
   if(route.query.id) {
@@ -168,7 +168,7 @@ onMounted(() => {
 });
 
 //禁用机构选择
-function disabledEditTree(list: tableType) {
+function disabledEditTree(list) {
   for (let i = 0; i < list.length; i++) {
     const node = list[i];
     if (route.query.id) {
@@ -184,7 +184,7 @@ function disabledEditTree(list: tableType) {
     }
   }
 }
-const disabledAddTree = (list: tableType) => {
+const disabledAddTree = (list) => {
   for (let i = 0; i < list.length; i++) {
     const node = list[i];
     if (list[i].parentId == '0') {

+ 221 - 191
src/views/personnel/roleManagement.vue

@@ -1,146 +1,137 @@
 <template>
-  <div>
-    <ElRow :gutter="20">
+  <div class="role">
+    <ElRow :gutter="20" style="background: white; height: 840px">
       <ElCol :md="6">
-        <PageMain class="vh100">
-          <ElFormItem prop="roleName">
-            <ElCol :md="20">
-              <ElInput
-                v-model="roleName"
-                placeholder="角色名称查找"
-                type="text"
-                tabindex="1"
-              >
-                <template #prefix>
-                  <SvgIcon name="i-ri:user-3-fill" />
-                </template>
-              </ElInput>
-            </ElCol>
-            <ElCol :md="20" style="margin-top: 20px;">
-              <ElButton type="primary" @click="addRole">
-                <el-icon><Plus /></el-icon>
-                添加</ElButton
-              >
-
-              <ElButton type="primary">查找</ElButton>
-            </ElCol>
-            <ElCol :md="24">
-              <div
-                v-for="item in roleList"
-                :key="item.id"
-                :class="roleId == item.id ? 'on' : 'role-item'"
-                @click="chooseRole(item)"
-              >
-                <p>{{ item.name }}</p>
-                <p>
-                  <span>{{ item.remark || "--" }}</span>
-                </p>
-              </div>
-            </ElCol>
-          </ElFormItem>
-        </PageMain>
+        <ElCol :md="20" style="margin: 10px 0">
+          <ElInput
+            v-model="roleName"
+            placeholder="角色名称查找"
+            type="text"
+            tabindex="1"
+          >
+            <template #prefix>
+              <SvgIcon name="i-ri:user-3-fill" />
+            </template>
+          </ElInput>
+        </ElCol>
+        <ElCol :md="20" style="margin: 10px 0">
+          <ElButton type="primary" @click="addRole">
+            <el-icon><Plus /></el-icon>添加
+          </ElButton>
+          <ElButton type="primary" @click="handleSearch">查找</ElButton>
+        </ElCol>
+        <ElCol :md="24" style="height: 720px; overflow-y: auto;">
+          <div
+            v-for="item in searchList"
+            :key="item.id"
+            :class="roleId == item.id ? 'on' : 'role-item'"
+            @click="chooseRole(item)"
+          >
+            <p>{{ item.name }}</p>
+            <p>
+              <span>{{ item.remark || "--" }}</span>
+            </p>
+          </div>
+        </ElCol>
       </ElCol>
       <ElCol :md="18">
-        <PageMain class="vh100">
-          <template #title>
-            <div class="flex j-s a-c">
-              <span class="strong">角色管理</span>
-              <div>
-                <ElButton type="primary" @click="roleSubmit">提交</ElButton>
-                <ElButton type="danger" @click="deleteRole">删除</ElButton>
-              </div>
-            </div>
-          </template>
-          <h5>基本信息</h5>
-          <!-- <ElCol :md="6"></ElCol> -->
-          <ElForm
-            :model="roleInfo"
-            :rules="roleRules"
-            label-width="auto"
-            size=""
-            style="max-width: 500px;"
+        <div class="flex j-s a-c" style="margin-top: 20px;">
+          <span class="strong">角色管理</span>
+          <div>
+            <ElButton type="primary" @click="roleSubmit(roleRef)">提交</ElButton>
+            <ElButton type="danger" @click="deleteRole">删除</ElButton>
+          </div>
+        </div>
+        <h5>基本信息</h5>
+        <!-- <ElCol :md="6"></ElCol> -->
+        <ElForm
+          :model="roleInfo"
+          :rules="roleRules"
+          ref="roleRef"
+          label-width="auto"
+          size=""
+          style="max-width: 500px;"
+        >
+          <ElFormItem prop="name" label="角色名称">
+            <ElInput
+              v-model="roleInfo.name"
+              placeholder="输入20个字以内的角色名称"
+              type="text"
+              tabindex="1"
+            >
+            </ElInput>
+          </ElFormItem>
+          <ElFormItem prop="deptId" label="所属机构">
+            <el-cascader
+              clearable
+              style="width: 100%;"
+              v-model="roleInfo.deptId"
+              :options="tableData"
+              :props="tableProps"
+              @change="deptChange"
+            />
+          </ElFormItem>
+          <ElFormItem prop="remark" label="角色描述">
+            <ElInput
+              v-model="roleInfo.remark"
+              placeholder="请输入"
+              type="textarea"
+              tabindex="2"
+            >
+            </ElInput>
+          </ElFormItem>
+        </ElForm>
+        <ElDivider></ElDivider>
+        <div style="min-height: 500px;">
+          <h5>角色权限
+            <span style=" font-size: 12px; font-weight: 400;color: #ccc;">
+              (该角色享有的后台模块功能权限剩余数据权限)
+            </span>
+          </h5>
+          <el-tabs
+            :tab-position="'left'"
+            style="height: 460px;"
+            class="demo-tabs"
           >
-            <ElFormItem prop="name" label="角色名称">
-              <ElInput
-                v-model="roleInfo.name"
-                placeholder="输入20个字以内的角色名称"
-                type="text"
-                tabindex="1"
-              >
-              </ElInput>
-            </ElFormItem>
-            <ElFormItem prop="deptId" label="所属机构">
-              <el-cascader
-                clearable
-                style="width: 100%;"
-                v-model="roleInfo.deptId"
-                :options="tableData"
-                :props="tableProps"
-                @change="deptChange"
+            <el-tab-pane label="菜单/操作权限">
+              <ElTree
+                style="height: 490px; overflow-y: auto;"
+                :data="treeData"
+                ref="permsRef"
+                :props="defaultProps"
+                show-checkbox
+                node-key="id"
+                :default-expand-all="true"
+                :default-checked-keys="checkedKeys"
+                @check="handleCheckChange"
               />
-            </ElFormItem>
-            <ElFormItem prop="desc" label="角色描述">
-              <ElInput
-                v-model="roleInfo.desc"
-                placeholder="请输入"
-                type="textarea"
-                tabindex="2"
-              >
-              </ElInput>
-            </ElFormItem>
-          </ElForm>
-          <ElDivider></ElDivider>
-          <div style="min-height: 500px;">
-            <h5>
-              角色权限<span
-                style=" font-size: 12px; font-weight: 400;color: #ccc;"
-                >(该角色享有的后台模块功能权限剩余数据权限)</span
+            </el-tab-pane>
+            <el-tab-pane label="组织架构权限">
+              <el-radio-group
+                v-model="roleInfo.dataMark"
+                @change="dataMarkChange"
               >
-            </h5>
-            <el-tabs
-              :tab-position="'left'"
-              style="height: 500px;"
-              class="demo-tabs"
-            >
-              <el-tab-pane label="菜单/操作权限">
-                <ElTree
-                  style="max-height: 440px; overflow-y: auto;"
-                  :data="treeData"
-                  :props="defaultProps"
-                  show-checkbox
-                  node-key="id"
-                  :default-expand-all="true"
-                  :default-checked-keys="checkedKeys"
-                  @check="handleCheckChange"
-                />
-              </el-tab-pane>
-              <el-tab-pane label="组织架构权限">
-                <el-radio-group
-                  v-model="roleInfo.dataMark"
-                  @change="dataMarkChange"
+                <el-radio value="1" size="large">可见本机构下的数据</el-radio>
+                <el-radio value="2" size="large"
+                >可见本机构及下级机构数据</el-radio
                 >
-                  <el-radio value="1" size="large">可见本机构下的数据</el-radio>
-                  <el-radio value="2" size="large"
-                    >可见本机构及下级机构数据</el-radio
-                  >
-                  <el-radio value="3" size="large">指定机构</el-radio>
-                </el-radio-group>
-                <ElTree
-                  style="max-height: 440px; overflow-y: auto;"
-                  :data="deptTreeData"
-                  :props="deptProps"
-                  show-checkbox
-                  node-key="id"
-                  :check-strictly="true"
-                  :default-expand-all="true"
-                  :default-checked-keys="roleInfo.deptIds"
-                  @check="handleDeptCheckChange"
-                  ref="deptTree"
-                />
-              </el-tab-pane>
-            </el-tabs>
-          </div>
-        </PageMain>
+                <el-radio value="3" size="large">指定机构</el-radio>
+              </el-radio-group>
+              <ElTree
+                style="max-height: 440px; overflow-y: auto;"
+                :data="deptTreeData"
+                :props="deptProps"
+                show-checkbox
+                node-key="id"
+                :check-strictly="true"
+                :default-expand-all="true"
+                :default-checked-keys="roleInfo.deptIds"
+                @check="handleDeptCheckChange"
+                ref="deptTree"
+              />
+            </el-tab-pane>
+          </el-tabs>
+        </div>
       </ElCol>
     </ElRow>
   </div>
@@ -152,8 +143,9 @@ import { ref, reactive, onMounted, onBeforeMount, } from "vue";
 import {
   type FormRules,
   type ElTree,
+  type FormInstance,
   ElMessage,
-  ElMessageBox,
+  ElMessageBox
 } from "element-plus";
 import {
   preprocessRoutes,
@@ -163,9 +155,12 @@ import {
 import api from "@/api";
 const roleName = ref<string>("");
 
+const roleRef = ref<FormInstance>()
+const permsRef = ref<InstanceType<typeof ElTree>>()
+
 let roleInfo = reactive<{
   name: string;
-  desc: string;
+  remark: string;
   system: string;
   permsId: number[];
   perms: any[];
@@ -174,7 +169,7 @@ let roleInfo = reactive<{
   dataMark: string;
 }>({
   name: "", //角色
-  desc: "", //描述
+  remark: "", //描述
   system: "PLATFORM", //系统
   permsId: [], //权限id
   perms: [], //权限标识
@@ -283,7 +278,7 @@ function chooseRole(item: any) {
     .roleInfo({
       roleId: item.id,
       name: "",
-      desc: "",
+      remark: "",
       system: "",
       permsId: [],
       perms: [],
@@ -292,7 +287,7 @@ function chooseRole(item: any) {
       // console.log(res);
       roleInfo.name = res.data.name;
 
-      roleInfo.desc = res.data.remark;
+      roleInfo.remark = res.data.remark;
       roleInfo.deptId = res.data.deptId;
       roleInfo.permsId = res.data.perms.map((val: Perm) => val.id);
       roleInfo.perms = res.data.perms;
@@ -323,50 +318,80 @@ const operationType = ref("add");
 function addRole() {
   showRole.value = true;
   operationType.value = "add";
+  roleInfo.name = ''
+  roleInfo.deptId = ''
+  roleInfo.remark = ''
+  roleInfo.deptIds = []
+  roleInfo.permsId = []
+  deptTree.value!.setCheckedKeys([], true)
+  permsRef.value!.setCheckedKeys([], true)
+}
+// 搜索
+let searchList = ref([])
+const handleSearch = () => {
+  searchList.value = roleList.value.filter(a => a.name.includes(roleName.value))
 }
 //提交角色信息
-function roleSubmit() {
-  if (operationType.value == "add") {
-    api.roleApi
-      .roleAdd({
-        name: roleInfo.name,
-        desc: roleInfo.desc,
-        system: localStorage.getItem("login_system") || "",
-        permsId: roleInfo.permsId,
-        perms: roleInfo.perms,
-        deptId: roleInfo.deptId,
-        dataScope: {
-          deptIds: roleInfo.deptIds,
-          dataMark: roleInfo.dataMark,
-        },
-      })
-      .then((res) => {
-        // console.log(res);
-        ElMessage.success("操作成功");
-        getRoleList();
-      });
-  } else {
-    api.roleApi
-      .roleUpdate({
-        // roleId: roleInfo.id,
-        id: roleId.value,
-        name: roleInfo.name,
-        desc: roleInfo.desc,
-        system: localStorage.getItem("login_system") || "",
-        permsId: roleInfo.permsId,
-        perms: roleInfo.perms,
-        deptId: roleInfo.deptId,
-        dataScope: {
-          deptIds: roleInfo.deptIds,
-          dataMark: roleInfo.dataMark,
-        },
-      })
-      .then((res) => {
-        // console.log(res);
-        ElMessage.success("操作成功");
-        getRoleList();
-      });
+async function roleSubmit(roleRef: FormInstance | undefined) {
+  if(!roleRef) {
+    roleRef.resetFields()
+    return
   }
+  await roleRef.validate((vaild) => {
+    if(vaild) {
+      if (operationType.value == "add") {
+        api.roleApi
+          .roleAdd({
+            name: roleInfo.name,
+            remark: roleInfo.remark,
+            system: localStorage.getItem("login_system") || "",
+            permsId: roleInfo.permsId,
+            perms: roleInfo.perms,
+            deptId: roleInfo.deptId,
+            dataScope: {
+              deptIds: roleInfo.deptIds,
+              dataMark: roleInfo.dataMark,
+            },
+          })
+          .then((res) => {
+            // console.log(res);
+            if(res.code == 200) {
+              ElMessage.success("操作成功");
+              getRoleList();
+            } else {
+              ElMessage.error(res.msg)
+            }
+          });
+      } else {
+        api.roleApi
+          .roleUpdate({
+            // roleId: roleInfo.id,
+            id: roleId.value,
+            name: roleInfo.name,
+            remark: roleInfo.remark,
+            system: localStorage.getItem("login_system") || "",
+            permsId: roleInfo.permsId,
+            perms: roleInfo.perms,
+            deptId: roleInfo.deptId,
+            dataScope: {
+              deptIds: roleInfo.deptIds,
+              dataMark: roleInfo.dataMark,
+            },
+          })
+          .then((res) => {
+            // console.log(res);
+            if(res.code == 200) {
+              ElMessage.success("操作成功");
+              getRoleList();
+            } else {
+              ElMessage.error(res.msg)
+            }
+          });
+      }
+    } else {
+      ElMessage.error('请填写相关信息!')
+    }
+  })
 }
 //删除角色
 function deleteRole() {
@@ -377,17 +402,17 @@ function deleteRole() {
     .then((res) => {
       console.log(res);
       if (res.code == 200) {
-        ElMessageBox.confirm("确认要删除当前数据吗?", "提示", {
+        ElMessageBox({
+          title: '提示',
+          message: '确认要删除当前数据吗?',
+          type: 'warning',
+          showCancelButton: true,
           confirmButtonText: "确认",
           cancelButtonText: "取消",
-          type: "warning",
-        })
-          .then(() => {
-            api.roleApi
-              .roleDelete({
+        }).then(() => {
+            api.roleApi.roleDelete({
                 id: roleId.value,
-              })
-              .then((res) => {
+              }).then((res) => {
                 ElMessage.success("操作成功");
                 getRoleList();
               });
@@ -485,12 +510,13 @@ function getRoleList() {
     .roleList({
       system: localStorage.getItem("login_system") || "",
       name: "",
-      desc: "",
+      remark: "",
       permsId: [],
       perms: [],
     })
     .then((res) => {
-      roleList.value = res.data;
+      roleList.value = JSON.parse(JSON.stringify(res.data))
+      searchList.value = JSON.parse(JSON.stringify(res.data))
       // roleId.value = res.data[0].id;
     });
 }
@@ -517,6 +543,10 @@ onMounted(() => {
 </script>
 
 <style lang="scss" scoped>
+.role{
+  height: 100%;
+  overflow: hidden;
+}
 .roleitem {
   padding: 20px;
   cursor: pointer;