From df5b61dcf9d7c6a71ba919b0556ea9aa43aa3f76 Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期一, 08 五月 2023 10:00:43 +0800 Subject: [PATCH] 修改展示 --- src/views/system/user/index.vue | 85 +++++++++++++++++++++++++++++------------- 1 files changed, 58 insertions(+), 27 deletions(-) diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 3030f1b..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 /> @@ -89,16 +92,21 @@ total: number; loading: boolean; listQuery: { - roleId: number | null; - usePage: boolean; pageIndex: number; pageSize: number; + searchParams:{ + roleId: number | null; + name: string + realName: string + userIndentityId: number | null; + } }; }; idTypeList: Array<idType> depList: []; roleList: []; - searchName:string + expList: []; + searchType: null | number } export default defineComponent({ @@ -112,10 +120,14 @@ total: 0, loading: false, listQuery: { - roleId: 1, - usePage: false, - pageIndex: 1, - pageSize: 10 + pageIndex: 1, + pageSize: 10, + searchParams:{ + roleId: null, + name: '', + realName: '', + userIndentityId: null + } } }, idTypeList:[ @@ -126,7 +138,8 @@ ], depList: [], roleList: [], - searchName: '' + expList: [], + searchType:null }); // 初始化表格数据 const initUserTableData = async () => { @@ -141,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() } @@ -190,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); }; // 删除用户 @@ -234,7 +263,9 @@ // 页面加载时 onMounted(() => { initUserTableData(); + initRoleTableData(); getRoleData(); + getExpertsData(); getDepList() }); return { -- Gitblit v1.9.2