Browse Source

fix:修复组件在计算时如果改变title导致计算表达式失效的问题

liu.shiyi 1 year ago
parent
commit
933f30f0d1

+ 1 - 1
data-room-ui/packages/BasicComponents/Numbers/index.vue

@@ -45,7 +45,7 @@ export default {
         const result = new Function('dataset', 'computedDatas', this.config.expression)
         config.customize.title = result(this.dataset, this.computedDatas)
         // 同时将计算得来的值保存到公共的数据存储的地方
-        this.updateComputedDatas({ code: config.code, title: config.title, data: config.customize.title })
+        this.updateComputedDatas({ code: config.code, name: config.name, data: config.customize.title })
       // this.changeChartConfig(config)
       }
     },

+ 1 - 1
data-room-ui/packages/BasicComponents/Texts/index.vue

@@ -45,7 +45,7 @@ export default {
         const result = new Function('dataset', 'computedDatas', this.config.expression)
         config.customize.title = result(this.dataset, this.computedDatas)
         // 同时将计算得来的值保存到公共的数据存储的地方
-        this.updateComputedDatas({ code: config.code, title: config.title, data: config.customize.title })
+        this.updateComputedDatas({ code: config.code, name: config.name, data: config.customize.title })
       // this.changeChartConfig(config)
       }
     },

+ 2 - 2
data-room-ui/packages/js/mixins/commonMixins.js

@@ -174,7 +174,7 @@ export default {
           }
           // 将后端返回的数据保存
           if (_res.success) {
-            this.updateDataset({ code: config.code, title: config.title, data: _res?.data })
+            this.updateDataset({ code: config.code, name: config.name, data: _res?.data })
           }
           config = this.dataFormatting(config, _res)
           this.changeChartConfig(config)
@@ -243,7 +243,7 @@ export default {
           }
           // 将后端返回的数据保存
           if (_res.success) {
-            this.updateDataset({ code: config.code, title: config.title, data: _res?.data })
+            this.updateDataset({ code: config.code, name: config.name, data: _res?.data })
           }
           config = this.dataFormatting(config, _res)
           if (this.chart) {

+ 2 - 2
data-room-ui/packages/js/store/mutations.js

@@ -372,11 +372,11 @@ export default {
   },
   // 更新数据集库中的内容
   updateDataset (state, res) {
-    Vue.set(state.dataset, res.title + res.code, res.data)
+    Vue.set(state.dataset, res.name + res.code, res.data)
   },
   // 更新数据集库中的内容
   updateComputedDatas (state, res) {
-    Vue.set(state.computedDatas, res.title + res.code, res.data)
+    Vue.set(state.computedDatas, res.name + res.code, res.data)
   },
   // 清空数据集库
   emptyDataset (state) {