From 210e6ea4eab68b1c607b48870b5e3553930853fb Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 05 一月 2024 14:53:51 +0800
Subject: [PATCH] 销售订单-下载按钮修改4
---
src/views/quality/packageinspect/packageInspect-form.vue | 196 +++++++++++++++++++++++++++++++++++-------------
1 files changed, 143 insertions(+), 53 deletions(-)
diff --git a/src/views/quality/packageinspect/packageInspect-form.vue b/src/views/quality/packageinspect/packageInspect-form.vue
index 3299eb1..5e46efd 100644
--- a/src/views/quality/packageinspect/packageInspect-form.vue
+++ b/src/views/quality/packageinspect/packageInspect-form.vue
@@ -63,13 +63,20 @@
</el-form>
</div>
<div class="packageInspect-detail">
- <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=='' || resultVal==null" style="width:100%" size="small" @click="clickAddLine()">娣诲姞妫�楠岄」鐩�</el-button>
- </el-col>
- <el-col :span="2">
- <el-button v-if="resultVal=='' || resultVal==null" style="width:100%" type="primary" size="small"
+ <el-row :gutter="10" style="width:100%;z-index: 10;height:30px;">
+ <el-col :span="12">妫�楠岄」鐩�</el-col>
+ <el-col :span="12" style="text-align: right;">
+ <el-dropdown @command="handleCommand" v-if="!isShow && resultVal==null">
+ <el-button size="mini" style="margin-right: 10px;" type="primary" >
+ 鍒囨崲榛樿妫�楠岄」<i class="el-icon-arrow-down el-icon--right"></i>
+ </el-button>
+ <el-dropdown-menu slot="dropdown">
+ <el-dropdown-item command="1">妫�楠岄」鐩�1</el-dropdown-item>
+ <el-dropdown-item divided command="2">妫�楠岄」鐩�2</el-dropdown-item>
+ </el-dropdown-menu>
+ </el-dropdown>
+ <el-button v-if="resultVal=='' || resultVal==null" size="mini" @click="clickAddLine()">娣诲姞妫�楠岄」鐩�</el-button>
+ <el-button v-if="resultVal=='' || resultVal==null" type="primary" size="mini"
@click="savePackIns()">淇濆瓨</el-button>
</el-col>
</el-row>
@@ -88,21 +95,24 @@
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
<el-table-column type="index" label="搴忓彿" width="60">
</el-table-column>
- <el-table-column prop="name" label="椤圭洰" width="260">
+ <el-table-column prop="name" label="椤圭洰" width="160">
<template slot-scope="scope">
- <el-input :readonly="resultVal!=null" v-if="scope.row.children" class="inline-input" style="width:90%;" v-model="scope.row.name"
+ <el-input :readonly="resultVal!=null || !scope.row.isEdit" v-if="scope.row.children" class="inline-input" style="width:80%;" v-model="scope.row.name"
placeholder="璇疯緭鍏ラ」鐩悕绉�"></el-input>
</template>
</el-table-column>
- <el-table-column prop="required" label="瑕佹眰" width="260">
+ <el-table-column prop="required" label="瑕佹眰" width="160">
<template slot-scope="scope">
<div v-if="!scope.row.children">
- <el-input :readonly="resultVal!=null" v-model="scope.row.required"
- placeholder="璇疯緭鍏ヨ姹�"></el-input>
+ <el-tooltip :content="scope.row.required">
+ <el-input :readonly="resultVal!=null || !scope.row.isEdit"
+ v-model="scope.row.required"
+ placeholder="璇疯緭鍏ヨ姹�"></el-input>
+ </el-tooltip>
</div>
</template>
</el-table-column>
- <el-table-column prop="note" label="妫�楠屾弿杩�" width="260" >
+ <el-table-column prop="note" label="妫�楠屾弿杩�" width="160">
<template slot-scope="scope">
<div v-if="!scope.row.children">
<el-input :readonly="resultVal!=null" v-model="scope.row.note" placeholder="妫�楠屾弿杩�"></el-input>
@@ -119,10 +129,10 @@
</el-table-column>
<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"
+ <el-button v-if="scope.row.children && scope.row.isEdit" icon="el-icon-circle-plus-outline" type="text" @click="clickAddChildren(scope.row,scope.$index)">娣诲姞琛�</el-button>
+ <el-button v-if="!scope.row.children && scope.row.isEdit" icon="el-icon-circle-close" type="text"
@click="clickDelLine(scope.row,scope.$index,scope.row.children!=null)">鍙栨秷</el-button>
- <el-button v-if="scope.row.children" icon="el-icon-circle-close" type="text"
+ <el-button v-if="scope.row.children && scope.row.isEdit" icon="el-icon-circle-close" type="text"
@click="clickDelLine(scope.row,scope.$index,scope.row.children!=null)">鍒犻櫎椤圭洰</el-button>
</template>
@@ -140,8 +150,8 @@
<el-table class="l-mes" border height="90" :data="conclusionTable" ref="conclusion" v-model="conclusion"
:header-cell-style="{textAlign:'center',color:'black',backgroundColor:'#fafafa'}"
:cell-style="{textAlign:'center'}">
- <el-table-column prop="packageNo" label="鍖呰缂栧彿"></el-table-column>
- <el-table-column prop="userName" label="妫�楠屽憳"></el-table-column>
+ <el-table-column prop="packageNo" label="鍖呰缂栧彿" width="200" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="userName" label="妫�楠屽憳" width="200" show-overflow-tooltip></el-table-column>
<el-table-column prop="result" label="妫�楠岀粨璁�">
<template slot-scope="scope">
<el-select :disabled="resultVal!=null" style="width:100%" v-model="scope.row.result">
@@ -152,7 +162,7 @@
</el-table-column>
<el-table-column label="鎿嶄綔">
<template>
- <el-button type="text" :disabled="resultVal==null" @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>
@@ -160,6 +170,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>
@@ -168,13 +192,23 @@
fetchListById,
updatePackageInsProduct,
updatePackageInspectById,
+ getCustomer,
} from '@/api/quality/packageInspect'
+import {inspect1,inspect2} from '@/const/defaultPackageInspect'
export default {
- computed:{},
+ computed:{
+ },
components:{
},
data(){
return{
+ isShow: false,
+ submitData: {
+ id:null,
+ result: null,
+ lineNo: null,
+ },
+ dialogVisible: false,
loading: false,
resultVal: null,
dataForm:{
@@ -222,23 +256,43 @@
this.init()
},
watch:{
+ dialogVisible(newVal){
+ if(!newVal){
+ this.$refs.form.resetFields();
+ }
+ }
},
methods:{
+ handleCommand(command) {
+ switch(command){
+ case "1":
+ this.init(inspect1)
+ break;
+ case "2":
+ this.init(inspect2)
+ break;
+ }
+ },
changeResult(){
let result = ''
let data = this.list
+ let passNum = 0
+ let unPassNum = 0
if(data){
- result='鍚堟牸'
data.forEach(item=>{
if(item.children){
item.children.forEach(ele=>{
if(ele.result=='涓嶅悎鏍�'){
- result='涓嶅悎鏍�'
+ unPassNum+=1
+ }
+ if(ele.result=='鍚堟牸'){
+ passNum+=1
}
})
}
})
}
+ result = (passNum+unPassNum)>0 ? unPassNum>0 ? '涓嶅悎鏍�' :'鍚堟牸' : ''
this.conclusionTable[0].result = result
},
//涓婃姤
@@ -249,32 +303,56 @@
cancelButtonText: '鍙栨秷',
type: 'warning'
}).then(() => {
- let data = {
- id: _than.dataForm.id,
- result: _than.conclusionTable[0].result,
- }
- 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);
- }
- })
+ _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
+ }
+ })
+ }
+ 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() {
this.list.push({
name: '',
randomId: Math.random(),
+ isEdit: true,
children: [{
name: '',
note: '',
required: '',
result: '',
randomId: Math.random(),
+ isEdit: true,
}]
})
},
@@ -286,6 +364,7 @@
required: '',
result: '',
randomId: Math.random(),
+ isEdit: true,
})
},
// 鍒犻櫎琛�
@@ -304,6 +383,7 @@
})
this.list[i].children.splice(childrenIndex,1)
}
+ this.changeResult()
},
//淇濆瓨妫�鏌ラ」
savePackIns(){
@@ -330,6 +410,7 @@
updatePackageInsProduct(dataList).then(res=>{
if(res.status===200){
this.$message.success("淇濆瓨鎴愬姛")
+ this.init()
}
}).catch(error=>{
console.log(error);
@@ -337,22 +418,27 @@
})
}
},
- init(){
- if(this.dataForm.id){
- fetchListById(this.dataForm.id).then(res=>{
+ init(dataList){
+ const _than = this
+ if(_than.dataForm.id){
+ fetchListById(_than.dataForm.id).then(res=>{
let data = res.data.data
- this.dataForm.packInsNo = data.packInsNo
- this.dataForm.packageNo = data.packageNo
- this.dataForm.contractNo = data.contractNo
- this.dataForm.customerName = data.customerName
- this.dataForm.projectName = data.projectName
- this.dataForm.createTime = data.createTime
- this.dataForm.createUser = data.createUser
- this.list = []
+ _than.dataForm.packInsNo = data.packInsNo
+ _than.dataForm.packageNo = data.packageNo
+ _than.dataForm.contractNo = data.contractNo
+ _than.dataForm.customerName = data.customerName
+ _than.dataForm.projectName = data.projectName
+ _than.dataForm.createTime = data.createTime
+ _than.dataForm.createUser = data.createUser
+ _than.list = []
let userNameList = []
+ if(dataList){
+ _than.list = JSON.parse(JSON.stringify(dataList))
+ }
data.packageInsProductS.forEach(item => {
if (item.children) {
let ele = {
+ isEdit: true,
randomId: Math.random(),
name: null,
children: []
@@ -365,6 +451,7 @@
let o = {
name: item.name,
randomId: Math.random(),
+ isEdit: true,
required: obj.required,
pid: obj.pid,
note: obj.note?obj.note:'',
@@ -372,24 +459,27 @@
}
ele.children.push(o)
})
- this.list.push(ele)
+ _than.list.push(ele)
}
})
- this.conclusionTable = [{
+ let find1 = this.list.find(ele=>ele.name===inspect1[0].name&&ele.isEdit) !=undefined;
+ let find2 = this.list.find(ele=>ele.name===inspect2[0].name&&ele.isEdit) !=undefined;
+ this.isShow = find1||find2
+ _than.conclusionTable = [{
packageNo: data.packageNo,
userName: Array.from(new Set(userNameList)).join(','),
result: null
}]
- this.$nextTick(()=>{
- if(this.list.length>0){
- this.changeResult()
+ _than.$nextTick(()=>{
+ if(_than.list.length>0){
+ _than.changeResult()
}
})
}).catch(error=>{
- this.$message.error("鑾峰彇澶辫触",error)
+ _than.$message.error("鑾峰彇澶辫触",error)
})
}else{
- this.conclusionTable = []
+ _than.conclusionTable = []
}
},
},
--
Gitblit v1.9.3