forked from github/dataease
fix: 反复切换全屏模式过滤器失效
This commit is contained in:
parent
191986df03
commit
28ffb0ee08
@ -166,6 +166,7 @@ export function delGroup(groupId) {
|
||||
}
|
||||
|
||||
export function initPanelData(panelId, useCache = false, callback) {
|
||||
store.commit('resetLastValidFilters')
|
||||
const queryMethod = useCache ? findUserCacheRequest : findOne
|
||||
// 加载视图数据
|
||||
queryMethod(panelId).then(response => {
|
||||
|
@ -5,6 +5,7 @@ import { $error } from '@/utils/message'
|
||||
import i18n from '@/lang'
|
||||
|
||||
export function proxyInitPanelData(panelId, proxy, callback) {
|
||||
store.commit('resetLastValidFilters')
|
||||
// 加载视图数据
|
||||
findOne(panelId, proxy).then(response => {
|
||||
if (response.data) {
|
||||
|
@ -378,7 +378,6 @@ export default {
|
||||
}, 500)
|
||||
},
|
||||
initLoad() {
|
||||
// this.value = this.fillValueDerfault()
|
||||
this.initOptions(this.fillFirstSelected)
|
||||
if (this.element.options.value && !this.selectFirst) {
|
||||
this.value = this.fillValueDerfault()
|
||||
@ -442,6 +441,12 @@ export default {
|
||||
this.element.options.manualModify = false
|
||||
} else {
|
||||
this.element.options.manualModify = true
|
||||
if (!this.showRequiredTips) {
|
||||
this.$store.commit('setLastValidFilters', {
|
||||
componentId: this.element.id,
|
||||
val: (this.value && Array.isArray(this.value)) ? this.value.join(',') : this.value
|
||||
})
|
||||
}
|
||||
}
|
||||
this.setCondition()
|
||||
this.handleShowNumber()
|
||||
@ -478,6 +483,9 @@ export default {
|
||||
return param
|
||||
},
|
||||
setCondition() {
|
||||
if (this.showRequiredTips) {
|
||||
return
|
||||
}
|
||||
const param = this.getCondition()
|
||||
!this.isRelation && this.inDraw && this.$store.commit('addViewFilter', param)
|
||||
},
|
||||
@ -504,7 +512,17 @@ export default {
|
||||
this.firstChange(this.value)
|
||||
},
|
||||
fillValueDerfault() {
|
||||
const defaultV = this.element.options.value === null ? '' : this.element.options.value.toString()
|
||||
let defaultV = this.element.options.value === null ? '' : this.element.options.value.toString()
|
||||
if (this.inDraw) {
|
||||
let lastFilters = null
|
||||
if (this.$store.state.lastValidFilters) {
|
||||
lastFilters = this.$store.state.lastValidFilters[this.element.id]
|
||||
if (lastFilters) {
|
||||
defaultV = lastFilters.val === null ? '' : lastFilters.val.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.element.options.attrs.multiple) {
|
||||
if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === '[object Object]') return []
|
||||
return defaultV.split(this.separator)
|
||||
|
@ -156,7 +156,8 @@ const data = {
|
||||
previewComponentData: [],
|
||||
currentCanvasNewId: [],
|
||||
lastViewRequestInfo: {},
|
||||
multiplexingStyleAdapt: true // 复用样式跟随主题
|
||||
multiplexingStyleAdapt: true, // 复用样式跟随主题
|
||||
lastValidFilters: {}
|
||||
},
|
||||
mutations: {
|
||||
...animation.mutations,
|
||||
@ -562,6 +563,9 @@ const data = {
|
||||
state.componentData.push(component)
|
||||
},
|
||||
deleteComponentWithId(state, id) {
|
||||
if (state.lastValidFilters && state.lastValidFilters[id]) {
|
||||
delete state.lastValidFilters[id]
|
||||
}
|
||||
for (let index = 0; index < state.componentData.length; index++) {
|
||||
const element = state.componentData[index]
|
||||
if (element.id && element.id === id) {
|
||||
@ -819,6 +823,7 @@ const data = {
|
||||
state.changeProperties[propertyInfo.custom][propertyInfo.property] = propertyInfo.value
|
||||
},
|
||||
initCanvasBase(state) {
|
||||
this.commit('resetLastValidFilters')
|
||||
this.commit('setCurComponent', { component: null, index: null })
|
||||
this.commit('clearLinkageSettingInfo', false)
|
||||
this.commit('resetViewEditInfo')
|
||||
@ -889,6 +894,10 @@ const data = {
|
||||
for (let index = 0; index < state.componentData.length; index++) {
|
||||
const element = state.componentData[index]
|
||||
if (element.canvasId && element.canvasId.includes(canvasId)) {
|
||||
const cid = state.componentData[index]
|
||||
if (state.lastValidFilters && state.lastValidFilters[cid]) {
|
||||
delete state.lastValidFilters[cid]
|
||||
}
|
||||
state.componentData.splice(index, 1)
|
||||
}
|
||||
}
|
||||
@ -913,6 +922,12 @@ const data = {
|
||||
},
|
||||
setMultiplexingStyleAdapt(state, value) {
|
||||
state.multiplexingStyleAdapt = value
|
||||
},
|
||||
setLastValidFilters(state, data) {
|
||||
state.lastValidFilters[data.componentId] = data
|
||||
},
|
||||
resetLastValidFilters(state) {
|
||||
state.lastValidFilters = {}
|
||||
}
|
||||
},
|
||||
modules: {
|
||||
|
@ -96,6 +96,7 @@ export const buildViewKeyFilters = (panelItems, result, isEdit = false) => {
|
||||
return result
|
||||
}
|
||||
const buildItems = panelItems[0].canvasId === 'canvas-main' ? panelItems : store.state.componentData
|
||||
const lastValidFilters = store.state.lastValidFilters
|
||||
const canvasIdMap = buildCanvasIdMap(buildItems)
|
||||
buildItems.forEach((element, index) => {
|
||||
if (element.type !== 'custom') {
|
||||
@ -105,9 +106,16 @@ export const buildViewKeyFilters = (panelItems, result, isEdit = false) => {
|
||||
|
||||
let param = null
|
||||
const widget = ApplicationContext.getService(element.serviceName)
|
||||
param = widget.getParam(element)
|
||||
let lastFilter = null
|
||||
if (lastValidFilters) {
|
||||
lastFilter = lastValidFilters[element.id]
|
||||
}
|
||||
param = widget.getParam(element, lastFilter?.val)
|
||||
const condition = formatCondition(param)
|
||||
const vValid = valueValid(condition)
|
||||
let vValid = valueValid(condition)
|
||||
if (lastFilter && !lastFilter.val) {
|
||||
vValid = false
|
||||
}
|
||||
const filterComponentId = condition.componentId
|
||||
Object.keys(result).forEach(viewId => {
|
||||
// 进行过滤时 如果过滤组件在主画布 则条件适用于所有画布视图 否则需要过滤组件和视图在相同画布
|
||||
|
Loading…
Reference in New Issue
Block a user