Skip to content

Commit f59cc94

Browse files
committed
fix: userManage tagGroup
1 parent 487e7ed commit f59cc94

File tree

8 files changed

+34
-17
lines changed

8 files changed

+34
-17
lines changed

ui/src/components/tag-group/index.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<template>
22
<div class="tag-group" v-if="props.tags.length">
3-
<el-tag class="default-tag" style="max-width: 100%">
3+
<el-tag :size="props.size" class="default-tag" style="max-width: 100%">
44
<span class="ellipsis" style="max-width: 100%">{{ props.tags[0] }}</span>
55
</el-tag>
6-
<el-tooltip effect="light">
7-
<el-tag class="info-tag ml-4 cursor" v-if="props.tags?.length > 1">
6+
<el-tooltip effect="light" :disabled="tooltipDisabled">
7+
<el-tag :size="props.size" class="info-tag ml-4 cursor" v-if="props.tags?.length > 1">
88
+{{ props.tags?.length - 1 }}
99
</el-tag>
1010
<template #content>
11-
<el-tag v-for="item in props.tags.slice(1)" :key="item" class="default-tag mr-4">
11+
<el-tag :size="props.size" v-for="item in props.tags.slice(1)" :key="item" class="default-tag mr-4">
1212
{{ item }}
1313
</el-tag>
1414
</template>
@@ -18,6 +18,8 @@
1818
<script setup lang="ts">
1919
const props = defineProps<{
2020
tags: string[]
21+
size?: 'large' | 'default' | 'small'
22+
tooltipDisabled?: boolean
2123
}>()
2224
</script>
2325

ui/src/layout/layout-header/avatar/index.vue

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@
2020
</div>
2121
<div style="width: 90%">
2222
<p class="bold mb-4" style="font-size: 14px">{{ user.userInfo?.username }}</p>
23-
<template v-if="user.userInfo?.role && user.userInfo.role.length > 0">
24-
<el-tag size="small" class="default-tag">{{ user.userInfo?.role[0] }}</el-tag>
25-
<el-tag size="small" class="default-tag ml-4" v-if="user.userInfo?.role?.length > 1"
26-
>+{{ user.userInfo?.role?.length - 1 }}
27-
</el-tag>
23+
<template v-if="user.userInfo?.role_name && user.userInfo.role_name.length > 0">
24+
<TagGroup size="small" :tags="user.userInfo?.role_name"/>
2825
</template>
2926
</div>
3027
</div>

ui/src/views/system-chat-user/chat-user/component/UserDrawer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,13 @@ const submit = async (formEl: FormInstance | undefined) => {
154154
await formEl.validate((valid, fields) => {
155155
if (valid) {
156156
if (isEdit.value) {
157-
loadPermissionApi('chatUser').putUserManage(userForm.value.id, userForm.value, loading).then((res) => {
157+
loadPermissionApi('chatUser').putUserManage(userForm.value.id, userForm.value, loading).then(() => {
158158
emit('refresh')
159159
MsgSuccess(t('common.editSuccess'))
160160
visible.value = false
161161
})
162162
} else {
163-
loadPermissionApi('chatUser').postUserManage(userForm.value, loading).then((res) => {
163+
loadPermissionApi('chatUser').postUserManage(userForm.value, loading).then(() => {
164164
emit('refresh')
165165
MsgSuccess(t('common.createSuccess'))
166166
visible.value = false

ui/src/views/system-chat-user/chat-user/component/UserPwdDialog.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ const submit = async (formEl: FormInstance | undefined) => {
119119
if (!formEl) return
120120
await formEl.validate((valid, fields) => {
121121
if (valid) {
122-
loadPermissionApi('chatUser').putUserManagePassword(userId.value, userForm.value, loading).then((res) => {
122+
loadPermissionApi('chatUser').putUserManagePassword(userId.value, userForm.value, loading).then(() => {
123123
emit('refresh')
124124
user.profile()
125125
MsgSuccess(t('views.userManage.tip.updatePwdSuccess'))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ function getList() {
301301
const params = {
302302
[search_type.value]: search_form.value[search_type.value as keyof typeof search_form.value],
303303
}
304-
return loadPermissionApi('chatUser').getUserManage(paginationConfig, params, loading).then((res) => {
304+
return loadPermissionApi('chatUser').getUserManage(paginationConfig, params, loading).then((res: any) => {
305305
userTableData.value = res.data.records
306306
paginationConfig.total = res.data.total
307307
})

ui/src/views/system/role/component/AddMemberDrawer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ async function getWorkspaceFormItem() {
9494
],
9595
selectProps: {
9696
options:
97-
res.data?.map((item) => ({
97+
res.data?.map((item: any) => ({
9898
label: item.name,
9999
value: item.id,
100100
})) || [],

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,19 @@
9494
<el-table-column prop="role_name" :label="$t('views.role.member.role')" min-width="100"
9595
v-if="user.isEE() || user.isPE()">
9696
<template #default="{ row }">
97-
<TagGroup :tags="row.role_name"/>
97+
<el-popover :width="400">
98+
<template #reference>
99+
<TagGroup class="cursor" :tags="row.role_name" tooltipDisabled />
100+
</template>
101+
<template #default>
102+
<el-table :data="row.role_workspace">
103+
<el-table-column prop="role" :label="$t('views.role.member.role')">
104+
</el-table-column>
105+
<el-table-column prop="workspace" :label="$t('views.workspace.title')">
106+
</el-table-column>
107+
</el-table>
108+
</template>
109+
</el-popover>
98110
</template>
99111
</el-table-column>
100112
<el-table-column prop="source" :label="$t('views.userManage.source.label')">
@@ -225,7 +237,13 @@ function getList() {
225237
return userManageApi
226238
.getUserManage(paginationConfig, params, loading)
227239
.then((res) => {
228-
userTableData.value = res.data.records
240+
userTableData.value = res.data.records.map((item: any) => ({
241+
...item,
242+
role_workspace: Object.entries(item.role_workspace).map(([role, workspaces]) => ({
243+
role,
244+
workspace: (workspaces as string[])?.[0] === 'None' ? '-': (workspaces as string[])?.join(", ")
245+
}))
246+
}))
229247
paginationConfig.total = res.data.total
230248
})
231249
}

ui/src/views/system/workspace/component/AddMemberDrawer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ async function getRoleFormItem() {
8585
},
8686
],
8787
selectProps: {
88-
options: res.data.filter(item => item.type !== RoleTypeEnum.ADMIN)?.map(item => ({
88+
options: res.data.filter((item: any) => item.type !== RoleTypeEnum.ADMIN)?.map((item: any) => ({
8989
label: item.name,
9090
value: item.id
9191
})) || [],

0 commit comments

Comments
 (0)