Explorar o código

Merge branch 'yx' of http://61.161.152.110:10101/r/electronic-map into yx

Koishi %!s(int64=3) %!d(string=hai) anos
pai
achega
44c97d9f62
Modificáronse 2 ficheiros con 26 adicións e 56 borrados
  1. 18 36
      src/views/HealthControl/Health2.vue
  2. 8 20
      src/views/HealthControl/Health3.vue

+ 18 - 36
src/views/HealthControl/Health2.vue

@@ -2,19 +2,22 @@
   <div class="health-2">
     <div class="power-info mg-b-16">
       <div class="info-tab">
-        <div
-          class="tab"
-          v-for="(item, index) in infoList"
-          :key="index"
-          :class="item.active ? 'active' : ''"
-          @click="onClickInfo(item)"
-        >
+        <div class="tab" :class="type === '2' ? 'active' : ''" @click="changeDate('2')">
           <i class="svg-icon svg-icon svg-icon-sm">
-            <svg-icon :svgid="item.svgid" />
+            <svg-icon :svgid="'svg-h-day'" />
           </i>
-          <span> {{ item.title }} </span>
+          <span> 7日健康趋势 </span>
+        </div>
+        <div class="tab" :class="type === '3' ? 'active' : ''" @click="changeDate('3')">
+          <i class="svg-icon svg-icon svg-icon-sm">
+            <svg-icon :svgid="'svg-h-month'" />
+          </i>
+          <span>30日健康趋势</span>
         </div>
         <div class="empty"></div>
+        <!-- <div class="tab">
+          <span>全部风场健康趋势</span>
+        </div> -->
       </div>
       <div class="info-chart">
         <panel class="info-chart-panel" :title="'损失电量分析'">
@@ -101,11 +104,6 @@ export default {
   data() {
     return {
       type: "2",
-      infoList: [
-        // {title: '24小时健康趋势', svgid: 'svg-24-houre', active: false, type: 'houre'},
-        { title: "7日健康趋势", svgid: "svg-h-day", active: true, type: "day" },
-        { title: "30日健康趋势", svgid: "svg-h-month", active: false, type: "month"},
-      ],
       bardata: {
         area: [],
         legend: [],
@@ -151,37 +149,22 @@ export default {
     };
   },
   created() {
-    this.requestCoulometry(2);
+    this.requestData();
     this.getAllMap();
   },
 
   methods: {
-    // 未确认缺陷按钮下的健康趋势选项
-    onClickInfo(item) {
-      this.infoList.forEach((element) => {
-        if (item.type == element.type) {
-          item.active = true;
-          switch (item.type) {
-            case "day":
-              this.requestCoulometry(2);
-              break;
-            case "month":
-              this.requestCoulometry(3);
-          }
-        } else {
-          element.active = false;
-        }
-      });
-    },
     // 获取顶部柱状图数据
-    // 损失电量分析  type:1 表示24小时健康趋势,2 表示七天健康趋势 3 表示30天健康趋势
-    requestCoulometry(type) {
+    requestData() {
       let that = this;
       that.API.requestData({
         method: "POST",
         timeout: 8000,
         subUrl: "recommen/findAllChartjz",
-        data: { wpId: 0, type: type },
+        data: {
+          wpId: "0",
+          type: that.type,
+        },
         success(res) {
           if (res.code == 200) {
             that.bardata.legend = ["优数量", "良数量", "差数量"];
@@ -199,7 +182,6 @@ export default {
       let that = this;
       that.API.requestData({
         method: "POST",
-        timeout: 8000,
         subUrl: "healthmain/findAllMap",
         success(res) {
           res.data.wpmap.forEach((ele) => {

+ 8 - 20
src/views/HealthControl/Health3.vue

@@ -179,33 +179,21 @@ export default {
       let that = this;
       that.API.requestData({
         method: "POST",
+        timeout: 8000,
         subUrl: "recommen/findAllChartjz",
         data: {
           wpId: that.wpId,
           type: that.type
         },
         success (res) {
-          // 顶部图表绿线
-          let lineData = res.data.lvchart;
-
-          let area = res.data.datechart;
-          let legend = ["优数量", "良数量", "差数量"];
-          let data = [];
-
-          let dataLength = res.data.datechart.length;
-
-          for(let i=0;i<dataLength;i++){
-            data.push([res.data.yslchart[i], res.data.lslchart[i], res.data.cslchart[i]]);
+          if (res.code == 200) {
+            that.bardata.legend = ["优数量", "良数量", "差数量"];
+            that.lineData = res.data.lvchart;
+            that.bardata.area = res.data.datechart;
+            that.bardata.data[2] = res.data.cslchart;
+            that.bardata.data[1] = res.data.lslchart;
+            that.bardata.data[0] = res.data.yslchart;
           }
-
-          let bardata = {
-            area,
-            legend,
-            data
-          };
-
-          that.bardata = bardata;
-          that.lineData = lineData;
         }
       });
     },