From f1f40e9a28fafab5d884630b8900b11060ebe9fc Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期二, 31 十月 2023 08:53:35 +0800
Subject: [PATCH] 修改

---
 src/views/system/user/index.vue |   71 ++++++++++++++++++++++++-----------
 1 files changed, 48 insertions(+), 23 deletions(-)

diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index fe0ea7e..473f805 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -2,7 +2,10 @@
     <div class="system-user-container">
         <el-card shadow="hover">
             <div class="system-user-search mb15">
-                <el-input size="default" v-model.trim="searchName" placeholder="真实姓名" style="max-width: 180px"> </el-input>
+                <el-input size="default" v-model.trim="userTableData.listQuery.searchParams.realName" placeholder="真实姓名" style="max-width: 180px;margin-right: 10px"> </el-input>
+                <el-select v-model="userTableData.listQuery.searchParams.roleId" placeholder="角色类型" clearable class="w100" style="max-width: 180px" size="default">
+                  <el-option v-for="item in roleList" :key="item.id" :label="item.name" :value="item.id"> </el-option>
+                </el-select>
                 <el-button size="default" type="primary" class="ml10" @click="searchByName()">
                     <el-icon>
                         <ele-Search />
@@ -95,13 +98,15 @@
               roleId: number | null;
               name: string
               realName: string
+              userIndentityId: number | null;
             }
         };
     };
     idTypeList: Array<idType>
     depList: [];
     roleList: [];
-    searchName:string
+    expList: [];
+    searchType: null | number
 }
 
 export default defineComponent({
@@ -120,7 +125,8 @@
                   searchParams:{
                     roleId: null,
                     name: '',
-                    realName: ''
+                    realName: '',
+                    userIndentityId: null
                   }
                 }
             },
@@ -132,12 +138,13 @@
             ],
             depList: [],
             roleList: [],
-            searchName: ''
+            expList: [],
+            searchType:null
         });
         // 初始化表格数据
         const initUserTableData = async () => {
             let res = await userApi().getUserList(state.userTableData.listQuery);
-            if (res.data.code === 200) {
+            if (res.data.code === 100) {
                 state.userTableData.data = res.data.data;
                 state.userTableData.total = res.data.total;
             } else {
@@ -147,28 +154,33 @@
                 });
             }
         };
-
-        const searchByName = async () =>{
-          if(state.searchName == ''){
+        const initRoleTableData = async () => {
+          let res = await useRoleApi().getRoleList();
+          if (res.data.code === 100) {
+            state.roleList = res.data.data;
+          } else {
             ElMessage({
               type: 'warning',
-              message: '请输入搜索内容'
+              message: res.data.msg
             });
-          }else{
-            let res = await userApi().getUserLByRealName(state.searchName);
-            if (res.data.code === 100) {
-              state.userTableData.data = res.data.data
-            } else {
-              ElMessage({
-                type: 'warning',
-                message: res.data.msg
-              });
-            }
           }
-        }
+        };
+
+      const searchByName = ()=>{
+        initUserTableData()
+      }
 
         const reset = () =>{
-          state.searchName = ''
+          state.userTableData.listQuery = {
+            pageIndex: 1,
+                pageSize: 10,
+                searchParams:{
+                  roleId: null,
+                  name: '',
+                  realName: '',
+                  userIndentityId: null
+                }
+          }
           initUserTableData()
         }
 
@@ -196,10 +208,21 @@
             }
         };
 
+        const getExpertsData = async () => {
+          let res = await useRoleApi().getExpList();
+          if (res.data.code === 100) {
+            state.expList = res.data.data;
+          } else {
+            ElMessage({
+              type: 'warning',
+              message: res.data.msg
+            });
+          }
+        };
+
         // 打开新增修改用户弹窗
         const onOpenUserDialog = (type: string, value: any) => {
-          console.log('打开',state.depList, state.roleList)
-            userRef.value.openDialog(type, value, state.depList, state.roleList);
+            userRef.value.openDialog(type, value, state.depList, state.roleList, state.expList);
         };
 
         // 删除用户
@@ -240,7 +263,9 @@
         // 页面加载时
         onMounted(() => {
             initUserTableData();
+            initRoleTableData();
             getRoleData();
+            getExpertsData();
             getDepList()
         });
         return {

--
Gitblit v1.9.2