2025-01-06 05:54:22 -05:00
|
|
|
|
import React, {Fragment, useEffect, useMemo} from "react";
|
2025-01-05 05:04:52 -05:00
|
|
|
|
import {getTaskCount} from "../../utils";
|
|
|
|
|
import dayjs from "dayjs";
|
2025-01-06 05:54:22 -05:00
|
|
|
|
import {DATE_FORMAT} from "../../utils/timeFormatUtil";
|
|
|
|
|
import {getDictionary} from "../../utils/dictUtil";
|
|
|
|
|
import {Tag} from "antd-mobile";
|
2025-01-13 06:33:16 -05:00
|
|
|
|
import detailSearchBar from "../../components/DetailSearchBar";
|
|
|
|
|
import {useNavigate} from "react-router-dom";
|
2025-01-06 05:54:22 -05:00
|
|
|
|
|
2025-01-05 05:04:52 -05:00
|
|
|
|
|
|
|
|
|
const TaskCount = (props) => {
|
|
|
|
|
let currentDay = props.currentDay;
|
2025-01-13 06:33:16 -05:00
|
|
|
|
const navigate = useNavigate();
|
2025-01-05 05:04:52 -05:00
|
|
|
|
const [taskCount, setTaskCount] = React.useState([]);
|
2025-01-06 05:54:22 -05:00
|
|
|
|
const [stateMap, setStateMap] = React.useState(new Map);
|
|
|
|
|
const [priorityMap, setPriorityMap] = React.useState(new Map);
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
console.log("useEffect");
|
|
|
|
|
if (currentDay) {
|
|
|
|
|
getTaskCount(dayjs(currentDay).set('h', 0).set('m', 0).set('s', 0).set('ms', 0),
|
|
|
|
|
dayjs(currentDay).add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0))
|
|
|
|
|
.then(taskCount => {
|
|
|
|
|
setTaskCount(taskCount)
|
|
|
|
|
})
|
2025-01-11 04:53:51 -05:00
|
|
|
|
getDictionary("2").then(state => {
|
|
|
|
|
setStateMap(state)
|
|
|
|
|
})
|
|
|
|
|
getDictionary("1").then(priority => {
|
|
|
|
|
console.log(priority)
|
|
|
|
|
setPriorityMap(priority)
|
|
|
|
|
})
|
|
|
|
|
}else {
|
|
|
|
|
setTaskCount([])
|
2025-01-05 05:04:52 -05:00
|
|
|
|
}
|
2025-01-11 04:53:51 -05:00
|
|
|
|
|
2025-01-06 05:54:22 -05:00
|
|
|
|
}, [currentDay])
|
|
|
|
|
|
2025-01-13 06:33:16 -05:00
|
|
|
|
const todoDayDetail = ()=>{
|
|
|
|
|
let andSearchModel = {}
|
|
|
|
|
let orSearchModel = {andSearchModel}
|
|
|
|
|
if (currentDay) {
|
|
|
|
|
andSearchModel.andList = [{
|
|
|
|
|
"name": "expectedStartTime",
|
|
|
|
|
"value": dayjs(currentDay).add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
|
|
|
|
|
"operateType": "<"
|
|
|
|
|
}, {
|
|
|
|
|
"name": "expectedEndTime",
|
|
|
|
|
"value": dayjs(currentDay).set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
|
|
|
|
|
"operateType": ">"
|
|
|
|
|
}]
|
|
|
|
|
andSearchModel.orSearchModel = {
|
|
|
|
|
"andList": [
|
|
|
|
|
{
|
|
|
|
|
"name": "expectedStartTime",
|
|
|
|
|
"value": dayjs(currentDay).add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
|
|
|
|
|
"operateType": "<"
|
|
|
|
|
}, {
|
|
|
|
|
"name": "expectedStartTime",
|
|
|
|
|
"value": dayjs(currentDay).set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
|
|
|
|
|
"operateType": ">"
|
|
|
|
|
}, {
|
|
|
|
|
"name": "expectedEndTime",
|
|
|
|
|
"operateType": "NULL"
|
|
|
|
|
}
|
|
|
|
|
], orSearchModel: {
|
|
|
|
|
"andList": [
|
|
|
|
|
{
|
|
|
|
|
"name": "expectedEndTime",
|
|
|
|
|
"value": dayjs(currentDay).add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
|
|
|
|
|
"operateType": "<"
|
|
|
|
|
}, {
|
|
|
|
|
"name": "expectedEndTime",
|
|
|
|
|
"value": dayjs(currentDay).set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
|
|
|
|
|
"operateType": ">"
|
|
|
|
|
}, {
|
|
|
|
|
"name": "expectedStartTime",
|
|
|
|
|
"operateType": "NULL"
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
console.log({orSearchModel})
|
|
|
|
|
navigate("/mobile/listTask", {
|
|
|
|
|
state: {
|
|
|
|
|
search: {
|
|
|
|
|
"pageSize": 12,
|
|
|
|
|
"pageNumber": 1,
|
|
|
|
|
"data": {
|
|
|
|
|
orSearchModel
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-05 05:04:52 -05:00
|
|
|
|
return (
|
2025-01-06 05:54:22 -05:00
|
|
|
|
<div style={{margin:"20px"}}>
|
2025-01-13 06:33:16 -05:00
|
|
|
|
<h2>TODO日{currentDay && dayjs(currentDay).format(DATE_FORMAT)}代办:
|
|
|
|
|
{currentDay&&<a onClick={todoDayDetail}>详情</a>}</h2>
|
2025-01-06 05:54:22 -05:00
|
|
|
|
<h3>任务状态</h3>
|
|
|
|
|
{
|
|
|
|
|
// taskCount.map(task => {
|
|
|
|
|
// // if (dayjs(task.todoDay).isSame(dayjs(currentDay))){
|
|
|
|
|
// // console.log(dict);
|
|
|
|
|
// // return <span key={task.todoDay}>{task.todoDay}</span>
|
|
|
|
|
// return Array.from(stateMap.entries()).map(([item,value]) => {
|
|
|
|
|
// console.log("key",item,"value",value,task.state)
|
|
|
|
|
// return <Tag color={value.josnValue?.color}>value.itemName</Tag> + task.state[item]
|
|
|
|
|
// })
|
|
|
|
|
//
|
|
|
|
|
// // return task.priority.map((key,value)=>getDictionary(2).get(key)+value)
|
|
|
|
|
// // }
|
|
|
|
|
// })
|
|
|
|
|
taskCount[0] && Object.keys(taskCount[0].state).map(ob => {
|
|
|
|
|
return <div style={{marginBottom:"20px"}} key={ob}><Tag color={
|
|
|
|
|
stateMap.get(ob).jsonValue?stateMap.get(ob).jsonValue.color:"default"
|
|
|
|
|
}>{stateMap.get(ob).itemName}</Tag> 共
|
|
|
|
|
{taskCount[0].state[ob]} 项代办;</div>;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
<h3>优先级</h3>
|
|
|
|
|
{
|
|
|
|
|
taskCount[0] && Object.keys(taskCount[0].priority).map(ob => {
|
|
|
|
|
console.log("stateMap.get(ob).jsonValue?.color", priorityMap.get(ob))
|
|
|
|
|
return <div style={{marginBottom:"20px"}} key={ob}><Tag
|
|
|
|
|
color={priorityMap.get(ob).jsonValue.color}>{priorityMap.get(ob).itemName}</Tag> 共
|
|
|
|
|
{taskCount[0].priority[ob]} 项代办;</div>;
|
|
|
|
|
})
|
|
|
|
|
}
|
2025-01-05 05:04:52 -05:00
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
export {TaskCount};
|