feat:backup
This commit is contained in:
parent
791e0c2ef6
commit
9c81ff199c
Binary file not shown.
Before Width: | Height: | Size: 5.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.9 KiB |
|
@ -29,6 +29,8 @@ export default () => {
|
||||||
// 获取form引用
|
// 获取form引用
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
||||||
|
|
||||||
if (location.pathname.endsWith("addTask")) {
|
if (location.pathname.endsWith("addTask")) {
|
||||||
setTitle("添加任务");
|
setTitle("添加任务");
|
||||||
setCurrentPath("addTask");
|
setCurrentPath("addTask");
|
||||||
|
@ -186,7 +188,7 @@ export default () => {
|
||||||
showCount
|
showCount
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name='state' label='任务状态' required disabled={updateFiledDisabled}>
|
<Form.Item name='state' label='任务状态' required={true} disabled={updateFiledDisabled}>
|
||||||
<Radio.Group>
|
<Radio.Group>
|
||||||
<Space direction='vertical'>
|
<Space direction='vertical'>
|
||||||
<Radio value='8'><Tag color='primary'>未开始</Tag></Radio>
|
<Radio value='8'><Tag color='primary'>未开始</Tag></Radio>
|
||||||
|
@ -196,7 +198,7 @@ export default () => {
|
||||||
</Space>
|
</Space>
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name='priority' label='任务优先级' disabled={updateFiledDisabled}>
|
<Form.Item name='priority' label='任务优先级' required={true} disabled={updateFiledDisabled}>
|
||||||
<Radio.Group>
|
<Radio.Group>
|
||||||
<Space direction='vertical'>
|
<Space direction='vertical'>
|
||||||
<Radio value='3'><Tag color='danger'>紧急重要</Tag></Radio>
|
<Radio value='3'><Tag color='danger'>紧急重要</Tag></Radio>
|
||||||
|
|
|
@ -18,7 +18,7 @@ const DetailSearchBar = (props) => {
|
||||||
(search.data.andList?.length > 0 || search.data.orList?.length > 0)
|
(search.data.andList?.length > 0 || search.data.orList?.length > 0)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
initSearch();
|
initSearch();
|
||||||
}, []);
|
}, [search]);
|
||||||
|
|
||||||
const initSearch = async () => {
|
const initSearch = async () => {
|
||||||
if (search && search.data) {
|
if (search && search.data) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import {TabBar, FloatingBubble, Toast} from 'antd-mobile'
|
||||||
import WidthUseNavigate from './../WidthUseNavigate/index'
|
import WidthUseNavigate from './../WidthUseNavigate/index'
|
||||||
import {
|
import {
|
||||||
AppOutline,
|
AppOutline,
|
||||||
MessageOutline,
|
CalendarOutline,
|
||||||
UnorderedListOutline,
|
UnorderedListOutline,
|
||||||
UserOutline,
|
UserOutline,
|
||||||
AddOutline,
|
AddOutline,
|
||||||
|
@ -15,25 +15,25 @@ const tabs = [
|
||||||
key: '/mobile/treeTask',
|
key: '/mobile/treeTask',
|
||||||
title: '主子任务',
|
title: '主子任务',
|
||||||
icon: <AppOutline/>,
|
icon: <AppOutline/>,
|
||||||
badge: '1',
|
// badge: '1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: '/mobile/listTask',
|
key: '/mobile/listTask',
|
||||||
title: '列表任务',
|
title: '列表任务',
|
||||||
icon: <UnorderedListOutline/>,
|
icon: <UnorderedListOutline/>,
|
||||||
badge: '2',
|
// badge: '2',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: '/mobile/calTask',
|
key: '/mobile/calTask',
|
||||||
title: '日历任务',
|
title: '日历任务',
|
||||||
icon: <MessageOutline/>,
|
icon: <CalendarOutline />,
|
||||||
badge: '3',
|
// badge: '3',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: '/mobile/me',
|
key: '/mobile/me',
|
||||||
title: '我的',
|
title: '我的',
|
||||||
icon: <UserOutline/>,
|
icon: <UserOutline/>,
|
||||||
badge: '4',
|
// badge: '4',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
class BottomInner extends React.Component {
|
class BottomInner extends React.Component {
|
||||||
|
|
|
@ -32,8 +32,9 @@ const DetailSearchContext = () => {
|
||||||
if (!search) {
|
if (!search) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (search.data && search.data.orSearchModel && search.data.orSearchModel.andList) {
|
||||||
let searchMap = new Map(
|
let searchMap = new Map(
|
||||||
search.data?.orSearchModel?.andList.map(searchObj => [searchObj.name, searchObj]));
|
search.data.orSearchModel.andList.map(searchObj => [searchObj.name, searchObj]));
|
||||||
if (searchMap.has("pid")) {
|
if (searchMap.has("pid")) {
|
||||||
|
|
||||||
// form.setFieldValue(task.name);
|
// form.setFieldValue(task.name);
|
||||||
|
@ -44,21 +45,23 @@ const DetailSearchContext = () => {
|
||||||
if (searchMap.has("priority")) {
|
if (searchMap.has("priority")) {
|
||||||
form.setFieldValue("priority", searchMap.get("priority").value.split(','))
|
form.setFieldValue("priority", searchMap.get("priority").value.split(','))
|
||||||
}
|
}
|
||||||
|
if (searchMap.has("name")) {
|
||||||
|
form.setFieldValue("name", searchMap.get("name").value)
|
||||||
|
}
|
||||||
|
}
|
||||||
// 结束时间大于todo日,开始时间小于结束日
|
// 结束时间大于todo日,开始时间小于结束日
|
||||||
search.data.orSearchModel?.andSearchModel?.andList?.forEach((searchObj) => {
|
search.data?.orSearchModel?.andSearchModel?.andList?.forEach((searchObj) => {
|
||||||
if (searchObj.name === "expectedEndTime") {
|
if (searchObj.name === "expectedEndTime") {
|
||||||
form.setFieldValue("todoDay", dayjs(searchObj.value).toDate())
|
form.setFieldValue("todoDay", dayjs(searchObj.value).toDate())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
if (search.data && search.data.andList) {
|
||||||
if (searchMap.has("name")) {
|
|
||||||
form.setFieldValue("name", searchMap.get("name").value)
|
|
||||||
}
|
|
||||||
let orMap = new Map(search.data.andList.map(searchObj => [searchObj.name, searchObj]));
|
let orMap = new Map(search.data.andList.map(searchObj => [searchObj.name, searchObj]));
|
||||||
if (orMap.has("state") && orMap.get("state").value === "10") {
|
if (orMap.has("state") && orMap.get("state").value === "10") {
|
||||||
form.setFieldValue("allOverdueTasks", 'checked')
|
form.setFieldValue("allOverdueTasks", 'checked')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import React, {Fragment} from 'react'
|
import React, {Fragment, useEffect} from 'react'
|
||||||
import Bottom from './../Bottom/index'
|
import Bottom from './../Bottom/index'
|
||||||
import './index.css'
|
import './index.css'
|
||||||
import {Outlet, useLocation} from 'react-router-dom'
|
import {Outlet, useLocation} from 'react-router-dom'
|
||||||
import DetailSearchBar from "../../components/DetailSearchBar";
|
import DetailSearchBar from "../../components/DetailSearchBar";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
import {dayStartUtcFormat, nextDayStartUtcFormat} from "../../utils/timeFormatUtil";
|
||||||
|
|
||||||
|
|
||||||
const Home = () => {
|
const Home = () => {
|
||||||
|
@ -12,7 +13,12 @@ const Home = () => {
|
||||||
console.log("Home", location);
|
console.log("Home", location);
|
||||||
const searchUrl = location?.state?.search;
|
const searchUrl = location?.state?.search;
|
||||||
const [pName, setName] = React.useState("");
|
const [pName, setName] = React.useState("");
|
||||||
const [search, setSearch] = React.useState(searchUrl ? searchUrl : {
|
const [search, setSearch] = React.useState()
|
||||||
|
const updateSearch = (values) => {
|
||||||
|
setSearch(values);
|
||||||
|
};
|
||||||
|
useEffect(() => {
|
||||||
|
setSearch(searchUrl ? searchUrl : {
|
||||||
"pageSize": 20,
|
"pageSize": 20,
|
||||||
"pageNumber": 1,
|
"pageNumber": 1,
|
||||||
"data": {
|
"data": {
|
||||||
|
@ -24,12 +30,12 @@ const Home = () => {
|
||||||
"andList": [
|
"andList": [
|
||||||
{
|
{
|
||||||
"name": "expectedStartTime",
|
"name": "expectedStartTime",
|
||||||
"value": dayjs().add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
|
"value": nextDayStartUtcFormat(dayjs()),
|
||||||
"operateType": "<"
|
"operateType": "<"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "expectedEndTime",
|
"name": "expectedEndTime",
|
||||||
"value": dayjs().set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
|
"value": dayStartUtcFormat(dayjs()),
|
||||||
"operateType": ">"
|
"operateType": ">"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -37,17 +43,17 @@ const Home = () => {
|
||||||
"andList": [
|
"andList": [
|
||||||
{
|
{
|
||||||
"name": "expectedStartTime",
|
"name": "expectedStartTime",
|
||||||
"value": dayjs().add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
|
"value": nextDayStartUtcFormat(dayjs()),
|
||||||
"operateType": "<"
|
"operateType": "<"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "expectedStartTime",
|
"name": "expectedStartTime",
|
||||||
"value": dayjs().set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
|
"value": dayStartUtcFormat(dayjs()),
|
||||||
"operateType": ">"
|
"operateType": ">"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "expectedEndTime",
|
"name": "expectedEndTime",
|
||||||
"value": dayjs().set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
|
"value": dayStartUtcFormat(dayjs()),
|
||||||
"operateType": "NULL"
|
"operateType": "NULL"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -55,17 +61,17 @@ const Home = () => {
|
||||||
"andList": [
|
"andList": [
|
||||||
{
|
{
|
||||||
"name": "expectedEndTime",
|
"name": "expectedEndTime",
|
||||||
"value": dayjs().add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
|
"value": nextDayStartUtcFormat(dayjs()),
|
||||||
"operateType": "<"
|
"operateType": "<"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "expectedEndTime",
|
"name": "expectedEndTime",
|
||||||
"value": dayjs().set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
|
"value": dayStartUtcFormat(dayjs()),
|
||||||
"operateType": ">"
|
"operateType": ">"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "expectedStartTime",
|
"name": "expectedStartTime",
|
||||||
"value": dayjs().set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format(),
|
"value": dayStartUtcFormat(dayjs()),
|
||||||
"operateType": "NULL"
|
"operateType": "NULL"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -78,9 +84,7 @@ const Home = () => {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const updateSearch = (values) => {
|
},[searchUrl])
|
||||||
setSearch(values);
|
|
||||||
};
|
|
||||||
return (
|
return (
|
||||||
<div className='body'>
|
<div className='body'>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {deleteTaskById, getTaskList, updateTaskStateById} from "../../utils";
|
||||||
import "./index.css"
|
import "./index.css"
|
||||||
import {useLocation, useNavigate, useOutletContext} from "react-router-dom";
|
import {useLocation, useNavigate, useOutletContext} from "react-router-dom";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import {DATE_TIME_FORMAT} from "../../utils/timeFormatUtil";
|
import {DATE_TIME_FORMAT, DATE_TIME_FORMAT_SIMPLE} from "../../utils/timeFormatUtil";
|
||||||
import {getDictionary} from "../../utils/dictUtil";
|
import {getDictionary} from "../../utils/dictUtil";
|
||||||
|
|
||||||
const reorder = (
|
const reorder = (
|
||||||
|
@ -26,23 +26,27 @@ const ToDoList = () => {
|
||||||
const [priorityMap, setPriorityMap] = useState([]);
|
const [priorityMap, setPriorityMap] = useState([]);
|
||||||
const [stateMap, setStateMap] = useState([])
|
const [stateMap, setStateMap] = useState([])
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
let loading = false;
|
let loading = true;
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const {search: outletSearch} = useOutletContext()
|
const {search: outletSearch} = useOutletContext()
|
||||||
const search = location.state ? location.state.search : outletSearch;
|
const search = location.state ? location.state.search : outletSearch;
|
||||||
console.log("ToDoList.search", location, outletSearch)
|
console.log("ToDoList.search", location, outletSearch)
|
||||||
|
console.log("ToDoList测试下从添加任务过来条件都没有了,",search,outletSearch)
|
||||||
const loadMore = async () => {
|
const loadMore = async () => {
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
loading = true;
|
loading = true;
|
||||||
console.log("loadMore", loading)
|
console.log("loadMore", loading)
|
||||||
await getTaskList({...search, "pageNumber": pageNumber + 1}).then(result => {
|
const taskRes = await getTaskList({...search, "pageNumber": pageNumber + 1});
|
||||||
setTaskList(val => [...val, ...result.content])
|
setTaskList(val => [...val, ...taskRes.connect])
|
||||||
setHasMore(result.page.number < result.page.totalPages)
|
if (taskRes.page.number < taskRes.page.totalPages){
|
||||||
})
|
setHasMore(true)
|
||||||
setPageNumber(pageNumber + 1)
|
setPageNumber(pageNumber + 1)
|
||||||
|
}else {
|
||||||
|
setHasMore(false)
|
||||||
|
setPageNumber(1)
|
||||||
|
}
|
||||||
loading = false;
|
loading = false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -61,11 +65,17 @@ const ToDoList = () => {
|
||||||
})
|
})
|
||||||
getTaskList({...search, "pageNumber": pageNumber}).then(result => {
|
getTaskList({...search, "pageNumber": pageNumber}).then(result => {
|
||||||
setTaskList(result.content)
|
setTaskList(result.content)
|
||||||
setHasMore(result.page.number < result.page.totalPages)
|
if (result.page.number < result.page.totalPages){
|
||||||
|
setHasMore(true)
|
||||||
|
setPageNumber(pageNumber + 1)
|
||||||
|
}else {
|
||||||
|
setHasMore(false)
|
||||||
|
setPageNumber(1)
|
||||||
|
}
|
||||||
loading = false;
|
loading = false;
|
||||||
})
|
})
|
||||||
|
|
||||||
}, [])
|
}, [useOutletContext()])
|
||||||
const ref = useRef(null)
|
const ref = useRef(null)
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
|
@ -75,8 +85,13 @@ const ToDoList = () => {
|
||||||
console.log("refresh")
|
console.log("refresh")
|
||||||
getTaskList({...search, "pageNumber": 1}).then(result => {
|
getTaskList({...search, "pageNumber": 1}).then(result => {
|
||||||
setTaskList(result.content)
|
setTaskList(result.content)
|
||||||
|
if (result.page.number < result.page.totalPages){
|
||||||
|
setHasMore(true)
|
||||||
|
setPageNumber(pageNumber + 1)
|
||||||
|
}else {
|
||||||
|
setHasMore(false)
|
||||||
setPageNumber(1)
|
setPageNumber(1)
|
||||||
setHasMore(result.page.number < result.page.totalPages)
|
}
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -187,9 +202,9 @@ const ToDoList = () => {
|
||||||
|
|
||||||
{item.expectedEndTime && (stateMap.get(item.state)?.jsonValue?.color ?
|
{item.expectedEndTime && (stateMap.get(item.state)?.jsonValue?.color ?
|
||||||
(<span style={{color: stateMap.get(item.state)?.jsonValue?.color}}>
|
(<span style={{color: stateMap.get(item.state)?.jsonValue?.color}}>
|
||||||
结束时间:{dayjs(item.expectedEndTime).format(DATE_TIME_FORMAT)}</span>) :
|
{dayjs(item.expectedEndTime).format(DATE_TIME_FORMAT_SIMPLE)}</span>) :
|
||||||
(
|
(
|
||||||
<span>结束时间:{dayjs(item.expectedEndTime).format(DATE_TIME_FORMAT)}</span>))
|
<span>{dayjs(item.expectedEndTime).format(DATE_TIME_FORMAT_SIMPLE)}</span>))
|
||||||
}
|
}
|
||||||
</div>}
|
</div>}
|
||||||
description={item.description}
|
description={item.description}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
|
import {Toast} from "antd-mobile";
|
||||||
|
|
||||||
export const requestUtil = axios.create({
|
export const requestUtil = axios.create({
|
||||||
baseURL: 'http://www.huaruyu.com/',
|
baseURL: 'http://www.huaruyu.com/',
|
||||||
|
@ -24,11 +25,25 @@ requestUtil.interceptors.response.use(function (response) {
|
||||||
// 对响应数据做点什么
|
// 对响应数据做点什么
|
||||||
console.log("response",response);
|
console.log("response",response);
|
||||||
if (response.data.status.code !== 200){
|
if (response.data.status.code !== 200){
|
||||||
|
Toast.show({
|
||||||
|
content: 'response.data.status.message',
|
||||||
|
afterClose: () => {
|
||||||
|
console.log('after')
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
return response.data.data;
|
return response.data.data;
|
||||||
}, function (error) {
|
}, function (error) {
|
||||||
// 超出 2xx 范围的状态码都会触发该函数。
|
// 超出 2xx 范围的状态码都会触发该函数。
|
||||||
// 对响应错误做点什么
|
// 对响应错误做点什么
|
||||||
|
Toast.show({
|
||||||
|
content: error.toString(),
|
||||||
|
afterClose: () => {
|
||||||
|
console.log('after')
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if (error.response.status >= 400 && error.response.status <= 500) {
|
||||||
|
window.location.href = '/login';
|
||||||
|
}
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
});
|
});
|
|
@ -1,5 +1,23 @@
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
const DATE_FORMAT = "YYYY-MM-DD"
|
const DATE_FORMAT = "YYYY-MM-DD"
|
||||||
// 到秒没啥意义
|
// 到秒没啥意义
|
||||||
const DATE_TIME_FORMAT = "YYYY-MM-DD HH:mm"
|
const DATE_TIME_FORMAT = "YYYY-MM-DD HH:mm"
|
||||||
|
|
||||||
export {DATE_TIME_FORMAT,DATE_FORMAT}
|
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()
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function nextDayStartUtcFormat(dayjs) {
|
||||||
|
if (dayjs) {
|
||||||
|
return dayjs.add(1, "d").set('h', 0).set('m', 0).set('s', 0).set('ms', 0).format()
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
export {DATE_TIME_FORMAT, DATE_FORMAT,DATE_TIME_FORMAT_SIMPLE,dayStartUtcFormat,nextDayStartUtcFormat}
|
Loading…
Reference in New Issue