Skip to content

Commit fbef723

Browse files
committed
feat: enhance user search functionality with additional filters for active status and source
--bug=1059690 --user=王孝刚 【用户管理】筛选项加上:状态、用户来源 https://www.tapd.cn/62980211/s/1744107
1 parent 53f83d3 commit fbef723

File tree

1 file changed

+96
-24
lines changed

1 file changed

+96
-24
lines changed

ui/src/views/system/user-manage/index.vue

Lines changed: 96 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
type="primary"
88
@click="createUser"
99
v-hasPermission="[RoleConst.ADMIN, PermissionConst.USER_CREATE]"
10-
>{{ $t('views.userManage.createUser') }}
10+
>{{ $t('views.userManage.createUser') }}
1111
</el-button>
1212
<div class="flex-between complex-search">
1313
<el-select
@@ -16,9 +16,17 @@
1616
style="width: 120px"
1717
@change="search_type_change"
1818
>
19-
<el-option :label="$t('views.login.loginForm.username.label')" value="username" />
20-
<el-option :label="$t('views.userManage.userForm.nick_name.label')" value="nick_name" />
21-
<el-option :label="$t('views.login.loginForm.email.label')" value="email" />
19+
<el-option :label="$t('views.login.loginForm.username.label')" value="username"/>
20+
<el-option :label="$t('views.userManage.userForm.nick_name.label')" value="nick_name"/>
21+
<el-option :label="$t('views.login.loginForm.email.label')" value="email"/>
22+
<el-option
23+
:label="$t('common.status.label')"
24+
value="is_active"
25+
/>
26+
<el-option
27+
:label="$t('views.userManage.source.label')"
28+
value="source"
29+
/>
2230
</el-select>
2331
<el-input
2432
v-if="search_type === 'username'"
@@ -44,6 +52,63 @@
4452
clearable
4553
:placeholder="$t('common.inputPlaceholder')"
4654
/>
55+
<el-select
56+
v-else-if="search_type === 'is_active'"
57+
v-model="search_form.is_active"
58+
@change="getList"
59+
style="width: 220px"
60+
>
61+
<el-option
62+
:label="$t('common.status.enabled')"
63+
:value="true"
64+
/>
65+
<el-option
66+
:label="$t('common.status.disabled')"
67+
:value="false"
68+
/>
69+
</el-select>
70+
<el-select
71+
v-else-if="search_type === 'source'"
72+
v-model="search_form.source"
73+
@change="getList"
74+
style="width: 220px"
75+
clearable
76+
:placeholder="$t('common.inputPlaceholder')"
77+
>
78+
<el-option
79+
:label="$t('views.userManage.source.local')"
80+
value="LOCAL"
81+
/>
82+
<el-option
83+
label="CAS"
84+
value="CAS"
85+
/>
86+
<el-option
87+
label="LDAP"
88+
value="LDAP"
89+
/>
90+
<el-option
91+
label="OIDC"
92+
value="OIDC"
93+
/>
94+
<el-option
95+
label="OAuth2"
96+
value="OAuth2"
97+
/>
98+
<el-option
99+
:label="$t('views.userManage.source.wecom')"
100+
value="wecom"
101+
/>
102+
<el-option
103+
:label="$t('views.userManage.source.lark')"
104+
value="lark"
105+
/>
106+
<el-option
107+
:label="$t('views.userManage.source.dingtalk')"
108+
value="dingtalk"
109+
/>
110+
</el-select>
111+
47112
</div>
48113
</div>
49114
<app-table
@@ -71,7 +136,7 @@
71136
<template #default="{ row }">
72137
<div v-if="row.is_active" class="flex align-center">
73138
<el-icon class="color-success mr-8" style="font-size: 16px">
74-
<SuccessFilled />
139+
<SuccessFilled/>
75140
</el-icon>
76141
<span class="color-secondary">
77142
{{ $t('common.status.enabled') }}
@@ -167,7 +232,7 @@
167232
v-if="hasPermission([RoleConst.ADMIN, PermissionConst.USER_EDIT], 'OR')"
168233
/>
169234
</span>
170-
<el-divider direction="vertical" />
235+
<el-divider direction="vertical"/>
171236
<el-tooltip effect="dark" :content="$t('common.edit')" placement="top">
172237
<span class="mr-8">
173238
<el-button
@@ -177,7 +242,7 @@
177242
:title="$t('common.edit')"
178243
v-if="hasPermission([RoleConst.ADMIN, PermissionConst.USER_EDIT], 'OR')"
179244
>
180-
<el-icon><EditPen /></el-icon>
245+
<el-icon><EditPen/></el-icon>
181246
</el-button>
182247
</span>
183248
</el-tooltip>
@@ -194,7 +259,7 @@
194259
:title="$t('views.userManage.setting.updatePwd')"
195260
v-if="hasPermission([RoleConst.ADMIN, PermissionConst.USER_EDIT], 'OR')"
196261
>
197-
<el-icon><Lock /></el-icon>
262+
<el-icon><Lock/></el-icon>
198263
</el-button>
199264
</span>
200265
</el-tooltip>
@@ -207,41 +272,47 @@
207272
:title="$t('common.delete')"
208273
v-if="hasPermission([RoleConst.ADMIN, PermissionConst.USER_DELETE], 'OR')"
209274
>
210-
<el-icon><Delete /></el-icon>
275+
<el-icon>
276+
<Delete/>
277+
</el-icon>
211278
</el-button>
212279
</el-tooltip>
213280
</template>
214281
</el-table-column>
215282
</app-table>
216283
</el-card>
217-
<UserDrawer :title="title" ref="UserDrawerRef" @refresh="refresh" />
218-
<UserPwdDialog ref="UserPwdDialogRef" @refresh="refresh" />
284+
<UserDrawer :title="title" ref="UserDrawerRef" @refresh="refresh"/>
285+
<UserPwdDialog ref="UserPwdDialogRef" @refresh="refresh"/>
219286
</div>
220287
</template>
221288

