refactor: chat user

This commit is contained in:
wxg0103 2025-07-01 14:32:29 +08:00
parent 9f6cde37c3
commit 75fd815e31
2 changed files with 54 additions and 31 deletions

View File

@ -67,12 +67,12 @@ const postRemoveMember: (
const getUserListByGroup: (
user_group_id: string,
page: pageRequest,
username: string,
params ?: any,
loading?: Ref<boolean>,
) => Promise<Result<PageList<ChatUserGroupUserItem[]>>> = (user_group_id, page, username, loading) => {
) => Promise<Result<PageList<ChatUserGroupUserItem[]>>> = (user_group_id, page, params, loading) => {
return get(
`${prefix}/${user_group_id}/user_list/${page.current_page}/${page.page_size}`,
username ? { username } : undefined,
params ? params : undefined,
loading,
)
}

View File

@ -27,7 +27,9 @@
[PermissionConst.WORKSPACE_USER_GROUP_CREATE, PermissionConst.USER_GROUP_CREATE],
[],'OR',)"
>
<el-icon :size="18"><Plus /></el-icon>
<el-icon :size="18">
<Plus/>
</el-icon>
</el-button>
</el-tooltip>
</div>
@ -70,7 +72,9 @@
[PermissionConst.WORKSPACE_USER_GROUP_EDIT, PermissionConst.USER_GROUP_EDIT],
[],'OR',),'OR',)"
>
<el-icon><EditPen /></el-icon>
<el-icon>
<EditPen/>
</el-icon>
{{ $t('common.rename') }}
</el-dropdown-item>
<el-dropdown-item
@ -81,7 +85,9 @@
[PermissionConst.WORKSPACE_USER_GROUP_DELETE, PermissionConst.USER_GROUP_DELETE],
[],'OR',),'OR',)"
>
<el-icon><Delete /></el-icon>
<el-icon>
<Delete/>
</el-icon>
{{ $t('common.delete') }}
</el-dropdown-item>
</el-dropdown-menu>
@ -141,6 +147,8 @@
<div class="flex-between complex-search">
<el-select class="complex-search__left" v-model="searchType" style="width: 120px">
<el-option :label="$t('views.login.loginForm.username.label')" value="username"/>
<el-option :label="$t('views.userManage.userForm.nick_name.label')"
value="nick_name"/>
</el-select>
<el-input
v-if="searchType === 'username'"
@ -150,6 +158,14 @@
style="width: 220px"
clearable
/>
<el-input
v-else-if="searchType === 'nick_name'"
v-model="searchForm.nick_name"
@change="getList"
:placeholder="$t('common.searchBar.placeholder')"
style="width: 220px"
clearable
/>
</div>
</div>
@ -284,7 +300,8 @@ function deleteGroup(item: ListItem) {
current.value = item.id === current.value?.id ? list.value[0] : current.value
})
})
.catch(() => {})
.catch(() => {
})
}
async function refresh(group?: ListItem) {
@ -298,6 +315,7 @@ const rightLoading = ref(false)
const searchType = ref('username')
const searchForm = ref<Record<string, any>>({
username: '',
nick_name: '',
})
const paginationConfig = reactive({
current_page: 1,
@ -310,10 +328,13 @@ const tableData = ref<ChatUserGroupUserItem[]>([])
async function getList() {
if (!current.value?.id) return
try {
const params = {
[searchType.value]: searchForm.value[searchType.value as keyof typeof searchForm.value],
}
const res = await SystemGroupApi.getUserListByGroup(
current.value?.id,
paginationConfig,
searchForm.value.username,
params,
rightLoading,
)
tableData.value = res.data.records
@ -372,8 +393,10 @@ function handleDeleteUser(item?: ChatUserGroupUserItem) {
await getList()
})
})
.catch(() => {})
.catch(() => {
})
}
const mouseId = ref('')
function mouseenter(row: any) {