import React, {Fragment, useContext, useEffect, useMemo} from "react"; import {getTaskCount} from "../../utils"; import dayjs from "dayjs"; import {DATE_FORMAT, dayStartUtcFormat, nextDayStartUtcFormat} from "../../utils/timeFormatUtil"; import {getDictionary} from "../../utils/dictUtil"; import {Divider, Tag} from "antd-mobile"; import {useNavigate} from "react-router-dom"; import {MyRootContext, UPDATE_SEARCH} from "../../components/MyRootContext"; const TaskCount = (props) => { const {currentDay, taskCount, today, backToToday} = props; const navigate = useNavigate(); const [stateMap, setStateMap] = React.useState(new Map); const [priorityMap, setPriorityMap] = React.useState(new Map); const {dispatch} = useContext(MyRootContext); const todoDayDetail = () => { let andSearchModel = {} let orSearchModel = {andSearchModel} if (currentDay) { andSearchModel.andList = [{ "name": "expectedStartTime", "value": nextDayStartUtcFormat(currentDay), "operateType": "<" }, { "name": "expectedEndTime", "value": dayStartUtcFormat(currentDay), "operateType": ">" }] andSearchModel.orSearchModel = { "andList": [ { "name": "expectedStartTime", "value": nextDayStartUtcFormat(currentDay), "operateType": "<" }, { "name": "expectedStartTime", "value": dayStartUtcFormat(currentDay), "operateType": ">" }, { "name": "expectedEndTime", "operateType": "NULL" } ], orSearchModel: { "andList": [ { "name": "expectedEndTime", "value": nextDayStartUtcFormat(currentDay), "operateType": "<" }, { "name": "expectedEndTime", "value": dayStartUtcFormat(currentDay), "operateType": ">" }, { "name": "expectedStartTime", "operateType": "NULL" } ] } } } console.log({orSearchModel}) dispatch({ type: UPDATE_SEARCH, search: { "pageSize": 12, "pageNumber": 1, "data": { orSearchModel } } }) navigate("/home/listTask") } useEffect(() => { console.log("useEffect"); getDictionary("2").then(state => { setStateMap(state) }) getDictionary("1").then(priority => { console.log(priority) setPriorityMap(priority) }) }, []) return (

TODO日{currentDay && dayjs(currentDay).format(DATE_FORMAT)}代办: {currentDay && 详情} {!dayjs(currentDay).isSame(today, 'date') && backToToday()}>回到今天}

{taskCount.filter(taskC => dayjs(taskC.todoDay).isSame(dayjs(currentDay), 'date'))?.map(taskC => { return

任务状态

{ Object.keys(taskC.state).map(ob => { return
{stateMap.get(ob).itemName} 共 {taskC.state[ob]} 项代办;
; })}

优先级

{ Object.keys(taskC.priority).map(ob => { console.log("stateMap.get(ob).jsonValue?.color", priorityMap.get(ob)) return
{priorityMap.get(ob).itemName} 共 {taskC.priority[ob]} 项代办;
; }) }
}) }
) } export {TaskCount};