From b8d4a192483a423419052a61e1d7bb6b653f6226 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 14 Aug 2023 15:37:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=9B=A0=E4=B8=8B=E9=92=BB=E5=AF=BC=E8=87=B4=E8=81=94?= =?UTF-8?q?=E5=8A=A8=E8=A7=A6=E5=8F=91=E8=8F=9C=E5=8D=95=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=8D=E5=87=86=E7=A1=AE=E7=9A=84=E9=97=AE=E9=A2=98=20#5768?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canvas/customComponent/UserView.vue | 24 +++++++--- frontend/src/store/index.js | 46 ++++++++++--------- 2 files changed, 42 insertions(+), 28 deletions(-) diff --git a/frontend/src/components/canvas/customComponent/UserView.vue b/frontend/src/components/canvas/customComponent/UserView.vue index 979f7dd264..c6c55c7f8e 100644 --- a/frontend/src/components/canvas/customComponent/UserView.vue +++ b/frontend/src/components/canvas/customComponent/UserView.vue @@ -431,18 +431,30 @@ export default { const trackMenuInfo = [] let linkageCount = 0 let jumpCount = 0 - this.chart.data && this.chart.data.fields && this.chart.data.fields.forEach(item => { - const sourceInfo = this.chart.id + '#' + item.id + if(this.drillFilters.length && !this.chart.type.includes('table')){ + const checkItem = this.drillFields[this.drillFilters.length] + const sourceInfo = this.chart.id + '#' + checkItem.id if (this.nowPanelTrackInfo[sourceInfo]) { linkageCount++ } - }) - this.chart.data && this.chart.data.fields && this.chart.data.fields.forEach(item => { - const sourceInfo = this.chart.id + '#' + item.id if (this.nowPanelJumpInfo[sourceInfo]) { jumpCount++ } - }) + }else{ + this.chart.data && this.chart.data.fields && this.chart.data.fields.forEach(item => { + const sourceInfo = this.chart.id + '#' + item.id + if (this.nowPanelTrackInfo[sourceInfo]) { + linkageCount++ + } + }) + this.chart.data && this.chart.data.fields && this.chart.data.fields.forEach(item => { + const sourceInfo = this.chart.id + '#' + item.id + if (this.nowPanelJumpInfo[sourceInfo]) { + jumpCount++ + } + }) + } + jumpCount && trackMenuInfo.push('jump') linkageCount && trackMenuInfo.push('linkage') this.drillFields.length && trackMenuInfo.push('drill') diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index ac0f46332b..d92ee3a727 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -22,14 +22,14 @@ import layer from '@/components/canvas/store/layer' import snapshot from '@/components/canvas/store/snapshot' import lock from '@/components/canvas/store/lock' import task from './modules/task' -import { formatCondition, valueValid } from '@/utils/conditionUtil' -import { Condition } from '@/components/widget/bean/Condition' +import {formatCondition, valueValid} from '@/utils/conditionUtil' +import {Condition} from '@/components/widget/bean/Condition' -import { DEFAULT_COMMON_CANVAS_STYLE_STRING } from '@/views/panel/panel' +import {DEFAULT_COMMON_CANVAS_STYLE_STRING} from '@/views/panel/panel' import bus from '@/utils/bus' -import { BASE_MOBILE_STYLE } from '@/components/canvas/customComponent/component-list' -import { TYPE_CONFIGS } from '@/views/chart/chart/util' -import { deepCopy } from '@/components/canvas/utils/utils' +import {BASE_MOBILE_STYLE} from '@/components/canvas/customComponent/component-list' +import {TYPE_CONFIGS} from '@/views/chart/chart/util' +import {deepCopy} from '@/components/canvas/utils/utils' Vue.use(Vuex) @@ -199,7 +199,7 @@ const data = { }) }, - setCurComponent(state, { component, index }) { + setCurComponent(state, {component, index}) { if (!component && state.curComponent) { Vue.set(state.curComponent, 'editing', false) } @@ -237,7 +237,7 @@ const data = { state.previewCanvasScale.scalePointHeight = scale.scaleHeight } }, - setShapeStyle({ curComponent, canvasStyleData, curCanvasScaleMap }, { top, left, width, height, rotate }) { + setShapeStyle({curComponent, canvasStyleData, curCanvasScaleMap}, {top, left, width, height, rotate}) { if (curComponent) { const curCanvasScaleSelf = curCanvasScaleMap[curComponent.canvasId] if (top || top === 0) curComponent.style.top = Math.round((top / curCanvasScaleSelf.scalePointHeight)) @@ -248,7 +248,7 @@ const data = { } }, - setShapeSingleStyle({ curComponent }, { key, value }) { + setShapeSingleStyle({curComponent}, {key, value}) { curComponent.style[key] = value }, @@ -272,14 +272,14 @@ const data = { setMobileComponentData(state, mobileComponentData = []) { Vue.set(state, 'mobileComponentData', mobileComponentData) }, - addComponent(state, { component, index }) { + addComponent(state, {component, index}) { if (index !== undefined) { state.componentData.splice(index, 0, component) } else { state.componentData.push(component) state.currentCanvasNewId.push(component.id) } - this.commit('setCurComponent', { component: component, index: index || state.componentData.length - 1 }) + this.commit('setCurComponent', {component: component, index: index || state.componentData.length - 1}) }, removeViewFilter(state, componentId) { state.componentData = state.componentData.map(item => { @@ -368,11 +368,13 @@ const data = { let trackInfo if (data.option === 'linkage') { trackInfo = state.nowPanelTrackInfo - // 兼容情况,当源视图多个个字段匹配目标视图一个字段的时候,默认只保留当前点击的维度,将改维度排序到组件结尾,去重时即可保留 - const activeDimensionIndex = data.dimensionList.findIndex(dimension =>dimension.id === data.name) - const dimensionLast = dimensionSort[dimensionSort.length-1] - dimensionSort[dimensionSort.length-1] = dimensionSort[activeDimensionIndex] - dimensionSort[activeDimensionIndex] = dimensionLast + // 兼容情况,当源视图多个字段匹配目标视图一个字段的时候,默认只保留当前点击的维度,将改维度排序到组件结尾,去重时即可保留 + const activeDimensionIndex = data.dimensionList.findIndex(dimension => dimension.id === data.name) + if (activeDimensionIndex > -1 && activeDimensionIndex != dimensionSort.length - 1) { + const dimensionLast = dimensionSort[dimensionSort.length - 1] + dimensionSort[dimensionSort.length - 1] = dimensionSort[activeDimensionIndex] + dimensionSort[activeDimensionIndex] = dimensionLast + } } else { trackInfo = state.nowPanelJumpInfoTargetPanel } @@ -462,7 +464,7 @@ const data = { const currentFilters = element.outerParamsFilters || [] // 外部参数信息 // 外部参数 可能会包含多个参数 - Object.keys(params).forEach(function(sourceInfo) { + Object.keys(params).forEach(function (sourceInfo) { // 获取外部参数的值 sourceInfo 是外部参数名称 支持数组传入 let paramValue = params[sourceInfo] let operator = 'in' @@ -661,13 +663,13 @@ const data = { } } }, - updateComponentViewsData(state, { viewId, propertyKey, propertyValue }) { + updateComponentViewsData(state, {viewId, propertyKey, propertyValue}) { state.componentViewsData[viewId][propertyKey] = propertyValue }, removeCurMultiplexingComponentWithId(state, id) { delete state.curMultiplexingComponents[id] }, - addCurMultiplexingComponent(state, { component, componentId }) { + addCurMultiplexingComponent(state, {component, componentId}) { if (componentId) { if (component.type === 'custom-button' && component.serviceName === 'buttonSureWidget') { const copyComponent = deepCopy(component) @@ -764,7 +766,7 @@ const data = { state.changeProperties[propertyInfo.custom][propertyInfo.property] = propertyInfo.value }, initCanvasBase(state) { - this.commit('setCurComponent', { component: null, index: null }) + this.commit('setCurComponent', {component: null, index: null}) this.commit('clearLinkageSettingInfo', false) this.commit('resetViewEditInfo') this.commit('initCurMultiplexingComponents') @@ -854,10 +856,10 @@ const data = { } }) - bus.$emit('clear_panel_linkage', { viewId: viewId }) + bus.$emit('clear_panel_linkage', {viewId: viewId}) }, setMultiplexingStyleAdapt(state, value) { - state.multiplexingStyleAdapt = value + state.multiplexingStyleAdapt = value } }, modules: {