Forráskód Böngészése

功率曲线拟合模块需求修改完成

Koishi 3 éve
szülő
commit
5a339cd84c
1 módosított fájl, 167 hozzáadás és 38 törlés
  1. 167 38
      src/views/totalCurve/chart.vue

+ 167 - 38
src/views/totalCurve/chart.vue

@@ -39,36 +39,91 @@
         (res) => {
           showDialog = false;
           tableData = [];
+          lassoTable = [];
           gzlx = '';
           gzItem = null;
         }
       "
     >
-      <el-table
-        :data="tableData"
-        style="width: 100%; height: 600px; overflow-y: scroll"
-        height="250"
-        border
-      >
-        <el-table-column
-          prop="sj"
-          label="时间"
-          width="200px"
-          align="center"
-        ></el-table-column>
-        <el-table-column
-          prop="fs"
-          label="风速(m/s)"
-          sortable
-          align="center"
-        ></el-table-column>
-        <el-table-column
-          prop="gl"
-          label="功率(kw)"
-          sortable
-          align="center"
-        ></el-table-column>
-      </el-table>
+      <div class="chartDialogBox">
+        <div class="l">
+          <el-table
+            :data="tableData"
+            style="width: 100%; height: 600px; overflow-y: scroll"
+            height="250"
+            border
+          >
+            <el-table-column
+              prop="sj"
+              label="时间"
+              width="200px"
+              align="center"
+            ></el-table-column>
+            <el-table-column
+              prop="fs"
+              label="风速(m/s)"
+              sortable
+              align="center"
+            ></el-table-column>
+            <el-table-column
+              prop="gl"
+              label="功率(kw)"
+              sortable
+              align="center"
+            ></el-table-column>
+          </el-table>
+        </div>
+        <div class="r">
+          <el-table
+            :data="lassoTable"
+            style="width: 100%; height: 600px; overflow-y: scroll"
+            height="250"
+            border
+            row-key="value"
+          >
+            <el-table-column prop="label" label="故障分类" width="130" />
+            <el-table-column prop="warntime" label="故障时间" align="center" />
+            <el-table-column prop="warndes" label="故障描述" align="center" />
+            <el-table-column
+              prop="model"
+              label="机型"
+              align="center"
+              width="100"
+            />
+          </el-table>
+          <el-table
+            :data="lassoTable"
+            style="width: 100%; height: 600px; overflow-y: scroll"
+            height="250"
+            border
+            v-if="false"
+          >
+            <el-table-column type="expand">
+              <template #default="props">
+                <el-table
+                  :data="props.row.children"
+                  style="width: 100%"
+                  height="250"
+                  border
+                >
+                  <el-table-column
+                    prop="warntime"
+                    label="故障时间"
+                    align="center"
+                  />
+                  <el-table-column
+                    prop="warndes"
+                    label="故障描述"
+                    align="center"
+                  />
+                  <el-table-column prop="model" label="机型" align="center" />
+                </el-table>
+              </template>
+            </el-table-column>
+            <el-table-column prop="label" label="故障类型" />
+          </el-table>
+        </div>
+      </div>
       <template #footer>
         <span class="dialog-footer">
           <span class="gzlxTitle" :class="!gzlx ? 'twinkle' : ''"
@@ -86,7 +141,7 @@
               v-for="item in gzlxArray"
               :key="item.id"
               :value="item._index"
-              :label="item.faulttype"
+              :label="item.name"
             >
             </el-option>
           </el-select>
