Переглянути джерело

健康报告无数据bug改

mw_666 3 роки тому
батько
коміт
c1e15ccef3

+ 36 - 32
src/components/other/healthReport/index.vue

@@ -879,7 +879,7 @@
             >中频:{{ datas.mediatefrequency }}</el-form-item
           >
           <el-form-item class="m-b-10 text-indent-4"
-            >低频:{{ datas.fowfrequency }}</el-form-item
+            >低频:{{ datas.fowfrequency == 'null'?'暂无数据':datas.fowfrequency }}</el-form-item
           >
           <el-form-item class="text-indent-2"
             >推荐检修理由:{{ datas.reason }}</el-form-item
@@ -1616,12 +1616,15 @@ export default {
       default: () => {},
     },
   },
-  created() {},
+  created() {
+	  this.getReport();
+  },
   beforeUpdate() {
     var that = this;
     that.$nextTick(() => {
       that.others();
     });
+	
   },
   mounted() {
     this.dialogVisible = this.show;
@@ -1702,7 +1705,7 @@ export default {
     },
 
     // 获取报告详情
-    getReport() {
+    getReport(wtid,recorddate) {
       let that = this;
       let reqData = this.params;
       that.API.requestData({
@@ -1711,18 +1714,17 @@ export default {
         baseURL: "http://10.155.32.4:8034/",
         subUrl: "/healthreport/healthReport",
         data: {
-          wtid: reqData.wtId,
-          // wtid: "MG01_01",
-          // date: "2021-07-30",
-          date: reqData.recorddate,
+    //       wtid: reqData.wtId,
+		  // date: reqData.recorddate,
+          wtid: wtid,
+          date: recorddate,
         }, // 请求所携带参数,默认为空,可缺省
         success(res) {
           if (res.code == 200) {
-            that.datas = res.data;
-            that.healthreport = res.data.healthreport;
-            that.randomInitDate();
-
-            that.qxpcls = [];
+				that.datas = res.data;
+				that.healthreport = that.datas.healthreport;
+				that.randomInitDate();
+    
             // 功率曲线拟合
             let glqxnh = [
               {
@@ -1736,7 +1738,7 @@ export default {
                 value: [],
               },
             ];
-            res.data.healthreport.nhglqxs.forEach((item) => {
+            that.datas.healthreport.nhglqxs && that.datas.healthreport.nhglqxs.forEach((item) => {
               if (Number(item.speed) % 1 == 0) {
                 glqxnh[0].value.push({
                   text: item.speed,
@@ -1751,6 +1753,7 @@ export default {
             that.glqxnh = glqxnh;
 
             //曲线偏差率
+	        that.qxpcls = [];
             let qxpcls = [
               {
                 title: "曲线偏差率",
@@ -1763,7 +1766,7 @@ export default {
                 value: [],
               },
             ];
-            let qxpcl = res.data.healthreport.qxpcls.sort(that.compare("date"));
+            let qxpcl = that.datas.healthreport.qxpcls.sort(that.compare("date"));
             if (qxpcl != null && qxpcl != undefined) {
               for (var i = qxpcl.length - 1; i >= 0; i--) {
                 qxpcls[0].value.push({
@@ -1803,21 +1806,21 @@ export default {
                 },
               ],
             };
-            res.data.healthreport.nipples.forEach((item) => {
+            that.datas.healthreport.nipples && that.datas.healthreport.nipples.forEach((item) => {
               let obj = {
                 text: item.pcl,
                 value: item.count,
               };
               dfpc.nipples[0].value.push(obj);
             });
-            res.data.healthreport.dfpclpowers.forEach((item) => {
+            that.datas.healthreport.dfpclpowers && that.datas.healthreport.dfpclpowers.forEach((item) => {
               let obj = {
                 text: item.power,
                 value: item.dfpcl,
               };
               dfpc.dfpclpowers[0].value.push(obj);
             });
-            res.data.healthreport.dfpclSpeeds.forEach((item) => {
+            that.datas.healthreport.dfpclSpeeds && that.datas.healthreport.dfpclSpeeds.forEach((item) => {
               let obj = {
                 text: item.speed,
                 value: item.dfpcl,
@@ -1828,9 +1831,9 @@ export default {
 
             // 部件隐患对比
             that.bjyhdbs = [];
-            that.bjyhdbs = res.data.healthreport.bjyhdbs;
+            that.bjyhdbs = that.datas.healthreport.bjyhdbs;
             // 隐患模型对比
-            let ybmxdj = res.data.healthreport.yhmxdbs;
+            let ybmxdj = that.datas.healthreport.yhmxdbs;
             if (ybmxdj != null) {
               for (let item of ybmxdj) {
                 if (item.part.indexOf("传动链")) {
@@ -1896,7 +1899,7 @@ export default {
 
             //切入切出对比
             that.qrqcs = [];
-            res.data.healthreport.qrqcs.forEach((item) => {
+            that.datas.healthreport.qrqcs && that.datas.healthreport.qrqcs.forEach((item) => {
               item.xfqr = item.xfqr == null ? 0 : item.xfqr.toFixed(2);
               item.xfqc = item.xfqc == null ? 0 : item.xfqc.toFixed(2);
               item.dfqr = item.dfqr == null ? 0 : item.dfqr.toFixed(2);
@@ -1905,7 +1908,7 @@ export default {
             });
 
             //设备可利用率
-            let sbklyls = res.data.healthreport.sbklyls;
+            let sbklyls = that.datas.healthreport.sbklyls;
             that.sbklyls = sbklyls;
             that.sbklyls2 = [];
             let sblyl = Object.assign([], sbklyls);
@@ -1961,7 +1964,7 @@ export default {
               that.sbklyls2.push(sbklyls7);
 
               // 风能利用率
-              let fnlyl = res.data.healthreport.fnlyls;
+              let fnlyl = that.datas.healthreport.fnlyls;
               let fnlyl1 = {
                 name: "发电量",
                 q1ysj: fnlyl[2].fdl.toFixed(2),
@@ -2028,15 +2031,15 @@ export default {
             }
 
             // 故障分类
-            that.faultclass = res.data.healthreport.faultclass.sort(
+            that.faultclass = that.datas.healthreport.faultclass.sort(
               that.compare("monthwarningnum")
             );
 
             // 功率对部件温度影响
             that.partwds = [];
-            let partwds = res.data.healthreport.partwds;
+            let partwds = that.datas.healthreport.partwds;
             let partwd = [];
-            partwds.forEach((item, i) => {
+            partwds && partwds.forEach((item, i) => {
               let bj = "";
               if (item.part == "zk") {
                 bj = "主控";
@@ -2077,7 +2080,7 @@ export default {
 
             // 性能评价结果
             that.xnpjjg = [];
-            let pjmxs = res.data.healthreport.pjjgs;
+            let pjmxs = that.datas.healthreport.pjjgs;
             if (pjmxs != null && pjmxs != undefined) {
               if (pjmxs[2] != undefined) {
                 let xnpj1 = {
@@ -2110,7 +2113,7 @@ export default {
 
             // 评价结果明细
             that.xnpjmx = [];
-            let pjmx = res.data.healthreport.pjmxs[0];
+            let pjmx = that.datas.healthreport.pjmxs[0];
             that.zhrank = pjmx.rank;
             let xnpjmx1 = {
               lx: "",
@@ -2273,7 +2276,7 @@ export default {
             that.xnpjmx.push(xnpjmx19);
             that.xnpjmx.push(xnpjmx20);
             // 评价明细蜘蛛图
-            let pjmxsE = res.data.healthreport.pjmxs[0];
+            let pjmxsE = that.datas.healthreport.pjmxs[0];
             that.pjmxs = [
               {
                 indicator: [
@@ -2338,7 +2341,7 @@ export default {
                 },
               ];
 
-            res.data.healthreport.wttragetreportcharts.forEach((item) => {
+            that.datas.healthreport.wttragetreportcharts && that.datas.healthreport.wttragetreportcharts.forEach((item) => {
               var recorddate = new Date(item.recorddate).formatDate(
                 "yyyy-MM-dd hh:mm"
               );
@@ -2497,9 +2500,10 @@ export default {
   watch: {
     show(value) {
       this.dialogVisible = value;
-      if (value) {
-        this.getReport();
-      }
+	  // console.log(value)
+      // if (value) {
+      //   this.datas();
+      // }
     },
     params(res) {
       this.reqData = res;

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

@@ -75,7 +75,7 @@
         </div>
       </panel>
     </div>
-    <health-report :show="reportshow" :params="reportparams" @closed="closed" />
+    <health-report :show="reportshow" :params="reportparams" @closed="closed" ref="eport"/>
   </div>
 </template>
 
@@ -146,11 +146,13 @@ export default {
     },
     // 查看健康报告
     onClickReport(item) {
+		let recorddate = new Date(item.createdate).formatDate("yyyy-MM-dd");
       this.reportshow = true;
       this.reportparams = {
         wtId: item.wtid,
         recorddate: new Date(item.createdate).formatDate("yyyy-MM-dd"),
       };
+	  this.$refs.eport.getReport(item.wtid,recorddate);
     },
     // 关闭健康报告
     closed() {