Koishi 3 роки тому
батько
коміт
03ad8defa3

+ 12 - 0
src/tools/excel/exportExcel.js

@@ -0,0 +1,12 @@
+// 导出的方法  tHeader => 设置Excel的表格第一行的标题  filterVal => 对象的属性key值 被导出listData => 导出数据  => 导出(文件)名称
+import { export_json_to_excel } from "./Export2Excel"; //引入文件
+
+export function outExportExcel(tHeader = [], filterVal = [], listData = [], exportName = new Date().getTime()) {
+    // 注意这个Export2Excel路径
+    const data = formatJson(filterVal, listData);
+    export_json_to_excel(tHeader, data, exportName);
+}
+
+function formatJson(filterVal, jsonData) {
+    return jsonData.map(v => filterVal.map(j => v[j]))
+}

Різницю між файлами не показано, бо вона завелика
+ 29 - 11
src/views/MalfunctionWarning/MalfunctionWarning.vue


+ 11 - 10
src/views/MalfunctionWarning/components/detectionRecord.vue

@@ -31,35 +31,34 @@
         <el-table-column
           prop="starttime"
           label="故障时间"
-          width="180"
+          width="160"
           align="center"
         ></el-table-column>
         <el-table-column
           prop="stationen"
           label="风场"
-          width="120"
+          width="80"
           align="center"
         ></el-table-column>
         <el-table-column
           prop="stationcn"
           label="场站名称"
-          width="140"
+          width="120"
           align="center"
         ></el-table-column>
         <el-table-column
           prop="windturbineid"
           label="风机编号"
-          width="120"
+          width="100"
           align="center"
         ></el-table-column>
         <el-table-column
           prop="model"
           label="风机型号"
-          width="120"
+          width="80"
           align="center"
         ></el-table-column>
-        <el-table-column width="210" label="故障标签">
-               
+        <el-table-column width="200" label="故障标签">
           <template #default="scope">
             <span>
               <el-select
@@ -68,7 +67,7 @@
                 clearable
                 placeholder="请选择"
                 popper-class="select"
-                style="width: 150px; margin-left: 30px"
+                style="width: 130px; margin-left: 30px"
               >
                 <el-option
                   v-for="item in faultLists"
@@ -80,9 +79,8 @@
               </el-select>
             </span>
           </template>
-             
         </el-table-column>
-        <el-table-column width="120">
+        <el-table-column width="120" label="操作">
           <button class="btn" @click="getReports()">查看检测报告</button>
         </el-table-column>
       </el-table>
@@ -171,4 +169,7 @@ export default {
 };
 </script>
 <style lang="less" scoped>
+.btn{
+  width: 106px !important;
+}
 </style>

+ 14 - 2
src/views/MalfunctionWarning/components/records.vue

