Browse Source

fix:修复组合锁定的问题

liu.shiyi 1 năm trước cách đây
mục cha
commit
7118950e7f

+ 3 - 1
data-room-ui/packages/js/mixins/chartContextMenu.js

@@ -36,7 +36,8 @@ export default {
       'changeLocked',
       'saveTimeLine',
       'copyCharts',
-      'pasteCharts'
+      'pasteCharts',
+      'clearActiveCodes'
     ]),
     // 改变hover的组件
     changeHover (code) {
@@ -117,6 +118,7 @@ export default {
         this.saveTimeLine('组合图表')
       } else {
         // 取消组合
+        this.clearActiveCodes()
         // 找到和本组件group相同的组件 取消group
         this.chartList.forEach(_chart => {
           if (_chart.group === chart.group) {

+ 5 - 1
data-room-ui/packages/js/store/mutations.js

@@ -77,6 +77,10 @@ export default {
       })
     }
   },
+  // 情况页面选中的组件
+  clearActiveCodes (state) {
+    state.activeCodes = []
+  },
   // 改变当前hover组件id
   changeHoverCode (state, code) {
     state.hoverCode = code
@@ -206,7 +210,7 @@ export default {
   // 改变锁定状态
   changeLocked (state, config) {
     // 如果是多选,则改变框选中的所有组件的锁定状态
-    if (state.activeCodes && state.activeCodes.length) {
+    if (state.activeCodes && state.activeCodes.length > 1) {
       state.pageInfo.chartList = state.pageInfo.chartList?.map(chart => {
         return {
           ...chart,