Skip to content

Commit b5fe64d

Browse files
committed
feat: add source selection option in user search and improve code formatting
1 parent 6e1fb1d commit b5fe64d

File tree

2 files changed

+92
-43
lines changed

2 files changed

+92
-43
lines changed

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

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,12 @@
6767
style="width: 120px"
6868
@change="search_type_change"
6969
>
70-
<el-option :label="$t('views.login.loginForm.username.label')" value="username" />
71-
<el-option :label="$t('views.userManage.userForm.nick_name.label')" value="nick_name" />
70+
<el-option :label="$t('views.login.loginForm.username.label')" value="username"/>
71+
<el-option :label="$t('views.userManage.userForm.nick_name.label')" value="nick_name"/>
72+
<el-option
73+
:label="$t('views.userManage.source.label')"
74+
value="source"
75+
/>
7276
</el-select>
7377
<el-input
7478
v-if="search_type === 'username'"
@@ -84,6 +88,23 @@
8488
style="width: 220px"
8589
clearable
8690
/>
91+
<el-select
92+
v-else-if="search_type === 'source'"
93+
v-model="search_form.source"
94+
@change="getList"
95+
style="width: 220px"
96+
clearable
97+
:placeholder="$t('common.inputPlaceholder')"
98+
>
99+
<el-option :label="$t('views.userManage.source.local')" value="LOCAL"/>
100+
<el-option label="CAS" value="CAS"/>
101+
<el-option label="LDAP" value="LDAP"/>
102+
<el-option label="OIDC" value="OIDC"/>
103+
<el-option label="OAuth2" value="OAuth2"/>
104+
<el-option :label="$t('views.userManage.source.wecom')" value="wecom"/>
105+
<el-option :label="$t('views.userManage.source.lark')" value="lark"/>
106+
<el-option :label="$t('views.userManage.source.dingtalk')" value="dingtalk"/>
107+
</el-select>
87108
</div>
88109
</div>
89110
<app-table
@@ -97,7 +118,7 @@
97118
@sort-change="handleSortChange"
98119
:maxTableHeight="270"
99120
>
100-
<el-table-column type="selection" width="55" />
121+
<el-table-column type="selection" width="55"/>
101122
<el-table-column
102123
prop="nick_name"
103124
:label="$t('views.userManage.userForm.nick_name.label')"
@@ -114,7 +135,7 @@
114135
<template #default="{ row }">
115136
<div v-if="row.is_active" class="flex align-center">
116137
<el-icon class="color-success mr-8" style="font-size: 16px">
117-
<SuccessFilled />
138+
<SuccessFilled/>
118139
</el-icon>
119140
<span class="color-secondary">
120141
{{ $t('common.status.enabled') }}
@@ -154,7 +175,7 @@
154175
min-width="150"
155176
>
156177
<template #default="{ row }">
157-
<TagGroup :tags="row.user_group_names" />
178+
<TagGroup :tags="row.user_group_names"/>
158179
</template>
159180
</el-table-column>
160181
<el-table-column prop="source" :label="$t('views.userManage.source.label')">
@@ -201,7 +222,7 @@
201222
"
202223
/>
203224
</span>
204-
<el-divider direction="vertical" />
225+
<el-divider direction="vertical"/>
205226
<span class="mr-8">
206227
<el-button
207228
type="primary"
@@ -243,7 +264,7 @@
243264
"
244265
>
245266
<el-icon>
246-
<Lock />
267+
<Lock/>
247268
</el-icon>
248269
</el-button>
249270
</span>
@@ -284,45 +305,47 @@
284305
ref="UserDrawerRef"
285306
@refresh="refresh"
286307
/>
287-
<UserPwdDialog ref="UserPwdDialogRef" @refresh="refresh" />
308+
<UserPwdDialog ref="UserPwdDialogRef" @refresh="refresh"/>
288309
<SetUserGroupsDialog
289310
:optionLoading="optionLoading"
290311
:chatGroupList="chatGroupList"
291312
ref="setUserGroupsRef"
292313
@refresh="refresh"
293314
/>
294-
<SyncUsersDialog ref="syncUsersDialogRef" @refresh="refresh" />
315+
<SyncUsersDialog ref="syncUsersDialogRef" @refresh="refresh"/>
295316
</div>
296317
</template>
297318

