From d2618a0663e823504742448cf25fe8e2eec48cdf Mon Sep 17 00:00:00 2001
From: 王震 <10952869+daywangzhen@user.noreply.gitee.com>
Date: 星期四, 02 十一月 2023 10:38:22 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/quality/finishedProductInspection/finishedProduct-form.vue |   84 +++++++++++++++++++++++++++---------------
 1 files changed, 54 insertions(+), 30 deletions(-)

diff --git a/src/views/quality/finishedProductInspection/finishedProductInspectionAdd.vue b/src/views/quality/finishedProductInspection/finishedProduct-form.vue
similarity index 87%
rename from src/views/quality/finishedProductInspection/finishedProductInspectionAdd.vue
rename to src/views/quality/finishedProductInspection/finishedProduct-form.vue
index f3a7a4c..46c7e91 100644
--- a/src/views/quality/finishedProductInspection/finishedProductInspectionAdd.vue
+++ b/src/views/quality/finishedProductInspection/finishedProduct-form.vue
@@ -4,7 +4,8 @@
     <div class="page-header">
         <div class="header-left">
             <a @click="$router.go(-1)"><i class="icon-btn-back"></i></a>
-            <h2>缂栬緫-浜у搧妫�楠屽崟</h2>
+            <h2 v-if="resultVal!=null && processInspectVo.id!=null">鏌ョ湅-浜у搧妫�楠屽崟</h2>
+            <h2 v-else>缂栬緫-浜у搧妫�楠屽崟</h2>
         </div>
         <div class="btn-group header-right">
             <el-button @click="addTestProject" v-if="processInspectVo.id==null">鐢熸垚妫�楠岄」鐩�</el-button>
@@ -35,14 +36,6 @@
                             </el-form-item>
                         </el-col>
                         <el-col :span="6">
-                            <el-form-item label="璐ㄩ噺杩芥函鍙凤細">
-                                <el-input disabled v-model="processInspectVo.qualityTraceability"
-                                    placeholder="璇疯緭鍏ヨ川閲忚拷婧彿" autocomplete="off" />
-                            </el-form-item>
-                        </el-col>
-                    </el-row>
-                    <el-row>
-                        <el-col :span="6">
                             <el-form-item label="浜у搧鍚嶇О锛�">
                                 <el-select style="width: 100%" @change="changeOptionsSamplename" :disabled="processInspectVo.id != null"
                                     v-model="processInspectVo.material" size="small" placeholder="璇烽�夋嫨浜у搧鍚嶇О">
@@ -52,6 +45,8 @@
                                 </el-select>
                             </el-form-item>
                         </el-col>
+                    </el-row>
+                    <el-row>
                         <el-col :span="6">
                             <el-form-item label="浜у搧缂栫爜锛�">
                                 <el-input disabled v-model="processInspectVo.mcode"
@@ -70,8 +65,6 @@
                                     placeholder="璇疯緭鍏ュ崟浣�" autocomplete="off" />
                             </el-form-item>
                         </el-col>
-                    </el-row>
-                    <el-row>
                         <el-col :span="6">
                             <el-form-item label="鏁伴噺锛�">
                                 <el-input v-model="processInspectVo.quantity" placeholder="璇疯緭鍏ユ暟閲�"
@@ -85,7 +78,7 @@
         <div class="finishedProduct-detail">
             <el-row style="width:100%;z-index: 10;height:30px;">
                 <el-col :span="12" class="inspectionProject_span">妫�楠岄」鐩�</el-col>
-                <el-col :span="12" class="inspectionProject_span" style="text-align: right;">
+                <el-col v-if="resultVal==null" :span="12" class="inspectionProject_span" style="text-align: right;">
                     <el-button size="mini" @click="clickAddInspectionColumn()">娣诲姞妫�娴嬪�煎垪</el-button>
                     <el-button size="mini" @click="clickDeleteInspectionColumn()">鍒犻櫎妫�娴嬪�煎垪</el-button>
                 </el-col>
@@ -109,16 +102,20 @@
                                     placement="top-start">
                                     <el-input :disabled="scope.row.eId == null" v-model="scope.row.empiricalValueAddss[index]"
                                         @blur="changeState(scope.row, index)" placeholder="璇疯緭鍏ユ娴嬪��"></el-input>
-                                </el-tooltip>
+                                    <span v-if="resultVal != null" v-text="scope.row.empiricalValueAddss[index]"></span>
+                                    </el-tooltip>
                             </template>
                         </el-table-column>
                         <el-table-column prop="deviceName" label="璇曢獙璁惧" min-width="250">
                             <template slot-scope="scope">
