From dec386a4b396f99f34f1c7739a42ef7665a487f8 Mon Sep 17 00:00:00 2001 From: dzc <2388224167@qq.com> Date: Mon, 27 Oct 2025 10:45:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=B0=B1=E9=A4=90=E4=BA=BA=E6=95=B0?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1-=E6=9C=AC=E6=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attendance-statistic/month-statistics.vue | 15 +++++++-------- src/components/person-through-rank.vue | 4 ++-- src/views/canteen.vue | 6 +++--- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/components/attendance-statistic/month-statistics.vue b/src/components/attendance-statistic/month-statistics.vue index 00ac074..0ac5b82 100644 --- a/src/components/attendance-statistic/month-statistics.vue +++ b/src/components/attendance-statistic/month-statistics.vue @@ -47,12 +47,18 @@ const props = defineProps({ const displayData = computed(() => { const days = getMonthDays(); const data = props.data; + console.log("data", props.data); + if (!Array.isArray(props.data)) return days.map((day) => ({ day, type: -1 })); if (props.data.length !== days.length) { for (let i = data.length; i < days.length; i++) { + const day = data[i - 1]; data.push({ - day: days[i], + day: day, type: -1, + morningCount: element.morningCount ?? 0, + noonCount: element.noonCount ?? 0, + eveningCount: element.eveningCount ?? 0, }); } return data.slice(0, days.length); @@ -66,13 +72,6 @@ const getBarColor = (type) => { return "#7f7f7f77"; }; -// 新增:类型文案 -const getTypeText = (type) => { - if (type === 0) return "正常"; - if (type === 1) return "休息"; - return "未知"; -}; - const doCar = (item) => { if (!item.day) return; if (item.type == "-1") { diff --git a/src/components/person-through-rank.vue b/src/components/person-through-rank.vue index de68594..27b7d21 100644 --- a/src/components/person-through-rank.vue +++ b/src/components/person-through-rank.vue @@ -106,11 +106,11 @@ const options = { borderRadius: [0, 10, 10, 0], color: (params) => { const palette = [ - ["#1F4F68", "#2FC6DC"], - ["#1F4F68", "#2FC6DC"], ["#F47E3D", "#F4C93D"], ["#1F4F68", "#2FC6DC"], ["#1F4F68", "#2FC6DC"], + ["#1F4F68", "#2FC6DC"], + ["#1F4F68", "#2FC6DC"], ]; const [c1, c2] = palette[params.dataIndex % palette.length]; return new echarts.graphic.LinearGradient(1, 0, 0, 0, [ diff --git a/src/views/canteen.vue b/src/views/canteen.vue index 7dbc828..f920a1a 100644 --- a/src/views/canteen.vue +++ b/src/views/canteen.vue @@ -230,9 +230,9 @@ const getAttendanceStatisticData = () => { if (dateRangeType === "THIS_MONTH") { timerObj.byHourType.data.data = { THIS_MONTH: data.morning?.list?.map((v) => { - const morningCount = data.morning?.list.find((item) => item.time === item.time)?.personCount ?? 0 - const noonCount = data.noon?.list.find((item) => item.time === item.time)?.personCount ?? 0 - const eveningCount = data.evening?.list.find((item) => item.time === item.time)?.personCount ?? 0 + const morningCount = data.morning?.list.find((item) => item.time === v.time)?.personCount ?? 0 + const noonCount = data.noon?.list.find((item) => item.time === v.time)?.personCount ?? 0 + const eveningCount = data.evening?.list.find((item) => item.time === v.time)?.personCount ?? 0 let type = -1; // 如果time大于等于当天 const targetDate = new Date(v.time);