From 67da82f0b0c24df5f19bbfcfec63801d9ae902d8 Mon Sep 17 00:00:00 2001
From: 王震 <10952869+daywangzhen@user.noreply.gitee.com>
Date: 星期三, 13 十二月 2023 16:22:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/quality/packageinspect/packageInspect-form.vue |   87 ++++++++++++++++++++++++++++---------------
 1 files changed, 57 insertions(+), 30 deletions(-)

diff --git a/src/views/quality/packageinspect/packageInspect-form.vue b/src/views/quality/packageinspect/packageInspect-form.vue
index 3bada7a..53f333c 100644
--- a/src/views/quality/packageinspect/packageInspect-form.vue
+++ b/src/views/quality/packageinspect/packageInspect-form.vue
@@ -160,6 +160,20 @@
         </el-row>
       </div>
     </div>
+    <el-dialog
+      title="鎻愮ず"
+      :visible.sync="dialogVisible"
+      width="30%">
+      <el-form :model="submitData" ref="form" label-width="100px" >
+        <el-form-item label="璇疯緭鍏ヨ鍙�" prop="lineNo" :rules="{required:true,message:'琛屽彿涓嶈兘涓虹┖',trigger:'blur'}">
+          <el-input v-model="submitData.lineNo" />
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
+        <el-button type="primary" @click="confirmSubmit(submitData,false)">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -176,6 +190,12 @@
     },
     data(){
         return{
+            submitData: {
+              id:null,
+              result: null,
+              lineNo: null,
+            },
+            dialogVisible: false,
             loading: false,
             resultVal: null,
             dataForm:{
@@ -223,6 +243,11 @@
       this.init()
     },
     watch:{
+      dialogVisible(newVal){
+        if(!newVal){
+          this.$refs.form.resetFields();
+        }
+      }
     },
     methods:{
       changeResult(){
@@ -250,39 +275,41 @@
           cancelButtonText: '鍙栨秷',
           type: 'warning'
         }).then(() => {
-          this.checkCustomer(_than.dataForm.id)
-        }).catch(() => {})
-      },
-      checkCustomer(id){
-        const _than = this
-        if(id){
-          getCustomer(id).then(res=>{
+          _than.submitData.id = _than.dataForm.id,
+          _than.submitData.result = _than.conclusionTable[0].result,
+          getCustomer(_than.dataForm.id).then(res=>{
             if(res.status===200){
-              console.log(res.data);
+              _than.confirmSubmit(_than.submitData,true)
             }
           }).catch(error=>{
-            this.$prompt('璇疯緭鍏ヨ鍙�', '鎻愮ず', {
-              confirmButtonText: '纭畾',
-              cancelButtonText: '鍙栨秷',
-              inputPattern: /\S/,
-              inputErrorMessage: '琛屽彿涓嶈兘涓虹┖'
-            }).then(({ value }) => {
-              let data = {
-                id: _than.dataForm.id,
-                result: _than.conclusionTable[0].result,
-                lineNo: value
-              }
-              updatePackageInspectById(data).then(res => {
-                if(res.data.code === 0){
-                  _than.resultVal = res.data.data
-                  sessionStorage.setItem("packIns-resultVal-"+_than.dataForm.id,res.data.data)
-                  _than.$message.success("涓婃姤鎴愬姛");
-                }else{
-                  _than.$message.error("涓婃姤澶辫触",res.data.data);
-                }
-              })
-            }).catch(() => {
-            })
+            console.log("杈撳叆琛屽彿");
+            _than.dialogVisible = true
+          })
+
+        }).catch(() => {})
+      },
+      confirmSubmit(data,isOtc){
+        const _than = this
+        let isSubmit = false
+        if(isOtc){
+          isSubmit = true
+        }else{
+          _than.$refs.form.validate(valid=>{
+            if(valid){
+              isSubmit = true
+              _than.dialogVisible = false
+            }
+          })
+        }
+        if(isSubmit){
+          updatePackageInspectById(data).then(res => {
+            if(res.data.code === 0){
+              _than.resultVal = res.data.data
+              sessionStorage.setItem("packIns-resultVal-"+_than.dataForm.id,res.data.data)
+              _than.$message.success("涓婃姤鎴愬姛");
+            }else{
+              _than.$message.error("涓婃姤澶辫触",res.data.data);
+            }
           })
         }
       },

--
Gitblit v1.9.3