From 1d3efb6ed52ef43c6184cfaa2ff11d5cc78565c9 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期日, 08 十二月 2024 19:24:21 +0800
Subject: [PATCH] 新增故障类型

---
 src/api/platform/threshold.js                   |    9 ++++
 src/views/system/work-order/threshold/index.vue |  101 ++++++++++++++++++++++++++++++++++++++++----------
 2 files changed, 89 insertions(+), 21 deletions(-)

diff --git a/src/api/platform/threshold.js b/src/api/platform/threshold.js
index 45c4286..9d3a337 100644
--- a/src/api/platform/threshold.js
+++ b/src/api/platform/threshold.js
@@ -150,3 +150,12 @@
     responseType: 'blob'
   })
 }
+
+// 淇敼宸ュ崟鐧藉悕鍗�
+export function addError(data) {
+  return request({
+    url: '/threshold/addBatch',
+    method: 'post',
+    data: data
+  })
+}
diff --git a/src/views/system/work-order/threshold/index.vue b/src/views/system/work-order/threshold/index.vue
index 7064243..2f38eae 100644
--- a/src/views/system/work-order/threshold/index.vue
+++ b/src/views/system/work-order/threshold/index.vue
@@ -26,14 +26,14 @@
                 v-hasPermi="['ycl:threshold:edit']"
                 @click="showEdit('video')"
                 v-if="!ifEditVideo"
-                >淇敼
+              >淇敼
               </el-button>
               <el-button
                 size="mini"
                 type="primary"
                 @click="saveEdit('video')"
                 v-if="ifEditVideo"
-                >淇濆瓨
+              >淇濆瓨
               </el-button>
             </div>
           </div>
@@ -116,14 +116,14 @@
                 v-hasPermi="['ycl:threshold:edit']"
                 @click="showEdit('face')"
                 v-if="!ifEditFace"
-                >淇敼
+              >淇敼
               </el-button>
               <el-button
                 size="mini"
                 type="primary"
                 @click="saveEdit('face')"
                 v-if="ifEditFace"
-                >淇濆瓨
+              >淇濆瓨
               </el-button>
             </div>
           </div>
@@ -186,13 +186,14 @@
                     <span v-else>{{ item.value }}</span>
                     <span class="unit" v-if="item.countType=='percent'">%</span>
                     <span class="unit" v-if="item.countType=='second'">绉�</span>
-                    </el-form-item
+                  </el-form-item
                   >
                 </el-form>
               </div>
             </div>
           </div>
-        </el-card></el-col
+        </el-card>
+      </el-col
       >
       <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
         <el-card style="margin-bottom: 20px; height: 350px; margin-right: 20px;color: #656565;">
@@ -206,14 +207,14 @@
                 v-hasPermi="['ycl:threshold:edit']"
                 @click="showEdit('car')"
                 v-if="!ifEditCar"
-                >淇敼
+              >淇敼
               </el-button>
               <el-button
                 size="mini"
                 type="primary"
                 @click="saveEdit('car')"
                 v-if="ifEditCar"
-                >淇濆瓨
+              >淇濆瓨
               </el-button>
             </div>
           </div>
@@ -281,7 +282,8 @@
               </div>
             </div>
           </div>
-        </el-card></el-col
+        </el-card>
+      </el-col
       >
     </el-row>
 
@@ -306,7 +308,8 @@
       <el-button size="small" type="success" @click="whiteOpen" plain>鏂板</el-button>
       <el-button size="small" type="danger" @click="bathDelete" plain>鍒犻櫎</el-button>
       <el-button type="primary" plain icon="el-icon-top" v-loading="download" size="mini" @click="handleExport"
-      >瀵煎嚭鐧藉悕鍗�</el-button>
+      >瀵煎嚭鐧藉悕鍗�
+      </el-button>
       <el-popover style="margin-left: 10px" placement="bottom" trigger="hover" content="瀵煎叆鐧藉悕鍗�">
         <div class="bottom_">
           <el-upload
@@ -324,11 +327,33 @@
         </div>
         <div>
           <el-button class="bottom_" type="primary" size="small" v-loading="upload" @click="handleImport"
-                   >瀵煎叆</el-button>
+          >瀵煎叆
+          </el-button>
         </div>
-        <el-button type="primary" size="small" plain icon="el-icon-bottom" slot="reference" >瀵煎叆鐧藉悕鍗�</el-button>
+        <el-button type="primary" size="small" plain icon="el-icon-bottom" slot="reference">瀵煎叆鐧藉悕鍗�</el-button>
       </el-popover>
+
+      <el-popover style="margin-left: 10px" placement="bottom" content="娣诲姞鏁呴殰绫诲瀷">
+        <div class="bottom_">
+          <el-form ref = "addErrorForm" :model="addErrorForm" v-loading="addErrorLoading" rules="addErrorFormRules" :inline="true" >
+            <el-form-item label="鏁呴殰绫诲瀷" prop="errorTypeList">
+              <el-select v-model="addErrorForm.errorTypeList" multiple>
+                <el-option v-for="dict in dict.type.error_type"
+                           :value="dict.value"
+                           :key="dict.value"
+                           :label="dict.label"/>
+              </el-select>
+            </el-form-item>
+          </el-form>
+        </div>
+        <div>
+          <el-button class="bottom_" type="primary" size="small" @click="addError" plain>纭</el-button>
+        </div>
+        <el-button style="margin-left: 10px" size="small" type="primary" slot="reference" plain>娣诲姞鏁呴殰绫诲瀷</el-button>
+      </el-popover>
+
     </el-row>
