From 8b88172ca8801bf26a083098a09d637b11da9f01 Mon Sep 17 00:00:00 2001
From: 王震 <10952869+daywangzhen@user.noreply.gitee.com>
Date: 星期四, 18 一月 2024 13:03:30 +0800
Subject: [PATCH] Merge branch 'master' of http://114.132.189.42:9002/r/mes-ocea-before

---
 src/views/quality/rawMaterial/rawMaterial-form.vue |   90 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 64 insertions(+), 26 deletions(-)

diff --git a/src/views/quality/rawMaterial/rawMaterial-form.vue b/src/views/quality/rawMaterial/rawMaterial-form.vue
index b4d8e55..2e84932 100644
--- a/src/views/quality/rawMaterial/rawMaterial-form.vue
+++ b/src/views/quality/rawMaterial/rawMaterial-form.vue
@@ -135,11 +135,14 @@
                     row-key="iid"
                     default-expand-all
                     :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
-                      <el-table-column type="index" label="搴忓彿" width="60">
+                      <el-table-column type="index" prop="parentIndex" label="搴忓彿" width="60">
+                        <template scope="scope">
+                            <span v-if="scope.row.isIndex">{{scope.row.parentIndex}}</span>
+                        </template>
                       </el-table-column>
                       <el-table-column prop="father" label="妫�楠岄」鐩�" width="160">
                         <template slot-scope="scope">
-                          <el-input v-if="scope.row.children" style="width:90%" :disabled="dataForm.id!=null" v-model="scope.row.father" placeholder="璇疯緭鍏ユ楠岄」鐩�"></el-input>
+                          <el-input v-if="scope.row.children" style="width:80%" :disabled="dataForm.id!=null" v-model="scope.row.father" placeholder="璇疯緭鍏ユ楠岄」鐩�"></el-input>
                         </template>
                       </el-table-column>
                       <el-table-column prop="name" label="椤圭洰" width="160">
@@ -170,11 +173,25 @@
                         <template slot-scope="scope">
                           <div v-if="!scope.row.children">
                           <el-tooltip :disabled="scope.row.deviceId != null" class="item" effect="dark" content="璇峰厛閫夋嫨璁惧锛�" placement="top-start">
-                              <el-select style="width:100%" allow-create filterable default-first-option
+                            <!-- <el-autocomplete clearable
+                            :disabled="scope.row.deviceId == null ||  (dataForm.id!=null&&resultVal!=null)"
+                            @blur="changeState(scope.row,scope.$index)"
+                            v-model="scope.row.testValueList[index]"
+                            :fetch-suggestions="querySearch"
+                            placeholder="璇疯緭鍏ユ垨閫夋嫨妫�娴嬪��" >
+                            <i style="line-height: normal;padding: 10px 7px;" class="el-icon-arrow-down" slot="suffix"></i>
+                            <template slot-scope="{ item }">
+                                <div>{{ item.value }}</div>
+                            </template>
+                            </el-autocomplete> -->
+
+                              <el-select style="width:100%" filterable
                               :disabled="scope.row.deviceId == null ||  (dataForm.id!=null&&resultVal!=null)"
                               v-model="scope.row.testValueList[index]"
                               placeholder="璇疯緭鍏ユ垨閫夋嫨妫�娴嬪��"
-                              @change="changeState(scope.row,scope.$index)">
+                              @change="changeState(scope.row,scope.$index)"
+                              @blur="selectBlur"
+                              >
                                 <el-option label="鏄�" value="鏄�"/>
                                 <el-option label="鍚�" value="鍚�"/>
                               </el-select>
