fix(task): time+download bug

This commit is contained in:
zhangheng
2026-06-02 10:43:54 +08:00
parent a384897386
commit f3a348e036
5 changed files with 55 additions and 49 deletions

View File

@@ -7,6 +7,7 @@ import {
import { Daily } from "@/components/label/api/daily/typing"
import { getSelfProjectList } from "@/components/label/api/project"
import { useAllUserStore } from "@/components/label/store/auth"
import { formatWorkTime } from "@/components/label/utils/time"
import {
SettingContentPanel,
SettingCustomPageSizeControl,
@@ -47,7 +48,6 @@ 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"
@@ -62,7 +62,6 @@ import {
workTypeOpts,
} from "./config"
import classes from "./page.module.css"
dayjs.extend(duration)
function weekDayText(day: number) {
const list = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"]
@@ -241,10 +240,6 @@ 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>[] = [
{
@@ -335,8 +330,9 @@ export default function PersonReportPage() {
title: "工时",
width: 90,
sortable: true,
render: (record) => (record.work_time ? getTime(record.work_time) : 0),
footer: getTime(sum(records.map((r) => r.work_time ?? 0))),
render: (record) =>
record.work_time ? formatWorkTime(record.work_time) : 0,
footer: formatWorkTime(sum(records.map((r) => r.work_time ?? 0))),
},
{ accessor: "rate", title: "额定倍率", width: 90 },
{