+
     <el-row class="content-warp">
       <el-col :span="24">
         <el-table v-loading="loading" :data="workOrderWhiteList" @selection-change="handleSelectionChange">
@@ -340,7 +365,8 @@
           <el-table-column label="鎿嶄綔" align="center" fixed="right" class-name="small-padding fixed-width">
             <template slot-scope="scope">
               <el-button size="mini" type="text" icon="el-icon-edit" @click="handleWhiteUpdate(scope.row)"
-                         >淇敼</el-button>
+              >淇敼
+              </el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -356,7 +382,7 @@
       </el-col>
     </el-row>
 
-<!--    鏂板鐧藉悕鍗�-->
+    <!--    鏂板鐧藉悕鍗�-->
     <el-dialog
       :title="title"
       :visible.sync="whiteShow"
@@ -364,14 +390,15 @@
       :close-on-click-modal="false"
       :before-close="whiteClose">
       <div>
-        <el-form :model="whiteForm" label-position="top" :rules="whiteFormRules" ref="whiteForm" size="small" class="add-form">
-          <el-form-item label="鐐逛綅" prop="serialNumber" >
+        <el-form :model="whiteForm" label-position="top" :rules="whiteFormRules" ref="whiteForm" size="small"
+                 class="add-form">
+          <el-form-item label="鐐逛綅" prop="serialNumber">
             <el-select
               v-model="whiteForm.pointName"
               filterable
               remote
               reserve-keyword
-              :disabled = "whiteForm.id"
+              :disabled="whiteForm.id"
               placeholder="鍥芥爣鐮�/鐐逛綅鍚嶇О鎼滅储"
               :remote-method="remoteGetPoints"
               @change="setPointId"
@@ -426,13 +453,16 @@
   whiteExport
 } from "@/api/platform/threshold";
 
-import { pointSelectData } from "@/api/platform/point";
+import {pointSelectData} from "@/api/platform/point";
+import {addError} from "../../../../api/platform/threshold";
+
 export default {
   dicts: ["image_qualify", "video_qualify", "error_type"],
   name: "Threshold",
   data() {
     return {
       download: false,
+      addErrorLoading: false,
       scrollPosition: 0, // 鐢ㄤ簬淇濆瓨婊氬姩浣嶇疆
       // 涓嬫媺鍔犺浇
       selectLoading: false,
@@ -477,6 +507,13 @@
       videoForm: {},
       carForm: {},
       faceForm: {},
+      addErrorForm: {},
+      // 鏂板妗嗘牎楠�
+      addErrorFormRules: {
+        errorTypeList: [
+          {required: true, message: "璇烽�夋嫨鏁呴殰绫诲瀷", trigger: "blur"}
+        ],
+      },
       // 琛ㄥ崟鏍¢獙
       faceRules: {
         monitorType: [
@@ -556,7 +593,7 @@
           {required: true, message: "璁惧涓嶈兘涓虹┖", trigger: "blur"},
         ],
         errorTypeList: [
-          { required: true, message: "璇烽�夋嫨鏁呴殰绫诲瀷", trigger: "blur" }
+          {required: true, message: "璇烽�夋嫨鏁呴殰绫诲瀷", trigger: "blur"}
         ],
       },
       // 瀵煎叆鏂囦欢璺緞
@@ -594,7 +631,7 @@
       this.download = true
       whiteExport().then(res => {
         // 灏嗕簩杩涘埗鏁版嵁杞崲涓� Blob 瀵硅薄
-        let blob = new Blob([res], { type: 'application/octet-stream' });
+        let blob = new Blob([res], {type: 'application/octet-stream'});
 
         // 鍒涘缓涓嬭浇閾炬帴
         let downloadLink = document.createElement('a');
@@ -964,6 +1001,19 @@
       this.whiteShow = false;
       this.whiteReset();
     },
+    // 鏂板鏁呴殰绫诲瀷
+    addError() {
+      this.$refs["addErrorForm"].validate((valid) => {
+        if (valid) {
+          this.addErrorLoading = true
+          addError(this.addErrorForm).then((response) => {
+            this.$modal.msgSuccess("娣诲姞鎴愬姛");
+            this.getWhiteList();
+          });
+          this.addErrorLoading = false
+        }
+      });
+    },
     // 鐧藉悕鍗曟鎻愪氦
     whiteSubmit() {
       this.$refs["whiteForm"].validate((valid) => {
@@ -1032,7 +1082,7 @@
         this.upload = false
         this.fileList = []
         this.getWhiteList()
-      }).catch(()=>{
+      }).catch(() => {
         this.upload = false
       })
     }
@@ -1047,17 +1097,21 @@
 ::v-deep .el-input-half-width {
   width: calc(50% - 6px); /* 鍑忓幓涓�浜涢棿闅� */
 }
+
 ::v-deep .table-row {
   display: flex;
   flex-direction: row;
 }
+
 ::v-deep .table-row-item {
   width: 120px;
   text-align: center;
 }
+
 .fixedWidth {
   width: 200px;
 }
+
 .threshold {
   display: flex;
   flex-direction: row;
@@ -1067,19 +1121,24 @@
   font-weight: bold;
   font-size: large;
 }
+
 ::v-deep .el-form-item {
   margin-bottom: 0px; /* 鏍规嵁闇�姹傝皟鏁磋繖涓�� */
 }
+
 ::v-deep .el-form-item__label {
   color: #8d8d8d;
 }
+
 .unit {
   margin-left: 5px;
   display: inline-block;
 }
+
 .content-warp {
   margin-top: 10px;
 }
+
 .bottom_ {
   width: 100%;
   margin-bottom: 8px;

--
Gitblit v1.8.0