|
@@ -145,38 +145,49 @@ const Runtime: React.FC = () => {
|
|
|
});
|
|
|
var resList = res.content || [];
|
|
|
resList.forEach((ritem) => {
|
|
|
- ritem.runTimeStatus = 'normalRun'; //正常工作
|
|
|
+ ritem.runTimeStatus = ''; //正常工作
|
|
|
+ ritem.hasWorkTime = false;
|
|
|
var timeList = [];
|
|
|
+ var allTimeArr = [];
|
|
|
|
|
|
if (ritem.hasOwnProperty('workTimeStartTime')) {
|
|
|
- var timeStrArr = [ritem.workTimeStartTime, ritem.workTimeEndTime];
|
|
|
- timeList.push(timeStrArr);
|
|
|
+ // var timeStrArr = [ritem.workTimeStartTime, ritem.workTimeEndTime];
|
|
|
+ //timeList.push(timeStrArr);
|
|
|
+ ritem.hasWorkTime = true;
|
|
|
+ allTimeArr.push(ritem.workTimeStartTime, ritem.workTimeEndTime);
|
|
|
}
|
|
|
if (ritem.hasOwnProperty('meetTime')) {
|
|
|
ritem.runTimeStatus = 'meetingBook'; //会议预约
|
|
|
ritem.meetTime.forEach((meetitem) => {
|
|
|
var timeStrArr = [meetitem.meetTimeStartTime, meetitem.meetTimeEndTime];
|
|
|
timeList.push(timeStrArr);
|
|
|
+ allTimeArr.push(meetitem.meetTimeStartTime, meetitem.meetTimeEndTime);
|
|
|
});
|
|
|
}
|
|
|
if (ritem.hasOwnProperty('overTime')) {
|
|
|
ritem.runTimeStatus = 'overtimeWork'; //加班
|
|
|
-
|
|
|
ritem.overTime.forEach((overitem) => {
|
|
|
var timeStrArr = [overitem.overTimeStartTime, overitem.overTimeEndTime];
|
|
|
timeList.push(timeStrArr);
|
|
|
+ allTimeArr.push(overitem.overTimeStartTime, overitem.overTimeEndTime);
|
|
|
});
|
|
|
}
|
|
|
ritem.showTimeList = timeList;
|
|
|
//console.log('timeList', timeList);
|
|
|
+ // ritem.showTimeStr =
|
|
|
+ // timeList.length > 0
|
|
|
+ // ? timeList[0][0] +
|
|
|
+ // '-' +
|
|
|
+ // (timeList[timeList.length - 1][1] > timeList[0][1]
|
|
|
+ // ? timeList[timeList.length - 1][1]
|
|
|
+ // : timeList[0][1])
|
|
|
+ // : '';
|
|
|
+ allTimeArr.sort((a, b) => {
|
|
|
+ return a - b;
|
|
|
+ });
|
|
|
+ console.log('allTimeArrallTimeArrallTimeArr', allTimeArr);
|
|
|
ritem.showTimeStr =
|
|
|
- timeList.length > 0
|
|
|
- ? timeList[0][0] +
|
|
|
- '-' +
|
|
|
- (timeList[timeList.length - 1][1] > timeList[0][1]
|
|
|
- ? timeList[timeList.length - 1][1]
|
|
|
- : timeList[0][1])
|
|
|
- : '';
|
|
|
+ allTimeArr.length > 1 ? allTimeArr[0] + '-' + allTimeArr[allTimeArr.length - 1] : '';
|
|
|
});
|
|
|
|
|
|
setSpaceTimeList(resList);
|
|
@@ -309,25 +320,29 @@ const Runtime: React.FC = () => {
|
|
|
{/* {(item.timeList || []).map(function (titem: string, tindex: number) {
|
|
|
return <span key={tindex + 'time'}>{titem},</span>;
|
|
|
})} */}
|
|
|
- {item.showTimeList && item.showTimeList.length > 1 && (
|
|
|
+ {item.showTimeList && item.showTimeList.length > 0 && (
|
|
|
<Popover
|
|
|
content={
|
|
|
<div>
|
|
|
- <div className={styles.popTitle}>工作时间:</div>
|
|
|
- <div>
|
|
|
- {item.showTimeList[0][0]}-{item.showTimeList[0][1]}
|
|
|
- </div>
|
|
|
+ {item.hasWorkTime && (
|
|
|
+ <>
|
|
|
+ <div className={styles.popTitle}>工作时间:</div>
|
|
|
+ <div>
|
|
|
+ {item.workTimeStartTime}-{item.workTimeEndTime}
|
|
|
+ </div>
|
|
|
+ </>
|
|
|
+ )}
|
|
|
<div className={styles.popTitle}>
|
|
|
{item.runTimeStatus == 'overtimeWork' ? '加班时间' : '会议时间'}:
|
|
|
</div>
|
|
|
{(item.showTimeList || []).map((timeItem, index) => {
|
|
|
- if (index > 0) {
|
|
|
- return (
|
|
|
- <div key={'time' + index}>
|
|
|
- {timeItem[0]}-{timeItem[1]}
|
|
|
- </div>
|
|
|
- );
|
|
|
- }
|
|
|
+ // if (index > 0) {
|
|
|
+ return (
|
|
|
+ <div key={'time' + index}>
|
|
|
+ {timeItem[0]}-{timeItem[1]}
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ // }
|
|
|
})}
|
|
|
</div>
|
|
|
}
|
|
@@ -344,7 +359,7 @@ const Runtime: React.FC = () => {
|
|
|
</span>
|
|
|
</Popover>
|
|
|
)}
|
|
|
- {item.showTimeList && item.showTimeList.length == 1 && (
|
|
|
+ {item.showTimeList && item.showTimeList.length == 0 && (
|
|
|
<span title={item.showTimeStr}>{item.showTimeStr}</span>
|
|
|
)}
|
|
|
</div>
|