NEZ-1509 fix: Main图表锁定后Group下的图表依然可以移动

This commit is contained in:
zhangyu
2022-02-14 17:48:13 +08:00
parent 0a02f01fae
commit 6f6d6e03aa
3 changed files with 21 additions and 5 deletions

View File

@@ -100,8 +100,7 @@ export default {
panelId: {}, panelId: {},
chartDetailInfo: Object, chartDetailInfo: Object,
timeRange: Array, // 时间范围 timeRange: Array, // 时间范围
panelLock: { type: Boolean, default: true }, isGroup: Boolean,
isGroup: { type: Boolean, default: false },
groupInfo: {}, groupInfo: {},
from: String, from: String,
dataList: Array // 看板中所有图表信息 dataList: Array // 看板中所有图表信息
@@ -123,6 +122,9 @@ export default {
}, },
layoutMargintop () { layoutMargintop () {
return this.isGroup ? '0' : (this.dataList.length ? (-1 * (this.stepWidth + 14) + 'px') : '0') return this.isGroup ? '0' : (this.dataList.length ? (-1 * (this.stepWidth + 14) + 'px') : '0')
},
panelLock () {
return this.$store.getters.getPanelLock
} }
}, },
data () { data () {
@@ -333,6 +335,9 @@ export default {
this.$store.commit('setChartListId', `chartList${this.timestamp}`) this.$store.commit('setChartListId', `chartList${this.timestamp}`)
} }
}, },
beforeDestroy () {
this.$store.dispatch('dispatchPanelLock', { flag: true })
},
watch: { watch: {
dataList: { dataList: {
deep: true, deep: true,

View File

@@ -64,7 +64,7 @@
> >
<template v-slot:before> <template v-slot:before>
<el-dropdown-item> <el-dropdown-item>
<div id="panel-lock" @click="panelLock=!panelLock"><i :class="{'nz-icon nz-icon-lock':!panelLock,'nz-icon nz-icon-unlock':panelLock}"></i>{{!panelLock ? $t('overall.locked') : $t('overall.unlocked')}}</div> <div id="panel-lock" @click="$store.dispatch('dispatchPanelLock',{flag:!panelLock})"><i :class="{'nz-icon nz-icon-lock':!panelLock,'nz-icon nz-icon-unlock':panelLock}"></i>{{!panelLock ? $t('overall.locked') : $t('overall.unlocked')}}</div>
</el-dropdown-item> </el-dropdown-item>
</template> </template>
<template v-slot:after> <template v-slot:after>
@@ -90,7 +90,6 @@
:data-list="dataList" :data-list="dataList"
:nowTimeType="nowTimeType" :nowTimeType="nowTimeType"
:from="fromRoute.panel" :from="fromRoute.panel"
:panel-lock="panelLock"
:time-range="searchTime" :time-range="searchTime"
@edit-chart="editChart" @edit-chart="editChart"
@on-refresh-time="refreshTime" @on-refresh-time="refreshTime"
@@ -170,7 +169,6 @@ export default {
panelTabLoading: false, panelTabLoading: false,
overScroll10: false, overScroll10: false,
isLoading: true, isLoading: true,
panelLock: true,
showTopBtn: false, // top按钮 showTopBtn: false, // top按钮
visible: false, visible: false,
chartListLoading: true, chartListLoading: true,
@@ -294,6 +292,9 @@ export default {
}, },
delChartFlag () { delChartFlag () {
return this.$store.getters.getDelChart return this.$store.getters.getDelChart
},
panelLock () {
return this.$store.getters.getPanelLock
} }
}, },
methods: { methods: {

View File

@@ -1,6 +1,7 @@
const panel = { const panel = {
state: { state: {
showRightBox: false, showRightBox: false,
panelLock: true,
chart: '', chart: '',
delChart: false, delChart: false,
groupId: '', groupId: '',
@@ -20,6 +21,9 @@ const panel = {
setShowRightBox (state, flag) { setShowRightBox (state, flag) {
state.showRightBox = flag state.showRightBox = flag
}, },
setPanelLock (state, flag) {
state.panelLock = flag
},
setChart (state, chart) { setChart (state, chart) {
state.chart = chart state.chart = chart
}, },
@@ -61,6 +65,9 @@ const panel = {
getShowRightBox (state) { getShowRightBox (state) {
return state.showRightBox return state.showRightBox
}, },
getPanelLock (state) {
return state.panelLock
},
getChart (state) { getChart (state) {
return state.chart return state.chart
}, },
@@ -119,6 +126,9 @@ const panel = {
dispatchHeaderH (store, playload) { dispatchHeaderH (store, playload) {
store.commit('setHeaderH', playload.headerH) store.commit('setHeaderH', playload.headerH)
}, },
dispatchPanelLock (store, playload) {
store.commit('setPanelLock', playload.flag)
},
clearPanel (store) { clearPanel (store) {
store.commit('cleanPanel') store.commit('cleanPanel')
} }