refactor: chat user

This commit is contained in:
teukkk 2025-06-17 20:16:49 +08:00
parent d0ba49456f
commit f1d9bfa648
8 changed files with 66 additions and 15 deletions

View File

@ -23,7 +23,7 @@ const getUserGroupList: (resource: ChatUserResourceParams, loading?: Ref<boolean
*
*/
const editUserGroupList: (resource: ChatUserResourceParams, data: { user_group_id: string, is_auth: boolean }[], loading?: Ref<boolean>) => Promise<Result<any>> = (resource, data, loading) => {
return put(`${prefix}/${resource.resource_type}/${resource.resource_id}/user_group`, data, undefined, loading)
return put(`${prefix.value}/${resource.resource_type}/${resource.resource_id}/user_group`, data, undefined, loading)
}
/**

View File

@ -1,10 +1,19 @@
export default {
title: 'Chat users',
syncUsers: 'Sync users',
setUserGroups: 'Set user groups',
syncUsers: 'Synchronize users',
setUserGroups: 'Configure user groups',
knowledgeTitleTip: 'This configuration will only take effect when the associated application enables chat user login authentication',
applicationTitleTip: 'This configuration requires login authentication to be enabled in the application',
autoAuthorization: 'Auto authorization',
authorization: 'Authorization',
group: {
title: 'User groups',
name: 'User group name',
usernameOrName: 'Username/Name',
delete: {
confirmTitle: 'Confirm to delete user group:',
confirmMessage: 'After deletion, all members in this user group will be removed. Please proceed with caution!',
},
batchDeleteMember: 'Remove selected {count} members?',
}
};

View File

@ -2,6 +2,8 @@ export default {
title: '对话用户',
syncUsers: '同步用户',
setUserGroups: '设置用户组',
knowledgeTitleTip: '该配置需要关联的应用开启对话用户登录认证后才会生效',
applicationTitleTip: '该配置需要应用开启登录认证后生效',
autoAuthorization: '自动授权',
authorization: '授权',
group: {

View File

@ -2,9 +2,18 @@ export default {
title: '對話用戶',
syncUsers: '同步用戶',
setUserGroups: '設定用戶組',
knowledgeTitleTip: '該配置需要關聯的應用開啟對話用戶登入認證後才會生效',
applicationTitleTip: '該配置需要應用開啟登入認證後生效',
autoAuthorization: '自動授權',
authorization: '授權',
group: {
title: '用戶組',
name: '用戶組名稱',
usernameOrName: '用戶名/姓名',
delete: {
confirmTitle: '是否刪除用戶組:',
confirmMessage: '刪除後,該用戶組下的成員將全部移除,請謹慎操作!',
},
batchDeleteMember: '是否移除選中的 {count} 個成員?',
}
};

View File

@ -55,7 +55,7 @@ const DocumentRouter = {
active: 'chat-log',
parentPath: '/knowledge/:id/:folderId',
parentName: 'KnowledgeDetail',
resourceType: ChatUserResourceEnum.APPLICATION
resourceType: ChatUserResourceEnum.KNOWLEDGE
},
component: () => import('@/views/chat-user/index.vue')
},

View File

@ -3,7 +3,8 @@
<template #header>
<div>
<h2>{{ $t('views.chatUser.title') }}</h2>
<div class="color-secondary">{{ $t('views.user.title') }}</div>
<div class="color-secondary">{{ resource.resource_type === ChatUserResourceEnum.APPLICATION ?
$t('views.chatUser.applicationTitleTip') : $t('views.chatUser.knowledgeTitleTip') }}</div>
</div>
</template>
<el-card style="--el-card-padding: 0" class="user-card">
@ -109,7 +110,7 @@ import { ChatUserResourceEnum } from '@/enums/workspaceChatUser'
import { MsgSuccess } from '@/utils/message'
const route = useRoute()
const resource: ChatUserResourceParams = { resource_id: route.params.id as string, resource_type: route.meta.resourceType as ChatUserResourceEnum }
const resource: ChatUserResourceParams = reactive({ resource_id: route.params.id as string, resource_type: route.meta.resourceType as ChatUserResourceEnum })
const filterText = ref('')
const loading = ref(false)

View File

@ -2,11 +2,11 @@
<ContentContainer>
<template #header>
<div class="shared-header">
<span class="title">{{ t('views.system.shared_resources') }}</span>
<span class="title">{{ t('views.chatUser.title') }}</span>
<el-icon size="12">
<rightOutlined></rightOutlined>
</el-icon>
<span class="sub-title">{{ t('views.knowledge.title') }}</span>
<span class="sub-title">{{ t('views.chatUser.group.title') }}</span>
</div>
</template>
<el-card style="--el-card-padding: 0" class="user-card">
@ -293,6 +293,23 @@ function handleDeleteUser(item?: ChatUserGroupUserItem) {
</script>
<style lang="scss" scoped>
.shared-header {
color: #646a73;
font-weight: 400;
font-size: 14px;
line-height: 22px;
display: flex;
align-items: center;
:deep(.el-icon i) {
height: 12px;
}
.sub-title {
color: #1f2329;
}
}
.content-container {
height: 100%;
display: flex;

View File

@ -2,11 +2,11 @@
<ContentContainer>
<template #header>
<div class="shared-header">
<span class="title">{{ t('views.system.shared_resources') }}</span>
<span class="title">{{ t('views.chatUser.title') }}</span>
<el-icon size="12">
<rightOutlined></rightOutlined>
</el-icon>
<span class="sub-title">{{ t('views.knowledge.title') }}</span>
<span class="sub-title">{{ t('views.chatUser.title') }}</span>
</div>
</template>
<el-card class="h-full">
@ -59,11 +59,7 @@
</template>
</el-table-column>
<el-table-column
prop="email"
:label="$t('views.login.loginForm.email.label')"
show-overflow-tooltip
>
<el-table-column prop="email" :label="$t('views.login.loginForm.email.label')" show-overflow-tooltip>
<template #default="{ row }">
{{ row.email || '-' }}
</template>
@ -264,6 +260,23 @@ onMounted(() => {
</script>
<style lang="scss" scoped>
.shared-header {
color: #646a73;
font-weight: 400;
font-size: 14px;
line-height: 22px;
display: flex;
align-items: center;
:deep(.el-icon i) {
height: 12px;
}
.sub-title {
color: #1f2329;
}
}
.content-container {
height: 100%;
display: flex;