Browse Source

健康矩阵-进入单机页面。页面增加风机下拉选择框

wsy 3 years ago
parent
commit
d7279a835d

+ 79 - 72
src/views/HealthControl/healthLineChart.vue

@@ -1,73 +1,80 @@
-<template>
-  <div class="pageBox">
-    <simple-line-chart :height="'100px'" v-for="(item, index) in chartData" :key="index" :title="item.title" :data="item.data" :color="item.color" :lineTitle="item.lineTitle" />
-  </div>
-</template>
-
-<script>
-import SimpleLineChart from "../../components/chart/line/simple-line-chart.vue";
-export default {
-  setup() {},
-  components: { SimpleLineChart },
-  data() {
-    return {
-      chartData:[]
-    };
-  },
-
-  created() {
-    this.wtId = this.$route.params.wtId;
-    this.wpId = this.$route.params.wpId;
-    this.requestData();
-  },
-  
-  methods:{
-    requestData(){
-      let that=this;
-      that.API.requestData({
-        method: "POST",
-        subUrl: "healthsub/hsFjValueIndex",
-        data:{
-          wtId: that.wtId
-        },
-        success(res) {
-
-          const color=["green","yellow","purple","blue","orange"];
-          let chartData=[];
-          let lineTitle=[];
-
-          res.data.xData.forEach(ele=>{
-            lineTitle.push(new Date(ele).formatDate("hh:mm"));
-          });
-
-          res.data.datasets.forEach((ele,index)=>{
-            chartData.push({
-              title:ele.name,
-              data:ele.data,
-              color:color[index],
-              lineTitle
-            });
-          });
-          that.chartData=chartData;
-        },
-      });
-    }
-  }
-};
-</script>
-
-<style lang="less" scoped>
-.pageBox {
-  width: 100%;
-  height:calc(100% - 1.481vh * 2);
-  display: flex;
-  flex-direction: column;
-  justify-content: space-between;
-  margin:1.481vh 0;
-
-  .chart{
-    width: 100%;
-    height:25%;
-  }
-}
+<template>
+  <div class="pageBox">
+    <wt-chooser @change="switchWt" :wpId="wpId" :wtId="wtId"></wt-chooser>
+    <simple-line-chart :height="'100px'" v-for="(item, index) in chartData" :key="index" :title="item.title" :data="item.data" :color="item.color" :lineTitle="item.lineTitle" />
+  </div>
+</template>
+
+<script>
+import SimpleLineChart from "../../components/chart/line/simple-line-chart.vue";
+import WtChooser from "@com/coms/wt-chooser/wt-chooser.vue"
+export default {
+  setup() {},
+  components: { SimpleLineChart ,WtChooser},
+  data() {
+    return {
+      chartData:[]
+    };
+  },
+
+  created() {
+    this.wtId = this.$route.params.wtId;
+    this.wpId = this.$route.params.wpId;
+    this.requestData();
+  },
+  
+  methods:{
+    switchWt(data){
+      this.$router.push(`/health/health4/healthLineChart/${data.wpId}/${data.wtId}`);
+      this.wtId = this.$route.params.wtId;
+      this.wpId = this.$route.params.wpId;
+      this.requestData();
+    },
+    requestData(){
+      let that=this;
+      that.API.requestData({
+        method: "POST",
+        subUrl: "healthsub/hsFjValueIndex",
+        data:{
+          wtId: that.wtId
+        },
+        success(res) {
+
+          const color=["green","yellow","purple","blue","orange"];
+          let chartData=[];
+          let lineTitle=[];
+
+          res.data.xData.forEach(ele=>{
+            lineTitle.push(new Date(ele).formatDate("hh:mm"));
+          });
+
+          res.data.datasets.forEach((ele,index)=>{
+            chartData.push({
+              title:ele.name,
+              data:ele.data,
+              color:color[index],
+              lineTitle
+            });
+          });
+          that.chartData=chartData;
+        },
+      });
+    }
+  }
+};
+</script>
+
+<style lang="less" scoped>
+.pageBox {
+  width: 100%;
+  height:calc(100% - 1.481vh * 2);
+  display: flex;
+  flex-direction: column;
+  justify-content: space-between;
+
+  .chart{
+    width: 100%;
+    height:25%;
+  }
+}
 </style>

+ 1 - 1
src/views/HealthControl/healthLineChart2.vue

@@ -87,7 +87,7 @@ export default {
       this.requestMttrrand();
     },
     switchWt(data){
-      this.$router.push(`/health/health10/${data.wpId}/${data.wtId}`);
+      this.$router.push(`/health/health4/healthLineChart2/${data.wpId}/${data.wtId}`);
       this.init();
     },
      // 未确认缺陷按钮下的健康趋势选项