298319
<script lang="ts" setup>
299-
import { onMounted, ref, reactive } from 'vue'
320+
import {onMounted, ref, reactive} from 'vue'
300321
import UserDrawer from './component/UserDrawer.vue'
301322
import UserPwdDialog from './component/UserPwdDialog.vue'
302323
import SetUserGroupsDialog from './component/SetUserGroupsDialog.vue'
303324
import SyncUsersDialog from './component/SyncUsersDialog.vue'
304325
import userManageApi from '@/api/system/chat-user'
305-
import { datetimeFormat } from '@/utils/time'
306-
import { MsgSuccess, MsgConfirm } from '@/utils/message'
307-
import { t } from '@/locales'
308-
import type { ChatUserItem } from '@/api/type/systemChatUser'
326+
import {datetimeFormat} from '@/utils/time'
327+
import {MsgSuccess, MsgConfirm} from '@/utils/message'
328+
import {t} from '@/locales'
329+
import type {ChatUserItem} from '@/api/type/systemChatUser'
309330
import SystemGroupApi from '@/api/system/user-group'
310-
import type { ListItem } from '@/api/type/common'
311-
import { PermissionConst, RoleConst } from '@/utils/permission/data'
312-
import { ComplexPermission } from '@/utils/permission/type'
313-
import { hasPermission } from '@/utils/permission'
314-
import { loadPermissionApi } from '@/utils/dynamics-api/permission-api.ts'
331+
import type {ListItem} from '@/api/type/common'
332+
import {PermissionConst, RoleConst} from '@/utils/permission/data'
333+
import {ComplexPermission} from '@/utils/permission/type'
334+
import {hasPermission} from '@/utils/permission'
335+
import {loadPermissionApi} from '@/utils/dynamics-api/permission-api.ts'
315336
316337
const search_type = ref('username')
317338
const search_form = ref<{
318339
username: string
319340
nick_name?: string
341+
source?: string
320342
}>({
321343
username: '',
322344
nick_name: '',
345+
source: '',
323346
})
324347
const search_type_change = () => {
325-
search_form.value = { username: '', nick_name: '' }
348+
search_form.value = {username: '', nick_name: '', source: ''}
326349
}
327350
328351
const loading = ref(false)
@@ -357,7 +380,7 @@ function getList() {
357380
358381
const orderBy = ref<string>('')
359382
360-
function handleSortChange({ prop, order }: { prop: string; order: string }) {
383+
function handleSortChange({prop, order}: { prop: string; order: string }) {
361384
orderBy.value = order === 'ascending' ? prop : `-${prop}`
362385
getList()
363386
}
@@ -412,7 +435,8 @@ function deleteUserManage(row: ChatUserItem) {
412435
getList()
413436
})
414437
})
415-
.catch(() => {})
438+
.catch(() => {
439+
})
416440
}
417441
418442
const UserPwdDialogRef = ref()
@@ -443,7 +467,7 @@ async function getChatGroupList() {
443467
}
444468
445469
function handleBatchDelete() {
446-
MsgConfirm(t('views.chatUser.batchDeleteUser', { count: multipleSelection.value.length }), '', {
470+
MsgConfirm(t('views.chatUser.batchDeleteUser', {count: multipleSelection.value.length}), '', {
447471
confirmButtonText: t('common.confirm'),
448472
confirmButtonClass: 'danger',
449473
})
@@ -458,7 +482,8 @@ function handleBatchDelete() {
458482
await getList()
459483
})
460484
})
461-
.catch(() => {})
485+
.catch(() => {
486+
})
462487
}
463488
464489
const setUserGroupsRef = ref<InstanceType<typeof SetUserGroupsDialog>>()

ui/src/views/system-chat-user/group/index.vue

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"
3535
>
3636
<el-icon :size="18">
37-
<Plus />
37+
<Plus/>
3838
</el-icon>
3939
</el-button>
4040
</el-tooltip>
@@ -108,7 +108,7 @@
108108
<div class="user-right" v-loading="rightLoading">
109109
<div class="flex align-center">
110110
<h4 class="medium ellipsis" :title="current?.name">{{ current?.name }}</h4>
111-
<el-divider direction="vertical" class="mr-8 ml-8" />
111+
<el-divider direction="vertical" class="mr-8 ml-8"/>
112112
<AppIcon
113113
iconName="app-workspace"
114114
style="font-size: 16px"
@@ -158,11 +158,15 @@
158158
</div>
159159
<div class="flex-between complex-search">
160160
<el-select class="complex-search__left" v-model="searchType" style="width: 120px">
161-
<el-option :label="$t('views.login.loginForm.username.label')" value="username" />
161+
<el-option :label="$t('views.login.loginForm.username.label')" value="username"/>
162162
<el-option
163163
:label="$t('views.userManage.userForm.nick_name.label')"
164164
value="nick_name"
165165
/>
166+
<el-option
167+
:label="$t('views.userManage.source.label')"
168+
value="source"
169+
/>
166170
</el-select>
167171
<el-input
168172
v-if="searchType === 'username'"
@@ -180,6 +184,23 @@
180184
style="width: 220px"
181185
clearable
182186
/>
187+
<el-select
188+
v-else-if="searchType === 'source'"
189+
v-model="searchForm.source"
190+
@change="getList"
191+
style="width: 220px"
192+
clearable
193+
:placeholder="$t('common.inputPlaceholder')"
194+
>
195+
<el-option :label="$t('views.userManage.source.local')" value="LOCAL"/>
196+
<el-option label="CAS" value="CAS"/>
197+
<el-option label="LDAP" value="LDAP"/>
198+
<el-option label="OIDC" value="OIDC"/>
199+
<el-option label="OAuth2" value="OAuth2"/>
200+
<el-option :label="$t('views.userManage.source.wecom')" value="wecom"/>
201+
<el-option :label="$t('views.userManage.source.lark')" value="lark"/>
202+
<el-option :label="$t('views.userManage.source.dingtalk')" value="dingtalk"/>
203+
</el-select>
183204
</div>
184205
</div>
185206

