From 154ef0e4c3dbb483d55e9b2b242021f627bee451 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期二, 26 十二月 2023 09:45:16 +0800
Subject: [PATCH] modified: src/views/technology/document/index.vue modified: src/views/technology/routing/index.vue
---
src/views/quality/packageinspect/packageInspect-form.vue | 121 +++++++++++++++++++++++++++++++---------
1 files changed, 94 insertions(+), 27 deletions(-)
diff --git a/src/views/quality/packageinspect/packageInspect-form.vue b/src/views/quality/packageinspect/packageInspect-form.vue
index b34bfa9..4f825f5 100644
--- a/src/views/quality/packageinspect/packageInspect-form.vue
+++ b/src/views/quality/packageinspect/packageInspect-form.vue
@@ -3,7 +3,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=='' || resultVal==null">缂栬緫-鍖呰妫�楠�</h2>
+ <h2 v-else>鏌ョ湅-鍖呰妫�楠�</h2>
</div>
<div class="btn-group header-right">
</div>
@@ -65,10 +66,10 @@
<el-row :gutter="10" style="width:100%;z-index: 10;height:50px;">
<el-col :span="20">妫�楠岄」鐩�</el-col>
<el-col :span="2">
- <el-button v-if="resultVal==''" style="width:100%" size="small" @click="clickAddLine()">娣诲姞妫�楠岄」鐩�</el-button>
+ <el-button v-if="resultVal=='' || resultVal==null" style="width:100%" size="small" @click="clickAddLine()">娣诲姞妫�楠岄」鐩�</el-button>
</el-col>
<el-col :span="2">
- <el-button v-if="resultVal==''" style="width:100%" type="primary" size="small"
+ <el-button v-if="resultVal=='' || resultVal==null" style="width:100%" type="primary" size="small"
@click="savePackIns()">淇濆瓨</el-button>
</el-col>
</el-row>
@@ -89,14 +90,14 @@
</el-table-column>
<el-table-column prop="name" label="椤圭洰" width="260">
<template slot-scope="scope">
- <el-input :readonly="resultVal!=''" v-if="scope.row.children" class="inline-input" style="width:90%;" v-model="scope.row.name"
+ <el-input :readonly="resultVal!=null" v-if="scope.row.children" class="inline-input" style="width:90%;" v-model="scope.row.name"
placeholder="璇疯緭鍏ラ」鐩悕绉�"></el-input>
</template>
</el-table-column>
<el-table-column prop="required" label="瑕佹眰" width="260">
<template slot-scope="scope">
<div v-if="!scope.row.children">
- <el-input :readonly="resultVal!=''" v-model="scope.row.required"
+ <el-input :readonly="resultVal!=null" v-model="scope.row.required"
placeholder="璇疯緭鍏ヨ姹�"></el-input>
</div>
</template>
@@ -104,19 +105,19 @@
<el-table-column prop="note" label="妫�楠屾弿杩�" width="260" >
<template slot-scope="scope">
<div v-if="!scope.row.children">
- <el-input :readonly="resultVal!=''" v-model="scope.row.note" placeholder="妫�楠屾弿杩�"></el-input>
+ <el-input :readonly="resultVal!=null" v-model="scope.row.note" placeholder="妫�楠屾弿杩�"></el-input>
</div>
</template>
</el-table-column>
<el-table-column prop="testState" label="缁撹" min-width="150">
<template slot-scope="scope">
- <el-select :disabled="resultVal!=''" @change="changeResult" v-model="scope.row.result" v-if="!scope.row.children">
+ <el-select style="width:100%" :disabled="resultVal!=null" @change="changeResult" v-model="scope.row.result" v-if="!scope.row.children">
<el-option label="鍚堟牸" value="鍚堟牸"></el-option>
<el-option label="涓嶅悎鏍�" value="涓嶅悎鏍�"></el-option>
</el-select>
</template>
</el-table-column>
- <el-table-column v-if="resultVal==''" fixed="right" style="background-color: white;" label="鎿嶄綔" width="200">
+ <el-table-column v-if="resultVal=='' || resultVal==null" fixed="right" style="background-color: white;" label="鎿嶄綔" width="200">
<template slot-scope="scope">
<el-button v-if="scope.row.children" icon="el-icon-circle-plus-outline" type="text" @click="clickAddChildren(scope.row,scope.$index)">娣诲姞琛�</el-button>
<el-button v-if="!scope.row.children" icon="el-icon-circle-close" type="text"
@@ -143,7 +144,7 @@
<el-table-column prop="userName" label="妫�楠屽憳"></el-table-column>
<el-table-column prop="result" label="妫�楠岀粨璁�">
<template slot-scope="scope">
- <el-select :disabled="resultVal!=''" style="width:100%" v-model="scope.row.result">
+ <el-select :disabled="resultVal!=null" style="width:100%" v-model="scope.row.result">
<el-option label="鍚堟牸" value="鍚堟牸"></el-option>
<el-option label="涓嶅悎鏍�" value="涓嶅悎鏍�"></el-option>
</el-select>
@@ -151,7 +152,7 @@
</el-table-column>
<el-table-column label="鎿嶄綔">
<template>
- <el-button type="text" :disabled="resultVal!=''" @click="submitSave()" size="small">涓婃姤</el-button>
+ <el-button type="text" :disabled="resultVal!=null" @click="submitSave()" size="small">涓婃姤</el-button>
</template>
</el-table-column>
</el-table>
@@ -159,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>
@@ -167,6 +182,7 @@
fetchListById,
updatePackageInsProduct,
updatePackageInspectById,
+ getCustomer,
} from '@/api/quality/packageInspect'
export default {
computed:{},
@@ -174,6 +190,12 @@
},
data(){
return{
+ submitData: {
+ id:null,
+ result: null,
+ lineNo: null,
+ },
+ dialogVisible: false,
loading: false,
resultVal: null,
dataForm:{
@@ -221,15 +243,18 @@
this.init()
},
watch:{
- list(){
- this.changeResult()
+ dialogVisible(newVal){
+ if(!newVal){
+ this.$refs.form.resetFields();
+ }
}
},
methods:{
changeResult(){
- let result = '鍚堟牸'
+ let result = ''
let data = this.list
if(data){
+ result='鍚堟牸'
data.forEach(item=>{
if(item.children){
item.children.forEach(ele=>{
@@ -244,26 +269,61 @@
},
//涓婃姤
submitSave(){
- let data = {
- id: this.dataForm.id,
- result: this.conclusionTable[0].result,
+ const _than = this
+ this.$confirm('涓婃姤鍓嶏紝璇风‘璁ゆ楠岄」鐩槸鍚﹀凡淇濆瓨!', '鎻愮ず', {
+ confirmButtonText: '纭涓婃姤',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ _than.submitData.id = _than.dataForm.id,
+ _than.submitData.result = _than.conclusionTable[0].result,
+ getCustomer(_than.dataForm.id).then(res=>{
+ if(res.status===200){
+ _than.confirmSubmit(_than.submitData,true)
+ }
+ }).catch(error=>{
+ _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
+ }
+ })
}
- updatePackageInspectById(data).then(res => {
- if(res.data.code === 0){
- this.resultVal = res.data.data
- sessionStorage.setItem("packIns-resultVal-"+this.dataForm.id,res.data.data)
- this.$message.success("涓婃姤鎴愬姛");
- }else{
- this.$message.error("涓婃姤澶辫触",res.data.data);
- }
- });
+ 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);
+ }
+ })
+ }
},
// 娣诲姞琛�
- clickAddLine(row) {
+ clickAddLine() {
this.list.push({
name: '',
randomId: Math.random(),
- children: []
+ children: [{
+ name: '',
+ note: '',
+ required: '',
+ result: '',
+ randomId: Math.random(),
+ }]
})
},
//娣诲姞瀛愮骇
@@ -292,6 +352,7 @@
})
this.list[i].children.splice(childrenIndex,1)
}
+ this.changeResult()
},
//淇濆瓨妫�鏌ラ」
savePackIns(){
@@ -318,6 +379,7 @@
updatePackageInsProduct(dataList).then(res=>{
if(res.status===200){
this.$message.success("淇濆瓨鎴愬姛")
+ this.init()
}
}).catch(error=>{
console.log(error);
@@ -368,6 +430,11 @@
userName: Array.from(new Set(userNameList)).join(','),
result: null
}]
+ this.$nextTick(()=>{
+ if(this.list.length>0){
+ this.changeResult()
+ }
+ })
}).catch(error=>{
this.$message.error("鑾峰彇澶辫触",error)
})
--
Gitblit v1.9.3