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

View File

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