@@ -191,13 +212,13 @@
191212
@selection-change="handleSelectionChange"
192213
:maxTableHeight="330"
193214
>
194-
<el-table-column type="selection" width="55" />
215+
<el-table-column type="selection" width="55"/>
195216
<el-table-column
196217
prop="nick_name"
197218
:label="$t('views.userManage.userForm.nick_name.label')"
198219
show-overflow-tooltip
199220
/>
200-
<el-table-column prop="username" :label="$t('views.login.loginForm.username.label')" />
221+
<el-table-column prop="username" :label="$t('views.login.loginForm.username.label')"/>
201222
<el-table-column prop="source" :label="$t('views.userManage.source.label')">
202223
<template #default="{ row }">
203224
{{
@@ -244,24 +265,24 @@
244265
</div>
245266
</el-card>
246267

247-
<CreateOrUpdateGroupDialog ref="createOrUpdateGroupDialogRef" @refresh="refresh" />
248-
<CreateGroupUserDialog ref="createGroupUserDialogRef" @refresh="getList" />
268+
<CreateOrUpdateGroupDialog ref="createOrUpdateGroupDialogRef" @refresh="refresh"/>
269+
<CreateGroupUserDialog ref="createGroupUserDialogRef" @refresh="getList"/>
249270
</div>
250271
</template>
251272

252273
<script lang="ts" setup>
253-
import { onMounted, ref, watch, reactive } from 'vue'
274+
import {onMounted, ref, watch, reactive} from 'vue'
254275
import SystemGroupApi from '@/api/system/user-group'
255-
import { t } from '@/locales'
256-
import type { ChatUserGroupUserItem } from '@/api/type/systemChatUser'
276+
import {t} from '@/locales'
277+
import type {ChatUserGroupUserItem} from '@/api/type/systemChatUser'
257278
import CreateOrUpdateGroupDialog from './component/CreateOrUpdateGroupDialog.vue'
258279
import CreateGroupUserDialog from './component/CreateGroupUserDialog.vue'
259-
import type { ListItem } from '@/api/type/common'
260-
import { MsgSuccess, MsgConfirm } from '@/utils/message'
261-
import { PermissionConst, RoleConst } from '@/utils/permission/data'
262-
import { ComplexPermission } from '@/utils/permission/type'
263-
import { hasPermission } from '@/utils/permission/index'
264-
import { loadPermissionApi } from '@/utils/dynamics-api/permission-api.ts'
280+
import type {ListItem} from '@/api/type/common'
281+
import {MsgSuccess, MsgConfirm} from '@/utils/message'
282+
import {PermissionConst, RoleConst} from '@/utils/permission/data'
283+
import {ComplexPermission} from '@/utils/permission/type'
284+
import {hasPermission} from '@/utils/permission/index'
285+
import {loadPermissionApi} from '@/utils/dynamics-api/permission-api.ts'
265286
266287
const filterText = ref('')
267288
const loading = ref(false)
@@ -347,7 +368,8 @@ function deleteGroup(item: ListItem) {
347368
current.value = item.id === current.value?.id ? list.value[0] : current.value
348369
})
349370
})
350-
.catch(() => {})
371+
.catch(() => {
372+
})
351373
}
352374
353375
async function refresh(group?: ListItem) {
@@ -366,6 +388,7 @@ const searchType = ref('username')
366388
const searchForm = ref<Record<string, any>>({
367389
username: '',
368390
nick_name: '',
391+
source: '',
369392
})
370393
const paginationConfig = reactive({
371394
current_page: 1,
@@ -422,7 +445,7 @@ function handleDeleteUser(item?: ChatUserGroupUserItem) {
422445
MsgConfirm(
423446
item
424447
? `${t('views.workspace.member.delete.confirmTitle')}${item.nick_name} ?`
425-
: t('views.chatUser.group.batchDeleteMember', { count: multipleSelection.value.length }),
448+
: t('views.chatUser.group.batchDeleteMember', {count: multipleSelection.value.length}),
426449
'',
427450
{
428451
confirmButtonText: t('common.confirm'),
@@ -445,7 +468,8 @@ function handleDeleteUser(item?: ChatUserGroupUserItem) {
445468
await getList()
446469
})
447470
})
448-
.catch(() => {})
471+
.catch(() => {
472+
})
449473
}
450474
451475
const mouseId = ref('')

0 commit comments

Comments
 (0)