Forráskód Böngészése

1、新增配置模块;
2、站场图30秒定时刷新当前状态。

git-svn-id: https://202.107.226.68:8443/svn/Services/ResistanceMonitor@46 a05970a1-87b9-9d4f-9ee5-fa77e2ec115b

yinwei 1 éve
szülő
commit
bcf50ad1d9

+ 4 - 0
2.Web/src/components/Layout.vue

@@ -94,6 +94,10 @@
       <i class="el-icon-notebook-2"></i>
       <span slot="title">相关记录</span>
      </el-menu-item>
+     <el-menu-item index="/layout/general_config">
+      <i class="el-icon-more"></i>
+      <span slot="title">通用配置</span>
+     </el-menu-item>
     </el-menu>
     <div class="open_close">
      <i @click="change" v-if="open_close" class="el-icon-s-fold"></i>

+ 6 - 0
2.Web/src/router/index.js

@@ -127,6 +127,12 @@ const router = new Router({
      name: 'record',
      component: resolve => require(['../views/Record.vue'], resolve),
     },
+    {
+     // 通用配置
+     path: 'general_config',
+     name: 'general_config',
+     component: resolve => require(['../views/GeneralConfiguration.vue'], resolve),
+    },
    ],
   },
   {

+ 21 - 0
2.Web/src/store/config-data.js

@@ -0,0 +1,21 @@
+// 一些公共数据
+const config_data = {
+ namespaced: true,
+ state: {
+  /**
+   * 滤波是否当不为0时不显示tooltips
+   *  -0: 否
+   *  -1: 是(默认)
+   */
+  filtering: localStorage.getItem('filtering') || '1',
+ },
+ mutations: {
+  // 通用保存配置项
+  handle_config_data(state, object) {
+   state[object.key] = object.value
+   localStorage.setItem(object.key, object.value)
+  },
+ },
+}
+
+export default config_data

+ 2 - 0
2.Web/src/store/index.js

@@ -2,6 +2,7 @@ import Vue from 'vue'
 import Vuex from 'vuex'
 import { Notification } from 'element-ui'
 import public_data from './data' // 公共数据
+import config_data from './config-data' // 配置数据
 
 Vue.use(Vuex)
 
@@ -56,6 +57,7 @@ const store = new Vuex.Store({
  // 引入公共数据
  modules: {
   public_data,
+  config_data,
  },
 })
 

+ 61 - 0
2.Web/src/views/GeneralConfiguration.vue

@@ -0,0 +1,61 @@
+<template>
+ <div class="config_box">
+  <div class="div_style text_color">
+   <b>说明:修改即生效。</b>
+  </div>
+  <div class="div_style">
+   <b class="b_style">●&nbsp;历史数据是否当滤波不为0时,曲线不显示tooltips:</b>
+   <div class="tools_style">
+    <div class="fun_style">
+     <el-switch
+      v-model="filtering"
+      @change="val => config_change(val, 'filtering')"
+      active-color="#13ce66"
+      inactive-color="#ff4949"
+      active-value="1"
+      active-text="不显示"
+      inactive-value="0"
+      inactive-text="显示"
+     >
+     </el-switch>
+    </div>
+   </div>
+  </div>
+ </div>
+</template>
+
+<script>
+export default {
+ name: 'GeneralConfiguration',
+ data() {
+  return {
+   filtering: '1',
+   config_key: ['filtering'],
+  }
+ },
+ computed: {},
+ methods: {
+  // 配置变化
+  config_change(val, type) {
+   let target_data = {
+    key: type,
+    value: val,
+   }
+   this.$store.commit('config_data/handle_config_data', target_data)
+  },
+  // 获取已有/默认配置
+  get_default_config() {
+   this.config_key.forEach(key => {
+    this[key] = this.$store.state.config_data[key]
+   })
+  },
+ },
+ mounted() {
+  this.get_default_config()
+ },
+}
+</script>
+
+<style lang="scss" scoped>
+@import '../../static/css/general-config.scss';
+</style>

+ 8 - 1
2.Web/src/views/RealTimeMonitoring.vue

@@ -67,6 +67,7 @@ export default {
    svg_id_list: [],
    show_org: true, // 是否左侧显示机构树
    SvgPanZoom_data: null, // 缩放的实例
+   state_timer: null,
   }
  },
  methods: {
@@ -99,6 +100,10 @@ export default {
   handle_node_click(data) {
    if (data.type != 'station') return
    this.click_id = data.id
+   if (this.state_timer) {
+    clearInterval(this.state_timer)
+    this.state_timer = null
+   }
    //  判断是否有svg
    is_option_svg(
     {
@@ -171,7 +176,6 @@ export default {
   },
   // 还原站场图
   reset_zoom() {
-   //  return this.get_svg_data()
    this.get_state_map(this.click_id)
   },
   // svg 缩放
@@ -216,6 +220,9 @@ export default {
        parent.scrollTo(offset, 0) // 滚动条居中
       }
       this.svg_zoom()
+      this.state_timer = setInterval(() => {
+       this.get_state_map(this.click_id)
+      }, 30 * 1000)
       return this.get_state_map(this.click_id)
      }, 64)
     })

+ 42 - 0
2.Web/static/css/general-config.scss

@@ -0,0 +1,42 @@
+$color: #ebeef7;
+.config_box {
+ padding: 10px;
+ margin: 0px 20px;
+ border-radius: 10px;
+ height: calc(100vh - 115px);
+ max-height: calc(100vh - 115px);
+ overflow: auto;
+ .div_style {
+  text-align: left;
+  margin: 18px 5px;
+  .b_style {
+   display: flex;
+   background: #909399;
+   padding: 5px 0 5px 5px;
+   border-radius: 5px;
+   color: white;
+   width: 550px;
+  }
+ }
+ .text_color {
+  color: red;
+ }
+ .tools_style {
+  text-align: left;
+  margin: 10px 5px;
+  .fun_style {
+   margin: 8px 0;
+  }
+  .tips {
+   font-size: 14px;
+   margin-left: 5px;
+   .red {
+    color: red;
+   }
+  }
+  //  样式
+  /deep/ .el-switch__label {
+   color: white;
+  }
+ }
+}