优化代码

This commit is contained in:
Your Name 2023-02-26 00:23:58 +08:00
parent 9ca54f153a
commit fa6c14c60a
4 changed files with 27 additions and 7 deletions

View File

@ -139,14 +139,23 @@
},
_getDayDetail:function(detail,day){
let _date = new Date();
let _taskYear = $that.monthAttendanceManageInfo.conditions.taskYear;
let _taskMonth = $that.monthAttendanceManageInfo.conditions.taskMonth;
if(_taskYear == _date.getFullYear() && _taskMonth == (_date.getMonth()+1) && day > _date.getDate()){
return "未到时间";
}
if(!detail.hasOwnProperty(day)){
return "休息";
return "无需考勤";
}
let _details = detail[day];
if(!_details){
return "休息";
return "无需考勤";
}
let _value = "";

View File

@ -25,7 +25,7 @@
</div>
<div>{{staffAttendanceManageInfo.curYear}}-{{staffAttendanceManageInfo.curMonth}}-{{index}}</div>
<div v-for="(item,detailIndex) in _getAttendanceDetail(index)">
<div v-if="item.rest">休息</div>
<div v-if="item.rest">{{item.rest}}</div>
<div v-else>
{{item.specCd=='1001'?'上班':'下班'}}
<span v-if="item.state != '10000'">{{vc.timeFormat(item.checkTime)}}</span>

View File

@ -92,8 +92,19 @@
_getAttendanceDetail: function (_day) {
let _attendance = $that._getDayAttendance(_day);
if (!_attendance) {
let _date = new Date();
let _taskYear = $that.staffAttendanceManageInfo.curYear
let _taskMonth = $that.staffAttendanceManageInfo.curMonth;
if(_taskYear == _date.getFullYear() && parseInt(_taskMonth) == (_date.getMonth()+1) && _day > _date.getDate()){
return [{
rest:'未到时间',
}];;
}
return [{
rest:'休息',
rest:'无需考勤',
}];
}
return _attendance.attendanceClassesTaskDetails;

View File

@ -1922,7 +1922,7 @@
let _date = new Date();
let y = _date.getFullYear();
let m = _date.getMonth();
return daysInMonth(y,m);
return vcFramework.daysInMonth(y,m);
}
vcFramework.daysInMonth = function(year, month) {
@ -1953,7 +1953,7 @@
} else {
nextM = m + _month
}
let daysInNextMonth = daysInMonth(nextY, nextM);
let daysInNextMonth = vcFramework.daysInMonth(nextY, nextM);
let day = _date.getDate();
if (day > daysInNextMonth) {
day = daysInNextMonth;
@ -1973,7 +1973,7 @@
} else {
nextM = m + _month
}
let daysInNextMonth = daysInMonth(nextY, nextM);
let daysInNextMonth = vcFramework.daysInMonth(nextY, nextM);
let day = _date.getDate();
if (day > daysInNextMonth) {
day = daysInNextMonth;