@@ -114,7 +114,16 @@ export default {
       accuracyList:{},
       barList: [],
       resultList: [],
-      showResultList: [],
+      showResultList: [
+        {
+          showTime: '2021-12-08 12:02:00',
+          showName: '牛首山UP82型风机DBSCAN模型',
+        },
+        {
+          showTime: '2021-12-08 11:22:23',
+          showName: '麻黄山UP77型风机DBSCAN模型',
+        },
+      ],
       recordList: [],
       detialsDisplay: false,
       colors: [
@@ -175,6 +184,9 @@ export default {
           name: "",
           encode: { tooltip: [0, 1] },
           symbolSize: 10,
+          itemStyle: {
+            color: "#FF0000",
+          },
           data: [
             [1.0, 8.04],
             [18.07, 6.95],
@@ -237,7 +249,7 @@ export default {
         baseURL: "http://192.168.10.18:8080/",
         subUrl: "api/coordinate/history",
         success(res) {
-          if (res) {
+          if (res.length > 0) {
             res.forEach((item) => {
               let arr = item.name.split("-");
               item.coordinate = JSON.parse(item.coordinate);

+ 8 - 8
src/views/MalfunctionWarning/components/superviseDataClassify.vue

@@ -80,7 +80,7 @@
             <el-table-column
               prop="starttime"
               label="故障时间"
-              width="180"
+              width="170"
               align="center"
             ></el-table-column>
             <el-table-column
@@ -92,7 +92,7 @@
             <el-table-column
               prop="stationcn"
               label="场站名称"
-              width="150"
+              width="130"
               align="center"
             ></el-table-column>
             <el-table-column
@@ -104,13 +104,13 @@
             <el-table-column
               prop="model"
               label="风机型号"
-              width="100"
+              width="90"
               align="center"
             ></el-table-column>
             <el-table-column
               prop="faulttype"
               label="故障"
-              width="120"
+              width="80"
               align="center"
             ></el-table-column>
           </el-table>
@@ -139,7 +139,7 @@
             <el-table-column
               prop="starttime"
               label="故障时间"
-              width="175"
+              width="170"
               align="center"
             ></el-table-column>
             <el-table-column
@@ -151,7 +151,7 @@
             <el-table-column
               prop="stationcn"
               label="场站名称"
-              width="150"
+              width="130"
               align="center"
             ></el-table-column>
             <el-table-column
@@ -163,13 +163,13 @@
             <el-table-column
               prop="model"
               label="风机型号"
-              width="100"
+              width="90"
               align="center"
             ></el-table-column>
             <el-table-column
               prop="faulttype"
               label="故障"
-              width="110"
+              width="80"
               align="center"
             ></el-table-column>
           </el-table>

+ 29 - 3
src/views/MalfunctionWarning/supervised.vue

@@ -62,13 +62,13 @@
                   clearable
                   placeholder="请选择"
                   popper-class="select"
-                  style="width: 130px; margin-left: 20px"
+                  style="width: 170px; margin-left: 20px"
                 >
                   <el-option
                     v-for="item in options"
                     :key="item.value"
                     :value="item.value"
-                    :label="item.value"
+                    :label="item.label"
                   />
                 </el-select>
               </div>
@@ -206,10 +206,12 @@ export default {
     )[0];
     this.selectMoudle = select.station[0].lable;
     this.moudleList = select.station;
+    this.getfaultLables();
   },
   data() {
     return {
       dataList: [],
+      faultLists: [],
       lossList: {},
       accuracyList: {},
       barList: [],
@@ -233,6 +235,7 @@ export default {
       options: [
         {
           value: "NSS_FDC",
+          label: "牛首山风电场",
           station: [
             {
               lable: "UP82",
@@ -242,6 +245,7 @@ export default {
         },
         {
           value: "MHS_FDC",
+          label: "麻黄山风电场",
           station: [
             {
               lable: "UP77",
@@ -255,6 +259,7 @@ export default {
         },
         {
           value: "QS_FDC",
+          label: "青山风电场",
           station: [
             {
               lable: "CCWE-1500",
@@ -268,6 +273,7 @@ export default {
         },
         {
           value: "SBQ_FDC",
+          label: "石板泉风电场",
           station: [
             {
               lable: "UP82",
@@ -285,6 +291,7 @@ export default {
         },
         {
           value: "XS_FDC",
+          label: "香山风电场",
           station: [
             {
               lable: "UP97",
@@ -313,6 +320,19 @@ export default {
     this.getType();
   },
   methods: {
+    getfaultLables() {
+      let that = this;
+      this.API.requestData({
+        method: "GET",
+        subUrl: "http://192.168.1.18:9002/know/fault/type/all",
+        success(res) {
+          if (res) {
+            console.log(444444444);
+            that.faultLists = res.data;
+          }
+        },
+      });
+    },
     getType() {
       let that = this;
       this.API.requestData({
@@ -372,16 +392,22 @@ export default {
         },
         success(res) {
           if (res) {
+            console.log(333333333);
             that.allData = res.data;
             res.data.forEach((item) => {
               let array = that.dataList.filter(
                 (val) => val.code === item.faultcode
               );
+              item.stationcn = that.options.filter(
+                  (items) => items.value === item.stationen
+                )[0]?.label;
               if (array.length > 0) {
                 array[0].children.push(item);
               } else {
                 let obj = {
-                  name: item.faulttype,
+                  name: that.faultLists.filter(
+                    (items) => items.faultcode === item.faultcode
+                  )[0]?.faulttype,
                   code: item.faultcode,
                   children: [],
                 };

+ 125 - 46
src/views/device/device.vue

@@ -1,15 +1,20 @@
 <template>
   <div class="main deviceClass">
     <el-card class="box-card-tree">
-      <button  class="btn green" style="margin-bottom:10px" @click="handleTreeAdd()"
-        >新增</button
+      <button
+        class="btn green"
+        style="margin-bottom: 10px"
+        @click="handleTreeAdd()"
       >
+        新增
+      </button>
       <button
         class="btn green"
         @click="handleTreeDel()"
         :disabled="state.isDel == ''"
-        >删除</button
       >
+        删除
+      </button>
       <el-tree
         :data="state.treedata"
         :props="state.defaultProps"
@@ -22,7 +27,42 @@
     <el-card class="box-card">
       <el-tabs type="card" class="tab">
         <el-tab-pane label="传感点">
-          <el-row :gutter="24" align="middle">
+          <div class="devicemenu">
+            <button
+              class="btn"
+              style="margin-bottom: 10px"
+              @click="handleEdit(state.addFormData)"
+              :disabled="state.desc.code == ''"
+            >
+              新增
+            </button>
+            <el-input
+            style="width:180px;margin: 0 10px;"
+              v-model="state.SearchVal"
+              placeholder="筛选"
+              :prefix-icon="Search"
+              @input="fifterSearch()"
+              size="small"
+            />
+            <button
+              class="btn"
+              size="mini"
+              type="primary"
+              :disabled="state.desc.code == ''"
+            >
+              导入
+            </button>
+            <button
+              class="btn"
+              size="mini"
+              type="primary"
+              @click="export2Excel"
+              :disabled="state.desc.code == ''"
+            >
+              导出
+            </button>
+          </div>
+          <!-- <el-row :gutter="24" align="middle">
             <el-col :span="2">
               <button
                  class="btn green"
@@ -41,27 +81,34 @@
                 size="small"
               />
             </el-col>
-          </el-row>
+          </el-row> -->
           <el-table
             :data="state.fifterSearchTableData"
             stripe
             style="width: 100%"
             height="700"
           >
-            <el-table-column type="index" width="50" />
+            <el-table-column type="index" width="50" align="center"/>
             <el-table-column
               prop="metriccode"
               label="测点编码"
+              align="center"
             ></el-table-column>
-            <el-table-column label="名称">
+            <el-table-column label="名称" align="center">
               <template #default="scope">
                 <el-popover placement="right" :width="260" trigger="click">
                   <template #reference>
-                    <el-button type="text" style="color: #B3BDC0" size="small">{{
-                      scope.row.name
-                    }}</el-button>
+                    <el-button
+                      type="text"
+                      style="color: #b3bdc0"
+                      size="small"
+                      >{{ scope.row.name }}</el-button
+                    >
                   </template>
-                  <el-table :data="scope.row.deviceModelMetrics" max-height="400px">
+                  <el-table
+                    :data="scope.row.deviceModelMetrics"
+                    max-height="400px"
+                  >
                     <el-table-column
                       property="devicemodel"
                       label="机型"
@@ -82,27 +129,29 @@
               </template>
             </el-table-column>
 
-            <el-table-column prop="unitname" label="单位"></el-table-column>
+            <el-table-column prop="unitname" label="单位" align="center"></el-table-column>
             <el-table-column
               prop="categorydata"
               label="测点类型"
+              align="center"
             ></el-table-column>
             <el-table-column
               prop="categorysci"
               label="物理类型"
+              align="center"
             ></el-table-column>
-            <el-table-column prop="description" label="描述"></el-table-column>
+            <el-table-column prop="description" label="描述" align="center"></el-table-column>
             <el-table-column label="操作" width="180" align="center">
               <template #default="scope">
                 <el-button
                   type="text"
-                  style="color: #B3BDC0"
+                  style="color: #b3bdc0"
                   @click="handleEdit(scope.row)"
                   >编辑</el-button
                 >
                 <el-button
                   type="text"
-                  style="color: #B3BDC0"
+                  style="color: #b3bdc0"
                   @click="handleDelete(scope.row)"
                   >删除</el-button
                 >
@@ -149,7 +198,7 @@
             </el-form-item>
             <el-form-item label="是否有效">
               <el-switch
-              class="elswitch"
+                class="elswitch"
                 v-model="state.desc.enabled"
                 active-color="#13ce66"
                 inactive-color="#ff4949"
@@ -158,11 +207,12 @@
           </el-form>
           <button
             style="float: right"
-             class="btn green"
+            class="btn green"
             @click="savedesc"
             :disabled="state.desc.code == ''"
-            >保存</button
           >
+            保存
+          </button>
         </el-tab-pane>
       </el-tabs>
     </el-card>
@@ -225,7 +275,7 @@
               <el-cascader
                 v-model="editFormData.structurecode"
                 :options="state.cascaderdata"
-                :props="{ checkStrictly: true ,emitPath:false}"
+                :props="{ checkStrictly: true, emitPath: false }"
                 clearable
               /> </el-form-item
           ></el-col>
@@ -246,7 +296,6 @@
         </el-row>
 
         <el-form-item label="适配机型" class="deviceModelClass">
-        
           <el-select
             v-model="state.deviceModelSel"
             style="margin-right: 20px"
@@ -261,16 +310,22 @@
             >
             </el-option>
           </el-select>
-            <button  class="btn green"  v-show="state.deviceModelSel !=''" size="mini" type="primary" @click="deviceModelAdd()"
-            >新增机型</button
+          <button
+            class="btn green"
+            v-show="state.deviceModelSel != ''"
+            size="mini"
+            type="primary"
+            @click="deviceModelAdd()"
           >
+            新增机型
+          </button>
           <el-table
             :data="editFormData.deviceModelMetrics"
             style="width: 100%"
             max-height="200px"
           >
             <el-table-column prop="devicemodel" label="机型" />
-            <el-table-column  label="倍率">
+            <el-table-column label="倍率">
               <template #default="scope">
                 <el-input v-model="scope.row.multiplier" size="mini" />
               </template>
@@ -285,13 +340,15 @@
       </el-form>
       <template #footer>
         <span class="dialog-footer">
-          <button  class="btn green"  @click="editVisible = false">取 消</button>
-          <button  class="btn green"  type="primary" @click="saveEdit">确 定</button>
+          <button class="btn green" @click="editVisible = false">取 消</button>
+          <button class="btn green" type="primary" @click="saveEdit">
+            确 定
+          </button>
         </span>
       </template>
     </el-dialog>
     <!-- tree add 弹出框 -->
-    <el-dialog v-model="treeVisible" width="40%"  custom-class="modal">
+    <el-dialog v-model="treeVisible" width="40%" custom-class="modal">
       <el-form :model="state.treeAddFormData" label-width="80px">
         <el-row :gutter="24">
           <el-col :span="12">
@@ -334,13 +391,12 @@
           ></el-col>
           <el-col :span="4">
             <el-form-item label="是否有效">
-               <el-switch 
+              <el-switch
                 v-model="state.treeAddFormData.enabled"
-                 class="elswitch"
+                class="elswitch"
                 active-color="#13ce66"
                 inactive-color="#ff4949"
-              />
-              </el-form-item
+              /> </el-form-item
           ></el-col>
           <el-col :span="8">
             <el-form-item label="设备ID">
@@ -361,8 +417,10 @@
       </el-form>
       <template #footer>
         <span class="dialog-footer">
-          <button  class="btn green"  @click="treeVisible = false">取 消</button>
-          <button  class="btn green"  type="primary" @click="saveTreeAdd">确 定</button>
+          <button class="btn green" @click="treeVisible = false">取 消</button>
+          <button class="btn green" type="primary" @click="saveTreeAdd">
+            确 定
+          </button>
         </span>
       </template>
     </el-dialog>
@@ -372,6 +430,7 @@
 import { ref, onMounted, reactive, provide, computed } from "vue";
 import { ElMessageBox, ElMessage, ElLoading } from "element-plus";
 import faultmode from "./faultmode.vue";
+import { outExportExcel } from "@tools/excel/exportExcel";
 import {
   tree,
   point,
@@ -416,7 +475,7 @@ let state = reactive({
     description: null,
     deviceid: "windturbine",
     enname: null,
-    id:null,
+    id: null,
     metriccode: "",
     name: "",
     structurecode: "101010205",
@@ -483,7 +542,7 @@ const handleNodeClick = (data) => {
   console.log(data);
   state.isDel = data.children;
   state.desc = data.node;
-  state.addFormData.structurecode = data.node.code
+  state.addFormData.structurecode = data.node.code;
   getPoint(data.node);
 };
 // 测点 编辑
@@ -645,6 +704,27 @@ const cascaderforEach = (val) => {
     return val.children;
   }
 };
+// 批量导出
+const export2Excel = () => {
+  const tableData = state.pointTableData;
+  const tableHeader = [
+    "测点编码",
+    "名称",
+    "单位",
+    "测点类型",
+    "物理类型",
+    "描述",
+  ];
+  const tableKey = [
+    "metriccode",
+    "name",
+    "unitname",
+    "categorydata",
+    "categorysci",
+    "description",
+  ];
+  outExportExcel(tableHeader, tableKey, tableData, "测点导出excel");
+};
 </script>
 <style lang="scss" scoped>
 .main {
@@ -671,7 +751,6 @@ const cascaderforEach = (val) => {
 }
 </style>
 <style lang="less" >
-
 .deviceModelClass {
   .el-table__header tr,
   .el-table__header th {
@@ -684,21 +763,21 @@ const cascaderforEach = (val) => {
     height: 40px;
   }
 }
-.tab{
-  .el-tabs__item.is-active{
-    color:@green;
+.tab {
+  .el-tabs__item.is-active {
+    color: @green;
   }
-  .el-tabs__item{
-      color: #b7b7b7;
+  .el-tabs__item {
+    color: #b7b7b7;
   }
 }
-.elswitch{
-.el-switch__input{
-    position: absolute!important;
-}
+.elswitch {
+  .el-switch__input {
+    position: absolute !important;
+  }
 }
-.deviceClass{
-  .el-row{
+.deviceClass {
+  .el-row {
     margin-bottom: 16px;
   }
 }

+ 23 - 1
src/views/device/faultmode.vue

@@ -1,11 +1,25 @@
 <template>
   <div style="display: block">
     <button
-       class="btn green"
+       class="btn"
       style="margin-bottom: 10px"
       @click="handleEdit(state.addFormData)"
       >新增</button
     >
+    <button
+       class="btn"
+      size="mini"
+      type="primary"
+      >导入</button
+    >
+    <button
+       class="btn"
+      size="mini"
+      type="primary"
+      @click="export2Excel"
+      :disabled='state.faultmodeTableData.length==0'
+      >导出</button
+    >
     <el-table
       :data="state.faultmodeTableData"
       stripe
@@ -147,6 +161,7 @@
 <script setup>
 import { ref, onMounted, reactive, inject, warn } from "vue";
 import { ElMessageBox, ElMessage, ElLoading } from "element-plus";
+import { outExportExcel }  from "@tools/excel/exportExcel";
 import {
   faultmode_windturbine,
   faultmode_structurecode,
@@ -257,6 +272,13 @@ const getfaultmode = async () => {
   loading.close();
   console.warn(res);
 };
+// 批量导出
+const export2Excel = () => {
+  const tableData = state.faultmodeTableData;
+  const tableHeader = ["名称", "故障编码", "频度", "严酷度", "难检度", "原因", "导致结果", "处理方法"];
+  const tableKey = ["name", "code", "occurence", "severity", "detection", "cause",'effects','measure'];
+  outExportExcel(tableHeader,tableKey,tableData,'故障模式导出excel');
+};
 </script>
 <style lang="scss" scoped>
 </style>