From b3c202648513fc01b69e09b4e3bbe1865a0b6b8c Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期四, 13 六月 2024 16:39:48 +0800 Subject: [PATCH] 完成检验下单功能优化 --- src/components/do/b3-work-time-management/work-time-management.vue | 226 ++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 161 insertions(+), 65 deletions(-) diff --git a/src/components/do/b3-work-time-management/work-time-management.vue b/src/components/do/b3-work-time-management/work-time-management.vue index e5dbe6f..1ebdf62 100644 --- a/src/components/do/b3-work-time-management/work-time-management.vue +++ b/src/components/do/b3-work-time-management/work-time-management.vue @@ -63,10 +63,12 @@ </el-radio-group> <div style="display: flex;align-items: center;"> <p style="font-size: 14px;margin-right: 30px;"> - 鎬诲伐鏃舵眹鎬伙細<span style="font-size: 16px;color: #3A7BFA;">{{ (totalInfo['浜ч噺宸ユ椂姹囨��']+totalInfo['杈呭姪宸ユ椂姹囨��'])? (totalInfo['浜ч噺宸ユ椂姹囨��']+totalInfo['杈呭姪宸ユ椂姹囨��']):0 }}</span> 浜ч噺宸ユ椂姹囨�伙細<span style="font-size: 16px;color: #3A7BFA;">{{totalInfo['浜ч噺宸ユ椂姹囨��']?totalInfo['浜ч噺宸ユ椂姹囨��']:0}}</span> 杈呭姪宸ユ椂姹囨�伙細<span style="font-size: 16px;color: #3A7BFA;">{{totalInfo['杈呭姪宸ユ椂姹囨��']?totalInfo['杈呭姪宸ユ椂姹囨��']:0}}</span> + 鎬诲伐鏃舵眹鎬伙細<span style="font-size: 16px;color: #3A7BFA;" v-if="totalInfo">{{ (totalInfo['浜ч噺宸ユ椂姹囨��']+totalInfo['杈呭姪宸ユ椂姹囨��'])? (totalInfo['浜ч噺宸ユ椂姹囨��']+totalInfo['杈呭姪宸ユ椂姹囨��']):0 }}</span> 浜ч噺宸ユ椂姹囨�伙細<span style="font-size: 16px;color: #3A7BFA;" v-if="totalInfo">{{totalInfo['浜ч噺宸ユ椂姹囨��']?totalInfo['浜ч噺宸ユ椂姹囨��']:0}}</span> 杈呭姪宸ユ椂姹囨�伙細<span style="font-size: 16px;color: #3A7BFA;" v-if="totalInfo">{{totalInfo['杈呭姪宸ユ椂姹囨��']?totalInfo['杈呭姪宸ユ椂姹囨��']:0}}</span> </p> - <el-button size="small" type="primary" style="margin-right: 16px;" @click="openAdd" v-show="currentTable == 'ValueTable0'">褰曞叆鏁版嵁</el-button> - <el-button size="small" type="primary" @click="handleOut" :loading="outLoading">瀵� 鍑�</el-button> + <el-button size="small" type="primary" style="margin-right: 16px;" @click="openAdd" v-show="currentTable == 'ValueTable0'&&add">褰曞叆鏁版嵁</el-button> + <el-button size="small" type="primary" + v-if="down" + @click="handleOut" :loading="outLoading">瀵� 鍑�</el-button> </div> </div> <div class="table"> @@ -174,13 +176,13 @@ <el-input v-model="formData0.number" size="small" :disabled="title=='鎵瑰噯'"></el-input> </el-form-item> <el-form-item label="鏁伴噺:" required> - <el-input v-model="formData0.amount" size="small" :disabled="title=='鎵瑰噯'"></el-input> + <el-input v-model="formData0.reviewerNumber" size="small" :disabled="title=='鎵瑰噯'"></el-input> </el-form-item> <el-form-item label="鏍稿噯宸ユ椂:"> <el-input v-model="formData0.approvedWorkingHour" size="small" disabled></el-input> </el-form-item> - <el-form-item label="杈呭姪宸ユ椂:"> - <el-input v-model="formData0.nonproductiveTime" size="small" disabled></el-input> + <el-form-item label="澶嶆牳宸ユ椂:"> + <el-input v-model="formData0.reviewerNonproductiveTime" size="small" disabled></el-input> </el-form-item> <el-form-item label="杈呭姪椤圭洰:"> <el-input v-model="formData0.auxiliaryProject" size="small" disabled></el-input> @@ -216,6 +218,8 @@ data () { return{ entity:{}, + down:false, + add:false, componentData: { entity: { week: null, @@ -254,11 +258,55 @@ tagField: { shift:{ select:[] + }, + state:{ + select:[ + { + label:'宸叉彁浜�', + value:'宸叉彁浜�', + type:'primary' + }, + { + label:'宸插鏍�', + value:'宸插鏍�', + type:'warning' + }, + { + label:'宸叉壒鍑�', + value:'宸叉壒鍑�', + type:'success' + }, + ] + }, + weekDay:{ + select:[] } }, linkEvent: {}, selectField: { shift:{ + select:[] + }, + state:{ + select:[ + { + label:'宸叉彁浜�', + value:'宸叉彁浜�', + type:'primary' + }, + { + label:'宸插鏍�', + value:'宸插鏍�', + type:'warning' + }, + { + label:'宸叉壒鍑�', + value:'宸叉壒鍑�', + type:'success' + }, + ] + }, + weekDay:{ select:[] } }, @@ -289,16 +337,17 @@ requiredAdd: [], requiredUp: [] }, + addFileVisible:false, entityCopy1: {}, upIndex1:100, weekList:[ - {label: '鏄熸湡涓�', value: '1'}, - {label: '鏄熸湡浜�', value: '2'}, - {label: '鏄熸湡涓�', value: '3'}, - {label: '鏄熸湡鍥�', value: '4'}, - {label: '鏄熸湡浜�', value: '5'}, - {label: '鏄熸湡鍏�', value: '6'}, - {label: '鏄熸湡鏃�', value: '7'} + {label: '鏄熸湡涓�', value: '1',type:'primary'}, + {label: '鏄熸湡浜�', value: '2',type:'primary'}, + {label: '鏄熸湡涓�', value: '3',type:'primary'}, + {label: '鏄熸湡鍥�', value: '4',type:'primary'}, + {label: '鏄熸湡浜�', value: '5',type:'primary'}, + {label: '鏄熸湡鍏�', value: '6',type:'primary'}, + {label: '鏄熸湡鏃�', value: '7',type:'primary'} ], currentTable:'ValueTable0', addVisible:false, @@ -324,9 +373,9 @@ createUser:'', shift:'', number:'', - amount:'', + reviewerNumber:'', approvedWorkingHour:'', - nonproductiveTime:'', + reviewerNonproductiveTime:'', auxiliaryProject:'', reviewerRemark:'', }, @@ -349,7 +398,7 @@ label:'宸叉壒鍑�' }, ], - totalInfo:{}, + totalInfo:null, auxiliaryWorking:null, outLoading:false } @@ -387,21 +436,21 @@ this.formData.nonproductiveTime = this.formData.amount*val } }, - 'formData0.amount'(val){ + 'formData0.reviewerNumber'(val){ if(val){ if(!isNaN(val)){ if(this.formData0.approvedWorkingHour){ - this.formData0.nonproductiveTime = this.formData0.approvedWorkingHour*val + this.formData0.reviewerNonproductiveTime = this.formData0.approvedWorkingHour*val } }else{ this.$message.error('璇疯緭鍏ユ暟瀛�') - this.formData0.amount = '' + this.formData0.reviewerNumber = '' } } }, 'formData0.approvedWorkingHour'(val){ - if(val&&this.formData0.amount){ - this.formData0.nonproductiveTime = this.formData0.amount*val + if(val&&this.formData0.reviewerNumber){ + this.formData0.reviewerNonproductiveTime = this.formData0.reviewerNumber*val } } }, @@ -412,8 +461,53 @@ this.selectshiftByUser() this.entityCopy = this.HaveJson(this.componentData.entity); this.entityCopy1 = this.HaveJson(this.componentData1.entity); + this.componentData.tagField.weekDay.select = this.weekList + this.componentData.selectField.weekDay.select = this.weekList }, methods:{ + getPower(){ + let power = JSON.parse(sessionStorage.getItem('power')) + let del = false + let down = false + let add = false + let up = false + let check = false + let ratify = false + for (var i = 0; i < power.length; i++) { + if (power[i].menuMethod == 'exportWorkingHours') { + down = true + } + if (power[i].menuMethod == 'deleteAuxiliaryWorkingHoursDay') { + del = true + } + if (power[i].menuMethod == 'insertAuxiliaryWorkingHoursDay') { + add = true + } + if (power[i].menuMethod == 'updateAuxiliaryWorkingHoursDay') { + up = true + } + if (power[i].menuMethod == 'check') { + check = true + } + if (power[i].menuMethod == 'approve') { + ratify = true + } + } + if (!approve) { + this.componentData.do.splice(3, 1) + } + if (!check) { + this.componentData.do.splice(2, 1) + } + if (!up) { + this.componentData.do.splice(1, 1) + } + if (!del) { + this.componentData.do.splice(0, 1) + } + this.down = down + this.add = add + }, getYearAndMonthAndDays(date){ return getYearAndMonthAndDays(date) }, @@ -421,9 +515,13 @@ let entity = {} if(this.entity.week1&&this.entity.week2){ entity.week = JSON.stringify([this.entity.week1,this.entity.week2]) + }else{ + entity.week = '' } if(this.entity.dateTime){ entity.dateTime = JSON.stringify(this.entity.dateTime) + }else{ + entity.dateTime = '' } entity.weekDay = this.entity.weekDay entity.name = this.entity.name @@ -534,14 +632,16 @@ this.$message.error('璇疯緭鍏ユ暟閲�') return } - this.checkLoadY = true + if(this.title == '瀹℃牳'){ - // if(e==0){ - // // 瀹℃牳涓嶉�氳繃 - // }else{ - // // 瀹℃牳閫氳繃 - // } - this.formData0.state = e==0?'瀹℃牳涓嶉�氳繃':'瀹℃牳閫氳繃' + if(e==0){ + // 瀹℃牳涓嶉�氳繃 + this.checkLoadN = true + }else{ + // 瀹℃牳閫氳繃 + this.checkLoadY = true + } + this.formData0.state = e==0?this.formData0.state:'宸插鏍�' this.$axios.post(this.$api.auxiliaryWorkingHoursDay.check, { ...this.formData0 }, { @@ -549,7 +649,13 @@ 'Content-Type': 'application/json' } }).then(res => { - this.checkLoadY = false + if(e==0){ + // 瀹℃牳涓嶉�氳繃 + this.checkLoadN = false + }else{ + // 瀹℃牳閫氳繃 + this.checkLoadY = false + } if (res.code == 201) return this.$message.success('鎿嶄綔鎴愬姛') this.checkVisible = false @@ -557,20 +663,24 @@ this.collectWorkingHours() }) }else{ - // if(e==0){ - // // 瀹℃牳涓嶉�氳繃 - // }else{ - // // 瀹℃牳閫氳繃 - // } + if(e==0){ + this.checkLoadN = true + }else{ + this.checkLoadY = true + } this.$axios.post(this.$api.auxiliaryWorkingHoursDay.approve, { id:this.formData0.id, - state:e==0?'鎵瑰噯涓嶉�氳繃':'鎵瑰噯閫氳繃' + state:e==0?'宸叉彁浜�':'宸叉壒鍑�' }, { headers: { 'Content-Type': 'application/json' } }).then(res => { - this.checkLoadY = false + if(e==0){ + this.checkLoadN = false + }else{ + this.checkLoadY = false + } if (res.code == 201) return this.$message.success('鎿嶄綔鎴愬姛') this.checkVisible = false @@ -628,42 +738,28 @@ if(this.formData.number){ this.$axios.post(this.$api.auxiliaryWorkingHoursDay.selectAuxiliaryWorkingHoursByNumber+'?number='+this.formData.number).then(res => { this.auxiliaryWorking = res.data - this.formData.approvedWorkingHour = this.auxiliaryWorking.approvedWorkingHour - this.formData.auxiliaryProject = this.auxiliaryWorking.auxiliaryProject + if(this.addVisible){ + this.formData.approvedWorkingHour = this.auxiliaryWorking.approvedWorkingHour + this.formData.auxiliaryProject = this.auxiliaryWorking.auxiliaryProject + }else if(this.title=='瀹℃牳'&&this.checkVisible){ + this.formData0.approvedWorkingHour = this.auxiliaryWorking.approvedWorkingHour + this.formData0.auxiliaryProject = this.auxiliaryWorking.auxiliaryProject + } }) } }, handleOut(){ this.outLoading = true - this.$axios.post(this.$api.auxiliaryOutputWorkingHours.exportWorkingHours,{responseType: 'blob'}).then(res => { + this.$axios.get(this.$api.auxiliaryOutputWorkingHours.exportWorkingHours,{responseType: "blob"}).then(res => { this.outLoading = false this.$message.success('瀵煎嚭鎴愬姛') - // let fileName="鏃ュ伐鏃舵眹鎬昏〃"; - // const blob = new Blob([res], { - // type: 'application/force-download' - // }) - // const filename = decodeURI(fileName+'.xlsx') - // // 鍒涘缓涓�涓秴閾炬帴锛屽皢鏂囦欢娴佽祴杩涘幓锛岀劧鍚庡疄鐜拌繖涓秴閾炬帴鐨勫崟鍑讳簨浠� - // const elink = document.createElement('a') - // elink.download = filename - // elink.style.display = 'none' - // elink.href = URL.createObjectURL(blob) - // document.body.appendChild(elink) - // elink.click() - // URL.revokeObjectURL(elink.href) // 閲婃斁URL 瀵硅薄 - // document.body.removeChild(elink) - const blob = new Blob([res], { - type: 'application/force-download' - }) - const link = document.createElement('a') - link.href = URL.createObjectURL(blob) - link.download = decodeURI('鏃ュ伐鏃舵眹鎬昏〃'+'.xlsx') - document.body.appendChild(link) - link.click() - window.setTimeout(function () { - URL.revokeObjectURL(blob) - document.body.removeChild(link) - }, 0) + const blob = new Blob([res]); + console.log(blob) + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = '鏃ュ伐鏃舵眹鎬昏〃.xlsx'; + link.click(); }) }, } -- Gitblit v1.9.3