Merge pull request #7087 from dataease/pr@dev@perf_filter_first_selector

fix: 下拉过滤器设置首项会影响到其他仪表板
This commit is contained in:
fit2cloud-chenyw 2023-12-08 16:28:00 +08:00 committed by GitHub
commit 980928bd04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 9 deletions

View File

@ -236,6 +236,11 @@ export default {
runAnimation(this.$el, this.config.animations)
},
methods: {
triggerFilterLoaded(p) {
if (this.config.type === 'de-tabs') {
this.$refs.wrapperChild?.triggerTabsFilterLoaded(p)
}
},
filterLoaded(p) {
this.$emit('filter-loaded', p)
},

View File

@ -445,7 +445,6 @@ export default {
this.canvasId === 'canvas-main' && bus.$on('pcChartDetailsDialog', this.openChartDetailsDialog)
bus.$on('trigger-search-button', this.triggerSearchButton)
bus.$on('trigger-reset-button', this.triggerResetButton)
bus.$on('trigger-filter-loaded', this.triggerFilterLoaded)
this.initPdfTemplate()
},
beforeDestroy() {
@ -461,17 +460,11 @@ export default {
this.canvasId === 'canvas-main' && bus.$off('pcChartDetailsDialog', this.openChartDetailsDialog)
bus.$off('trigger-search-button', this.triggerSearchButton)
bus.$off('trigger-reset-button', this.triggerResetButton)
bus.$off('trigger-filter-loaded', this.triggerFilterLoaded)
},
methods: {
triggerFilterLoaded({ canvasIdStr, panelId, p }) {
if (this.panelInfo.id === panelId && !canvasIdStr.includes(this.canvasId)) {
this.filterLoaded(p, canvasIdStr)
}
},
filterLoaded(p, canvasIdStr = '') {
filterLoaded(p) {
buildAfterFilterLoaded(this.filterMap, p)
bus.$emit('trigger-filter-loaded', { canvasIdStr: (canvasIdStr + this.canvasId), panelId: this.panelInfo.id, p })
this.getWrapperChildRefs().forEach(item => item.triggerFilterLoaded(p))
},
getWrapperChildRefs() {
return this.$refs['viewWrapperChild']

View File

@ -495,6 +495,16 @@ export default {
bus.$off('add-new-tab', this.addNewTab)
},
methods: {
triggerTabsFilterLoaded(p) {
if (!this.element.options.tabList.length) {
return
}
const item = this.element.options.tabList[0]
if (item.content && item.content.type === 'canvas' && (!this.isEdit || this.mobileLayoutStatus)) {
const targetRef = this.$refs['canvasTabRef-' + this.activeTabName]
targetRef?.length && targetRef[0].filterLoaded(p)
}
},
setTabLayout: _.debounce(function() {
this.headClassScroll = !!this.$refs?.deTabsConstom?.$refs?.tabsConstom?.$refs?.nav?.scrollable ? 'head-class-scroll' : ''
}, 100),