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, currentMonth} = 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}) let setting = localStorage.getItem('huayu-todo-setting'); if (setting && JSON.parse(setting).columnSort) { dispatch({ type: UPDATE_SEARCH, search: { "pageSize": 12, "pageNumber": 1, "sortList":[{"property":"expectedStartTime","direction":"ASC"}], "data": { orSearchModel } } }) }else { dispatch({ type: UPDATE_SEARCH, search: { "pageSize": 12, "pageNumber": 1, "data": { orSearchModel } } }) } navigate("/home/listTask") } useEffect(() => { getDictionary("2").then(state => { setStateMap(state) }) getDictionary("1").then(priority => { setPriorityMap(priority) }) }, []) return (