浏览代码

供电系统的图

namin 3 年之前
父节点
当前提交
5893d0eedd
共有 2 个文件被更改,包括 9 次插入9 次删除
  1. 1 1
      src/store/index.js
  2. 8 8
      src/views/power_supply/dataBoard/leftChart.vue

+ 1 - 1
src/store/index.js

@@ -5,7 +5,7 @@ Vue.use(Vuex)
 
 export default new Vuex.Store({
   state: {
-    websocketIP: "10.170.46.116:8081",
+    websocketIP: "10.170.31.131:8081",
   },
   mutations: {
 

+ 8 - 8
src/views/power_supply/dataBoard/leftChart.vue

@@ -47,9 +47,10 @@ export default {
           label: "功率因数",
         },
       ],
+      title:'电压',
       type: "fuhe_after",
       unit:'',
-      currentChartId: "负荷",
+      currentChartId: 1,
       currentChartTitle: "负荷",
       yData: new Array(30).fill("-"),
       xData: new Array(30).fill("-"),
@@ -196,24 +197,23 @@ export default {
     idChange(id) {
       console.log("left", id);
       // 数据清空
-      this.paiqidata = new Array(30).fill("-");
-      this.chouqidata = new Array(30).fill("-");
+      this.yData = new Array(30).fill("-");
       this.xData = new Array(30).fill("-");
       // 关闭以前的websocket
-      this.websocket.close();
+      // this.websocket.close();
       // 开启一个新的
-      // this.websocket = new WebSocket(`ws://${this.websocketIP}/hbase/ws/belt/${id}`);
-      // this.initWebSocket();
+      this.websocket = new WebSocket(`ws://${this.websocketIP}/hbase/ws/belt/62`);
+      this.initWebSocket();
     },
     // 选择要展示的参数
     selectParm() {
       for (let i in this.parmoptions) {
         if (this.parmoptions[i].id == this.currentChartId) {
-          this.currentChartTitle = this.parmoptions[i].label;
+          this.title = this.parmoptions[i].label;
           break;
         }
       }
-      switch (currentChartId) {
+      switch (this.currentChartId) {
         case '1':
           this.unit = "kvar";
           this.type = "fuhe_after";