|
|
@@ -155,7 +155,8 @@ export function buildComponent (name, column, preview, vm) {
|
|
|
hasMounted: false,
|
|
|
attendanceData: [],
|
|
|
scheduleShift: [],
|
|
|
- todaySchedule: []
|
|
|
+ todaySchedule: [],
|
|
|
+ tempSelectedValue: ''
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -695,8 +696,7 @@ export function buildComponent (name, column, preview, vm) {
|
|
|
}
|
|
|
},
|
|
|
// 打卡处理逻辑
|
|
|
- handleClock (event, currentTime, dayStart) {
|
|
|
- const attendance = event.extendedProps.attendance
|
|
|
+ handleClock (attendance) {
|
|
|
if (Object.keys(attendance).length === 0) {
|
|
|
this.$message.warning('考勤数据异常!')
|
|
|
return
|
|
|
@@ -761,6 +761,71 @@ export function buildComponent (name, column, preview, vm) {
|
|
|
const timeDifference = endTime - startTime
|
|
|
return timeDifference / (1000 * 60)
|
|
|
},
|
|
|
+ // 打卡处理逻辑
|
|
|
+ handleClockFromTab (todaySchedule) {
|
|
|
+ const today = this.$common.getDateNow()
|
|
|
+ // 当天仅有一个班次
|
|
|
+ if (todaySchedule.length == 1) {
|
|
|
+ const scheduleObj = this.scheduleData.filter(item => item.start == today && item.alias == todaySchedule[0])
|
|
|
+ const attendance = scheduleObj.attendance
|
|
|
+ this.handleClock(attendance)
|
|
|
+ } else {
|
|
|
+ let scheduleArr = []
|
|
|
+ for (let i = 0; i < todaySchedule.length; i++) {
|
|
|
+ const currentSchedule = todaySchedule[i]
|
|
|
+ const filtered = this.scheduleData.filter(item => item.start === today && item.alias === currentSchedule)
|
|
|
+ scheduleArr = scheduleArr.concat(filtered)
|
|
|
+ }
|
|
|
+ debugger
|
|
|
+ const h = this.$createElement
|
|
|
+ const self = this
|
|
|
+ this.$msgbox({
|
|
|
+ title: '选择打卡班次',
|
|
|
+ message: h('div', null, [
|
|
|
+ h('p', { style: 'margin-bottom: 15px;' }, '请选择一个班次打卡'),
|
|
|
+ h('el-radio-group', {
|
|
|
+ model: {
|
|
|
+ value: self.tempSelectedValue,
|
|
|
+ callback: (value) => {
|
|
|
+ self.tempSelectedValue = value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, scheduleArr.map(schedule =>
|
|
|
+ h('el-radio', {
|
|
|
+ props: {
|
|
|
+ label: schedule.alias,
|
|
|
+ key: schedule.alias
|
|
|
+ },
|
|
|
+ style: 'display: block; margin: 10px 0;'
|
|
|
+ }, schedule.alias))
|
|
|
+ )
|
|
|
+ ]),
|
|
|
+ showCancelButton: true,
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ beforeClose: (action, instance, done) => {
|
|
|
+ if (action === 'confirm') {
|
|
|
+ if (!this.tempSelectedValue) {
|
|
|
+ this.$message.warning('请选择一个班次');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ done();
|
|
|
+ } else {
|
|
|
+ done();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).then(() => {
|
|
|
+ const scheduleObj = this.scheduleData.find(item =>
|
|
|
+ item.start === today && item.alias === this.tempSelectedValue
|
|
|
+ );
|
|
|
+ if (scheduleObj?.attendance) {
|
|
|
+ this.handleClock(scheduleObj.attendance);
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ // 用户取消操作
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
showMySchedule () {
|
|
|
const scheduleConfig = {
|
|
|
height: '100%',
|
|
|
@@ -830,7 +895,7 @@ export function buildComponent (name, column, preview, vm) {
|
|
|
// 绑定点击事件(通过闭包传递当前事件)
|
|
|
button.onclick = (e) => {
|
|
|
e.stopPropagation()
|
|
|
- this.handleClock(event, now, dayStart)
|
|
|
+ this.handleClock(event.extendedProps.attendance)
|
|
|
}
|
|
|
const placeholder = content.querySelector('.button-placeholder')
|
|
|
placeholder.replaceWith(button)
|