perf: 下拉过滤器与选项卡交互

This commit is contained in:
fit2cloud-chenyw 2023-11-29 16:23:56 +08:00
parent 515b881558
commit f78ab3f29d
3 changed files with 4 additions and 6 deletions

View File

@ -136,6 +136,7 @@ export function panelDataPrepare(componentData, componentStyle, callback) {
}
if (item.type === 'custom') {
item.options.manualModify = false
item.options.loaded = false
}
if (item.filters && item.filters.length > 0) {
item.filters = []

View File

@ -382,6 +382,8 @@ export default {
componentId: this.element.id,
val: (this.value && Array.isArray(this.value)) ? this.value.join(',') : this.value
})
this.element.options.loaded = true
this.$store.commit('setComponentWithId', this.element)
}
},
refreshLoad() {

View File

@ -91,11 +91,6 @@ const cacheCondition = (cb, obj) => {
obj.cb = cb
}
const crossCanvasFilter = (filterEle, viewId) => {
const filterCanvas = filterEle.canvasId
const canvasIdMap = buildCanvasIdMap(store.state.componentData)
return canvasIdMap[viewId] !== filterCanvas
}
export const buildViewKeyFilters = (panelItems, result, isEdit = false) => {
if (!(panelItems && panelItems.length > 0)) {
return result
@ -118,7 +113,7 @@ export const buildViewKeyFilters = (panelItems, result, isEdit = false) => {
// 进行过滤时 如果过滤组件在主画布 则条件适用于所有画布视图 否则需要过滤组件和视图在相同画布
if (element.canvasId === 'canvas-main' || element.canvasId === canvasIdMap[viewId]) {
const vidMatch = viewIdMatch(condition.viewIds, viewId)
if (vidMatch && selectFirst && !(crossCanvasFilter(element, viewId) && isEdit)) {
if (vidMatch && selectFirst && !element.options.loaded) {
const obj = {}
const promise = new Promise(resolve => {
cacheCondition(cbParam => {