222289
<script lang="ts" setup>
223-
import { onMounted, ref, reactive, watch } from 'vue'
290+
import {onMounted, ref, reactive, watch} from 'vue'
224291
import UserDrawer from './component/UserDrawer.vue'
225292
import UserPwdDialog from './component/UserPwdDialog.vue'
226293
import userManageApi from '@/api/system/user-manage'
227-
import { datetimeFormat } from '@/utils/time'
228-
import { MsgSuccess, MsgConfirm } from '@/utils/message'
229-
import { t } from '@/locales'
230-
import { ValidCount, ValidType } from '@/enums/common.ts'
294+
import {datetimeFormat} from '@/utils/time'
295+
import {MsgSuccess, MsgConfirm} from '@/utils/message'
296+
import {t} from '@/locales'
297+
import {ValidCount, ValidType} from '@/enums/common.ts'
231298
import useStore from '@/stores'
232-
import { PermissionConst, RoleConst } from '@/utils/permission/data'
233-
import { hasPermission } from '@/utils/permission/index'
299+
import {PermissionConst, RoleConst} from '@/utils/permission/data'
300+
import {hasPermission} from '@/utils/permission/index'
234301
235-
const { user, common } = useStore()
302+
const {user, common} = useStore()
236303
const search_type = ref('username')
237304
const search_form = ref<{
238305
username: string
239306
nick_name?: string
240307
email?: string
308+
is_active?: boolean | null
309+
source?: string | null
241310
}>({
242311
username: '',
243312
nick_name: '',
244313
email: '',
314+
is_active: true,
315+
source: '',
245316
})
246317
247318
const UserDrawerRef = ref()
@@ -257,7 +328,7 @@ const paginationConfig = reactive({
257328
const userTableData = ref<any[]>([])
258329
259330
const search_type_change = () => {
260-
search_form.value = { username: '', nick_name: '', email: '' }
331+
search_form.value = {username: '', nick_name: '', email: '', is_active: null}
261332
}
262333
263334
function handleSizeChange() {
@@ -267,9 +338,9 @@ function handleSizeChange() {
267338
268339
function getList() {
269340
const params: any = {}
270-
if (search_form.value[search_type.value as keyof typeof search_form.value]) {
271-
params[search_type.value] =
272-
search_form.value[search_type.value as keyof typeof search_form.value]
341+
const searchValue = search_form.value[search_type.value as keyof typeof search_form.value];
342+
if (searchValue !== undefined && searchValue !== null && searchValue !== '') {
343+
params[search_type.value] = searchValue;
273344
}
274345
return userManageApi.getUserManage(paginationConfig, params, loading).then((res) => {
275346
userTableData.value = res.data.records.map((item: any) => ({
@@ -329,7 +400,8 @@ function deleteUserManage(row: any) {
329400
getList()
330401
})
331402
})
332-
.catch(() => {})
403+
.catch(() => {
404+
})
333405
}
334406
335407
function editPwdUser(row: any) {

0 commit comments

Comments
 (0)