fix: userManage tagGroup
This commit is contained in:
parent
487e7eda6f
commit
f59cc9425e
@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="tag-group" v-if="props.tags.length">
|
<div class="tag-group" v-if="props.tags.length">
|
||||||
<el-tag class="default-tag" style="max-width: 100%">
|
<el-tag :size="props.size" class="default-tag" style="max-width: 100%">
|
||||||
<span class="ellipsis" style="max-width: 100%">{{ props.tags[0] }}</span>
|
<span class="ellipsis" style="max-width: 100%">{{ props.tags[0] }}</span>
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tooltip effect="light">
|
<el-tooltip effect="light" :disabled="tooltipDisabled">
|
||||||
<el-tag class="info-tag ml-4 cursor" v-if="props.tags?.length > 1">
|
<el-tag :size="props.size" class="info-tag ml-4 cursor" v-if="props.tags?.length > 1">
|
||||||
+{{ props.tags?.length - 1 }}
|
+{{ props.tags?.length - 1 }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<template #content>
|
<template #content>
|
||||||
<el-tag v-for="item in props.tags.slice(1)" :key="item" class="default-tag mr-4">
|
<el-tag :size="props.size" v-for="item in props.tags.slice(1)" :key="item" class="default-tag mr-4">
|
||||||
{{ item }}
|
{{ item }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
@ -18,6 +18,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
tags: string[]
|
tags: string[]
|
||||||
|
size?: 'large' | 'default' | 'small'
|
||||||
|
tooltipDisabled?: boolean
|
||||||
}>()
|
}>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -20,11 +20,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div style="width: 90%">
|
<div style="width: 90%">
|
||||||
<p class="bold mb-4" style="font-size: 14px">{{ user.userInfo?.username }}</p>
|
<p class="bold mb-4" style="font-size: 14px">{{ user.userInfo?.username }}</p>
|
||||||
<template v-if="user.userInfo?.role && user.userInfo.role.length > 0">
|
<template v-if="user.userInfo?.role_name && user.userInfo.role_name.length > 0">
|
||||||
<el-tag size="small" class="default-tag">{{ user.userInfo?.role[0] }}</el-tag>
|
<TagGroup size="small" :tags="user.userInfo?.role_name"/>
|
||||||
<el-tag size="small" class="default-tag ml-4" v-if="user.userInfo?.role?.length > 1"
|
|
||||||
>+{{ user.userInfo?.role?.length - 1 }}
|
|
||||||
</el-tag>
|
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -154,13 +154,13 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||||||
await formEl.validate((valid, fields) => {
|
await formEl.validate((valid, fields) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (isEdit.value) {
|
if (isEdit.value) {
|
||||||
loadPermissionApi('chatUser').putUserManage(userForm.value.id, userForm.value, loading).then((res) => {
|
loadPermissionApi('chatUser').putUserManage(userForm.value.id, userForm.value, loading).then(() => {
|
||||||
emit('refresh')
|
emit('refresh')
|
||||||
MsgSuccess(t('common.editSuccess'))
|
MsgSuccess(t('common.editSuccess'))
|
||||||
visible.value = false
|
visible.value = false
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
loadPermissionApi('chatUser').postUserManage(userForm.value, loading).then((res) => {
|
loadPermissionApi('chatUser').postUserManage(userForm.value, loading).then(() => {
|
||||||
emit('refresh')
|
emit('refresh')
|
||||||
MsgSuccess(t('common.createSuccess'))
|
MsgSuccess(t('common.createSuccess'))
|
||||||
visible.value = false
|
visible.value = false
|
||||||
|
|||||||
@ -119,7 +119,7 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||||||
if (!formEl) return
|
if (!formEl) return
|
||||||
await formEl.validate((valid, fields) => {
|
await formEl.validate((valid, fields) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
loadPermissionApi('chatUser').putUserManagePassword(userId.value, userForm.value, loading).then((res) => {
|
loadPermissionApi('chatUser').putUserManagePassword(userId.value, userForm.value, loading).then(() => {
|
||||||
emit('refresh')
|
emit('refresh')
|
||||||
user.profile()
|
user.profile()
|
||||||
MsgSuccess(t('views.userManage.tip.updatePwdSuccess'))
|
MsgSuccess(t('views.userManage.tip.updatePwdSuccess'))
|
||||||
|
|||||||
@ -301,7 +301,7 @@ function getList() {
|
|||||||
const params = {
|
const params = {
|
||||||
[search_type.value]: search_form.value[search_type.value as keyof typeof search_form.value],
|
[search_type.value]: search_form.value[search_type.value as keyof typeof search_form.value],
|
||||||
}
|
}
|
||||||
return loadPermissionApi('chatUser').getUserManage(paginationConfig, params, loading).then((res) => {
|
return loadPermissionApi('chatUser').getUserManage(paginationConfig, params, loading).then((res: any) => {
|
||||||
userTableData.value = res.data.records
|
userTableData.value = res.data.records
|
||||||
paginationConfig.total = res.data.total
|
paginationConfig.total = res.data.total
|
||||||
})
|
})
|
||||||
|
|||||||
@ -94,7 +94,7 @@ async function getWorkspaceFormItem() {
|
|||||||
],
|
],
|
||||||
selectProps: {
|
selectProps: {
|
||||||
options:
|
options:
|
||||||
res.data?.map((item) => ({
|
res.data?.map((item: any) => ({
|
||||||
label: item.name,
|
label: item.name,
|
||||||
value: item.id,
|
value: item.id,
|
||||||
})) || [],
|
})) || [],
|
||||||
|
|||||||
@ -94,7 +94,19 @@
|
|||||||
<el-table-column prop="role_name" :label="$t('views.role.member.role')" min-width="100"
|
<el-table-column prop="role_name" :label="$t('views.role.member.role')" min-width="100"
|
||||||
v-if="user.isEE() || user.isPE()">
|
v-if="user.isEE() || user.isPE()">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<TagGroup :tags="row.role_name"/>
|
<el-popover :width="400">
|
||||||
|
<template #reference>
|
||||||
|
<TagGroup class="cursor" :tags="row.role_name" tooltipDisabled />
|
||||||
|
</template>
|
||||||
|
<template #default>
|
||||||
|
<el-table :data="row.role_workspace">
|
||||||
|
<el-table-column prop="role" :label="$t('views.role.member.role')">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="workspace" :label="$t('views.workspace.title')">
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</template>
|
||||||
|
</el-popover>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="source" :label="$t('views.userManage.source.label')">
|
<el-table-column prop="source" :label="$t('views.userManage.source.label')">
|
||||||
@ -225,7 +237,13 @@ function getList() {
|
|||||||
return userManageApi
|
return userManageApi
|
||||||
.getUserManage(paginationConfig, params, loading)
|
.getUserManage(paginationConfig, params, loading)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
userTableData.value = res.data.records
|
userTableData.value = res.data.records.map((item: any) => ({
|
||||||
|
...item,
|
||||||
|
role_workspace: Object.entries(item.role_workspace).map(([role, workspaces]) => ({
|
||||||
|
role,
|
||||||
|
workspace: (workspaces as string[])?.[0] === 'None' ? '-': (workspaces as string[])?.join(", ")
|
||||||
|
}))
|
||||||
|
}))
|
||||||
paginationConfig.total = res.data.total
|
paginationConfig.total = res.data.total
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,7 +85,7 @@ async function getRoleFormItem() {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
selectProps: {
|
selectProps: {
|
||||||
options: res.data.filter(item => item.type !== RoleTypeEnum.ADMIN)?.map(item => ({
|
options: res.data.filter((item: any) => item.type !== RoleTypeEnum.ADMIN)?.map((item: any) => ({
|
||||||
label: item.name,
|
label: item.name,
|
||||||
value: item.id
|
value: item.id
|
||||||
})) || [],
|
})) || [],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user