Browse Source

4-26 优化

zhaomiao 3 years ago
parent
commit
c28d5e49b3

+ 1 - 1
src/api/axios.js

@@ -163,7 +163,7 @@ export function postL(url, params = {}) {
     axios.create({
       withCredentials: false, // 允许携带cookie
       baseURL: process.env.VUE_APP_API_URL || '/api/',
-      timeout: 60000, // 请求超时时间 - 60s
+      timeout: 210000, // 请求超时时间 - 60s
       //修改请求头信息
       headers: {
         'Content-Type': 'application/x-www-form-urlencoded'

+ 3 - 0
src/assets/js/singlePerformanceAnalysis/individualHistoryinformation.js

@@ -35,6 +35,7 @@ export default {
       });
 
      },
+     /**改变格式 */
      data_formatter(cellValue){ return this.BASE.getBzDate(new Date(cellValue.recorddate),0)},
      gaindate() {
       this.b = this.$route.query.data;
@@ -48,11 +49,13 @@ export default {
       );
       this.query_wpid();
     },
+    /**返回 */
     goback() {
       this.$router.push({
         path: "/individualPandectinformation"
       });
     },
+    /**获取id */
     query_wpid() {
       this.API.get("powercompare/windfarmAjax?").then((res) => {
         this.wpIdslist = res.data;

+ 2 - 0
src/assets/js/singlePerformanceAnalysis/individualPandectinformation.js

@@ -17,6 +17,7 @@ export default {
   },
   created() {},
   methods: {
+    /**查询数据 */
     query_table(){
       let that = this;
       this.tableData = [];
@@ -28,6 +29,7 @@ export default {
           that.tableData = res.data.list;
       })
     },
+    /**跳转详情或历史 */
     handleEdit(b) {
       this.$router.push({
         path: "/individualPandectinformationdetails",

+ 9 - 1
src/assets/js/singlePerformanceAnalysis/individualPandectinformationdetails.js

@@ -127,10 +127,12 @@ export default {
 
   },
   methods: {
+    /**返回 */
     goback() {
       this.$router.push({ path: "/individualPandectinformation" });
     },
     handleClose() { },
+    /**改变数据格式 */
     formatter_date(cellValue) {
       return this.BASE.getBzDate(new Date(cellValue.warningtime), 0);
     },
@@ -152,6 +154,7 @@ export default {
     headStyle() {
       return "text-align:center";
     },
+    /**刷新 */
     gaindate() {
       let _this = this;
       if (this.fc == null || this.fc == undefined || this.fc == "") {
@@ -173,6 +176,7 @@ export default {
       this.fj = '';
       this.query1();
     },
+    /**查询风场 */
     query1() {
       this.wtIdslist = [];
       let that = this;
@@ -208,6 +212,7 @@ export default {
       });
       this.ybjtable();
     },
+    /**查询数据 */
     ybjtable() {
       let that = this;
       var digital1 = new URLSearchParams();
@@ -280,6 +285,7 @@ export default {
         this.formInline = res.data;
       });
     },
+    /**查看当前卡片状态 */
     handleClick() {
       if (this.activeName == "no_3") {
         this.queryleidatu_fc_01();
@@ -303,6 +309,7 @@ export default {
         this.query_cutin_windspeed1()
       )
     },
+    /**查询数据 */
     query_cutin_windspeed1() {
       this.loading = true;
       let that = this;
@@ -661,6 +668,7 @@ export default {
 
       option && myChart.setOption(option);
     },
+    /**弹出 */
     async tanchu(params) {
       var digital1 = new URLSearchParams();
       digital1.append("wtId", this.fj);
@@ -939,7 +947,7 @@ export default {
       this.currentPage2_gz = val;
       this.gztable();
     },
-
+    /**分页 */
     handleSizeChange_ybj(val) {
       this.pagesize_ybj = val;
       this.ybjtable();

+ 47 - 284
src/assets/js/singlePerformanceAnalysis/powerChart.js

@@ -20,28 +20,37 @@ export default {
       year: "2021",
       month: "01",
       activeName: "no_1",
-      loading:true,
-      loading2:true,
-      loading3:true,
+      loading: true,
+      loading2: true,
+      loading3: true,
       xllist: [],
       scatter_1: [],
       scatter_2: [],
       scatter_3: [],
     };
   },
-  created() {},
+  created() { },
   methods: {
+    /**
+     * 查询风场
+     */
     query_wpid() {
       let that = this;
       let newData = new Date();
-      this.year = newData.getFullYear()+'';
-      let month = newData.getMonth()+1; 
-      if(month<10){that.month='0'+month};
-      this.$http.get("powercompare/windfarmAjax?").then((res) => {
-        this.wpIdslist = res.data.data;
-        // this.query_xml();
+      this.year = newData.getFullYear() + '';
+      let month = newData.getMonth() +'';
+      if(this.month==0){that.month=12;that.year=that.year-1};
+      if (month < 10) { that.month = '0' + month };
+      this.API.get("powercompare/windfarmAjax?").then((res) => {
+        this.wpIdslist = res.data;
+        this.query_xml();
+        this.query_xl();
       });
+      this.query_xl();
     },
+    /**
+     * 当前卡片判断
+     */
     handleClick() {
       if (this.activeName == "no_1") {
         this.query_scatter_1();
@@ -51,15 +60,21 @@ export default {
         this.query_scatter_3();
       }
     },
+    /**
+     * 查线路
+     */
     query_xl() {
       this.xl = "";
       Object.assign(this.$data.xlIdslist, this.$options.data().xlIdslist);
-      this.$http
-        .get("powercompare/lineAjax?pjIds=" + this.xllist)
+      this.API
+        .get("powercompare/lineWpIdAjax?wpId=" + this.fc)
         .then((res) => {
-          this.xlIdslist = res.data.data;
+          this.xlIdslist = res.data;
         });
     },
+    /**
+     * 查数据
+     */
     query_scatter_1() {
       let that = this;
       Object.assign(this.$data.scatter_1, this.$options.data().scatter_1);
@@ -69,11 +84,11 @@ export default {
       digital.append("pjId", "");
       digital.append("year", this.year);
       digital.append("month", this.month);
-      this.$http.post("/scatter/scatterAjax", digital).then((res) => {
+      this.API.postL("/scatter/scatterAjax", digital).then((res) => {
         this.scatter_1 = res.data.data;
-        this.loading1=false;
-        this.draw_scatter_diagram_1();
-        
+        this.loading1 = false;
+        this.ECZM.sdt("scatter_diagram_1",this.scatter_1);
+
       });
     },
     query_scatter_2() {
@@ -85,11 +100,11 @@ export default {
       digital.append("pjId", this.pj);
       digital.append("year", this.year);
       digital.append("month", this.month);
-      this.$http.post("/scatter/scatterAjax", digital).then((res) => {
+      this.API.postL("/scatter/scatterAjax", digital).then((res) => {
         this.scatter_2 = res.data.data;
-        this.loading2=false;
-        this.draw_scatter_diagram_2();
-        
+        this.loading2 = false;
+        this.ECZM.sdt("scatter_diagram_2",this.scatter_2);
+
       });
     },
     query_scatter_3() {
@@ -100,12 +115,15 @@ export default {
       digital.append("pjId", "");
       digital.append("year", this.year);
       digital.append("month", this.month);
-      this.$http.post("/scatter/scatterAjax", digital).then((res) => {
+      this.API.postL("/scatter/scatterAjax", digital).then((res) => {
         this.scatter_3 = res.data.data;
-        this.loading3=false;
-        this.draw_scatter_diagram_3();
+        this.loading3 = false;
+        this.ECZM.sdt("scatter_diagram_3",this.scatter_3);
       });
     },
+    /**
+     * 查项目
+     */
     query_xml() {
       let that = this;
       Object.assign(this.$data.xllist, this.$options.data().xllist);
@@ -113,16 +131,18 @@ export default {
       this.pj = "";
       this.xl = "";
       this.xllist = [];
-      this.$http
+      this.API
         .get("powercompare/projectAjax?wpIds=" + this.fc)
         .then((res) => {
-          this.pjIdslist = res.data.data;
+          this.pjIdslist = res.data;
           for (let i = 0; i < Object.keys(this.pjIdslist).length; i++) {
             that.xllist.push(that.pjIdslist[i].id);
           }
-          this.query_xl();
         });
     },
+    /**
+     * 过滤
+     */
     filter() {
       for (let i = 0; i < Object.keys(this.QBlist).length; i++) {
         fjj = "";
@@ -134,263 +154,6 @@ export default {
         }
       }
     },
-    draw_scatter_diagram_1() {
-      var chartDom = document.getElementById("scatter_diagram_1");
-      var myChart = echarts.init(chartDom);
-      var option;
-
-
-      option = {
-        title: {
-          text: "风机功率排布情况",
-          lft: "300px",
-        },
-        legend: {
-          data: ["功率"],
-          right: "66px",
-        },
-
-        tooltip: {
-          show: false,
-          trigger: "axis",
-          axisPointer: {
-            type: "cross",
-          },
-        },
-        xAxis: {
-          type: "value",
-          scale: true,
-          splitLine: {
-            lineStyle: {
-              type: "dashed",
-            },
-          },
-          axisLabel: {
-            formatter: "{value} m/s",
-          },
-          splitNumber: 20,
-        },
-        yAxis: {
-          type: "value",
-          scale: true,
-          min: -40,
-          splitLine: {
-            lineStyle: {
-              type: "dashed",
-            },
-          },
-          axisLabel: {
-            formatter: "{value} 万kw",
-          },
-        },
-        series: [
-          {
-            name: "功率",
-            type: "scatter",
-            color: "#FF7F50",
-            data: this.scatter_1,
-            markPoint: {
-              data: [
-                { type: "max", name: "最大值" },
-                { type: "min", name: "最小值" },
-              ],
-              symbol: "pin",
-              symbolSize: 50,
-              silent: true,
-            },
-            markLine: {
-              data: [{ type: "average", name: "平均值" }],
-            },
-          },
-          {
-            name: "line",
-            type: "line",
-            smooth: true,
-            datasetIndex: 1,
-            symbolSize: 0.1,
-            symbol: "circle",
-            color: "#87CEFA",
-            label: { show: false },
-            labelLayout: { dx: -20 },
-            encode: { label: 2, tooltip: 1 },
-          },
-        ],
-      };
-
-      option && myChart.setOption(option);
-    },
-    draw_scatter_diagram_2() {
-      var chartDom = document.getElementById("scatter_diagram_2");
-      var myChart = echarts.init(chartDom);
-      var option;
-
-      option = {
-        title: {
-          text: "项目功率排布情况",
-          left: "300px",
-        },
-        legend: {
-          data: ["功率"],
-          right: "66px",
-        },
-
-        tooltip: {
-          show: false,
-          trigger: "axis",
-          axisPointer: {
-            type: "cross",
-          },
-        },
-        xAxis: {
-          splitLine: {
-            lineStyle: {
-              type: "dashed",
-            },
-          },
-          scale: true,
-          axisLabel: {
-            formatter: "{value} m/s",
-          },
-          splitNumber: 20,
-        },
-        yAxis: {
-          min: -40,
-          splitLine: {
-            lineStyle: {
-              type: "dashed",
-            },
-            scale: true,
-          },
-          axisLabel: {
-            formatter: "{value} 万kw",
-          },
-        },
-        series: [
-          {
-            name: "功率",
-            type: "scatter",
-            color: "#FF7F50",
-            data: this.scatter_2,
-            markPoint: {
-              data: [
-                { type: "max", name: "最大值" },
-                { type: "min", name: "最小值" },
-              ],
-              symbol: "pin",
-              symbolSize: 50,
-              silent: true,
-            },
-            markLine: {
-              data: [{ type: "average", name: "平均值" }],
-            },
-          },
-          {
-            name: "line",
-            type: "line",
-            smooth: true,
-            datasetIndex: 1,
-            symbolSize: 0.1,
-            symbol: "circle",
-            color: "#87CEFA",
-            label: { show: false },
-            labelLayout: { dx: -20 },
-            encode: { label: 2, tooltip: 1 },
-          },
-        ],
-      };
-
-      option && myChart.setOption(option);
-    },
-    draw_scatter_diagram_3() {
-      var chartDom = document.getElementById("scatter_diagram_3");
-      var myChart = echarts.init(chartDom);
-      var option;
-
-
-      option = {
-        title: {
-          text: "线路功率排布情况",
-          left: "300px",
-        },
-        legend: {
-          data: ["功率"],
-          right: "66px",
-        },
-
-        tooltip: {
-          show: false,
-          trigger: "axis",
-          axisPointer: {
-            type: "cross",
-          },
-        },
-        xAxis: {
-          splitLine: {
-            lineStyle: {
-              type: "dashed",
-            },
-          },
-          scale: true,
-          axisLabel: {
-            formatter: "{value} m/s",
-          },
-          splitNumber: 20,
-        },
-        yAxis: {
-          min: -40,
-          splitLine: {
-            lineStyle: {
-              type: "dashed",
-            },
-          },
-          axisLabel: {
-            formatter: "{value} 万kw",
-          },
-        },
-        series: [
-          {
-            name: "功率",
-            type: "scatter",
-            color: "#FF7F50",
-            data: this.scatter_3,
-            markPoint: {
-              data: [
-                { type: "max", name: "最大值" },
-                { type: "min", name: "最小值" },
-              ],
-              symbol: "pin",
-              symbolSize: 50,
-              silent: true,
-            },
-            //     emphasis: {
-            //   label: {
-            //     show: true,
-            //     position: "top",
-            //     distance: 4,
-            //     fontStyle: "italic",
-            //   }
-            // },
-            markLine: {
-              data: [{ type: "average", name: "平均值" }],
-            },
-          },
-          {
-            name: "line",
-            type: "line",
-            smooth: true,
-            datasetIndex: 1,
-            symbolSize: 0.1,
-            symbol: "circle",
-            color: "#87CEFA",
-            label: { show: false },
-            labelLayout: { dx: -20 },
-            encode: { label: 2, tooltip: 1 },
-          },
-        ],
-      };
-
-      option && myChart.setOption(option);
-    },
   },
   mounted() {
     this.query_wpid();

+ 9 - 0
src/assets/js/singlePerformanceAnalysis/powerandWindspeedChart.js

@@ -23,6 +23,9 @@ export default {
   },
   created() {},
   methods: {
+    /**
+     * 查询风机风场
+     */
     query() {
       this.wtIdslist = [];
       let that = this;
@@ -43,6 +46,9 @@ export default {
       });
       this.query();
     },
+    /**
+     * 获取数据
+     */
     query_scatter() {
       let sdtDate = [];
       let lineDate = [];
@@ -57,6 +63,9 @@ export default {
         this.loading=false;
       });
     },
+    /**
+     * 画图
+     */
     draw_scatter_diagram(a,b) {
       var chartDom = document.getElementById("scatter_diagram");
       var myChart = echarts.init(chartDom);

+ 143 - 0
src/tools/echartsToolzm.js

@@ -721,6 +721,147 @@ export function qt_DJXNFX(id  , value) {
     
     myChart.setOption(option, true);
   }
+
+/**
+ * 散点图
+ * @param {名称} id 
+ * @param {数据} value 
+ */
+
+export function sdt(id  , value) {
+    if(value === undefined){
+      message.error("没有找到报表数据,请检查!");
+      return;
+    }
+    var myChart = EC.init(document.getElementById(id));
+    var option;
+
+
+      option = {
+        title: {
+          text: "风机功率排布情况",
+          lft: "300px",
+        },
+        legend: {
+          data: ["功率"],
+          right: "66px",
+        },
+
+        tooltip: {
+          show: false,
+          trigger: "axis",
+          axisPointer: {
+            type: "cross",
+          },
+        },
+        xAxis: {
+          type: "value",
+          scale: true,
+          splitLine: {
+            lineStyle: {
+              type: "dashed",
+            },
+          },
+          axisLabel: {
+            formatter: "{value} m/s",
+          },
+          splitNumber: 20,
+        },
+        yAxis: {
+          type: "value",
+          scale: true,
+          min: -40,
+          splitLine: {
+            lineStyle: {
+              type: "dashed",
+            },
+          },
+          axisLabel: {
+            formatter: "{value} 万kw",
+          },
+        },
+        series: [
+          {
+            name: "功率",
+            type: "scatter",
+            color: "#FF7F50",
+            data: value,
+            markPoint: {
+              data: [
+                { type: "max", name: "最大值" },
+                { type: "min", name: "最小值" },
+              ],
+              symbol: "pin",
+              symbolSize: 50,
+              silent: true,
+            },
+            markLine: {
+              data: [{ type: "average", name: "平均值" }],
+            },
+          },
+          {
+            name: "line",
+            type: "line",
+            smooth: true,
+            datasetIndex: 1,
+            symbolSize: 0.1,
+            symbol: "circle",
+            color: "#87CEFA",
+            label: { show: false },
+            labelLayout: { dx: -20 },
+            encode: { label: 2, tooltip: 1 },
+          },
+        ],
+      };
+    
+      myChart.setOption(option, true);
+  }
+
+    /**
+   * 数据长度固定曲线图(多曲线,传service整体)
+   */
+
+export function zzt_cdbqd(id  , value , name ) {
+      if(value === undefined){
+        message.error("没有找到报表数据,请检查!");
+        return;
+      }
+      var myChart = EC.init(document.getElementById(id));
+      var option;
+    option = {
+      title: {
+        text: "折线图堆叠",
+      },
+      tooltip: {
+        trigger: "axis",
+      },
+      legend: {
+        data: value
+      },
+      grid: {
+        left: "3%",
+        right: "4%",
+        bottom: "3%",
+        containLabel: true,
+      },
+      toolbox: {
+        feature: {
+          saveAsImage: {},
+        },
+      },
+      xAxis: {
+        type: "category",
+        data: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],
+      },
+      yAxis: {
+        type: "value",
+      },
+      series:name,
+    };
+    
+    myChart.setOption(option, true);
+  }
+  
 export default {
   getBar_fdd,
   leida_tc,
@@ -730,5 +871,7 @@ export default {
   bar_djbhd,
   bar_DJXNFX,
   qt_DJXNFX,
+  zzt_cdbqd,
+  sdt,
   color,
 }