Merge pull request #7120 from dataease/pr@dev_one_dot_x

Pr@dev one dot x
This commit is contained in:
dataeaseShu 2023-12-12 11:56:40 +08:00 committed by GitHub
commit a0be293ca9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 2 deletions

View File

@ -886,6 +886,7 @@ export default {
originWidth: 80, //
originHeight: 20
},
filterMapCache: {},
showDrag: true,
vLine: [],
hLine: [],
@ -1026,6 +1027,18 @@ export default {
},
filterMap() {
const result = buildFilterMap(this.componentData)
Object.keys(result).forEach(ele => {
if (this.filterMapCache[ele]?.length) {
result[ele].forEach(itx => {
const condition = this.filterMapCache[ele].find(item => item.componentId === itx.componentId && itx.cacheObj)
if (condition) {
itx.cacheObj = condition.cacheObj
}
})
} else {
this.filterMapCache[ele] = result[ele]
}
})
if (this.searchButtonInfo && this.searchButtonInfo.buttonExist && !this.searchButtonInfo.autoTrigger && this.searchButtonInfo.relationFilterIds) {
for (const key in result) {
if (Object.hasOwnProperty.call(result, key)) {
@ -1140,12 +1153,16 @@ export default {
bus.$off('trigger-search-button', this.triggerSearchButton)
bus.$off('refresh-button-info', this.refreshButtonInfo)
bus.$off('trigger-reset-button', this.triggerResetButton)
bus.$off('filter-loaded-viewIds')
},
created() {
bus.$on('filter-loaded-viewIds', this.filterLoaded)
},
methods: {
filterLoaded(p) {
console.log('filter-loaded-viewIds')
buildAfterFilterLoaded(this.filterMap, p)
this.filterMapCache = {}
},
getWrapperChildRefs() {
return this.$refs['wrapperChild']

View File

@ -276,6 +276,7 @@ export default {
mainWidth: '100%',
mainHeight: '100%',
searchCount: 0,
filterMapCache: {},
// 1.pc pc 2.mobile
terminal: 'pc',
buttonFilterMap: null,
@ -383,6 +384,21 @@ export default {
},
filterMap() {
const result = buildFilterMap(this.componentData)
Object.keys(result).forEach(ele => {
if (this.filterMapCache[ele]?.length) {
result[ele].forEach(itx => {
const condition = this.filterMapCache[ele].find(item => item.componentId === itx.componentId && itx.cacheObj)
if (condition) {
itx.cacheObj = condition.cacheObj
}
})
if (!result[ele].length) {
result[ele] = this.filterMapCache[ele]
}
} else {
this.filterMapCache[ele] = result[ele]
}
})
if (this.searchButtonInfo && this.searchButtonInfo.buttonExist && !this.searchButtonInfo.autoTrigger && this.searchButtonInfo.relationFilterIds) {
for (const key in result) {
if (Object.hasOwnProperty.call(result, key)) {
@ -446,6 +462,7 @@ export default {
bus.$on('trigger-search-button', this.triggerSearchButton)
bus.$on('trigger-reset-button', this.triggerResetButton)
this.initPdfTemplate()
bus.$on('filter-loaded-preview', this.filterLoaded)
},
beforeDestroy() {
if (this.$refs[this.previewTempRefId]) {
@ -454,16 +471,18 @@ export default {
if (this.$refs[this.previewRefId]) {
erd.uninstall(this.$refs[this.previewRefId])
}
erd.uninstall(this.canvasMain)
erd.uninstall(this.tempCanvas)
this.canvasMain && erd.uninstall(this.canvasMain)
this.tempCanvas && erd.uninstall(this.tempCanvas)
clearInterval(this.timer)
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('filter-loaded-preview')
},
methods: {
filterLoaded(p) {
buildAfterFilterLoaded(this.filterMap, p)
this.filterMapCache = {}
this.getWrapperChildRefs().forEach(item => item.triggerFilterLoaded(p))
},
getWrapperChildRefs() {