From a0faa6ff04f38f53728b97c21c82fd9798488e45 Mon Sep 17 00:00:00 2001
From: gaoluyang <gaoluyang@rengu.cc>
Date: 星期三, 17 七月 2024 15:49:25 +0800
Subject: [PATCH] 日工时管理的辅助工时增加可以批量审核和批准的功能
---
src/components/tool/value-table.vue | 44 ++++++++
src/components/do/b3-work-time-management/work-time-management.vue | 244 ++++++++++++++++++++++++++++++------------------
2 files changed, 197 insertions(+), 91 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 2dce23e..77e90cd 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
@@ -65,10 +65,12 @@
<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>
</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">
@@ -203,6 +205,17 @@
</el-row>
</span>
</el-dialog>
+ <el-dialog
+ :title="batchCheckTitle"
+ :visible.sync="batchCheckDialog"
+ width="30%"
+ :before-close="closeBatchCheckDialog">
+ <span>杩欐槸涓�娈典俊鎭�</span>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="batchCheckDialog = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="batchCheck">纭� 瀹�</el-button>
+ </span>
+ </el-dialog>
</div>
</template>
@@ -223,97 +236,104 @@
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:[]
- },
- 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: []
},
entityCopy: {},
upIndex: 0,
@@ -402,7 +422,10 @@
],
totalInfo:null,
auxiliaryWorking:null,
- outLoading:false
+ outLoading:false,
+ batchCheckTitle: '鎵归噺瀹℃牳',
+ batchCheckDialog: false,
+ ValueTable0Selected: []
}
},
watch:{
@@ -481,6 +504,7 @@
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'))
@@ -653,6 +677,44 @@
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 ? '鎵归噺瀹℃牳' : '鎵归噺鎵瑰噯'
+ 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('璇疯緭鍏ョ紪鍙�')
diff --git a/src/components/tool/value-table.vue b/src/components/tool/value-table.vue
index 0f74844..6416a82 100644
--- a/src/components/tool/value-table.vue
+++ b/src/components/tool/value-table.vue
@@ -1106,6 +1106,50 @@
this.$message.error('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁')
}
},
+ // 鏃ュ伐鏃剁鐞嗚緟鍔╁伐鏃�--鎵归噺瀹℃牳鍜屾壒鍑�
+ batchCheck(e) {
+ if (this.multipleSelection && this.multipleSelection.length > 0) {
+ const list = JSON.parse(JSON.stringify(this.multipleSelection))
+ list.forEach(item => {
+ if (e == 0) {
+ item.state = '宸插鏍�'
+ this.$axios.post(this.$api.auxiliaryWorkingHoursDay.check, {
+ ...item
+ },{
+ headers: {
+ 'Content-Type': 'application/json'
+ }
+ }
+ ).then(res => {
+ if (res.code === 201) {
+ return
+ }
+ this.$parent.submitBatchCheckDialog()
+ this.$message.success('鎿嶄綔鎴愬姛')
+ })
+ } else {
+ item.state = '宸叉壒鍑�'
+ this.$axios.post(this.$api.auxiliaryWorkingHoursDay.approve, {
+ id: item.id,
+ state: item.state
+ },{
+ headers: {
+ 'Content-Type': 'application/json'
+ }
+ }
+ ).then(res => {
+ if (res.code === 201) {
+ return
+ }
+ this.$parent.submitBatchCheckDialog()
+ this.$message.success('鎿嶄綔鎴愬姛')
+ })
+ }
+ })
+ } else {
+ this.$message.error('璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�')
+ }
+ },
getRedColor(label,row){
if(this.data.cellSpecialStyle&&this.data.cellSpecialStyle.redColorByKey&&label.includes(this.data.cellSpecialStyle.redColorByKey)&&row[(label.replace(this.data.cellSpecialStyle.redColorByKey, ""))]){
return true
--
Gitblit v1.9.3