perf: 修改 labels 关联

This commit is contained in:
ibuler
2023-12-18 17:55:46 +08:00
committed by 老广
parent f10e31bd60
commit 5cefbbfb51
4 changed files with 20 additions and 7 deletions

View File

@@ -383,7 +383,7 @@ export default {
if (Array.isArray(resData) && resData.length) { if (Array.isArray(resData) && resData.length) {
this.asyncDataList = resData this.asyncDataList = resData
this.notSelectDataList = resData this.notSelectDataList = resData
this.initData(true) this.initData(false)
this.isLastPage = resData.length < this.pageSize this.isLastPage = resData.length < this.pageSize
} else { } else {
this.notSelectDataList = [] this.notSelectDataList = []

View File

@@ -15,6 +15,7 @@
import { GenericListPage } from '@/layout/components' import { GenericListPage } from '@/layout/components'
import BindDialog from './BindDialog.vue' import BindDialog from './BindDialog.vue'
import LabelResourcesDialog from '@/views/labels/LabelResourcesDialog.vue' import LabelResourcesDialog from '@/views/labels/LabelResourcesDialog.vue'
import { mapGetters } from 'vuex'
export default { export default {
components: { components: {
@@ -31,10 +32,13 @@ export default {
tableConfig: { tableConfig: {
url: '/api/v1/labels/labels/', url: '/api/v1/labels/labels/',
columnsShow: { columnsShow: {
default: ['name', 'value', 'res_count', 'date_created', 'date_updated', 'actions'], default: ['name', 'value', 'res_count', 'date_created', 'action'],
min: ['name', 'action'] min: ['name', 'action']
}, },
columnsMeta: { columnsMeta: {
name: {
formatter: (row) => row.name
},
res_count: { res_count: {
formatter: (row) => { formatter: (row) => {
const onClick = () => { const onClick = () => {
@@ -54,6 +58,9 @@ export default {
callback: ({ row }) => { callback: ({ row }) => {
this.label = row this.label = row
this.bindVisible = true this.bindVisible = true
},
can: () => {
return !this.currentOrgIsRoot
} }
} }
] ]
@@ -67,6 +74,9 @@ export default {
} }
} }
}, },
computed: {
...mapGetters(['currentOrgIsRoot'])
},
methods: { methods: {
handleClickResCount(row) { handleClickResCount(row) {
this.label = row this.label = row

View File

@@ -1,5 +1,11 @@
<template> <template>
<Dialog :title="$tc('labels.BindResource')" destroy-on-close v-bind="$attrs" v-on="$listeners"> <Dialog
:show-buttons="false"
:title="$tc('labels.BindResource')"
destroy-on-close
v-bind="$attrs"
v-on="$listeners"
>
<ListTable :header-actions="headerActions" :table-config="tableConfig" /> <ListTable :header-actions="headerActions" :table-config="tableConfig" />
</Dialog> </Dialog>
</template> </template>

View File

@@ -120,10 +120,7 @@ export default {
ajax: { ajax: {
url: '/api/v1/rbac/system-roles/?id!=00000000-0000-0000-0000-000000000004', url: '/api/v1/rbac/system-roles/?id!=00000000-0000-0000-0000-000000000004',
transformOption: (item) => { transformOption: (item) => {
if (item.name !== 'SystemComponent') { return { label: item.display_name, value: item.id }
return { label: item.display_name, value: item.id }
}
return false
} }
} }
}, },