From c1a35f017eba33c14536784325f3fd16a60a603d Mon Sep 17 00:00:00 2001 From: zss <zss@example.com> Date: 星期三, 17 七月 2024 16:20:56 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/components/do/b3-work-time-management/work-time-management.vue | 440 ++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 320 insertions(+), 120 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..bea077b 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 @@ -1,7 +1,7 @@ <template> <div class="work-time-management"> <div class="search"> - <div class="search_thing"> + <!-- <div class="search_thing"> <div class="search_label">鍛ㄦ锛�</div> <div class="search_input" style="display: flex;align-items: center;"> <el-input size="small" placeholder="寮�濮嬪懆娆�" clearable @@ -10,7 +10,7 @@ <el-input size="small" placeholder="缁撴潫鍛ㄦ" clearable v-model="entity.week2"></el-input> </div> - </div> + </div> --> <div class="search_thing" style="width: 200px;"> <div class="search_label">鏄熸湡锛�</div> <el-select v-model="entity.weekDay" placeholder="鍏ㄩ儴" size="small" @change="refreshTable()" clearable> @@ -18,7 +18,7 @@ </el-option> </el-select> </div> - <div class="search_thing"> + <div class="search_thing" style="width: 390px;"> <div class="search_label" style="width: 90px;">鏃堕棿鑼冨洿锛�</div> <div class="search_input"> <el-date-picker @@ -63,10 +63,14 @@ </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" @click="openAdd" v-show="currentTable == 'ValueTable0'&&add">褰曞叆鏁版嵁</el-button> + <el-button size="small" type="primary" + v-if="down" + @click="handleOut" :loading="outLoading">瀵� 鍑�</el-button> + <el-button size="small" type="primary" v-show="currentTable == 'ValueTable0'&&add" @click="openBatchCheck(0)">鎵归噺瀹℃牳</el-button> + <el-button size="small" type="primary" v-show="currentTable == 'ValueTable0'&&add" @click="openBatchCheck(1)">鎵归噺鎵瑰噯</el-button> </div> </div> <div class="table"> @@ -174,13 +178,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> @@ -201,6 +205,17 @@ </el-row> </span> </el-dialog> + <el-dialog + :title="batchCheckTitle" + :visible.sync="batchCheckDialog" + width="30%" + :before-close="closeBatchCheckDialog"> + <span>{{batchCheckDialogMessage}}</span> + <span slot="footer" class="dialog-footer"> + <el-button @click="batchCheckDialog = false">{{batchCheckTitle=='鎵归噺瀹℃牳'?'涓嶉�氳繃':'涓嶆壒鍑�'}}</el-button> + <el-button type="primary" @click="batchCheck">{{batchCheckTitle=='鎵归噺瀹℃牳'?'閫� 杩�':'鎵� 鍑�'}}</el-button> + </span> + </el-dialog> </div> </template> @@ -215,55 +230,110 @@ }, data () { return{ - entity:{}, + entity:{ + dateTime: [] + }, + down:false, + add:false, componentData: { - entity: { - week: null, - weekDay: null, - dateTime: null, - name:null, - orderBy: { - field: 'id', - order: 'desc' - } - }, - isIndex: true, - showSelect: false, - select: false, - do: [{ - id: 'delete', - font: '鍒犻櫎', - type: 'text', - method: 'doDiy' - }, { - id: 'handleEdit', - font: '缂栬緫', - type: 'text', - method: 'handleEdit' - },{ - id: 'handleCheck', - font: '瀹℃牳', - type: 'text', - method: 'handleCheck' - }, { - id: 'handleRatify', - font: '鎵瑰噯', - type: 'text', - method: 'handleRatify' - }], - tagField: { - shift:{ - select:[] - } + entity: { + week: null, + weekDay: null, + dateTime: null, + name:null, + orderBy: { + field: 'id', + order: 'desc' + } + }, + isIndex: true, + showSelect: true, + select: true, + selectMethod: 'handleChangeTask', + do: [{ + id: 'delete', + font: '鍒犻櫎', + type: 'text', + method: 'doDiy' + }, { + id: 'handleEdit', + font: '缂栬緫', + type: 'text', + method: 'handleEdit' + },{ + id: 'handleCheck', + font: '瀹℃牳', + type: 'text', + method: 'handleCheck', + disabFun: (row, index) => { + return row.state === '宸插鏍�' || row.state === '宸叉壒鍑�' + } + }, { + id: 'handleRatify', + font: '鎵瑰噯', + type: 'text', + method: 'handleRatify', + disabFun: (row, index) => { + return row.state === '宸叉壒鍑�' + } + }], + tagField: { + shift:{ + select:[] }, - linkEvent: {}, - selectField: { - shift:{ - select:[] - } + state:{ + select:[ + { + label:'宸叉彁浜�', + value:'宸叉彁浜�', + type:'primary' + }, + { + label:'宸插鏍�', + value:'宸插鏍�', + type:'warning' + }, + { + label:'宸叉壒鍑�', + value:'宸叉壒鍑�', + type:'success' + }, + ] }, - requiredAdd: [], - requiredUp: [] + weekDay:{ + select:[] + } + }, + linkEvent: {}, + selectField: { + shift:{ + select:[] + }, + state:{ + select:[ + { + label:'宸叉彁浜�', + value:'宸叉彁浜�', + type:'primary' + }, + { + label:'宸插鏍�', + value:'宸插鏍�', + type:'warning' + }, + { + label:'宸叉壒鍑�', + value:'宸叉壒鍑�', + type:'success' + }, + ] + }, + weekDay:{ + select:[] + } + }, + requiredAdd: [], + requiredUp: [] }, entityCopy: {}, upIndex: 0, @@ -289,16 +359,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 +395,9 @@ createUser:'', shift:'', number:'', - amount:'', + reviewerNumber:'', approvedWorkingHour:'', - nonproductiveTime:'', + reviewerNonproductiveTime:'', auxiliaryProject:'', reviewerRemark:'', }, @@ -349,9 +420,13 @@ label:'宸叉壒鍑�' }, ], - totalInfo:{}, + totalInfo:null, auxiliaryWorking:null, - outLoading:false + outLoading:false, + batchCheckTitle: '鎵归噺瀹℃牳', + batchCheckDialog: false, + ValueTable0Selected: [], + batchCheckDialogMessage: '' } }, watch:{ @@ -387,23 +462,26 @@ 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 } } + }, + created() { + this.setDate() }, mounted(){ this.getCurrentWeekNumber() @@ -412,8 +490,67 @@ 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 + this.getPower() }, methods:{ + /** 灏嗘椂闂撮�夋嫨鍣ㄩ粯璁ら�変负褰撳ぉ鐨勬棩鏈� */ + setDate(){ + let currentDate = new Date(); + let year = currentDate.getFullYear(); + let month = String(currentDate.getMonth() + 1).padStart(2, '0'); + let day = String(currentDate.getDate()).padStart(2, '0'); + let formattedDate1 = `${year}-${month}-${day} 00:00:00`; + let formattedDate2 = `${year}-${month}-${day} 23:59:59`; + this.entity.dateTime.push(formattedDate1); + this.entity.dateTime.push(formattedDate2); + this.refreshTable() + }, + 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 + } + console.log(add) + if (power[i].menuMethod == 'updateAuxiliaryWorkingHoursDay') { + up = true + } + if (power[i].menuMethod == 'check') { + check = true + } + if (power[i].menuMethod == 'approve') { + ratify = true + } + } + if (!ratify) { + 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 +558,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 @@ -435,6 +576,7 @@ this.componentData1.entity = {...this.componentData1.entity,...entity} this.$refs['ValueTable1'].selectList() } + this.collectWorkingHours() }, refresh(){ this.entity = {} @@ -494,7 +636,13 @@ this.addLoad = false if (res.code == 201) return this.$message.success('宸叉彁浜�') - this.addVisible = false + this.formData.number = '' + this.formData.amount = '' + this.formData.remarks = '' + this.formData.approvedWorkingHour = '' + this.formData.nonproductiveTime = '' + this.formData.auxiliaryProject = '' + // this.addVisible = false this.refreshTable() this.collectWorkingHours() }) @@ -509,7 +657,13 @@ this.addLoad = false if (res.code == 201) return this.$message.success('鎿嶄綔鎴愬姛') - this.addVisible = false + this.formData.number = '' + this.formData.amount = '' + this.formData.remarks = '' + this.formData.approvedWorkingHour = '' + this.formData.nonproductiveTime = '' + this.formData.auxiliaryProject = '' + // this.addVisible = false this.refreshTable() this.collectWorkingHours() }) @@ -525,6 +679,45 @@ this.formData0 = row; this.checkVisible = true }, + handleChangeTask (row) { + this.ValueTable0Selected = JSON.parse(JSON.stringify(row)) + }, + openBatchCheck (e) { + if (this.ValueTable0Selected.length > 0) { + const isChecked = this.ValueTable0Selected.every(item => item.state === '宸叉彁浜�') + const isApprove = this.ValueTable0Selected.every(item => item.state !== '宸叉壒鍑�') + console.log('this.isApprove---', isApprove) + this.batchCheckTitle = e === 0 ? '鎵归噺瀹℃牳' : '鎵归噺鎵瑰噯' + this.batchCheckDialogMessage = e === 0 ? '鏄惁鍏ㄩ儴閫氳繃瀹℃牳?' : '鏄惁鍏ㄩ儴閫氳繃鎵瑰噯?' + if (this.batchCheckTitle === '鎵归噺瀹℃牳') { + if (isChecked) { + this.batchCheckDialog = true + } else { + this.$message.error('璇烽�夋嫨鏈鏍告垨鏈壒鍑嗙殑鏁版嵁') + } + } else { + if (isApprove) { + this.batchCheckDialog = true + } else { + this.$message.error('璇烽�夋嫨鏈壒鍑嗙殑鏁版嵁') + } + } + } else { + this.$message.error('璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�') + } + }, + batchCheck () { + const e = this.batchCheckTitle === '鎵归噺瀹℃牳' ? 0 : 1 + this.$refs.ValueTable0.batchCheck(e) + }, + closeBatchCheckDialog () { + this.batchCheckDialog = false + }, + submitBatchCheckDialog () { + this.batchCheckDialog = false + this.refreshTable() + this.collectWorkingHours() + }, submitCheck(e){ if(!this.formData0.number){ this.$message.error('璇疯緭鍏ョ紪鍙�') @@ -534,14 +727,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 +744,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 +758,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 @@ -615,9 +820,15 @@ return String(d) }, collectWorkingHours(){ - this.$axios.post(this.$api.auxiliaryOutputWorkingHours.collectWorkingHours).then(res => { - this.totalInfo = res.data - }) + this.$axios.post(this.$api.auxiliaryOutputWorkingHours.collectWorkingHours,{ + entity:this.componentData.entity + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + this.totalInfo = res.data + }) }, selectshiftByUser(){ this.$axios.post(this.$api.auxiliaryWorkingHoursDay.selectshiftByUser).then(res => { @@ -628,42 +839,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(); }) }, } @@ -708,4 +905,7 @@ height: calc(100% - 60px - 80px - 10px - 40px - 25px); padding: 20px; } +>>>.el-dialog__wrapper { + z-index: 9999 !important; /* 鏍规嵁闇�瑕佽皟鏁村眰绾� */ +} </style> -- Gitblit v1.9.3