mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 10:12:51 +00:00
fix: userManage tagGroup
This commit is contained in:
parent
487e7eda6f
commit
f59cc9425e
|
|
@ -1,14 +1,14 @@
|
|||
<template>
|
||||
<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>
|
||||
</el-tag>
|
||||
<el-tooltip effect="light">
|
||||
<el-tag class="info-tag ml-4 cursor" v-if="props.tags?.length > 1">
|
||||
<el-tooltip effect="light" :disabled="tooltipDisabled">
|
||||
<el-tag :size="props.size" class="info-tag ml-4 cursor" v-if="props.tags?.length > 1">
|
||||
+{{ props.tags?.length - 1 }}
|
||||
</el-tag>
|
||||
<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 }}
|
||||
</el-tag>
|
||||
</template>
|
||||
|
|
@ -18,6 +18,8 @@
|
|||
<script setup lang="ts">
|
||||
const props = defineProps<{
|
||||
tags: string[]
|
||||
size?: 'large' | 'default' | 'small'
|
||||
tooltipDisabled?: boolean
|
||||
}>()
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -20,11 +20,8 @@
|
|||
</div>
|
||||
<div style="width: 90%">
|
||||
<p class="bold mb-4" style="font-size: 14px">{{ user.userInfo?.username }}</p>
|
||||
<template v-if="user.userInfo?.role && user.userInfo.role.length > 0">
|
||||
<el-tag size="small" class="default-tag">{{ user.userInfo?.role[0] }}</el-tag>
|
||||
<el-tag size="small" class="default-tag ml-4" v-if="user.userInfo?.role?.length > 1"
|
||||
>+{{ user.userInfo?.role?.length - 1 }}
|
||||
</el-tag>
|
||||
<template v-if="user.userInfo?.role_name && user.userInfo.role_name.length > 0">
|
||||
<TagGroup size="small" :tags="user.userInfo?.role_name"/>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -154,13 +154,13 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
await formEl.validate((valid, fields) => {
|
||||
if (valid) {
|
||||
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')
|
||||
MsgSuccess(t('common.editSuccess'))
|
||||
visible.value = false
|
||||
})
|
||||
} else {
|
||||
loadPermissionApi('chatUser').postUserManage(userForm.value, loading).then((res) => {
|
||||
loadPermissionApi('chatUser').postUserManage(userForm.value, loading).then(() => {
|
||||
emit('refresh')
|
||||
MsgSuccess(t('common.createSuccess'))
|
||||
visible.value = false
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
if (!formEl) return
|
||||
await formEl.validate((valid, fields) => {
|
||||
if (valid) {
|
||||
loadPermissionApi('chatUser').putUserManagePassword(userId.value, userForm.value, loading).then((res) => {
|
||||
loadPermissionApi('chatUser').putUserManagePassword(userId.value, userForm.value, loading).then(() => {
|
||||
emit('refresh')
|
||||
user.profile()
|
||||
MsgSuccess(t('views.userManage.tip.updatePwdSuccess'))
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ function getList() {
|
|||
const params = {
|
||||
[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
|
||||
paginationConfig.total = res.data.total
|
||||
})
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ async function getWorkspaceFormItem() {
|
|||
],
|
||||
selectProps: {
|
||||
options:
|
||||
res.data?.map((item) => ({
|
||||
res.data?.map((item: any) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
})) || [],
|
||||
|
|
|
|||
|
|
@ -94,7 +94,19 @@
|
|||
<el-table-column prop="role_name" :label="$t('views.role.member.role')" min-width="100"
|
||||
v-if="user.isEE() || user.isPE()">
|
||||
<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>
|
||||
</el-table-column>
|
||||
<el-table-column prop="source" :label="$t('views.userManage.source.label')">
|
||||
|
|
@ -225,7 +237,13 @@ function getList() {
|
|||
return userManageApi
|
||||
.getUserManage(paginationConfig, params, loading)
|
||||
.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
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ async function getRoleFormItem() {
|
|||
},
|
||||
],
|
||||
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,
|
||||
value: item.id
|
||||
})) || [],
|
||||
|
|
|
|||
Loading…
Reference in New Issue