From fbda3fa388f69165e3e1d820a0f1d3a609bdfa37 Mon Sep 17 00:00:00 2001 From: xuesinan <1404152492@qq.com> Date: Thu, 23 Dec 2021 16:49:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/List/List.vue | 218 +++++++++++++++++++++++++++++++---- 1 file changed, 194 insertions(+), 24 deletions(-) diff --git a/src/components/List/List.vue b/src/components/List/List.vue index 7bcf6ba..d1b2c7a 100644 --- a/src/components/List/List.vue +++ b/src/components/List/List.vue @@ -33,12 +33,11 @@ {{ $moment(record.morning - 0).format('HH:mm') }} - 未打卡 + 未打卡 打卡 @@ -119,12 +118,11 @@ {{ $moment(record.night - 0).format('HH:mm') }} - 未打卡 + 未打卡 打卡 @@ -186,7 +184,7 @@ - + {{ record.checkerName || checkers[0].name }} + + + 打卡 + + 打卡原因 + + + + 打卡时间 + + + + + 审核人 + + + {{ member.name }} + + + + @@ -238,10 +275,15 @@ export default { timer: null, chooseTime: '', auditOptions: null, - morningLoading: false, - nightLoading: false, + // morningLoading: false, + // nightLoading: false, today: this.$moment(new Date()).format('YYYY-MM-DD'), selectedDate: '', // 当前选择的日期 + visible: false, + punchParams: {}, // 打卡参数 + recordInfo: {}, // 当前点击的打卡信息 + punchTimeType: 0, // 打卡时间是上午还是下午 0 早打卡 1 晚打卡 + remark: '', // 打卡原因 }; }, @@ -279,6 +321,22 @@ export default { await this.getClockQuery(params); }, + showModal() { + this.visible = true; + }, + + handleOk(e) { + this.handleClockPunch(this.punchParams); + + setTimeout(() => { + this.visible = false; + }, 2000); + }, + + handleCancel(e) { + this.visible = false; + }, + /** * 查询考勤信息 * @param {string} projectId @@ -317,6 +375,9 @@ export default { // 打卡 checkTime(listIndex, index, clockType, id, memberId, checkerId, clockTime) { + this.auditOptions = { id, clockType }; + + this.showModal(); const time = Date.now(); const selectTime = this.$moment(time).format('HH:mm'); if (clockType === 0) { @@ -324,9 +385,13 @@ export default { } else { this.clockInfos[listIndex].recordList[index].night = selectTime; } + this.recordInfo = this.clockInfos[listIndex].recordList[index]; + this.punchTimeType = clockType; + this.selectedDate = clockTime; const dateTime = this.$moment(`${clockTime} ${selectTime}`).format('x') - 0; const params = { param: { checkerId: this.checkerId || checkerId || this.checkers[0].memberId, clockType, dateTime, id, memberId } }; - this.handleClockPunch(params); + this.punchParams = params; + // this.handleClockPunch(params); }, /** @@ -339,11 +404,19 @@ export default { */ async handleClockPunch(params) { try { - if (params.param.clockType === 0) { - this.morningLoading = true; - } else { - this.nightLoading = true; + // if (params.param.clockType === 0) { + // this.morningLoading = true; + // } else { + // this.nightLoading = true; + // } + if (this.checkerId) { + params.param.checkerId = this.checkerId; } + + if (this.remark) { + params.param.remark = this.remark; + } + const res = await clockPunch(params); const { code, msg } = res.data; if (code === 200) { @@ -354,17 +427,17 @@ export default { this.$message.error(msg || '打卡失败'); throw msg; } - if (params.param.clockType === 0) { - this.morningLoading = false; - } else { - this.nightLoading = false; - } + // if (params.param.clockType === 0) { + // this.morningLoading = false; + // } else { + // this.nightLoading = false; + // } } catch (error) { - if (params.param.clockType === 0) { - this.morningLoading = false; - } else { - this.nightLoading = false; - } + // if (params.param.clockType === 0) { + // this.morningLoading = false; + // } else { + // this.nightLoading = false; + // } throw error || '打卡失败'; } }, @@ -395,14 +468,36 @@ export default { this.selectedDate = selectedDate; this.auditOptions = { id, type }; }, + // 选择修改时间 timeChange(time) { let updateTime = this.$moment(time).format('HH:mm:ss'); let updateDate = this.selectedDate + ' ' + updateTime; - this.chooseTime = this.$moment(updateDate).format('x'); + this.chooseTime = this.$moment(updateDate).format('x') - 0; }, + async openChange(open, record, show, timeType) { - if (!open && this.chooseTime) { + if (this.punchTimeType === 0) { + let clockType = 0; + if (timeType === 'morning') { + clockType = 0; + } else { + clockType = 1; + } + const params = { + param: { + checkerId: this.checkerId || record.checkerId || this.checkers[0].memberId, + clockType, + dateTime: this.chooseTime, + id: record.id, + memberId: record.memberId, + }, + }; + + this.punchParams = params; + } + + if (!open && this.chooseTime && this.punchTimeType === 1) { this.auditOptions[timeType] = this.chooseTime; this.auditOptions.projectId = this.projectId; const params = { param: this.auditOptions }; @@ -531,6 +626,81 @@ img { background-color: #10b981 !important; color: #fff; } + +>>> .ant-modal-body { + padding: 16px; +} + +.modal-title { + font-size: 17px; + font-weight: bold; + height: 56px; + line-height: 56px; + text-align: center; +} + +.modal-con { + height: 48px; + border-bottom: 1px solid rgba(0, 0, 0, 0.1); +} + +.modal-con .ant-input, +.modal-con .ant-input:hover, +.modal-con .ant-input:focus, +.modal-con >>> .ant-time-picker-input { + padding: 0; + border: none; + box-shadow: none; +} + +.modal-con >>> .ant-time-picker { + width: 130px; +} + +.modal-con >>> .ant-time-picker-input { + text-align: right; + padding-right: 20px; +} + +.modal-con >>> .ant-time-picker-icon, +.modal-con >>> .ant-time-picker-clear, +.modal-con >>> .ant-select-arrow { + right: 0; +} + +.modal-con >>> .ant-select-selection, +.modal-con >>> .ant-select-selection:hover { + border: none; +} + +.modal-con >>> .ant-select-selection-selected-value { + float: unset; + text-align: right; +} + +>>> .ant-modal-footer { + margin-top: 16px; + padding: 0; +} + +>>> .ant-modal-footer div { + display: flex; +} + +>>> .ant-modal-footer div .ant-btn { + width: 50%; + height: 56px; + margin: 0; + border: 0; + border-radius: 0; + font-size: 17px; +} + +>>> .ant-modal-footer div .ant-btn.ant-btn-primary { + background: transparent; + color: #1890ff; + border-left: 1px solid #e8e8e8; +}