fix(workload): display

This commit is contained in:
zhangheng
2026-05-14 17:15:09 +08:00
parent 5c3b45b247
commit 39dc96320c
2 changed files with 37 additions and 9 deletions

View File

@@ -43,6 +43,7 @@ import { VirtualTreeSelect } from "@/components/tree-select/tree"
import { DateInput } from "@mantine/dates"
import dayjs from "dayjs"
import "dayjs/locale/zh-cn"
import duration from "dayjs/plugin/duration"
import { DataTableColumn, DataTableSortStatus } from "mantine-datatable"
import { useCallback, useEffect, useMemo, useState } from "react"
import DailyReportModal from "./components/DailyReportModal"
@@ -57,6 +58,7 @@ import {
workTypeOpts,
} from "./config"
import classes from "./page.module.css"
dayjs.extend(duration)
function weekDayText(day: number) {
const list = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"]
@@ -276,6 +278,10 @@ export default function PersonReportPage() {
return accumulator + (Number.isFinite(value) ? value : 0)
}, 0)
const getTime = (time: number) => {
return dayjs.duration(time, "seconds").format("HH:mm:ss")
}
const columns = useMemo(() => {
const cols: DataTableColumn<Daily.DailyWorkList>[] = [
{
@@ -366,7 +372,8 @@ export default function PersonReportPage() {
title: "工时",
width: 90,
sortable: true,
footer: sum(records.map((r) => r.work_time ?? 0)).toLocaleString(),
render: (record) => (record.work_time ? getTime(record.work_time) : 0),
footer: getTime(sum(records.map((r) => r.work_time ?? 0))),
},
{ accessor: "rate", title: "额定倍率", width: 90 },
{