feat:添加默认排序
This commit is contained in:
parent
d8aa521394
commit
f0e81181eb
|
@ -28,9 +28,9 @@ const DetailSearchBar = (props) => {
|
||||||
console.log("search.data.orSearchModel", search.data.orSearchModel)
|
console.log("search.data.orSearchModel", search.data.orSearchModel)
|
||||||
search.data.orSearchModel?.andList?.forEach((searchObj) => {
|
search.data.orSearchModel?.andList?.forEach((searchObj) => {
|
||||||
if (searchObj.name === "pid") {
|
if (searchObj.name === "pid") {
|
||||||
getTaskById(searchObj.value).then(result=>{
|
getTaskById(searchObj.value).then(result => {
|
||||||
setTags([<Tag key={result.content[0].name}>{result.content[0].name}</Tag>
|
setTags([<Tag key={result.content[0].name}>{result.content[0].name}</Tag>
|
||||||
,...tagList])
|
, ...tagList])
|
||||||
})
|
})
|
||||||
} else if (searchObj.name === "state") {
|
} else if (searchObj.name === "state") {
|
||||||
const items = searchObj.value.split(',');
|
const items = searchObj.value.split(',');
|
||||||
|
@ -94,6 +94,21 @@ const DetailSearchBar = (props) => {
|
||||||
{tags}
|
{tags}
|
||||||
</div>
|
</div>
|
||||||
{showCloseOutline && <div className="CloseOutline-CloseOutline" onClick={() => {
|
{showCloseOutline && <div className="CloseOutline-CloseOutline" onClick={() => {
|
||||||
|
// 查看排序
|
||||||
|
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": {
|
||||||
|
"andList": [],
|
||||||
|
"orList": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: UPDATE_SEARCH, search: {
|
type: UPDATE_SEARCH, search: {
|
||||||
"pageSize": 12,
|
"pageSize": 12,
|
||||||
|
@ -104,6 +119,7 @@ const DetailSearchBar = (props) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
setTags([]);
|
setTags([]);
|
||||||
}}>
|
}}>
|
||||||
<CloseOutline key="close-icon" style={{float: "right"}}/>
|
<CloseOutline key="close-icon" style={{float: "right"}}/>
|
||||||
|
|
|
@ -17,6 +17,7 @@ function getInitialState(){
|
||||||
const initialState = {"search":{
|
const initialState = {"search":{
|
||||||
"pageSize": 20,
|
"pageSize": 20,
|
||||||
"pageNumber": 1,
|
"pageNumber": 1,
|
||||||
|
"sortList":[{"property":"expectedStartTime","direction":"ASC"}],
|
||||||
"data": {
|
"data": {
|
||||||
"orSearchModel": {
|
"orSearchModel": {
|
||||||
"andList": [
|
"andList": [
|
||||||
|
|
|
@ -13,7 +13,7 @@ const DetailSearchContext = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [visible, setVisible] = React.useState(false);
|
const [visible, setVisible] = React.useState(false);
|
||||||
const { state, dispatch } = useContext(MyRootContext);
|
const {state, dispatch} = useContext(MyRootContext);
|
||||||
const search = state.search
|
const search = state.search
|
||||||
const [stateList, setStateList] = React.useState([]);
|
const [stateList, setStateList] = React.useState([]);
|
||||||
const [priorityList, setPriorityList] = React.useState([]);
|
const [priorityList, setPriorityList] = React.useState([]);
|
||||||
|
@ -34,7 +34,7 @@ const DetailSearchContext = () => {
|
||||||
console.log({res, parentMessageVOList});
|
console.log({res, parentMessageVOList});
|
||||||
setPName(parentMessageVOList[parentMessageVOList.length - 1].name);
|
setPName(parentMessageVOList[parentMessageVOList.length - 1].name);
|
||||||
setPidArray(parentMessageVOList.map(parent => parent.id))
|
setPidArray(parentMessageVOList.map(parent => parent.id))
|
||||||
form.setFieldValue("pidArray",parentMessageVOList.map(parent => parent.id))
|
form.setFieldValue("pidArray", parentMessageVOList.map(parent => parent.id))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,14 +145,31 @@ const DetailSearchContext = () => {
|
||||||
if (allOverdueTasks) {
|
if (allOverdueTasks) {
|
||||||
andList.push({"name": "state", "value": "10", "operateType": "="})
|
andList.push({"name": "state", "value": "10", "operateType": "="})
|
||||||
}
|
}
|
||||||
dispatch({type:UPDATE_SEARCH,search:{
|
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": {
|
||||||
|
andList,
|
||||||
|
orSearchModel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
dispatch({
|
||||||
|
type: UPDATE_SEARCH, search: {
|
||||||
"pageSize": 12,
|
"pageSize": 12,
|
||||||
"pageNumber": 1,
|
"pageNumber": 1,
|
||||||
"data": {
|
"data": {
|
||||||
andList,
|
andList,
|
||||||
orSearchModel
|
orSearchModel
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
navigate("/home/listTask")
|
navigate("/home/listTask")
|
||||||
}}
|
}}
|
||||||
footer={
|
footer={
|
||||||
|
@ -232,11 +249,11 @@ const DetailSearchContext = () => {
|
||||||
<CalendarPicker
|
<CalendarPicker
|
||||||
visible={visible}
|
visible={visible}
|
||||||
selectionMode='single'
|
selectionMode='single'
|
||||||
defaultValue={getFieldValue('todoDay')??new Date()}
|
defaultValue={getFieldValue('todoDay') ?? new Date()}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
}}
|
}}
|
||||||
onConfirm={(val)=>setFieldsValue({todoDay:val})}
|
onConfirm={(val) => setFieldsValue({todoDay: val})}
|
||||||
/>
|
/>
|
||||||
{
|
{
|
||||||
getFieldValue('todoDay') ? dayjs(getFieldValue('todoDay')).format('YYYY-MM-DD') : '请选择日期'
|
getFieldValue('todoDay') ? dayjs(getFieldValue('todoDay')).format('YYYY-MM-DD') : '请选择日期'
|
||||||
|
|
|
@ -7,7 +7,7 @@ export const columnSortConstant = [
|
||||||
{ label: '任务优先级', value: 'priority' },
|
{ label: '任务优先级', value: 'priority' },
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{ label: '升序', value: 'am' },
|
{ label: '升序', value: 'ASC' },
|
||||||
{ label: '降序', value: 'pm' },
|
{ label: '降序', value: 'DESC' },
|
||||||
],
|
],
|
||||||
]
|
]
|
|
@ -1,20 +1,84 @@
|
||||||
import React, {useState} from "react";
|
import React, {Fragment, useContext, useEffect, useState} from "react";
|
||||||
import {Button, Form, List, Picker, Space, Switch} from "antd-mobile";
|
import {Button, Form, List, Picker, Space, Switch} from "antd-mobile";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
import {columnSortConstant} from "./columnSortConstant";
|
import {columnSortConstant} from "./columnSortConstant";
|
||||||
|
import {MyRootContext, UPDATE_SEARCH} from "../../components/MyRootContext";
|
||||||
|
|
||||||
export function PersonalCenter() {
|
export function PersonalCenter() {
|
||||||
const [columnSort, setColumnSort] = useState()
|
const [columnSort, setColumnSort] = useState(['expectedStartTime', 'ASC'])
|
||||||
return <div>
|
const [parentCheck, setParentCheck] = useState(true)
|
||||||
<List header='网站:http://www.hauruyu.com'>
|
const webUrl = <Fragment>网站:<a>http://www.hauruyu.com</a></Fragment>;
|
||||||
<List.Item extra={<Switch defaultChecked/>}>新建任务时父任务只展示未完成任务</List.Item>
|
const {state, dispatch} = useContext(MyRootContext);
|
||||||
|
useEffect(() => {
|
||||||
|
let setting = localStorage.getItem('huayu-todo-setting');
|
||||||
|
if (setting) {
|
||||||
|
setColumnSort(JSON.parse(setting).columnSort);
|
||||||
|
setParentCheck(JSON.parse(setting).parentCheck);
|
||||||
|
dispatch({
|
||||||
|
type: UPDATE_SEARCH, search: {
|
||||||
|
...state.search,
|
||||||
|
sortList: [{
|
||||||
|
"property": JSON.parse(setting).columnSort[0],
|
||||||
|
"direction": JSON.parse(setting).columnSort[1]
|
||||||
|
}],
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
localStorage.setItem('huayu-todo-setting', JSON.stringify({
|
||||||
|
columnSort: columnSort,
|
||||||
|
parentCheck: parentCheck,
|
||||||
|
}));
|
||||||
|
dispatch({
|
||||||
|
type: UPDATE_SEARCH, search: {
|
||||||
|
...state.search,
|
||||||
|
sortList: [{
|
||||||
|
"property": columnSort[0],
|
||||||
|
"direction": columnSort[1]
|
||||||
|
}],
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}, [])
|
||||||
|
return <div>
|
||||||
|
<List header={webUrl}>
|
||||||
|
<List.Item extra={<Switch checked={parentCheck} onChange={
|
||||||
|
(checked) => {
|
||||||
|
let setting = localStorage.getItem('huayu-todo-setting');
|
||||||
|
if (setting) {
|
||||||
|
let parseObj = JSON.parse(setting);
|
||||||
|
parseObj.parentCheck = checked
|
||||||
|
setting = JSON.stringify(parseObj)
|
||||||
|
setParentCheck(checked);
|
||||||
|
} else {
|
||||||
|
setting = JSON.stringify({parentCheck: checked})
|
||||||
|
}
|
||||||
|
localStorage.setItem('huayu-todo-setting', setting);
|
||||||
|
}
|
||||||
|
}/>}>新建任务时父任务只展示未完成任务</List.Item>
|
||||||
<Picker
|
<Picker
|
||||||
columns={columnSortConstant}
|
columns={columnSortConstant}
|
||||||
value={columnSort}
|
value={columnSort}
|
||||||
onConfirm={setColumnSort}
|
onConfirm={(val, extend) => {
|
||||||
onSelect={(val, extend) => {
|
console.log({val})
|
||||||
console.log('onSelect', val, extend.items)
|
let setting = localStorage.getItem('huayu-todo-setting');
|
||||||
|
if (setting) {
|
||||||
|
let parseObj = JSON.parse(setting);
|
||||||
|
parseObj.columnSort = val
|
||||||
|
setting = JSON.stringify(parseObj)
|
||||||
|
setColumnSort(val);
|
||||||
|
} else {
|
||||||
|
setting = JSON.stringify({columnSort: val})
|
||||||
|
}
|
||||||
|
console.log({setting})
|
||||||
|
dispatch({
|
||||||
|
type: UPDATE_SEARCH, search: {
|
||||||
|
...state.search,
|
||||||
|
sortList: [{"property": val[0], "direction": val[1]}],
|
||||||
|
}
|
||||||
|
});
|
||||||
|
localStorage.setItem('huayu-todo-setting', setting);
|
||||||
}}>
|
}}>
|
||||||
{(items, {open}) => {
|
{(items, {open}) => {
|
||||||
return (
|
return (
|
||||||
|
@ -28,32 +92,8 @@ export function PersonalCenter() {
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
</Picker>
|
</Picker>
|
||||||
|
|
||||||
<List.Item description='管理已授权的产品和设备' clickable>
|
|
||||||
授权管理
|
|
||||||
</List.Item>
|
|
||||||
<List.Item title='副标题信息A' description='副标题信息B' clickable>
|
|
||||||
这里是主信息
|
|
||||||
</List.Item>
|
|
||||||
</List>
|
</List>
|
||||||
{/*<Form*/}
|
<Button style={{width: '100%'}} color={"danger"} onClick={() => {
|
||||||
{/* layout='horizontal'*/}
|
|
||||||
{/* footer={*/}
|
|
||||||
{/* <Button block type='submit' color='primary' size='large'>*/}
|
|
||||||
{/* 提交*/}
|
|
||||||
{/* </Button>*/}
|
|
||||||
{/* }*/}
|
|
||||||
{/*>*/}
|
|
||||||
{/* <Form.Header>网站:http://www.hauruyu.com</Form.Header>*/}
|
|
||||||
{/* <Form.Item*/}
|
|
||||||
{/* name='delivery'*/}
|
|
||||||
{/* label='新建任务时,父任务只展示未完成任务'*/}
|
|
||||||
{/* childElementPosition='right'*/}
|
|
||||||
{/* >*/}
|
|
||||||
{/* <Switch/>*/}
|
|
||||||
{/* </Form.Item>*/}
|
|
||||||
{/*</Form>*/}
|
|
||||||
<Button color={"danger"} onClick={() => {
|
|
||||||
localStorage.removeItem('platform-security');
|
localStorage.removeItem('platform-security');
|
||||||
Cookies.remove('platform-security');
|
Cookies.remove('platform-security');
|
||||||
window.location.href = "http:///www.huaruyu.com/login"
|
window.location.href = "http:///www.huaruyu.com/login"
|
||||||
|
|
|
@ -61,6 +61,19 @@ const TaskCount = (props) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log({orSearchModel})
|
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({
|
dispatch({
|
||||||
type: UPDATE_SEARCH, search: {
|
type: UPDATE_SEARCH, search: {
|
||||||
"pageSize": 12,
|
"pageSize": 12,
|
||||||
|
@ -70,6 +83,7 @@ const TaskCount = (props) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
navigate("/home/listTask")
|
navigate("/home/listTask")
|
||||||
}
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
@ -52,7 +52,7 @@ const ToDoList = () => {
|
||||||
loading = false;
|
loading = false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 根据查询条件筛选本地列表,不触发接口
|
* 根据查询条件筛选本地列表,不触发接口?
|
||||||
*/
|
*/
|
||||||
const localRefresh = () => {
|
const localRefresh = () => {
|
||||||
console.log("refresh")
|
console.log("refresh")
|
||||||
|
|
Loading…
Reference in New Issue