From 63fce2b793451ee340b7a0f6e0d6ce6c2d470dd0 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期四, 21 七月 2022 17:10:22 +0800
Subject: [PATCH] 1.优化代码,2.完成工序缺陷页面3.模板下载功能

---
 src/views/zlgl/gxjy.vue |   76 +++++++++++++++++++++++++++----------
 1 files changed, 55 insertions(+), 21 deletions(-)

diff --git a/src/views/zlgl/gxjy.vue b/src/views/zlgl/gxjy.vue
index 09ff2c6..bcab59c 100644
--- a/src/views/zlgl/gxjy.vue
+++ b/src/views/zlgl/gxjy.vue
@@ -98,7 +98,9 @@
             highlight-current-row
             :header-cell-style="this.$headerCellStyle"
             :cell-style="this.$cellStyle"
+            :row-class-name="tableRowClassName"
             @selection-change="handleSelectionChange"
+            @cell-dblclick="cellDblclick"
           >
             <el-table-column
               type="index"
@@ -141,9 +143,17 @@
               prop="stepcheckitem_desc"
               label="妫�楠屾爣鍑嗘弿杩�"
             >
-              <template slot-scope="{row}">
-                <el-input v-if="row.isVisible===1" v-model="row.stepcheckitem_desc" placeholder="璇疯緭鍏�" />
-                <div v-else> {{ row.stepcheckitem_desc }}</div>
+              <template slot-scope="scope">
+                <el-input
+                  v-if="scope.row.isVisible===1||scope.row.index === tabClickIndex && tabClickLabel === '妫�楠屾爣鍑嗘弿杩�'"
+                  v-model="scope.row.stepcheckitem_desc"
+                  placeholder="璇疯緭鍏�"
+                  @keyup.enter.native="val=>keyUpEnterNative(val,scope.row)"
+                />
+                <div
+                  v-else
+                > {{ scope.row.stepcheckitem_desc }}</div>
+
               </template>
             </el-table-column>
 
@@ -242,7 +252,6 @@
 // const SER_HZ = /^[\u4e00-\u9fa5]+$/
 import $ from 'jquery'
 import {
-  DeleteStepCheckStaned,
   MesOrderStepCheckItemList,
   MesOrderStepCheckSearch,
   MesOrderStepCheckSelect, SaveMesOrderStepCheckItem,
@@ -283,7 +292,9 @@
       JYTableData: [], // 妫�楠岄」淇℃伅琛ㄦ牸
       JYSelectArr: [], // 妫�楠屼笅鎷夋暟缁�
       JYSelectedArr: [], // 宸查�夋楠岄」鐩暟缁�
-      multipleSelection: []// 琛ㄦ牸澶氶�夋
+      multipleSelection: [], // 琛ㄦ牸澶氶�夋
+      tabClickIndex: null, // 鐐瑰嚮鐨勫崟鍏冩牸
+      tabClickLabel: '' // 褰撳墠鐐瑰嚮鐨勫垪鍚�
     }
   },
   created() {
@@ -330,12 +341,13 @@
         number = number === 0 ? (10 + Math.random()) : number
 
         // item.result = 0 // 0鍚堟牸  1涓嶈壇
-        item.result = 'NG'
+        item.result = 'OK'
 
         item.isVisible = 0
         item.number = number
         this.JYSelectedArr.push(item.code)
       })
+      this.$refs.multipleTable.toggleAllSelection()
     },
     // changeRadioValue(val, row) {
     //   console.log(val, row.result, 20000)
@@ -354,14 +366,11 @@
           it.result = 'NG'
         }
       })
-      if (this.multipleSelection.length > 0) {
-        if (this.multipleSelection.length === this.JYTableData.length) {
-          this.checkResult = 'OK'
-        } else {
-          this.checkResult = 'NG'
-        }
+
+      if (this.multipleSelection.length > 0 && this.multipleSelection.length === this.JYTableData.length) {
+        this.checkResult = 'OK'
       } else {
-        this.checkResult = ''
+        this.checkResult = 'NG'
       }
     },
     // 妫�楠岄」鐩紪鐮侊紙鍚嶇О锛�
@@ -390,8 +399,9 @@
 
       let number = Math.random() * Math.random()// 浣滀负鍒犻櫎鏃剁殑鏍囪瘑绗�
       number = number === 0 ? (10 + Math.random()) : number
-      const data = { result: 'NG', code: '', name: '', stepcheckitem_desc: '', isVisible: 1, number }
+      const data = { result: 'OK', code: '', name: '', stepcheckitem_desc: '', isVisible: 1, number }
       this.JYTableData.push(data)
+      this.$refs.multipleTable.toggleRowSelection(data, true)
     },
 
     //  纭
@@ -415,14 +425,10 @@
         }
       })
 
-      if (this.multipleSelection.length > 0) {
-        if (this.multipleSelection.length === this.JYTableData.length) {
-          this.checkResult = 'OK'
-        } else {
-          this.checkResult = 'NG'
-        }
+      if (this.multipleSelection.length > 0 && this.multipleSelection.length === this.JYTableData.length) {
+        this.checkResult = 'OK'
       } else {
-        this.checkResult = ''
+        this.checkResult = 'NG'
       }
     },
     //  鍙栨秷
@@ -439,6 +445,7 @@
         }
       })
     },
+
     // 鍒犻櫎
     del(row) {
       this.JYTableData.forEach((item, index) => {
@@ -530,6 +537,33 @@
       this.form.stepcode = ''
       this.form.stepname = ''
     },
+
+    // 鍗曞厓鏍艰鐐瑰嚮鏃�
+    cellDblclick(row, column, cell, event) {
+      console.log(row, column, cell, event)
+      console.log(column.label)
+      console.log(row.index)
+      switch (column.label) {
+        case '妫�楠屾爣鍑嗘弿杩�':
+          this.tabClickIndex = row.index
+          this.tabClickLabel = column.label
+          break
+        // case '鍒よ矗閲戦(鍏�)':
+        //   this.tabClickIndex = row.index
+        //   this.tabClickLabel = column.label
+        //   break
+        default: return
+      }
+    },
+    // 鍥炶溅浜嬩欢
+    keyUpEnterNative(val, row) {
+      this.tabClickLabel = ''
+    },
+
+    tableRowClassName({ row, rowIndex }) {
+      // 鎶婃瘡涓�琛岀殑绱㈠紩鏀捐繘row
+      row.index = rowIndex
+    },
     // 鑾峰彇椤甸潰楂樺害
     getHeight() {
       this.$nextTick(() => {

--
Gitblit v1.9.3