@@ -115,7 +170,7 @@ export default {
   data() {
     return {
       treeData: [],
-      defaultTreeData: [],//默认选中数据
+      defaultTreeData: [], //默认选中数据
       xAxisData: [],
       seriesData: [],
       station: "",
@@ -126,7 +181,9 @@ export default {
       gzlx: "",
       gzlxArray: [],
       gzItem: null,
-      currentNodeKey:""
+      currentNodeKey: "",
+      lassoTimeArray: [],
+      lassoTable: [],
     };
   },
   created() {
@@ -134,6 +191,38 @@ export default {
     this.getGzlx();
   },
   methods: {
+    getLassoData() {
+      const that = this;
+      that.API.requestData({
+        method: "POST",
+        baseURL: "http://192.168.10.5:9002/",
+        subUrl: "powercurve/lasso",
+        data: {
+          station: "NSS_FDC",
+          wtid: "NG01_70",
+          time: that.lassoTimeArray.toString(),
+        },
+        success(res) {
+          let lassoTable = res.data.data;
+          lassoTable.forEach((pEle) => {
+            if (pEle.children?.length) {
+              pEle.sortNum = pEle.children.length;
+              pEle.label += `(${pEle.children.length}条)`;
+            } else {
+              pEle.sortNum = 0;
+              pEle.label += "(0条)";
+            }
+            pEle.children.forEach((cEle) => {
+              cEle.label = "---";
+            });
+          });
+          lassoTable.sort((a, b) => {
+            return b.sortNum - a.sortNum;
+          });
+          that.lassoTable = lassoTable;
+        },
+      });
+    },
     // 选择故障类型
     gzlxChange(idx) {
       let gzItem = this.gzlxArray.find((ele) => {
@@ -154,12 +243,14 @@ export default {
           that.defaultTreeData.push(res.data[0].id);
           that.defaultTreeData.push(res.data[0].children[0].id);
           that.defaultTreeData.push(res.data[0].children[0].children[0].id);
-          that.defaultTreeData.push(res.data[0].children[0].children[0].children[0].id);
+          that.defaultTreeData.push(
+            res.data[0].children[0].children[0].children[0].id
+          );
           let getFirstTreeData = that.getFirstTreeData(res.data[0]);
-          that.currentNodeKey = getFirstTreeData.id
+          that.currentNodeKey = getFirstTreeData.id;
           that.station = getFirstTreeData.stationen;
           that.wtId = getFirstTreeData.windturbineid;
-          that.time = getFirstTreeData.time;   
+          that.time = getFirstTreeData.time;
           that.getChartData();
         },
       });
@@ -311,6 +402,7 @@ export default {
     getSelected(res) {
       const seriesIndex = res[0]?.selected[0]?.seriesIndex;
       const selected = res[0]?.selected[0]?.dataIndex;
+      let lassoTimeArray = [];
       if (selected?.length) {
         let tableData = [];
         selected?.forEach((seleIndex) => {
@@ -320,7 +412,10 @@ export default {
             gl: item[1],
             sj: item[2],
           });
+          lassoTimeArray.push(item[2]);
         });
+        this.lassoTimeArray = lassoTimeArray;
+        this.getLassoData();
         this.tableData = tableData;
         this.showDialog = true;
       }
@@ -334,8 +429,8 @@ export default {
         data.push({
           tag: "0",
           windturbineid: that.wtId,
-          faulttype: that.gzItem.faulttype,
-          faultcode: that.gzItem.faultcode,
+          faulttype: that.gzItem.name,
+          faultcode: that.gzItem.code,
           starttime: ele.sj,
           stationen: that.station,
           category: "1",
@@ -351,12 +446,31 @@ export default {
         },
       }).then((res) => {
         if (res.data.code === 200) {
-          that.showDialog = false;
-          that.BASE.showMsg({
-            type: "success",
-            msg: "保存成功",
+          let lassoData = [];
+
+          this.lassoTable.forEach((pEle) => {
+            pEle.children.forEach((cEle) => {
+              lassoData.push(cEle);
+            });
+          });
+
+          axios({
+            method: "post",
+            url: "http://192.168.10.5:9002/case/warning/insert",
+            data: lassoData,
+            header: {
+              "Content-Type": "application/json",
+            },
+          }).then((res) => {
+            if (res.data.code === 200) {
+              that.showDialog = false;
+              that.BASE.showMsg({
+                type: "success",
+                msg: "保存成功",
+              });
+              that.BASE.closeLoading();
+            }
           });
-          that.BASE.closeLoading();
         }
       });
     },
@@ -405,6 +519,18 @@ export default {
       color: rgb(179, 189, 192);
     }
   }
+
+  .chartDialogBox {
+    width: 100%;
+    display: flex;
+    justify-content: start;
+    align-items: center;
+
+    .l,
+    .r {
+      width: 50%;
+    }
+  }
 }
 </style>
 
@@ -414,5 +540,8 @@ export default {
     max-height: 620px;
     overflow: hidden;
   }
+  .el-table__expand-icon {
+    color: #b3bdc0;
+  }
 }
 </style>