瀏覽代碼

健康管理模块bug修改

chenminghua 3 年之前
父節點
當前提交
5c644c2a90

+ 1 - 1
src/components/chart/combination/vertival-bar-line-chart.vue

@@ -46,7 +46,7 @@ export default {
     // 单位
     units: {
       type: Array,
-      default: () => ["健康趋势", "风机健康状态数量"],
+      default: () => ["", "风机健康状态数量"],
     },
     // 显示 legend
     showLegend: {

+ 44 - 38
src/views/HealthControl/Health2.vue

@@ -2,22 +2,19 @@
   <div class="health-2">
     <div class="power-info mg-b-16">
       <div class="info-tab">
-        <div class="tab" :class="type === '2' ? 'active' : ''" @click="changeDate('2')">
+        <div
+          class="tab"
+          v-for="(item, index) in infoList"
+          :key="index"
+          :class="item.active ? 'active' : ''"
+          @click="onClickInfo(item)"
+        >
           <i class="svg-icon svg-icon svg-icon-sm">
-            <svg-icon :svgid="'svg-h-day'" />
+            <svg-icon :svgid="item.svgid" />
           </i>
-          <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>
+          <span> {{ item.title }} </span>
         </div>
         <div class="empty"></div>
-        <!-- <div class="tab">
-          <span>全部风场健康趋势</span>
-        </div> -->
       </div>
       <div class="info-chart">
         <panel class="info-chart-panel" :title="'损失电量分析'">
@@ -104,6 +101,11 @@ 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: [],
@@ -149,43 +151,46 @@ export default {
     };
   },
   created() {
-    this.requestData();
+    this.requestCoulometry(2);
     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;
+        }
+      });
+    },
     // 获取顶部柱状图数据
-    requestData() {
+    // 损失电量分析  type:1 表示24小时健康趋势,2 表示七天健康趋势 3 表示30天健康趋势
+    requestCoulometry(type) {
       let that = this;
       that.API.requestData({
         method: "POST",
+        timeout: 8000,
         subUrl: "recommen/findAllChartjz",
-        data: {
-          wpId: "0",
-          type: that.type,
-        },
+        data: { wpId: 0, type: 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;
         },
       });
     },
@@ -194,6 +199,7 @@ export default {
       let that = this;
       that.API.requestData({
         method: "POST",
+        timeout: 8000,
         subUrl: "healthmain/findAllMap",
         success(res) {
           res.data.wpmap.forEach((ele) => {

+ 1 - 0
src/views/HealthControl/HealthTab1.vue

@@ -201,6 +201,7 @@ export default {
       let that = this;
       that.API.requestData({
         method: "POST",
+        timeout: 8000,
         subUrl: "recommen/findAllChartjz",
         data: { wpId: 0, type: type },
         success(res) {

+ 1 - 0
src/views/HealthControl/HealthTab2.vue

@@ -90,6 +90,7 @@ export default {
       let that = this;
       that.API.requestData({
         method: "POST",
+        timeout: 8000,
         subUrl: "recommen/findAllChartjz",
         data: { wpId: 0, type: type },
         success(res) {

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

@@ -103,6 +103,7 @@ export default {
       let that = this;
       that.API.requestData({
         method: "POST",
+        timeout: 8000,
         subUrl: "recommen/findAllChartjz",
         data: { wpId: 0, type: type },
         success(res) {