From 785c63e39728947f523f256889b8d081300b6471 Mon Sep 17 00:00:00 2001 From: LH_R Date: Mon, 26 Aug 2024 22:21:25 +0800 Subject: [PATCH] feat: export remove reference attr --- cmdb-ui/src/modules/cmdb/views/ci/index.vue | 2 +- .../cmdb/views/relation_views/index.vue | 2 +- .../cmdb/views/resource_search/index.vue | 18 ++++++++++++++---- .../modules/cmdb/views/tree_views/index.vue | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/cmdb-ui/src/modules/cmdb/views/ci/index.vue b/cmdb-ui/src/modules/cmdb/views/ci/index.vue index 86c96e4..7835dcb 100644 --- a/cmdb-ui/src/modules/cmdb/views/ci/index.vue +++ b/cmdb-ui/src/modules/cmdb/views/ci/index.vue @@ -417,7 +417,7 @@ export default { async openBatchDownload() { this.$refs.batchDownload.open({ - preferenceAttrList: this.preferenceAttrList, + preferenceAttrList: this.preferenceAttrList.filter((attr) => !attr?.is_reference), ciTypeName: this.$route.meta.title || this.$route.meta.name, }) }, diff --git a/cmdb-ui/src/modules/cmdb/views/relation_views/index.vue b/cmdb-ui/src/modules/cmdb/views/relation_views/index.vue index a87ec37..5f95adc 100644 --- a/cmdb-ui/src/modules/cmdb/views/relation_views/index.vue +++ b/cmdb-ui/src/modules/cmdb/views/relation_views/index.vue @@ -1259,7 +1259,7 @@ export default { }, async openBatchDownload() { this.$refs.batchDownload.open({ - preferenceAttrList: this.preferenceAttrList, + preferenceAttrList: this.preferenceAttrList.filter((attr) => !attr?.is_reference), ciTypeName: this.$route.meta.name, }) }, diff --git a/cmdb-ui/src/modules/cmdb/views/resource_search/index.vue b/cmdb-ui/src/modules/cmdb/views/resource_search/index.vue index fe2f2b9..dcf1e5e 100644 --- a/cmdb-ui/src/modules/cmdb/views/resource_search/index.vue +++ b/cmdb-ui/src/modules/cmdb/views/resource_search/index.vue @@ -592,11 +592,21 @@ export default { return '' }, handleExport() { + const preferenceAttrList = [ + { id: `ci_type_alias`, value: 'ci_type_alias', label: this.$t('cmdb.ciType.ciType') }, + ...this.columnsGroup, + ] + + preferenceAttrList.forEach((attr) => { + if (Array.isArray(attr?.children) && attr?.children?.length) { + attr.children = attr.filter((child) => { + return !child?.is_reference + }) + } + }) + this.$refs.batchDownload.open({ - preferenceAttrList: [ - { id: `ci_type_alias`, value: 'ci_type_alias', label: this.$t('cmdb.ciType.ciType') }, - ...this.columnsGroup, - ], + preferenceAttrList, }) }, batchDownload({ filename, type, checkedKeys }) { diff --git a/cmdb-ui/src/modules/cmdb/views/tree_views/index.vue b/cmdb-ui/src/modules/cmdb/views/tree_views/index.vue index 8188eca..66a5635 100644 --- a/cmdb-ui/src/modules/cmdb/views/tree_views/index.vue +++ b/cmdb-ui/src/modules/cmdb/views/tree_views/index.vue @@ -808,7 +808,7 @@ export default { }) }, async openBatchDownload() { - this.$refs.batchDownload.open({ preferenceAttrList: this.currentAttrList, ciTypeName: this.currentCiTypeName }) + this.$refs.batchDownload.open({ preferenceAttrList: this.currentAttrList.filter((attr) => !attr?.is_reference), ciTypeName: this.currentCiTypeName }) }, batchDownload({ filename, type, checkedKeys }) { console.log(filename, type)