diff --git a/ui/src/api/system/chat-user.ts b/ui/src/api/system/chat-user.ts index 0279b25bf..5a82c6631 100644 --- a/ui/src/api/system/chat-user.ts +++ b/ui/src/api/system/chat-user.ts @@ -1,6 +1,6 @@ import { Result } from '@/request/Result' import { get, put, post, del } from '@/request/index' -import type { pageRequest } from '@/api/type/common' +import type { pageRequest, PageList } from '@/api/type/common' import type { ChatUserItem } from '@/api/type/systemChatUser' import type { Ref } from 'vue' const prefix = '/system/chat_user' @@ -22,7 +22,7 @@ const getUserManage: ( page: pageRequest, username_or_nickname: string, loading?: Ref, -) => Promise> = (page, username_or_nickname, loading) => { +) => Promise>> = (page, username_or_nickname, loading) => { return get( `${prefix}/user_manage/${page.current_page}/${page.page_size}`, username_or_nickname ? { username_or_nickname } : undefined, @@ -73,12 +73,43 @@ const putUserManagePassword: ( return put(`${prefix}/${user_id}/re_password`, data, undefined, loading) } +/** + * 设置用户组 + */ +const batchAddGroup: (data: any, loading?: Ref) => Promise> = ( + data, + loading, +) => { + return post(`${prefix}/batch_add_group`, data, undefined, loading) +} +/** + * 批量删除 + */ +const batchDelete: (data: string[], loading?: Ref) => Promise> = ( + data, + loading, +) => { + return post(`${prefix}/batch_delete`, data, undefined, loading) +} + +/** + * 同步用户 + */ +const batchSync: (sync_type: string, loading?: Ref) => Promise> = ( + sync_type, + loading, +) => { + return post(`${prefix}/sync/${sync_type}`, undefined, undefined, loading) +} export default { getUserManage, putUserManage, delUserManage, postUserManage, putUserManagePassword, - getChatUserList + getChatUserList, + batchAddGroup, + batchDelete, + batchSync } diff --git a/ui/src/api/type/systemChatUser.ts b/ui/src/api/type/systemChatUser.ts index e5e33de6b..c22485844 100644 --- a/ui/src/api/type/systemChatUser.ts +++ b/ui/src/api/type/systemChatUser.ts @@ -12,15 +12,12 @@ interface ChatUserItem { user_group_names?: string[], } -// TODO interface ChatUserGroupUserItem { id: string, - is_auth: boolean, email: string, phone: string, nick_name: string, username: string, - password: string, source: string, is_active: boolean, create_time: string, diff --git a/ui/src/locales/lang/en-US/common.ts b/ui/src/locales/lang/en-US/common.ts index 9ee3012df..00c8d5b46 100644 --- a/ui/src/locales/lang/en-US/common.ts +++ b/ui/src/locales/lang/en-US/common.ts @@ -1,4 +1,5 @@ export default { + syncSuccess: 'Successful', create: 'Create', createSuccess: 'Successful', copy: 'Copy', diff --git a/ui/src/locales/lang/en-US/views/chat-user.ts b/ui/src/locales/lang/en-US/views/chat-user.ts index b1092913a..61e751cb1 100644 --- a/ui/src/locales/lang/en-US/views/chat-user.ts +++ b/ui/src/locales/lang/en-US/views/chat-user.ts @@ -1,19 +1,24 @@ export default { - title: 'Chat users', - syncUsers: 'Synchronize users', - setUserGroups: 'Configure user groups', - knowledgeTitleTip: 'This configuration will only take effect when the associated application enables chat user login authentication', + title: 'Chat Users', + syncUsers: 'Sync Users', + syncUsersTip: 'Only sync newly added users', + setUserGroups: 'Configure User Groups', + knowledgeTitleTip: 'This configuration will only take effect after enabling chat user login authentication in the associated application', applicationTitleTip: 'This configuration requires login authentication to be enabled in the application', - autoAuthorization: 'Auto authorization', + autoAuthorization: 'Auto Authorization', authorization: 'Authorization', + batchDeleteUser: 'Delete selected {count} users?', + settingMethod: 'Configuration Method', + append: 'Append', + replace: 'Replace', group: { - title: 'User groups', - name: 'User group name', + 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!', + confirmMessage: 'All members in this group will be removed after deletion. Proceed with caution!', }, batchDeleteMember: 'Remove selected {count} members?', } -}; \ No newline at end of file +} \ No newline at end of file diff --git a/ui/src/locales/lang/zh-CN/common.ts b/ui/src/locales/lang/zh-CN/common.ts index a9305c5be..48cb5742f 100644 --- a/ui/src/locales/lang/zh-CN/common.ts +++ b/ui/src/locales/lang/zh-CN/common.ts @@ -1,4 +1,5 @@ export default { + syncSuccess: '同步成功', create: '创建', createSuccess: '创建成功', copy: '复制', diff --git a/ui/src/locales/lang/zh-CN/views/chat-user.ts b/ui/src/locales/lang/zh-CN/views/chat-user.ts index 703907cc9..844959eb3 100644 --- a/ui/src/locales/lang/zh-CN/views/chat-user.ts +++ b/ui/src/locales/lang/zh-CN/views/chat-user.ts @@ -1,11 +1,16 @@ export default { title: '对话用户', syncUsers: '同步用户', + syncUsersTip: '仅同步新增用户', setUserGroups: '设置用户组', knowledgeTitleTip: '该配置需要关联的应用开启对话用户登录认证后才会生效', applicationTitleTip: '该配置需要应用开启登录认证后生效', autoAuthorization: '自动授权', authorization: '授权', + batchDeleteUser: '是否删除选中的 {count} 个用户?', + settingMethod: '设置方式', + append: '追加', + replace: '替换', group: { title: '用户组', name: '用户组名称', diff --git a/ui/src/locales/lang/zh-Hant/common.ts b/ui/src/locales/lang/zh-Hant/common.ts index 2f409a113..1138940d4 100644 --- a/ui/src/locales/lang/zh-Hant/common.ts +++ b/ui/src/locales/lang/zh-Hant/common.ts @@ -1,4 +1,5 @@ export default { + syncSuccess: '同步完成', create: '創建', createSuccess: '創建成功', copy: '複製', diff --git a/ui/src/locales/lang/zh-Hant/views/chat-user.ts b/ui/src/locales/lang/zh-Hant/views/chat-user.ts index 3eba778bb..644b221f5 100644 --- a/ui/src/locales/lang/zh-Hant/views/chat-user.ts +++ b/ui/src/locales/lang/zh-Hant/views/chat-user.ts @@ -1,11 +1,16 @@ export default { title: '對話用戶', syncUsers: '同步用戶', + syncUsersTip: '僅同步新增用戶', setUserGroups: '設定用戶組', knowledgeTitleTip: '該配置需要關聯的應用開啟對話用戶登入認證後才會生效', applicationTitleTip: '該配置需要應用開啟登入認證後生效', autoAuthorization: '自動授權', authorization: '授權', + batchDeleteUser: '是否刪除選中的 {count} 個用戶?', + settingMethod: '設定方式', + append: '追加', + replace: '替換', group: { title: '用戶組', name: '用戶組名稱', @@ -16,4 +21,4 @@ export default { }, batchDeleteMember: '是否移除選中的 {count} 個成員?', } -}; \ No newline at end of file +} \ No newline at end of file diff --git a/ui/src/views/system-chat-user/group/index.vue b/ui/src/views/system-chat-user/group/index.vue index 30e8b55a7..48d0a6cba 100644 --- a/ui/src/views/system-chat-user/group/index.vue +++ b/ui/src/views/system-chat-user/group/index.vue @@ -263,7 +263,7 @@ watch(() => current.value?.id, () => { const createGroupUserDialogRef = ref>() function createUser() { - createGroupUserDialogRef.value?.open(current.value?.id); + createGroupUserDialogRef.value?.open(current.value?.id as string); } const multipleSelection = ref([]) diff --git a/ui/src/views/system-chat-user/user-manage/component/SetUserGroupsDialog.vue b/ui/src/views/system-chat-user/user-manage/component/SetUserGroupsDialog.vue new file mode 100644 index 000000000..e8dba6e02 --- /dev/null +++ b/ui/src/views/system-chat-user/user-manage/component/SetUserGroupsDialog.vue @@ -0,0 +1,86 @@ + + + diff --git a/ui/src/views/system-chat-user/user-manage/component/SyncUsersDialog.vue b/ui/src/views/system-chat-user/user-manage/component/SyncUsersDialog.vue new file mode 100644 index 000000000..00e9dd091 --- /dev/null +++ b/ui/src/views/system-chat-user/user-manage/component/SyncUsersDialog.vue @@ -0,0 +1,74 @@ + + + diff --git a/ui/src/views/system-chat-user/user-manage/component/UserDrawer.vue b/ui/src/views/system-chat-user/user-manage/component/UserDrawer.vue index 0e7679b00..8b10802ea 100644 --- a/ui/src/views/system-chat-user/user-manage/component/UserDrawer.vue +++ b/ui/src/views/system-chat-user/user-manage/component/UserDrawer.vue @@ -1,68 +1,43 @@