Bläddra i källkod

AGC模块与AGC曲线拟合模块修改

Koishi 2 dagar sedan
förälder
incheckning
fc2f8cca6d

+ 2 - 2
src/api/powerAnalyse.js

@@ -14,7 +14,7 @@ export function getPowerFittingId(data) {
 export function getPowerFittingChart(data) {
     return request({
         baseURL: process.env.VUE_APP_TEST,
-        url: `new/power/fitting/curve?id=${data.id}`,
+        url: `new/power/fitting/curve${data?.id ? ('?id=' + data.id) : ''}`,
         method: "get",
         timeout: 15000,
     });
@@ -23,7 +23,7 @@ export function getPowerFittingChart(data) {
 export function getPowerFittingTable(data) {
     return request({
         baseURL: process.env.VUE_APP_TEST,
-        url: `new/power/fitting/show?id=${data.id}`,
+        url: `new/power/fitting/show${data?.id ? ('?id=' + data.id) : ''}`,
         method: "get",
     });
 }

+ 3 - 1
src/views/economicsOperation/stationAnalyse/angleAnalysis/index.vue

@@ -132,7 +132,7 @@
               </table-cop>
               <el-pagination
                 layout="prev, pager, next"
-                :total="lossDataParams.total"
+                :total="lossDataParams.currentPages"
                 :current-page="lossDataParams.pageNum"
                 @current-change="
                   (page) => {
@@ -294,6 +294,7 @@ const xdLossTableDataColumn = ref([
   },
 ]);
 const lossDataParams = ref({
+  currentPages: 0,
   startTs: 0,
   endTs: 0,
   pageNum: 1,
@@ -308,6 +309,7 @@ const getXdLossData = (params) => {
     )
     .then((res) => {
       xdLossTableData.value = res.records;
+      lossDataParams.value.currentPages = res.pages;
       lossDataParams.value.total = res.total;
     });
 };

+ 203 - 183
src/views/economicsOperation/windAnalyse/powerCurve/index.vue

@@ -205,7 +205,15 @@
           </div>
         </div>
         <div class="search-actions">
-          <el-button size="mini" round class="buttons" @click="search"
+          <el-button
+            size="mini"
+            round
+            class="buttons"
+            @click="
+              () => {
+                this.search(false);
+              }
+            "
             >曲线拟合</el-button
           >
           <el-button
@@ -308,7 +316,7 @@
           </el-table>
         </el-tab-pane>
         <el-tab-pane label="故障" name="problem">
-            <el-table :data="faultData" row-key="id" :max-height="550">
+          <el-table :data="faultData" row-key="id" :max-height="550">
             <el-table-column property="wtid" align="center" label="风机" />
             <el-table-column
               property="time"
@@ -338,7 +346,7 @@
           </el-table>
         </el-tab-pane>
         <el-tab-pane label="预警" name="warning">
-            <el-table :data="warnData" row-key="id" :max-height="550">
+          <el-table :data="warnData" row-key="id" :max-height="550">
             <el-table-column property="wtid" align="center" label="风机" />
             <el-table-column
               property="time"
@@ -384,12 +392,10 @@ import {
   getPowerFittingChart,
   getPowerFittingTable,
   getPowerFittingSelectedChart,
-  getWindFittingAlarms
+  getWindFittingAlarms,
 } from "@/api/powerAnalyse.js";
-import {
-  getApiequipmentListByWp2
-} from "@/api/monthlyPerformanceAnalysis";
-import dataJson from "./dataJson.json"
+import { getApiequipmentListByWp2 } from "@/api/monthlyPerformanceAnalysis";
+import dataJson from "./dataJson.json";
 export default {
   // 名称
   name: "PowerCurve",
@@ -404,6 +410,7 @@ export default {
   // 数据
   data() {
     return {
+      isFirstLoad: true,
       activeTab: "2",
       checkList: [
         { name: "非并网", code: "isfbw" },
@@ -525,11 +532,11 @@ export default {
   // 函数
   methods: {
     tabClick(val) {
-        if (val.props.name === '1') {
-            this.getTableData();
-        } else {
-            this.getChartData();
-        }
+      if (val.props.name === "1") {
+        this.getTableData();
+      } else {
+        this.getChartData();
+      }
     },
     selectAll() {
       if (this.checked) {
@@ -568,7 +575,7 @@ export default {
           if (res.data.code === 200) {
             this.wpArray = res.data.data;
             this.station = res.data.data[0].id;
-              this.getChartData();
+            this.getChartData();
             this.getWt(this.station, reGetWp);
           }
         });
@@ -577,17 +584,18 @@ export default {
     getWt(wpid, reGetWp) {
       if (wpid) {
         getApiequipmentListByWp2({
-            wpid: wpid,
-          })
-          .then((res) => {
-            if (res.data.code === 200) {
-              this.wtArray = res.data.data;
-              this.wtIds = this.isMultiple ? [res.data.data[0].id] : res.data.data[0].id;
-              if (!reGetWp) {
-                this.search();
-              }
+          wpid: wpid,
+        }).then((res) => {
+          if (res.data.code === 200) {
+            this.wtArray = res.data.data;
+            this.wtIds = this.isMultiple
+              ? [res.data.data[0].id]
+              : res.data.data[0].id;
+            if (!reGetWp) {
+              this.search(true);
             }
-          });
+          }
+        });
       }
     },
     //获取拟合id
@@ -622,17 +630,24 @@ export default {
         dimension: this.dimension,
         mode: this.mode,
       };
-      getPowerFittingId(params).then((res) => {
-        if (res.code == 200) {
-          this.fittingId = res.data.id;
-          this.getChartData();
-          this.getTableData();
-        } else {
-          this.BASE.closeLoading();
-          this.$message.error(res.msg);
-          this.clear();
-        }
-      });
+
+      if (this.isFirstLoad) {
+        this.getChartData();
+        this.getTableData();
+      } else {
+        getPowerFittingId(params).then((res) => {
+          if (res.code == 200) {
+            this.isFirstLoad = false;
+            this.fittingId = res.data.id;
+            this.getChartData();
+            this.getTableData();
+          } else {
+            this.BASE.closeLoading();
+            this.$message.error(res.msg);
+            this.clear();
+          }
+        });
+      }
     },
     //清空数据
     clear() {
@@ -764,143 +779,148 @@ export default {
     },
     // 获取表格数据
     getTableData() {
-        // this.tabledataChange(dataJson.tableData)
+      // this.tabledataChange(dataJson.tableData)
       this.tableLoading = true;
-      getPowerFittingTable({
-        id: this.fittingId,
-      }).then((res) => {
-        this.tabledataChange(res)
+      const params = {};
+      if (!this.isFirstLoad) {
+        params.id = this.fittingId;
+      }
+      getPowerFittingTable(params).then((res) => {
+        this.tabledataChange(res);
       });
     },
     tabledataChange(res) {
-        if (res.code == 200) {
-          this.tableColumn = res.data.title.map((o) => {
-            return {
-              prop: o.key,
-              width: o.des === "时间" ? 100 : 80,
-              label: o.des,
-            };
-          });
-          this.tableData = res.data.data;
-          this.$message.success(res.msg);
-        }
-        this.tableLoading = false;
+      if (res.code == 200) {
+        this.tableColumn = res.data.title.map((o) => {
+          return {
+            prop: o.key,
+            width: o.des === "时间" ? 100 : 80,
+            label: o.des,
+          };
+        });
+        this.tableData = res.data.data;
+        this.$message.success(res.msg);
+      }
+      this.tableLoading = false;
     },
     // 获取图表数据
     getChartData() {
-        // this.chartdataChange(dataJson.chartData)
-      getPowerFittingChart({
-        id: this.fittingId,
-      }).then((res) => {
-        this.chartdataChange(res)
+      // this.chartdataChange(dataJson.chartData)
+      const params = {};
+      if (!this.isFirstLoad) {
+        params.id = this.fittingId;
+      }
+      getPowerFittingChart(params).then((res) => {
+        this.chartdataChange(res);
       });
     },
     chartdataChange(res) {
-        if (res.code == 200) {
-          let chartRes = {
-            scatterhs: [[]],
-            scatterls: [[]],
-            sjgl: [[]],
-            llgl: [[]],
-            cpz: [[]],
-          };
-          chartRes = res.data;
-          this.markDot.pcl5 = chartRes.obj.pc5ratio;
-          this.markDot.pcl10 = chartRes.obj.pc10ratio;
-          this.markDot.pcl12 = chartRes.obj.pc12ratio;
-          this.markDot.pcl25 = chartRes.obj.pc25ratio;
-          this.avgObj.title =
-            this.mode == 0
-              ? chartRes.obj.code
-              : chartRes.obj.path
-                  .substring(
-                    chartRes.obj.path.indexOf(chartRes.obj.station + "_") +
-                      (chartRes.obj.station + "_").length
-                  )
-                  .split("_")[0];
-          this.avgObj.cpavg = Number(chartRes.obj.cpavg).toFixed(2);
-          this.avgObj.frequency = Number(chartRes.obj.frequency).toFixed(2);
-          this.avgObj.pcratio = Number(chartRes.obj.pcratio).toFixed(2);
-          this.dataSet = JSON.stringify([
-            {
-              source: chartRes.wyd,
+      if (res.code == 200) {
+        let chartRes = {
+          scatterhs: [[]],
+          scatterls: [[]],
+          sjgl: [[]],
+          llgl: [[]],
+          cpz: [[]],
+        };
+        chartRes = res.data;
+        this.markDot.pcl5 = chartRes.obj.pc5ratio;
+        this.markDot.pcl10 = chartRes.obj.pc10ratio;
+        this.markDot.pcl12 = chartRes.obj.pc12ratio;
+        this.markDot.pcl25 = chartRes.obj.pc25ratio;
+        this.avgObj.title =
+          this.mode == 0
+            ? chartRes.obj.code
+            : chartRes.obj.path
+                .substring(
+                  chartRes.obj.path.indexOf(chartRes.obj.station + "_") +
+                    (chartRes.obj.station + "_").length
+                )
+                .split("_")[0];
+        this.avgObj.cpavg = Number(chartRes.obj.cpavg).toFixed(2);
+        this.avgObj.frequency = Number(chartRes.obj.frequency).toFixed(2);
+        this.avgObj.pcratio = Number(chartRes.obj.pcratio).toFixed(2);
+        this.dataSet = JSON.stringify([
+          {
+            source: chartRes.wyd,
+          },
+          {
+            source: chartRes.yyd,
+          },
+        ]);
+        this.seriesData = [
+          {
+            name: "拟合功率",
+            type: "line",
+            symbol: "line", //设定为实心点
+            symbolSize: 0, //设定实心点的大小
+            smooth: true, //这个是把线变成曲线
+            data: chartRes.sjgl,
+            xAxisIndex: 0,
+          },
+          {
+            name: "保证功率",
+            type: "line",
+            symbol: "line", //设定为实心点
+            symbolSize: 0, //设定实心点的大小
+            smooth: true, //这个是把线变成曲线
+            data: chartRes.llgl,
+            xAxisIndex: 0,
+          },
+          {
+            type: "effectScatter",
+            showEffectOn: "emphasis",
+            rippleEffect: {
+              scale: 1,
             },
-            {
-              source: chartRes.yyd,
+            name: "无用点",
+            symbolSize: (data) => {
+              return data.s ? (data.s > 10 ? 10 : data.s) : 4;
             },
-          ]);
-          this.seriesData = [
-            {
-              name: "拟合功率",
-              type: "line",
-              symbol: "line", //设定为实心点
-              symbolSize: 0, //设定实心点的大小
-              smooth: true, //这个是把线变成曲线
-              data: chartRes.sjgl,
-              xAxisIndex: 0,
+            datasetIndex: 0,
+            encode: {
+              x: "x",
+              y: "y",
             },
-            {
-              name: "保证功率",
-              type: "line",
-              symbol: "line", //设定为实心点
-              symbolSize: 0, //设定实心点的大小
-              smooth: true, //这个是把线变成曲线
-              data: chartRes.llgl,
-              xAxisIndex: 0,
+            xAxisIndex: 0,
+            yAxisIndex: 0,
+          },
+          {
+            type: "effectScatter",
+            showEffectOn: "emphasis",
+            rippleEffect: {
+              scale: 1,
             },
-            {
-              type: "effectScatter",
-              showEffectOn: "emphasis",
-              rippleEffect: {
-                scale: 1,
-              },
-              name: "无用点",
-              symbolSize: (data) => {
-                return data.s ? (data.s > 10 ? 10 : data.s) : 4;
-              },
-              datasetIndex: 0,
-              encode: {
-                x: "x",
-                y: "y",
-              },
-              xAxisIndex: 0,
-              yAxisIndex: 0,
+            name: "有用点",
+            symbolSize: (data) => {
+              return data.s ? (data.s > 10 ? 10 : data.s) : 4;
             },
-            {
-              type: "effectScatter",
-              showEffectOn: "emphasis",
-              rippleEffect: {
-                scale: 1,
-              },
-              name: "有用点",
-              symbolSize: (data) => {
-                return data.s ? (data.s > 10 ? 10 : data.s) : 4;
-              },
-              datasetIndex: 1,
-              encode: {
-                x: "x",
-                y: "y",
-              },
-              xAxisIndex: 0,
-              yAxisIndex: 0,
-            },
-            {
-              name: "Cp值",
-              type: "line",
-              symbol: "line", //设定为实心点
-              symbolSize: 0, //设定实心点的大小
-              smooth: true, //这个是把线变成曲线
-              data: chartRes.cpz,
-              xAxisIndex: 0,
-              yAxisIndex: 1,
+            datasetIndex: 1,
+            encode: {
+              x: "x",
+              y: "y",
             },
-          ];
-          this.$message.success(res.msg);
-        }
-        this.BASE.closeLoading();
+            xAxisIndex: 0,
+            yAxisIndex: 0,
+          },
+          {
+            name: "Cp值",
+            type: "line",
+            symbol: "line", //设定为实心点
+            symbolSize: 0, //设定实心点的大小
+            smooth: true, //这个是把线变成曲线
+            data: chartRes.cpz,
+            xAxisIndex: 0,
+            yAxisIndex: 1,
+          },
+        ];
+        this.$message.success(res.msg);
+      }
+      this.BASE.closeLoading();
     },
     //拟合按钮
-    search() {
+    search(isFirstLoad = true) {
+      this.isFirstLoad = isFirstLoad;
       this.isChartArea = false;
       if (!this.station || !this.wtIds || !this.wtIds.length) {
         this.BASE.showMsg({
@@ -911,32 +931,32 @@ export default {
       }
     },
     handleClick(val) {
-        this.wtTab = val.props.name;
-        if (this.wtTab === "problem") {
-            this.faultDataFn();
-        } else if (this.wtTab === "warning") {
-            this.warnDataFn();
-        }
+      this.wtTab = val.props.name;
+      if (this.wtTab === "problem") {
+        this.faultDataFn();
+      } else if (this.wtTab === "warning") {
+        this.warnDataFn();
+      }
     },
     //故障数据
     async faultDataFn() {
-        let params = {
-            // only: dataRadom.value,
-            alarmList: this.allpowerFittingData,
-            table: "alarmWt",
-        };
-        const faultRes = await getWindFittingAlarms(params);
-        this.faultData = faultRes.data;
+      let params = {
+        // only: dataRadom.value,
+        alarmList: this.allpowerFittingData,
+        table: "alarmWt",
+      };
+      const faultRes = await getWindFittingAlarms(params);
+      this.faultData = faultRes.data;
     },
     //预警数据
     async warnDataFn() {
-        let params = {
-            // only: dataRadom.value,
-            alarmList: this.allpowerFittingData,
-            table: "alarmCt",
-        };
-        const warnRes = await getWindFittingAlarms(params);
-        this.warnData = warnRes.data;
+      let params = {
+        // only: dataRadom.value,
+        alarmList: this.allpowerFittingData,
+        table: "alarmCt",
+      };
+      const warnRes = await getWindFittingAlarms(params);
+      this.warnData = warnRes.data;
     },
     async funChartSelect(batch) {
       const wDataArr = [];
@@ -965,13 +985,13 @@ export default {
             wk: wDataArr.join(","),
           });
           this.allpowerFittingData = [];
-            wtRes.data.forEach((it) => {
-                let obj = {
-                    wtId: it.wtId,
-                    time: it.time,
-                };
-                this.allpowerFittingData.push(obj);
-            });
+          wtRes.data.forEach((it) => {
+            let obj = {
+              wtId: it.wtId,
+              time: it.time,
+            };
+            this.allpowerFittingData.push(obj);
+          });
           if (wtRes.code === 200) {
             let id = 1;
             const tempArr = []; //用于以风机id 聚合dataArr
@@ -1092,8 +1112,8 @@ export default {
         .custom {
           width: auto;
         }
-        .customsv{
-            width: 100%;
+        .customsv {
+          width: 100%;
         }
       }
       .search-actions {