@@ -489,6 +506,10 @@
       },
     },
     methods:{
+      querySearch(queryString, cb){
+        // 璋冪敤 callback 杩斿洖寤鸿鍒楄〃鐨勬暟鎹�
+        cb([{value:'鏄�'},{value:'鍚�'}]);
+      },
       tabsClick(tab,even){
         if(tab.index == 1){
           if(this.dataForm.rawInsNo==null){
@@ -549,7 +570,7 @@
         this.updateDevice(this.row,this.proIndex)
         }else{
           this.$message({
-          message: '鏈瘑鍒嚭浜屼綅鐮佽閲忓櫒鍏蜂俊鎭紒',
+          message: '浜岀淮鐮佹湭璇嗗埆鍑鸿閲忓櫒鍏蜂俊鎭紒',
           type: 'warning'
         });
         }
@@ -564,7 +585,7 @@
       getResultInfo(data){
         if(!data.includes("part_no")){
           this.$message({
-          message: '鏈瘑鍒嚭浜岀淮鐮侀浂浠朵俊鎭紒',
+          message: '浜岀淮鐮佹湭璇嗗埆鍑洪浂浠朵俊鎭紒',
           type: 'warning'
         });
         }
@@ -575,7 +596,7 @@
           this.showPart = true
         }else{
           this.$message({
-          message: '鏈瘑鍒嚭浜岀淮鐮侀浂浠朵俊鎭紒',
+          message: '浜岀淮鐮佹湭璇嗗埆鍑洪浂浠朵俊鎭紒',
           type: 'warning'
         });
         }
@@ -602,8 +623,8 @@
           this.dataForm.message = param.message
           this.dataForm.projectName = param.projectName
           this.projectList = param.rawInsProducts == null ? [] : param.rawInsProducts
-          param.rawInsProducts.forEach(o=>{
-            this.clickAddLine(o)
+          param.rawInsProducts.forEach((o,index)=>{
+            this.clickAddLine(o,index)
           })
         }
 
@@ -677,7 +698,7 @@
         this.empiricalValueAdd = this.empiricalValueAdd + 1;
       },
       // 娣诲姞琛�
-      clickAddLine(row) {
+      clickAddLine(row,index) {
         let ele = {
             fId: Math.random(),
             father: null,
@@ -685,6 +706,8 @@
             children:[]
         }
         if(row){
+          ele.isIndex = true;
+          ele.parentIndex = index + 1;
           ele.father = row.father?row.father:null
           row.children.forEach(item => {
               ele.children.push({
@@ -709,6 +732,8 @@
             })
             this.list.push(ele)
         }else{
+          ele.isIndex = true;
+          ele.parentIndex = this.list.length + 1;
           ele.children.push({
               deviceId: null,
               deviceName: null,
@@ -784,17 +809,19 @@
             this.dataForm.createUser = data.createUser
             let userNameList = []
             this.list = []
-            data.children.forEach(item => {
+            data.children.forEach((item,index) => {
               if (item.children) {
                     let ele = {
                       iid: null,
                       father: null,
                       children: []
                     }
+                    ele.isIndex = true;
+                    ele.parentIndex = index + 1;
                     ele.iid = Math.random()
                     ele.father = item.rpFather
                     if (item.children != undefined) {
-                    item.children.forEach(obj => {
+                    item.children.forEach((obj) => {
                       let arr= []
                       if(obj.userName){
                         userNameList.push(obj.userName)
@@ -853,33 +880,43 @@
           this.conclusionTable = []
         }
       },
+      selectBlur(e){
+        console.log(e);
+      },
       changeState(row, index) {
-          if(row){
-            let isTrue = true
-            for(var i=0;i<row.testValueList.length;i++){
-              let val = row.testValueList[i]
-              let reg = /(^-?[0-9]{1,6}$)|(^-?[0-9]{1,6}[\.]{1}[0-9]{1,3}$)/
-              if(!reg.test(val) && !['鏄�','鍚�'].includes(val)){
-                this.$message.error("璇疯緭鍏ユ暟瀛楁垨閫夋嫨鏄惁")
-                row.testValueList[i] = null
-                isTrue = false
-              }
-            }
-            if(!isTrue){
-              return
-            }
+          console.log(row.testValueList);
+          return
+        this.$nextTick(()=>{
+            if(row){
+                let isTrue = true
+                for(var i=0;i<row.testValueList.length;i++){
+                let val = row.testValueList[i]
+                let reg = /(^-?[0-9]{1,6}$)|(^-?[0-9]{1,6}[\.]{1}[0-9]{1,3}$)/
+                if(!reg.test(val) && !['鏄�','鍚�'].includes(val)){
+                    row.testValueList[i] = null
+                    this.$message.error("璇疯緭鍏ユ暟瀛楁垨閫夋嫨鏄惁")
+                    isTrue = false
+                }
+                }
+                if(!isTrue){
+                return
+                }
           }
           if (row.rpId != null && row.rpId != '') {
             let val = row.testValueList.join(",")
             if (val === undefined || val === '' || val === null) {
                 return
             }
+            console.log(val);
+            console.log(...row.testValueList);
             let obj = {
               deviceId: row.deviceId,
               rpId: row.rpId,
               testValue: val,
               note: row.note
             }
+            console.log(obj);
+            return
             updateRawInsProduct(obj).then(res => {
                 if (res.data.code == 0) {
                     this.$message.success("鏇存柊鎴愬姛")
@@ -889,6 +926,7 @@
                 this.init()
             })
           }
+        })
       },
       // 鍒犻櫎瀛愰」鐩�
       delChildren(row,index,isParent) {

--
Gitblit v1.9.3