perf: 优化应用授权列表

This commit is contained in:
ibuler 2021-07-30 15:15:51 +08:00 committed by 老广
parent 8929957fd9
commit 0e665912ff
2 changed files with 37 additions and 12 deletions

View File

@ -28,7 +28,7 @@ export default {
showMenu: false,
showRefresh: true,
showAssets: false,
treeUrl: '/api/v1/applications/applications/tree/?show_count=0',
treeUrl: '/api/v1/applications/applications/tree/',
callback: {
onSelected: function(event, treeNode) {
let url = '/api/v1/applications/accounts/'

View File

@ -1,20 +1,51 @@
<template>
<GenericListPage :table-config="tableConfig" :header-actions="headerActions" :title="title" />
<GenericTreeListPage ref="TreeTablePage" :tree-setting="treeSetting" :header-actions="headerActions" :table-config="tableConfig" />
</template>
<script>
import { GenericListPage } from '@/layout/components'
import GenericTreeListPage from '@/layout/components/GenericTreeListPage'
import { setUrlParam } from '@/utils/common'
import { DetailFormatter } from '@/components/TableFormatters'
import { ApplicationTypes } from '../const'
import { ApplicationTypes } from '@/views/perms/const'
export default {
name: 'AssetAccountList',
components: {
GenericListPage
GenericTreeListPage
},
data() {
const vm = this
return {
title: this.$t('route.ApplicationPermission'),
isInit: true,
clickedRow: null,
iShowTree: true,
treeSetting: {
async: false,
showMenu: false,
showRefresh: true,
showAssets: false,
treeUrl: '/api/v1/applications/applications/tree/',
callback: {
onSelected: function(event, treeNode) {
let url = '/api/v1/perms/application-permissions/'
const nodeId = treeNode.id
if (treeNode.meta.type === 'category') {
url = setUrlParam(url, 'category', nodeId)
url = setUrlParam(url, 'type', '')
} else if (treeNode.meta.type === 'type') {
url = setUrlParam(url, 'category', '')
url = setUrlParam(url, 'type', nodeId)
} else if (treeNode.meta.type === 'application') {
url = setUrlParam(url, 'category', '')
url = setUrlParam(url, 'type', '')
url = setUrlParam(url, 'application_id', nodeId)
}
setTimeout(() => {
vm.tableConfig.url = url
}, 100)
}
}
},
tableConfig: {
url: '/api/v1/perms/application-permissions/',
columns: [
@ -104,12 +135,6 @@ export default {
}
}
}
},
methods: {
}
}
</script>
<style>
</style>