pc端可访问:http://www.hauruyu.com
-
+ const [columnSort, setColumnSort] = useState()
+ return
+
+ }>新建任务时父任务只展示未完成任务
+
+ {
+ console.log('onSelect', val, extend.items)
+ }}>
+ {(items, {open}) => {
+ return (
+ //
+ item === null)
+ ? '未选择'
+ : items.map(item => item?.label ?? '未选择').join(' - ')}>
+ 任务排序方式:
+
+ //
+ )
+ }}
+
+
+
+ 授权管理
+
+
+ 这里是主信息
+
+
+ {/*
网站:http://www.hauruyu.com*/}
+ {/*
*/}
+ {/* */}
+ {/* */}
+ {/**/}
+
}
\ No newline at end of file
diff --git a/src/pages/TaskCount/index.js b/src/pages/TaskCount/index.js
index 1dbd22e..ffbaa8e 100644
--- a/src/pages/TaskCount/index.js
+++ b/src/pages/TaskCount/index.js
@@ -1,7 +1,7 @@
import React, {Fragment, useContext, useEffect, useMemo} from "react";
import {getTaskCount} from "../../utils";
import dayjs from "dayjs";
-import {DATE_FORMAT} from "../../utils/timeFormatUtil";
+import {DATE_FORMAT, dayStartUtcFormat, nextDayStartUtcFormat} from "../../utils/timeFormatUtil";
import {getDictionary} from "../../utils/dictUtil";
import {Tag} from "antd-mobile";
import {useNavigate} from "react-router-dom";
@@ -18,8 +18,8 @@ const TaskCount = (props) => {
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))
+ getTaskCount(dayStartUtcFormat(currentDay),
+ nextDayStartUtcFormat(currentDay))
.then(taskCount => {
setTaskCount(taskCount)
})
@@ -42,22 +42,22 @@ const TaskCount = (props) => {
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(),
+ "value": nextDayStartUtcFormat(currentDay),
"operateType": "<"
}, {
"name": "expectedEndTime",
- "value": dayjs(currentDay).set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
+ "value": dayStartUtcFormat(currentDay),
"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(),
+ "value": nextDayStartUtcFormat(currentDay),
"operateType": "<"
}, {
"name": "expectedStartTime",
- "value": dayjs(currentDay).set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
+ "value": dayStartUtcFormat(currentDay),
"operateType": ">"
}, {
"name": "expectedEndTime",
@@ -67,11 +67,11 @@ const TaskCount = (props) => {
"andList": [
{
"name": "expectedEndTime",
- "value": dayjs(currentDay).add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
+ "value": nextDayStartUtcFormat(currentDay),
"operateType": "<"
}, {
"name": "expectedEndTime",
- "value": dayjs(currentDay).set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
+ "value": dayStartUtcFormat(currentDay),
"operateType": ">"
}, {
"name": "expectedStartTime",
diff --git a/src/pages/ToDoTree/index.js b/src/pages/ToDoTree/index.js
index 656ecb7..f6d15c8 100644
--- a/src/pages/ToDoTree/index.js
+++ b/src/pages/ToDoTree/index.js
@@ -1,70 +1,90 @@
import {Fragment, useEffect, useMemo, useState} from "react";
import {Card, Cascader, CascaderView} from "antd-mobile";
import {getTaskByPid} from "../../utils";
+import dayjs from "dayjs";
+import {DATE_TIME_FORMAT} from "../../utils/timeFormatUtil";
+import {useChildList} from "../../hooks/useChildList";
export default () => {
- const [valueToOptions, setValueToOptions] = useState([])
- const options = useMemo(() => {
- function generate(v) {
- const options = valueToOptions[v]
- if (options === null) {
- return undefined
- }
- if (options === undefined) {
- return Cascader.optionSkeleton
- }
- return options.map(option => ({
- ...option,
- children: generate(option.value),
- }))
- }
+ // const [valueToOptions, setValueToOptions] = useState([])
+ // const [currentTask, setCurrentTask] = useState({
+ // name:"想做的事情",
+ // description:"想做的事情描述",
+ // expectedStartTime:dayjs().format(DATE_TIME_FORMAT),
+ // expectedEndTime:"",
+ // state:"",
+ // priority:"",
+ // })
+ // const options = useMemo(() => {
+ // function generate(v) {
+ // const options = valueToOptions[v]
+ // if (options === null || options === undefined) {
+ // return undefined
+ // }
+ // // if (options === undefined) {
+ // // return Cascader.optionSkeleton
+ // // }
+ // return options.map(option => ({
+ // ...option,
+ // children: generate(option.value),
+ // }))
+ // }
+ //
+ // return generate('0') ?? []
+ // }, [valueToOptions])
+ //
+ // async function fetchOptionsForValue(v, level) {
+ // if (v in valueToOptions) return
+ // // if (level >= 3) {
+ // // setValueToOptions(prev => ({
+ // // ...prev,
+ // // [v]: null,
+ // // }))
+ // // return
+ // // }
+ // const data = await getTaskByPid(v)
+ // console.log("await getTaskByPid(v)", data.content)
+ // const options =
+ // data.content.length === 0
+ // ? null
+ // : data.content.map(task => ({
+ // value: task.id,
+ // label: task.name,
+ // }))
+ // console.log("await getTaskByPid(v) options", options)
+ // if (options){
+ // setValueToOptions(prev => ({
+ // ...prev,
+ // [v]: options,
+ // }))
+ // }else {
+ // setValueToOptions(prev => ({
+ // ...prev,
+ // [v]: undefined,
+ // }))
+ // }
+ // }
- return generate('0') ?? []
- }, [valueToOptions])
+ // useEffect(() => {
+ // fetchOptionsForValue('0', 0)
+ // }, [])
- async function fetchOptionsForValue(v, level) {
- if (v in valueToOptions) return
- // if (level >= 3) {
- // setValueToOptions(prev => ({
- // ...prev,
- // [v]: null,
- // }))
- // return
- // }
- const data = await getTaskByPid(v)
- console.log("await getTaskByPid(v)", data.content)
- const options =
- data.content.length === 0
- ? null
- : data.content.map(task => ({
- value: task.id,
- label: task.name,
- }))
- console.log("await getTaskByPid(v) options", options)
- if (options){
- setValueToOptions(prev => ({
- ...prev,
- [v]: options,
- }))
- }else {
- setValueToOptions(prev => ({
- ...prev,
- [v]: [],
- }))
- }
-
-
- }
-
- useEffect(() => {
- fetchOptionsForValue('0', 0)
- }, [])
+ const {task, options, changeTaskId,} = useChildList();
return
-
- 任务详情
+
+ {task?.description}
+
+ 预计开始时间:{task?.expectedStartTime}
+ 预计结束时间:{task?.expectedEndTime}
- {
- fetchOptionsForValue(value)
- }}/>
+ {
+ // fetchOptionsForValue(value[value.length-1])
+ console.log({value})
+ changeTaskId(value)
+ }}
+
+ />
}
\ No newline at end of file
diff --git a/src/utils/index.js b/src/utils/index.js
index 8b34ec6..c8ed1bb 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -2,7 +2,7 @@ import {requestUtil} from "./requestUtil";
export const getTaskList = (data) => {
let request = encodeURI(JSON.stringify(data))
- return requestUtil.get('/V2/search/task_message_tree?search=' + request);
+ return requestUtil.get('/todo-server/V2/search/task_message_tree?search=' + request);
}
// 根据pid获取未完成的任务
export const getTaskByPid = (pid) => {
diff --git a/src/utils/timeFormatUtil.js b/src/utils/timeFormatUtil.js
index b6f9ae2..6470191 100644
--- a/src/utils/timeFormatUtil.js
+++ b/src/utils/timeFormatUtil.js
@@ -1,23 +1,37 @@
-import dayjs from "dayjs";
-
+import dayjs, {isDayjs} from "dayjs";
+import utc from "dayjs/plugin/utc";
+dayjs.extend(utc)
const DATE_FORMAT = "YYYY-MM-DD"
// 到秒没啥意义
const DATE_TIME_FORMAT = "YYYY-MM-DD HH:mm"
const DATE_TIME_FORMAT_SIMPLE = "MM-DD HH:mm"
-function dayStartUtcFormat(dayjs) {
- if (dayjs) {
- return dayjs.set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format()
+function dayStartUtcFormat(dayjsString) {
+
+ if (!dayjsString) {
+ return
}
- return null;
+ let dayJsObj;
+ if (isDayjs(dayjsString)) {
+ dayJsObj = dayjsString;
+ }else {
+ dayJsObj = dayjs(dayjsString);
+ }
+ return dayJsObj.set('h', 0).set('m', 0).set('s', 0).set('ms', 0).utc().format()
}
-function nextDayStartUtcFormat(dayjs) {
- if (dayjs) {
- return dayjs.add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format()
+function nextDayStartUtcFormat(dayjsString) {
+ if (!dayjsString) {
+ return
}
- return null
+ let dayJsObj;
+ if (isDayjs(dayjsString)) {
+ dayJsObj = dayjsString;
+ }else {
+ dayJsObj = dayjs(dayjsString);
+ }
+ return dayJsObj.add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).utc().format()
}
export {DATE_TIME_FORMAT, DATE_FORMAT,DATE_TIME_FORMAT_SIMPLE,dayStartUtcFormat,nextDayStartUtcFormat}
\ No newline at end of file