diff --git a/src/views/healthMonitor/healMonitorManage/monitorToll/userInfo/componets/sleep.vue b/src/views/healthMonitor/healMonitorManage/monitorToll/userInfo/componets/sleep.vue index ea41767..95e0e97 100644 --- a/src/views/healthMonitor/healMonitorManage/monitorToll/userInfo/componets/sleep.vue +++ b/src/views/healthMonitor/healMonitorManage/monitorToll/userInfo/componets/sleep.vue @@ -168,32 +168,30 @@ let xArr: any[] = []; let yArr: any[] = []; res.timePeriods && - res.timePeriods.map((item) => { + res.timePeriods.forEach((item) => { switch (item.flag) { case 1: // 浅睡 - yArr.push(1); - yArr.push(1); + yArr.push(1, 1, null); break; case 3: // 深睡 - yArr.push(0); - yArr.push(0); + yArr.push(0, 0, null); break; case 4: // 清醒 - yArr.push(3); - yArr.push(3); + yArr.push(3, 3, null); break; case 5: // 零星小睡 - yArr.push(2); - yArr.push(2); + yArr.push(2, 2, null); break; } - xArr.push(dayjs(item.start).format('HH:mm')); - xArr.push(dayjs(item.end).format('HH:mm')); + xArr.push(dayjs(item.start).format('HH:mm'), dayjs(item.end).format('HH:mm'), ''); }); + // 去掉最后多余的 null + if (yArr.length > 0) yArr.pop(); + if (xArr.length > 0) xArr.pop(); const option = { xAxis: { type: 'category',