Browse Source

大屏查看器增加整个页面定时刷新功能,解决表格等增加列时,只刷新数据不刷新表头,同时也释放图表内存

木子李 1 year ago
parent
commit
537ef5b615

+ 2 - 2
report-ui/src/utils/screenMixins.js

@@ -177,10 +177,10 @@ const mixin = {
       if (!this.widgets || this.widgets.length == 0) {
         return this.$message.error("请添加组件");
       }
-      const { title, width, height, backgroundColor, backgroundImage } = { ...this.dashboard }
+      const { title, width, height, backgroundColor, backgroundImage, refreshSeconds } = { ...this.dashboard }
       const screenData = {
         reportCode: this.reportCode,
-        dashboard: { title, width, height, backgroundColor, backgroundImage },
+        dashboard: { title, width, height, backgroundColor, backgroundImage, refreshSeconds },
         widgets: this.widgets,
       };
       screenData.widgets.forEach((widget) => {

+ 4 - 0
report-ui/src/views/bigscreenDesigner/designer/components/dynamicForm.vue

@@ -105,6 +105,10 @@
               v-if="item.type == 'el-slider'"
               v-model="formData[item.name]"
               @change="(val) => changed(val, item.name)"
+              :step="item.options==null?1:item.options.step"
+              :min="item.options==null?1:item.options.min"
+              :max="item.options==null?100:item.options.max"
+              :show-stops="item.options==null?false:item.options.showStops"
             />
 
             <el-button

+ 16 - 2
report-ui/src/views/bigscreenDesigner/designer/tools/index.js

@@ -3,8 +3,8 @@
  * @version:
  * @Author: qianlishi
  * @Date: 2021-08-29 06:43:07
- * @LastEditors: qianlishi qianlishi@anji-plus.com
- * @LastEditTime: 2023-03-06 16:00:09
+ * @LastEditors: lide1202
+ * @LastEditTime: 2023-11-22 15:00:35
  */
 import { widgetTool } from "./main"
 const screenConfig = {
@@ -62,6 +62,20 @@ const screenConfig = {
         placeholder: '',
         value: '',
       },
+      {
+        type: 'el-slider',
+        label: '刷新间隔(秒)',
+        name: 'refreshSeconds',
+        require: false,
+        placeholder: '',
+        value: 0,
+        options: {
+          step: 1800,
+          min: 0,
+          max: 14400,
+          showStops: true,
+        }
+      },
     ],
     data: [],
     position: [],

+ 5 - 0
report-ui/src/views/bigscreenDesigner/viewer/index.vue

@@ -69,6 +69,11 @@ export default {
         }
       })
       this.widgets = data.dashboard.widgets;
+
+      // 定时刷新
+      if(data.dashboard.refreshSeconds>0) {
+        setTimeout(function(){ window.location.reload(); }, data.dashboard.refreshSeconds*1000);
+      }
     }
   }
 };