From 41c2f79abd464e6c063166d680b51f746d6f0456 Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期六, 10 八月 2024 16:25:13 +0800 Subject: [PATCH] 修改特殊值填值 --- src/components/do/b3-work-time-management/work-time-management.vue | 375 +++++++++++++++++++++++++++++++++++------------------ 1 files changed, 248 insertions(+), 127 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 f47b25e..95dcc1c 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 @@ -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 @@ -27,8 +27,8 @@ size="small" type="daterange" range-separator="鑷�" - format="yyyy-MM-dd HH:mm:ss" - value-format="yyyy-MM-dd HH:mm:ss" + format="yyyy-MM-dd" + value-format="yyyy-MM-dd" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡" @change="refreshTable()" clearable> </el-date-picker> @@ -63,22 +63,23 @@ </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;" 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> + 鎬诲伐鏃舵眹鎬伙細<span style="font-size: 16px;color: #3A7BFA;" v-if="totalInfo">{{ (totalInfo['浜ч噺宸ユ椂姹囨��']+totalInfo['杈呭姪宸ユ椂姹囨��'])? Number((totalInfo['浜ч噺宸ユ椂姹囨��']+totalInfo['杈呭姪宸ユ椂姹囨��'])).tofixed(4):0 }}</span> 浜ч噺宸ユ椂姹囨�伙細<span style="font-size: 16px;color: #3A7BFA;" v-if="totalInfo">{{totalInfo['浜ч噺宸ユ椂姹囨��']?Number(totalInfo['浜ч噺宸ユ椂姹囨��']).tofixed(4):0}}</span> 杈呭姪宸ユ椂姹囨�伙細<span style="font-size: 16px;color: #3A7BFA;" v-if="totalInfo">{{totalInfo['杈呭姪宸ユ椂姹囨��']?Number(totalInfo['杈呭姪宸ユ椂姹囨��']).tofixed(4):0}}</span> </p> - <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" @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"> <ValueTable ref="ValueTable0" - v-if="currentTable == 'ValueTable0'" + v-if="currentTable == 'ValueTable0'" :isColumnWidth="true" :url="$api.auxiliaryWorkingHoursDay.selectAuxiliaryWorkingHoursDay" :delUrl="$api.auxiliaryWorkingHoursDay.deleteAuxiliaryWorkingHoursDay" :componentData="componentData" :key="upIndex" @delete="handleDelete" /> - <ValueTable ref="ValueTable1" - v-if="currentTable == 'ValueTable1'" + <ValueTable ref="ValueTable1" v-if="currentTable == 'ValueTable1'" :isColumnWidth="true" :url="$api.auxiliaryOutputWorkingHours.selectAuxiliaryOutputWorkingHours" :componentData="componentData1" :key="upIndex1" /> </div> <el-dialog :title="formData.id?'缂栬緫':'褰曞叆鏁版嵁'" :visible.sync="addVisible" width="600px" :before-close="handleClose"> @@ -160,13 +161,16 @@ </el-select> </el-form-item> <el-form-item label="濮撳悕:"> - <el-input v-model="formData0.nameUser" size="small" disabled></el-input> + <el-input v-model="formData0.name" size="small" disabled></el-input> </el-form-item> <el-form-item label="鐝:"> <el-select v-model="formData0.shift" placeholder="璇烽�夋嫨" size="small" :disabled="title=='鎵瑰噯'"> <el-option v-for="item in classType" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select> + </el-form-item> + <el-form-item label="澶嶆牳璇存槑:"> + <el-input v-model="formData0.reviewerRemark" type="textarea" :rows="3" size="small" :disabled="title=='鎵瑰噯'"></el-input> </el-form-item> </el-form> </el-col> @@ -176,6 +180,9 @@ <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-form-item> + <el-form-item label="澶嶆牳鏁伴噺:" required> <el-input v-model="formData0.reviewerNumber" size="small" :disabled="title=='鎵瑰噯'"></el-input> </el-form-item> <el-form-item label="鏍稿噯宸ユ椂:"> @@ -190,12 +197,6 @@ </el-form> </el-col> </el-row> - <el-form :model="formData0" label-width="90px"> - <el-form-item label="澶嶆牳璇存槑:"> - <el-input v-model="formData0.reviewerRemark" type="textarea" - :rows="3" size="small" :disabled="title=='鎵瑰噯'"></el-input> - </el-form-item> - </el-form> <span slot="footer" class="dialog-footer"> <el-row> <el-button @click="submitCheck(0)" :loading="checkLoadN">{{title=='瀹℃牳'?'涓嶉�氳繃':'涓嶆壒鍑�'}}</el-button> @@ -203,6 +204,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> @@ -217,101 +229,111 @@ }, data () { return{ - entity:{}, + entity:{ + dateTime: [] + }, down:false, add:false, componentData: { - entity: { - week: null, - weekDay: null, - dateTime: new Date(), - 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:[] - }, - state:{ - select:[ - { - label:'宸叉彁浜�', - value:'宸叉彁浜�', - type:'primary' - }, - { - label:'宸插鏍�', - value:'宸插鏍�', - type:'warning' - }, - { - label:'宸叉壒鍑�', - value:'宸叉壒鍑�', - type:'success' - }, - ] - }, - weekDay:{ - 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' - }, - ] - }, - weekDay:{ - 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: [], + needSort: ['createTime', 'name'] }, entityCopy: {}, upIndex: 0, @@ -319,7 +341,7 @@ entity: { week: null, weekDay: null, - dateTime: null, + dateTime: [], name:null, orderBy: { field: 'id', @@ -341,13 +363,13 @@ entityCopy1: {}, upIndex1:100, weekList:[ - {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'} + {label: '鍛ㄤ竴', value: '鍛ㄤ竴',type:'primary'}, + {label: '鍛ㄤ簩', value: '鍛ㄤ簩',type:'primary'}, + {label: '鍛ㄤ笁', value: '鍛ㄤ笁',type:'primary'}, + {label: '鍛ㄥ洓', value: '鍛ㄥ洓',type:'primary'}, + {label: '鍛ㄤ簲', value: '鍛ㄤ簲',type:'primary'}, + {label: '鍛ㄥ叚', value: '鍛ㄥ叚',type:'primary'}, + {label: '鍛ㄦ棩', value: '鍛ㄦ棩',type:'primary'} ], currentTable:'ValueTable0', addVisible:false, @@ -378,6 +400,8 @@ reviewerNonproductiveTime:'', auxiliaryProject:'', reviewerRemark:'', + nameUser: '', + name: '' }, checkVisible:false, checkLoadN:false, @@ -400,7 +424,11 @@ ], totalInfo:null, auxiliaryWorking:null, - outLoading:false + outLoading:false, + batchCheckTitle: '鎵归噺瀹℃牳', + batchCheckDialog: false, + ValueTable0Selected: [], + batchCheckDialogMessage: '' } }, watch:{ @@ -454,6 +482,9 @@ } } }, + created() { + this.setDate() + }, mounted(){ this.getCurrentWeekNumber() this.selectEnumByCategory() @@ -466,6 +497,21 @@ 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}`; + let formattedDate2 = `${year}-${month}-${day}`; + this.entity.dateTime.push(formattedDate1); + this.entity.dateTime.push(formattedDate2); + this.componentData1.entity.dateTime.push(formattedDate1); + this.componentData1.entity.dateTime.push(formattedDate2); + this.componentData1.entity.dateTime = JSON.stringify(this.componentData1.entity.dateTime) + this.refreshTable() + }, getPower(){ let power = JSON.parse(sessionStorage.getItem('power')) let del = false @@ -513,7 +559,7 @@ getYearAndMonthAndDays(date){ return getYearAndMonthAndDays(date) }, - refreshTable(){ + refreshTable(e){ let entity = {} if(this.entity.week1&&this.entity.week2){ entity.week = JSON.stringify([this.entity.week1,this.entity.week2]) @@ -530,11 +576,14 @@ if(this.currentTable=='ValueTable0'){ entity.state = this.entity.state this.componentData.entity = {...this.componentData.entity,...entity} - this.$refs['ValueTable0'].selectList() + this.$nextTick(() => { + this.$refs['ValueTable0'].selectList(e) + }) }else{ this.componentData1.entity = {...this.componentData1.entity,...entity} - this.$refs['ValueTable1'].selectList() + this.$refs['ValueTable1'].selectList(e) } + this.collectWorkingHours() }, refresh(){ this.entity = {} @@ -594,8 +643,14 @@ this.addLoad = false if (res.code == 201) return this.$message.success('宸叉彁浜�') - this.addVisible = false - this.refreshTable() + this.formData.number = '' + this.formData.amount = '' + this.formData.remarks = '' + this.formData.approvedWorkingHour = '' + this.formData.nonproductiveTime = '' + this.formData.auxiliaryProject = '' + // this.addVisible = false + this.refreshTable('page') this.collectWorkingHours() }) }else{ @@ -609,8 +664,14 @@ this.addLoad = false if (res.code == 201) return this.$message.success('鎿嶄綔鎴愬姛') - this.addVisible = false - this.refreshTable() + this.formData.number = '' + this.formData.amount = '' + this.formData.remarks = '' + this.formData.approvedWorkingHour = '' + this.formData.nonproductiveTime = '' + this.formData.auxiliaryProject = '' + // this.addVisible = false + this.refreshTable('page') this.collectWorkingHours() }) } @@ -619,11 +680,52 @@ this.title = '瀹℃牳' this.formData0 = row; this.checkVisible = true + this.formData0.reviewerNumber = this.formData0.amount }, handleRatify(row){ this.title = '鎵瑰噯' this.formData0 = row; this.checkVisible = true + this.formData0.reviewerNumber = this.formData0.amount + }, + 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('page') + this.collectWorkingHours() }, submitCheck(e){ if(!this.formData0.number){ @@ -645,7 +747,7 @@ } this.formData0.state = e==0?this.formData0.state:'宸插鏍�' this.$axios.post(this.$api.auxiliaryWorkingHoursDay.check, { - ...this.formData0 + auxiliaryWorkingHoursDays:[this.formData0] }, { headers: { 'Content-Type': 'application/json' @@ -661,7 +763,7 @@ if (res.code == 201) return this.$message.success('鎿嶄綔鎴愬姛') this.checkVisible = false - this.refreshTable() + this.refreshTable('page') this.collectWorkingHours() }) }else{ @@ -686,7 +788,7 @@ if (res.code == 201) return this.$message.success('鎿嶄綔鎴愬姛') this.checkVisible = false - this.refreshTable() + this.refreshTable('page') this.collectWorkingHours() }) } @@ -727,9 +829,28 @@ return String(d) }, collectWorkingHours(){ - this.$axios.post(this.$api.auxiliaryOutputWorkingHours.collectWorkingHours).then(res => { - this.totalInfo = res.data - }) + 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 + this.$axios.post(this.$api.auxiliaryOutputWorkingHours.collectWorkingHours,{ + entity:entity + }, { + headers: { + 'Content-Type': 'application/json' + } + }).then(res => { + this.totalInfo = res.data + }) }, selectshiftByUser(){ this.$axios.post(this.$api.auxiliaryWorkingHoursDay.selectshiftByUser).then(res => { -- Gitblit v1.9.3