| | |
| | | </el-table-column> |
| | | <el-table-column prop="swingDate" label="考勤时间" min-width="150" width="150"></el-table-column> |
| | | <el-table-column label="签入/签出情况"> |
| | | <el-table-column prop="workDateTime" label="上班时间" min-width="160" width="160"> |
| | | <el-table-column prop="workDateTime" label="上班时间" min-width="160" > |
| | | <template slot-scope="scope"> |
| | | <el-tag type="success" v-if="scope.row.workDateTime && scope.row.workClockInState===1">{{ scope.row.workDateTime }}</el-tag> |
| | | <el-tag type="danger" v-else-if="scope.row.workDateTime && scope.row.workClockInState===0">{{ scope.row.workDateTime }}</el-tag> |
| | | <span v-else>{{ scope.row.workDateTime }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="offWorkDateTime" label="下班时间" min-width="160" width="160"> |
| | | <el-table-column prop="offWorkDateTime" label="下班时间" min-width="160" > |
| | | <template slot-scope="scope"> |
| | | <el-tag type="success" v-if="scope.row.offWorkDateTime && scope.row.offClockInState===1">{{ scope.row.offWorkDateTime }}</el-tag> |
| | | <el-tag type="danger" v-else-if="scope.row.offWorkDateTime && scope.row.offClockInState===0">{{ scope.row.offWorkDateTime }}</el-tag> |
| | |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <el-table-column label="考勤时长(h)"> |
| | | <el-table-column prop="plannedWorkHours" label="应勤时长" min-width="80" width="80"></el-table-column> |
| | | <el-table-column prop="actualWorkHours" label="实际时长" min-width="80" width="80"></el-table-column> |
| | | <el-table-column prop="absenceWorkHours" label="缺勤时长" min-width="80" width="80"></el-table-column> |
| | | <el-table-column prop="plannedWorkHours" label="应勤时长" min-width="100" ></el-table-column> |
| | | <el-table-column prop="actualWorkHours" label="实际时长" min-width="100"></el-table-column> |
| | | <el-table-column prop="absenceWorkHours" label="缺勤时长" min-width="100" ></el-table-column> |
| | | </el-table-column> |
| | | <el-table-column prop="isSync" label="数据来源" min-width="120"> |
| | | <el-table-column prop="isSync" label="数据来源" min-width="120" width="120"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.isSync===0" type="success">ICC同步</el-tag> |
| | | <el-tag v-else-if="scope.row.isSync===1" type="info">手动新增</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="createUser" label="创建人" min-width="150" width="150" :formatter="(row)=>formatterUserName(row.createUser)"></el-table-column> |
| | | <el-table-column prop="createUser" label="创建人" min-width="120" width="120" :formatter="(row)=>formatterUserName(row.createUser)"></el-table-column> |
| | | <el-table-column prop="createTime" label="创建时间" min-width="180" width="180"></el-table-column> |
| | | <el-table-column prop="updateUser" label="更新人" min-width="150" width="150" :formatter="(row)=>formatterUserName(row.updateUser)"></el-table-column> |
| | | <el-table-column prop="updateUser" label="更新人" min-width="120" width="120" :formatter="(row)=>formatterUserName(row.updateUser)"></el-table-column> |
| | | <el-table-column prop="updateTime" label="更新时间" min-width="180" width="180"></el-table-column> |
| | | <el-table-column fixed="right" width="180" label="操作"> |
| | | <template slot-scope="scope"> |
| | |
| | | title="进出记录" |
| | | :visible.sync="dialogVisible" |
| | | width="60%"> |
| | | <staff-clock-in-record :key="Math.random()" :query-params="clockInQueryParams" ></staff-clock-in-record> |
| | | <staff-clock-in-record :query-params="clockInQueryParams" @changeEnable="refreshTable()"></staff-clock-in-record> |
| | | </el-dialog> |
| | | <el-dialog |
| | | :title="attendanceForm.id?'编辑考勤记录':'新增考勤记录'" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <!-- <el-form-item label="考勤结果" prop="result">--> |
| | | <!-- <el-select size="small" style="width:100%" clearable v-model="attendanceForm.result" placeholder="请选择考勤结果">--> |
| | | <!-- <el-option v-for="(item,index) in resultList" :key="index" :label="item.label" :value="item.value"/>--> |
| | | <!-- </el-select>--> |
| | | <!-- </el-form-item>--> |
| | | </el-col> |
| | | </el-row> |
| | | <el-divider content-position="left">签入/签出情况</el-divider> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="上班时间" prop="workTime"> |
| | | <el-form-item label="上班时间" prop="workDateTime"> |
| | | <el-time-picker |
| | | style="width:100%" |
| | | value-format="HH:mm" |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="下班时间" prop="offWorkTime"> |
| | | <el-form-item label="下班时间" prop="offWorkDateTime"> |
| | | <el-time-picker |
| | | style="width:100%" |
| | | value-format="HH:mm" |
| | |
| | | syncAttendanceRecord |
| | | } from '@/api/performance/attendance' |
| | | import {getDicts} from "@/api/system/dict/data"; |
| | | import dayjs from 'dayjs'; |
| | | import {getTimeRange} from "@/utils/date"; |
| | | export default { |
| | | name: "Attendance", |
| | | components: { |
| | |
| | | this.selectEnumByCategory() |
| | | this.getUserList() |
| | | this.getTableHeight(); |
| | | this.dateRange = this.getTimeRange() |
| | | this.dateRange = getTimeRange() |
| | | this.resizeHandler = this.debounce(() => { |
| | | this.getTableHeight(); |
| | | }, 200); |
| | |
| | | this.dailyTypeList = response.data; |
| | | }); |
| | | }, |
| | | /** |
| | | * 初始化默认日期范围:近一个月(当前日期 - 30天 至 当前日期) |
| | | */ |
| | | getTimeRange(format = 'YYYY-MM-DD HH:mm:ss') { |
| | | // 获取当前时间 |
| | | const now = dayjs(); |
| | | // 获取当前日期的「日」(1-31) |
| | | const currentDate = now.date(); |
| | | |
| | | let startTime, endTime; |
| | | |
| | | // 核心逻辑:判断当前日期是否大于25号 |
| | | if (currentDate > 25) { |
| | | // ✅ 情况1:当前日>25 → 当月26号 ~ 次月25号 |
| | | startTime = now.startOf('month').add(25, 'day'); // 当月1号 +25天 = 26号 |
| | | endTime = startTime.add(1, 'month').date(25).hour(23) |
| | | .minute(59) |
| | | .second(59); // 次月25号(dayjs自动处理跨年) |
| | | } else { |
| | | // ✅ 情况2:当前日≤25 → 上月26号 ~ 当月25号 |
| | | startTime = now.subtract(1, 'month').startOf('month').add(25, 'day'); // 上月26号 |
| | | endTime = now.date(25).hour(23) |
| | | .minute(59) |
| | | .second(59); // 当月25号 |
| | | } |
| | | |
| | | // 返回格式化后的时间数组 |
| | | return [startTime.format(format), endTime.format(format)]; |
| | | }, |
| | | //同步考勤记录 |
| | | confirmSyncAttendance(){ |
| | | if(!this.syncDateRange || this.syncDateRange.length<2){ |
| | |
| | | }, |
| | | //打开同步考勤记录弹框 |
| | | openSyncAttendanceDialog(){ |
| | | this.syncAttendanceVisible = true |
| | | this.syncDateRange = getTimeRange() |
| | | this.$nextTick(()=>{ |
| | | this.syncAttendanceVisible = true |
| | | }) |
| | | }, |
| | | //删除考勤记录 |
| | | confirmRemoveRecord(row){ |
| | |
| | | openAddAttendanceDialog(row){ |
| | | if(row){ |
| | | //处理上/下班时间格式 |
| | | let workTime = row.workDateTime&&row.workDateTime.length>8?row.workDateTime.substring(11,16):row.workDateTime |
| | | let offWorkTime = row.offWorkDateTime&&row.offWorkDateTime.length>8?row.offWorkDateTime.substring(11,16):row.offWorkDateTime |
| | | row.workDateTime = workTime |
| | | row.offWorkDateTime = offWorkTime |
| | | this.attendanceForm = {...row} |
| | | let formData = {...row} |
| | | let workTime = formData.workDateTime&&formData.workDateTime.length>8?formData.workDateTime.substring(11,16):formData.workDateTime |
| | | let offWorkTime = formData.offWorkDateTime&&formData.offWorkDateTime.length>8?formData.offWorkDateTime.substring(11,16):formData.offWorkDateTime |
| | | formData.workDateTime = workTime |
| | | formData.offWorkDateTime = offWorkTime |
| | | this.attendanceForm = formData |
| | | } |
| | | this.addAttendanceVisible = true |
| | | }, |
| | |
| | | }, |
| | | //重置按钮 |
| | | resetQuery() { |
| | | this.dateRange = this.getTimeRange(); |
| | | this.dateRange = getTimeRange(); |
| | | this.queryParams = { |
| | | startDate: "", |
| | | endDate: "", |