-                                <el-select style="width:100%" v-model="scope.row.eId" 
-                                v-if="scope.row.iname != null" filterable @change="updateDevice(scope.row)">
-                                    <el-option v-for="(item,index) in deviceList" 
-                                    :key="index" :value="item.id" :label="item.number +'-'+ item.name"></el-option>
-                                </el-select>
+                                <span v-if="resultVal!=null && processInspectVo.id!=null" v-text="scope.row.ename"></span>
+                                <div v-else>
+                                    <el-select style="width:100%" v-model="scope.row.eId" 
+                                    v-if="scope.row.iname != null" filterable @change="updateDevice(scope.row)">
+                                        <el-option v-for="(item,index) in deviceList" 
+                                        :key="index" :value="item.id" :label="item.number +'-'+ item.name"></el-option>
+                                    </el-select>
+                                </div>
                             </template>
                         </el-table-column>
                         <el-table-column label="缁撹" fixed="right" min-width="100">
@@ -148,13 +145,13 @@
                         <el-table-column prop="userName" label="妫�楠屽憳"></el-table-column>
                         <el-table-column prop="result" label="妫�楠岀粨璁�">
                             <template slot-scope="scope">
-                                <el-tag type="success" v-if="scope.row.result == 1">鍚堟牸</el-tag>
-                                <el-tag type="danger" v-else-if="scope.row.result == 0">涓嶅悎鏍�</el-tag>
+                                <el-tag type="success" v-if="scope.row.result == '1'">鍚堟牸</el-tag>
+                                <el-tag type="danger" v-else-if="scope.row.result == '0'">涓嶅悎鏍�</el-tag>
                             </template>
                         </el-table-column>
                         <el-table-column  label="鎿嶄綔">
                             <template>
-                                <el-button type="text"  @click="submitSave()" size="small">涓婃姤</el-button>
+                                <el-button type="text" :disabled="resultVal!=null && processInspectVo.id!=null"  @click="submitSave()" size="small">涓婃姤</el-button>
                             </template>
                         </el-table-column>
                     </el-table>
@@ -178,6 +175,7 @@
 export default {
     data() {
         return {
+            resultVal: null,
             deviceList: [],
             hasChildren: true,
             optionsSamplename: [],
@@ -214,6 +212,11 @@
     mounted() {
         this.getDeviceList()
         this.processInspectVo.id = this.$route.query.id
+        this.resultVal = this.$route.query.resultVal
+        if(this.resultVal == null){
+            let val = sessionStorage.getItem("finished-resultVal");
+            val == undefined ? this.resultVal=null : this.resultVal = val
+        }
         this.init()
     },
     methods: {
@@ -240,15 +243,40 @@
                     number: value
                     }
                     updateFinishedInspectById(data).then(res => {
-                        this.$message.success("涓婃姤鎴愬姛");
+                        if(res.data.data.indexOf("鎴愬姛") > 0){
+                            this.$message.success("涓婃姤鎴愬姛");
+                            this.checkTestState()
+                        }else{
+                            this.$message.warning(res.data.data)
+                        }
                     });
                 }).catch(() => {});
             }else{
                 updateFinishedInspectById({id:this.processInspectVo.id,number:0}).then(res => {
-                    this.$message.success("涓婃姤鎴愬姛");
+                    if(res.data.data.indexOf("鎴愬姛") > 0){
+                            this.$message.success("涓婃姤鎴愬姛");
+                            this.checkTestState()
+                        }else{
+                            this.$message.warning(res.data.data)
+                        }
                 });
             }
             this.init()
+        },
+        checkTestState(){
+            let resultVal = '1'
+            this.inspectionItems.forEach(item=>{
+                if(item.children){
+                    item.children.forEach(obj=>{
+                        if(obj.iresult == 0){
+                            resultVal = '0'
+                        }
+                    })
+                }
+            })
+            this.resultVal = resultVal
+            this.inspectionResultForm[0].result = resultVal
+            sessionStorage.setItem("finished-resultVal",resultVal)
         },
         init(){
             let id = this.processInspectVo.id
@@ -263,7 +291,6 @@
                     this.processInspectVo.specificationsModel = result.specs
                     this.processInspectVo.unit = result.punit
                     this.processInspectVo.quantity = result.quantity
-                    let resultVal = 1
                     let userList = []
                     result.children.forEach(item=>{
                         item.iid = Math.random()
@@ -275,9 +302,6 @@
                                 }
                                 if(obj.inspectionValue){
                                     arr = obj.inspectionValue.split(",")
-                                }
-                                if(obj.iresult && obj.iresult == 0){
-                                    resultVal = 0
                                 }
                                 obj.empiricalValueAddss = arr
                                 if(arr.length > this.empiricalValueAdd){
@@ -291,7 +315,7 @@
                         materialCode: result.materialCode,
                         material: result.material,
                         userName: Array.from(new Set(userList)).join(","),
-                        result: resultVal,
+                        result: this.resultVal==null ? '' : this.resultVal,
                     }]
                 }).catch(error=>{
                     console.log(error)
@@ -425,7 +449,7 @@
 <style scoped>
 .finishedProduct-detail {
   width: 100%;
-  height: 470px;
+  height: 500px;
   padding: 10px 20px;
   display: flex;
   border: 1px solid #ddd;
@@ -449,7 +473,7 @@
 
 .finishedProduct-basic {
   background-color: #fff;
-  height: 155px;
+  height: 120px;
   display: flex;
   flex-wrap: wrap;
   padding: 10px 20px;

--
Gitblit v1.9.3