feat:backup
This commit is contained in:
parent
2b7bb13c83
commit
9d4a0d059b
|
@ -1,26 +1,13 @@
|
||||||
'use client'
|
'use client'
|
||||||
import SideNav from '@/app/ui/dashboard/sidenav';
|
|
||||||
import TreeTable from "@/app/ui/task/four/TreeTable";
|
import TreeTable from "@/app/ui/task/four/TreeTable";
|
||||||
import '@/app/ui/task/four/index.modules.css'
|
import '@/app/ui/task/four/index.modules.css'
|
||||||
import {useContext, useEffect} from "react";
|
import {useContext, useEffect, useState} from "react";
|
||||||
import LocalContext from "@/app/ui/LocalContent";
|
import LocalContext from "@/app/ui/LocalContent";
|
||||||
|
import {useSearchParams} from "next/dist/client/components/navigation";
|
||||||
|
import {getTaskTreeResult, taskStateList} from "@/app/lib/task/project/data";
|
||||||
|
import {DataType, ResponseVO, ResultPage} from "@/app/lib/definitions";
|
||||||
|
|
||||||
export default function Layout({children}: { children: React.ReactNode }) {
|
export default function Layout({children}: { children: React.ReactNode }) {
|
||||||
// useEffect(() => {
|
|
||||||
// // @ts-ignore
|
|
||||||
// const divWidth = document.getElementById('myDiv').offsetWidth;
|
|
||||||
// // @ts-ignore
|
|
||||||
// document.getElementById('mySpan').style.fontSize = divWidth + 'px';
|
|
||||||
// }, []); // 这里的空数组表示只在组件挂载时执行一次
|
|
||||||
//
|
|
||||||
// return (
|
|
||||||
// <>
|
|
||||||
// <div id="myDiv" style={{width: '200px'}}>
|
|
||||||
// Content
|
|
||||||
// </div>
|
|
||||||
// <span id="mySpan">Content</span>
|
|
||||||
// </>
|
|
||||||
// )
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
@ -33,31 +20,48 @@ export default function Layout({children}: { children: React.ReactNode }) {
|
||||||
const divHeight = document.getElementById('left').offsetHeight;
|
const divHeight = document.getElementById('left').offsetHeight;
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
document.getElementById('tenLeft').style.fontSize = divHeight/6*4 + 'px';
|
document.getElementById('tenLeft').style.fontSize = divHeight/6*4 + 'px';
|
||||||
}, []);
|
refreshDate()
|
||||||
|
}, [useContext(LocalContext)]);
|
||||||
const data = useContext(LocalContext);
|
const data = useContext(LocalContext);
|
||||||
console.log('data-data.taskState',data.taskState,);
|
const leftUp:{name:string,operateType:string,value:string|number|boolean}[] = []
|
||||||
const leftUp = [{name:"priority",value:"3",operateType:"="}];
|
var pid = useSearchParams().get('pid');
|
||||||
const rightUp =[{name:"priority",value:"2",operateType:"="}];
|
// 如果有pid,在前端过滤(防止中间数据不满足条件,导致子数据丢失),
|
||||||
const leftDown = [{name:"priority",value:"1",operateType:"="}];
|
// 无pid在后端过滤(防止数据量过大)。
|
||||||
const rightDown = [{name:"priority",value:"0",operateType:"="}];
|
console.log('data',data);
|
||||||
if (data.taskState.length>0){
|
console.log('pid!=null',pid!=null);
|
||||||
leftUp.push({name:"state",value:data.taskState,operateType:"IN"});
|
if (pid!=null) {
|
||||||
rightUp.push({name:"state",value:data.taskState,operateType:"IN"});
|
leftUp.push({name:"pid",value:pid,operateType:"="},{name:'TREE',value:"false",operateType: "TREE"});
|
||||||
leftDown.push({name:"state",value:data.taskState,operateType:"IN"});
|
}else {
|
||||||
rightDown.push({name:"state",value:data.taskState,operateType:"IN"});
|
if (data.taskState.length>0){
|
||||||
|
leftUp.push({name:"state",value:data.taskState,operateType:"IN"});
|
||||||
|
}
|
||||||
|
if (data.expectedStartTime.length>0){
|
||||||
|
const parse = JSON.parse(data.expectedStartTime);
|
||||||
|
leftUp.push(...parse);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (data.expectedStartTime.length>0){
|
|
||||||
const parse = JSON.parse(data.expectedStartTime);
|
const [resultDataTypeList, setResultDataTypeList] = useState<DataType[]>([]);
|
||||||
leftUp.push(...parse);
|
const refreshDate = (): void => {
|
||||||
rightUp.push(...parse);
|
getTaskTreeResult(JSON.stringify({
|
||||||
leftDown.push(...parse);
|
pageSize:1000,
|
||||||
rightDown.push(...parse);
|
pageNumber:1,
|
||||||
|
data: leftUp
|
||||||
|
})).then((result: ResponseVO<ResultPage<DataType>>) => {
|
||||||
|
if (result.status.success) {
|
||||||
|
// recursionActionChild(result.data.content);
|
||||||
|
result.data.content.forEach(dataType=>{
|
||||||
|
dataType.state=taskStateList.find(taskState=>taskState.code===dataType.state+'')?.name
|
||||||
|
})
|
||||||
|
setResultDataTypeList(result.data.content)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className='firstRow' style={{display: 'flex'}}>
|
<div className='firstRow' style={{display: 'flex'}}>
|
||||||
<div className='leftUp'>
|
<div className='leftUp'>
|
||||||
<TreeTable search={leftUp} priority='3'/>
|
<TreeTable refreshDate={refreshDate} priority='3' resultDataTypeList={resultDataTypeList}/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id='tenUp' className='up'>
|
<div id='tenUp' className='up'>
|
||||||
|
@ -65,7 +69,7 @@ export default function Layout({children}: { children: React.ReactNode }) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='rightUp' >
|
<div className='rightUp' >
|
||||||
<TreeTable search={rightUp} priority='2'/>
|
<TreeTable refreshDate={refreshDate} priority='2' resultDataTypeList={resultDataTypeList}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='left' className='left'>
|
<div id='left' className='left'>
|
||||||
|
@ -73,14 +77,14 @@ export default function Layout({children}: { children: React.ReactNode }) {
|
||||||
</div>
|
</div>
|
||||||
<div className='secondRow' style={{display: 'flex'}}>
|
<div className='secondRow' style={{display: 'flex'}}>
|
||||||
<div className='leftDown'>
|
<div className='leftDown'>
|
||||||
<TreeTable search={leftDown} priority='1'/>
|
<TreeTable refreshDate={refreshDate} priority='1' resultDataTypeList={resultDataTypeList}/>
|
||||||
</div>
|
</div>
|
||||||
<div className='up'>
|
<div className='up'>
|
||||||
<span id='upDown'>向上重要</span>
|
<span id='upDown'>向上重要</span>
|
||||||
</div>
|
</div>
|
||||||
{/*<div style={{float:'left',width:'48%',height: '48vh',background:"gray"}}>{children}</div>*/}
|
{/*<div style={{float:'left',width:'48%',height: '48vh',background:"gray"}}>{children}</div>*/}
|
||||||
<div className='rightDown'>
|
<div className='rightDown'>
|
||||||
<TreeTable search={rightDown} priority='0'/>
|
<TreeTable refreshDate={refreshDate} priority='0' resultDataTypeList={resultDataTypeList}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -10,12 +10,18 @@ export default function Layout({children}: { children: React.ReactNode }) {
|
||||||
expectStartTimeList.push({'name':"expectedStartTime",'value':dayjs().subtract(7,'day'),'operateType':">="});
|
expectStartTimeList.push({'name':"expectedStartTime",'value':dayjs().subtract(7,'day'),'operateType':">="});
|
||||||
expectStartTimeList.push({'name':"expectedStartTime",'value':dayjs().add(7,'day'),'operateType':"<"})
|
expectStartTimeList.push({'name':"expectedStartTime",'value':dayjs().add(7,'day'),'operateType':"<"})
|
||||||
const [expectedStartTime, setExpectedStartTime] = React.useState<string>(JSON.stringify(expectStartTimeList))
|
const [expectedStartTime, setExpectedStartTime] = React.useState<string>(JSON.stringify(expectStartTimeList))
|
||||||
|
const [refreshDataFlag, setRefreshDataFlag] = React.useState<boolean>(true)
|
||||||
|
function refreshData() {
|
||||||
|
setRefreshDataFlag(!refreshDataFlag)
|
||||||
|
}
|
||||||
|
console.log('taskState,expectedStartTime,refreshDataFlag',taskState,expectedStartTime,refreshDataFlag)
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<TitleOperation setTaskState={setTaskState} setExpectedStartTime={setExpectedStartTime}/>
|
|
||||||
<LocalContext.Provider value={{'taskState':taskState,'expectedStartTime':expectedStartTime}}>
|
<LocalContext.Provider value={{'taskState':taskState,'expectedStartTime':expectedStartTime,'refreshData':refreshDataFlag}}>
|
||||||
|
<TitleOperation setTaskState={setTaskState} setExpectedStartTime={setExpectedStartTime} refreshData={refreshData}/>
|
||||||
{children}
|
{children}
|
||||||
</LocalContext.Provider>
|
</LocalContext.Provider>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
import TreeTable from "@/app/ui/task/four/TreeTable";
|
|
||||||
import TreeTablePro from "@/app/ui/task/project/TreeTablePro";
|
import TreeTablePro from "@/app/ui/task/project/TreeTablePro";
|
||||||
|
|
||||||
const Page: React.FC = () => {
|
const Page: React.FC = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<TreeTablePro/>
|
<TreeTablePro/>
|
||||||
{/*<TreeTable/>*/}
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
const LocalContext = React.createContext({'taskState':'','expectedStartTime':''});
|
const LocalContext = React.createContext({'taskState':'','expectedStartTime':'','refreshData':true});
|
||||||
|
|
||||||
export default LocalContext;
|
export default LocalContext;
|
||||||
|
|
|
@ -10,12 +10,12 @@ export interface OperationButtonProps {
|
||||||
pid: number,
|
pid: number,
|
||||||
pPid: number,
|
pPid: number,
|
||||||
operationId?: string,
|
operationId?: string,
|
||||||
refreshDate?: () => void
|
refreshDate?: () => void,
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OperationModelProps {
|
interface OperationModelProps {
|
||||||
operationId: number | undefined,
|
operationId: number | undefined,
|
||||||
pPid:number,
|
pPid: number,
|
||||||
pid: number,
|
pid: number,
|
||||||
openModal: boolean
|
openModal: boolean
|
||||||
}
|
}
|
||||||
|
@ -60,8 +60,7 @@ class OperationButton extends React.Component<OperationButtonProps, OperationMod
|
||||||
label: <a onClick={(e) => {
|
label: <a onClick={(e) => {
|
||||||
this.setState({openModal: true, operationId: OPERATION_BUTTON_TYPE.UPDATE})
|
this.setState({openModal: true, operationId: OPERATION_BUTTON_TYPE.UPDATE})
|
||||||
}}>修改任务</a>,
|
}}>修改任务</a>,
|
||||||
}
|
},
|
||||||
,
|
|
||||||
{
|
{
|
||||||
key: OPERATION_BUTTON_TYPE.DELETE,
|
key: OPERATION_BUTTON_TYPE.DELETE,
|
||||||
label: <Popconfirm
|
label: <Popconfirm
|
||||||
|
@ -92,7 +91,7 @@ class OperationButton extends React.Component<OperationButtonProps, OperationMod
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: OPERATION_BUTTON_TYPE.SHOW_FOUR,
|
key: OPERATION_BUTTON_TYPE.SHOW_FOUR,
|
||||||
label: <Link href={`/task/four`} >四象限显示子任务</Link>,
|
label: <Link href={"/task/four?pid=" + this.props.itemId}>四象限显示子任务</Link>,
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
return <Fragment>
|
return <Fragment>
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
export interface RequestDateType {
|
||||||
|
name:string,
|
||||||
|
value:string|number|boolean,
|
||||||
|
operateType:string
|
||||||
|
}
|
|
@ -1,36 +1,47 @@
|
||||||
import React from "react";
|
import React, {useContext} from "react";
|
||||||
import {Button, DatePicker, Flex, Select, Space} from "antd";
|
import {Button, DatePicker, Flex, Select, Space} from "antd";
|
||||||
import {usePathname, useRouter} from "next/navigation";
|
import {usePathname, useRouter} from "next/navigation";
|
||||||
import {DetailModelForm} from "@/app/ui/task/project/DetailModelForm";
|
import {DetailModelForm} from "@/app/ui/task/project/DetailModelForm";
|
||||||
import {OPERATION_BUTTON_TYPE, taskStateList} from "@/app/lib/task/project/data";
|
import {OPERATION_BUTTON_TYPE, taskStateList} from "@/app/lib/task/project/data";
|
||||||
import '@/app/ui/task/TitleOperation.modules.css'
|
import '@/app/ui/task/TitleOperation.modules.css'
|
||||||
import dayjs from "dayjs";
|
import LocalContext from "@/app/ui/LocalContent";
|
||||||
|
import {RequestDateType} from "@/app/ui/task/RequestDateType";
|
||||||
|
import dayjs, {Dayjs} from "dayjs";
|
||||||
|
import {element} from "prop-types";
|
||||||
|
|
||||||
interface TitleOperationProps {
|
interface TitleOperationProps {
|
||||||
setTaskState: (value: string) => void;
|
setTaskState: (value: string) => void;
|
||||||
setExpectedStartTime: (value: string) => void;
|
setExpectedStartTime: (value: string) => void;
|
||||||
|
refreshData: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export const TitleOperation: React.FC<TitleOperationProps> = ({
|
export const TitleOperation: React.FC<TitleOperationProps> = ({
|
||||||
setTaskState,
|
setTaskState,
|
||||||
setExpectedStartTime
|
setExpectedStartTime,
|
||||||
|
refreshData
|
||||||
}: TitleOperationProps) => {
|
}: TitleOperationProps) => {
|
||||||
const {replace} = useRouter();
|
const {replace} = useRouter();
|
||||||
const [currentPath, setCurrentPath] = React.useState(usePathname());
|
console.log('usePathname()', usePathname());
|
||||||
|
const data = useContext(LocalContext);
|
||||||
const {RangePicker} = DatePicker;
|
const {RangePicker} = DatePicker;
|
||||||
|
const expectStartTimeParseResult:RequestDateType[] = data.expectedStartTime.length>0?JSON.parse(data.expectedStartTime):[undefined,undefined]
|
||||||
|
expectStartTimeParseResult.map(item => item&&item.value ? dayjs(item.value.toString()) : undefined)
|
||||||
|
const defaultExpectStartTime:[start: Dayjs | null | undefined, end: Dayjs | null | undefined] = [
|
||||||
|
expectStartTimeParseResult[0]&&expectStartTimeParseResult[0].value ? dayjs(expectStartTimeParseResult[0].value.toString()) : undefined,
|
||||||
|
expectStartTimeParseResult[1]&&expectStartTimeParseResult[1].value ? dayjs(expectStartTimeParseResult[1].value.toString()) : undefined
|
||||||
|
];
|
||||||
return <Space style={{marginTop: 0}}>
|
return <Space style={{marginTop: 0}}>
|
||||||
<DetailModelForm operationId={OPERATION_BUTTON_TYPE.ADD} description='添加主线任务'/>
|
<DetailModelForm operationId={OPERATION_BUTTON_TYPE.ADD} description='添加主线任务' reloadData={refreshData}/>
|
||||||
{currentPath.startsWith("/task/project") ?
|
{usePathname().startsWith("/task/project") ?
|
||||||
<>
|
<>
|
||||||
<Button type="primary" onClick={() => {
|
<Button type="primary" onClick={() => {
|
||||||
replace("/task/four");
|
replace("/task/four");
|
||||||
setCurrentPath("/task/four");
|
// setCurrentPath("/task/four");
|
||||||
}}>四象限显示</Button>
|
}}>四象限显示</Button>
|
||||||
</> : <>
|
</> : <>
|
||||||
<Button type="primary" onClick={() => {
|
<Button type="primary" onClick={() => {
|
||||||
replace("/task/project");
|
replace("/task/project");
|
||||||
setCurrentPath("/task/project")
|
// setCurrentPath("/task/project")
|
||||||
}}>任务树</Button>
|
}}>任务树</Button>
|
||||||
<span style={{whiteSpace: 'nowrap'}}>任务状态:</span>
|
<span style={{whiteSpace: 'nowrap'}}>任务状态:</span>
|
||||||
<Select
|
<Select
|
||||||
|
@ -38,7 +49,7 @@ export const TitleOperation: React.FC<TitleOperationProps> = ({
|
||||||
allowClear
|
allowClear
|
||||||
style={{minWidth: '100px'}}
|
style={{minWidth: '100px'}}
|
||||||
placeholder="任务状态"
|
placeholder="任务状态"
|
||||||
defaultValue={['8', '9']}
|
defaultValue={data.taskState.split(",")}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
console.log('onChange')
|
console.log('onChange')
|
||||||
setTaskState(value.join(','))
|
setTaskState(value.join(','))
|
||||||
|
@ -50,7 +61,7 @@ export const TitleOperation: React.FC<TitleOperationProps> = ({
|
||||||
<span style={{whiteSpace: 'nowrap'}}>期望开始时间范围:</span>
|
<span style={{whiteSpace: 'nowrap'}}>期望开始时间范围:</span>
|
||||||
<RangePicker
|
<RangePicker
|
||||||
placeholder={['开始时间', '结束时间']}
|
placeholder={['开始时间', '结束时间']}
|
||||||
defaultValue={[dayjs().subtract(7, 'day'), dayjs().add(7, 'day')]}
|
defaultValue={defaultExpectStartTime}
|
||||||
allowEmpty={[true, true]}
|
allowEmpty={[true, true]}
|
||||||
onChange={(dates, dateStrings) => {
|
onChange={(dates, dateStrings) => {
|
||||||
console.log('onChange:', dates, dateStrings);
|
console.log('onChange:', dates, dateStrings);
|
||||||
|
@ -65,6 +76,8 @@ export const TitleOperation: React.FC<TitleOperationProps> = ({
|
||||||
'value': dates[0],
|
'value': dates[0],
|
||||||
'operateType': ">="
|
'operateType': ">="
|
||||||
});
|
});
|
||||||
|
}else{
|
||||||
|
expectStartTimeList.push(undefined)
|
||||||
}
|
}
|
||||||
if (dates[1]) {
|
if (dates[1]) {
|
||||||
expectStartTimeList.push({
|
expectStartTimeList.push({
|
||||||
|
@ -72,6 +85,8 @@ export const TitleOperation: React.FC<TitleOperationProps> = ({
|
||||||
'value': dates[1].add(1, 'day'),
|
'value': dates[1].add(1, 'day'),
|
||||||
'operateType': "<"
|
'operateType': "<"
|
||||||
})
|
})
|
||||||
|
}else{
|
||||||
|
expectStartTimeList.push(undefined)
|
||||||
}
|
}
|
||||||
setExpectedStartTime(JSON.stringify(expectStartTimeList))
|
setExpectedStartTime(JSON.stringify(expectStartTimeList))
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -33,9 +33,10 @@ import {DATE_TIME} from "@/app/lib/constants";
|
||||||
|
|
||||||
export interface DetailFormProps {
|
export interface DetailFormProps {
|
||||||
itemId: number,
|
itemId: number,
|
||||||
pPid:number,
|
pPid: number,
|
||||||
operationId: number|undefined,
|
operationId: number | undefined,
|
||||||
handleCancel: () => void
|
handleCancel: () => void,
|
||||||
|
setUpdatePriority?: (value: (((prevState: (string | undefined)) => (string | undefined)) | string | undefined)) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DetailForm: React.FC<DetailFormProps> = (props) => {
|
export const DetailForm: React.FC<DetailFormProps> = (props) => {
|
||||||
|
@ -45,27 +46,28 @@ export const DetailForm: React.FC<DetailFormProps> = (props) => {
|
||||||
const {RangePicker} = DatePicker;
|
const {RangePicker} = DatePicker;
|
||||||
const {TextArea} = Input;
|
const {TextArea} = Input;
|
||||||
// const [taskMessage,setTaskMessage]=useState<any>({name:"useState没效果吗,是这样的"});
|
// const [taskMessage,setTaskMessage]=useState<any>({name:"useState没效果吗,是这样的"});
|
||||||
// let taskMessage;
|
let defaultPriority:string|undefined;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (props.operationId === OPERATION_BUTTON_TYPE.DETAIL||props.operationId === OPERATION_BUTTON_TYPE.UPDATE) {
|
if (props.operationId === OPERATION_BUTTON_TYPE.DETAIL || props.operationId === OPERATION_BUTTON_TYPE.UPDATE) {
|
||||||
getTask(props.itemId).then(task => {
|
getTask(props.itemId).then(task => {
|
||||||
console.log('getTask(props.itemId)',props.itemId,task);
|
console.log('getTask(props.itemId)', props.itemId, task);
|
||||||
if(task.status.success){
|
if (task.status.success) {
|
||||||
// setTaskMessage(task.data)
|
// setTaskMessage(task.data)
|
||||||
task.data.state=taskStateList.find(taskState=>taskState.code===task.data.state?.toString())?.name;
|
task.data.state = taskStateList.find(taskState => taskState.code === task.data.state?.toString())?.name;
|
||||||
task.data.priority=taskPriorityList.find(taskPriority=>taskPriority.code===task.data.priority?.toString())?.name;
|
task.data.priority = taskPriorityList.find(taskPriority => taskPriority.code === task.data.priority?.toString())?.name;
|
||||||
task.data.actualTimeRange = [task.data.actualStartTime?dayjs(task.data.actualStartTime):'',
|
defaultPriority = task.data.priority
|
||||||
task.data.actualEndTime?dayjs(task.data.actualEndTime):''];
|
task.data.actualTimeRange = [task.data.actualStartTime ? dayjs(task.data.actualStartTime) : '',
|
||||||
task.data.expectedTimeRange = [task.data.expectedStartTime?dayjs(task.data.expectedStartTime):'',
|
task.data.actualEndTime ? dayjs(task.data.actualEndTime) : ''];
|
||||||
task.data.expectedEndTime?dayjs(task.data.expectedEndTime):''];
|
task.data.expectedTimeRange = [task.data.expectedStartTime ? dayjs(task.data.expectedStartTime) : '',
|
||||||
|
task.data.expectedEndTime ? dayjs(task.data.expectedEndTime) : ''];
|
||||||
form.setFieldsValue(task.data)
|
form.setFieldsValue(task.data)
|
||||||
}else{
|
} else {
|
||||||
message.error(task.status.message);
|
message.error(task.status.message);
|
||||||
props.handleCancel()
|
props.handleCancel()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},[])
|
}, [])
|
||||||
const normFile = (e: any) => {
|
const normFile = (e: any) => {
|
||||||
if (Array.isArray(e)) {
|
if (Array.isArray(e)) {
|
||||||
return e;
|
return e;
|
||||||
|
@ -104,8 +106,8 @@ export const DetailForm: React.FC<DetailFormProps> = (props) => {
|
||||||
let request: DataType = {
|
let request: DataType = {
|
||||||
key: values.id,
|
key: values.id,
|
||||||
id: values.id,
|
id: values.id,
|
||||||
pPid: props.operationId===OPERATION_BUTTON_TYPE.ADD_CHILD?props.pPid:values.pPid,
|
pPid: props.operationId === OPERATION_BUTTON_TYPE.ADD_CHILD ? props.pPid : values.pPid,
|
||||||
pid: props.operationId===OPERATION_BUTTON_TYPE.ADD_CHILD?props.itemId:props.operationId===OPERATION_BUTTON_TYPE.UPDATE?values.pid:0,
|
pid: props.operationId === OPERATION_BUTTON_TYPE.ADD_CHILD ? props.itemId : props.operationId === OPERATION_BUTTON_TYPE.UPDATE ? values.pid : 0,
|
||||||
code: values.code,
|
code: values.code,
|
||||||
name: values.name,
|
name: values.name,
|
||||||
description: values.description,
|
description: values.description,
|
||||||
|
@ -130,28 +132,28 @@ export const DetailForm: React.FC<DetailFormProps> = (props) => {
|
||||||
request.actualEndTime = values.actualTimeRange[1]
|
request.actualEndTime = values.actualTimeRange[1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (props.operationId===OPERATION_BUTTON_TYPE.ADD_CHILD){
|
if (props.operationId === OPERATION_BUTTON_TYPE.ADD_CHILD) {
|
||||||
addTask(request).then(response => {
|
addTask(request).then(response => {
|
||||||
console.log('response',response)
|
console.log('response', response)
|
||||||
if (response.status.success) {
|
if (response.status.success) {
|
||||||
message.success("添加任务成功:"+response.data)
|
message.success("添加任务成功:" + response.data)
|
||||||
props.handleCancel()
|
props.handleCancel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}else if(props.operationId===OPERATION_BUTTON_TYPE.UPDATE){
|
} else if (props.operationId === OPERATION_BUTTON_TYPE.UPDATE) {
|
||||||
var stateFind = taskStateList.find(taskState=>taskState.name===request.state?.toString());
|
var stateFind = taskStateList.find(taskState => taskState.name === request.state?.toString());
|
||||||
if (stateFind){
|
if (stateFind) {
|
||||||
request.state=stateFind.code;
|
request.state = stateFind.code;
|
||||||
}
|
}
|
||||||
var priorityFind =taskPriorityList.find(taskPriority=>taskPriority.name===request.priority?.toString());
|
var priorityFind = taskPriorityList.find(taskPriority => taskPriority.name === request.priority?.toString());
|
||||||
if(priorityFind){
|
if (priorityFind) {
|
||||||
request.priority=priorityFind.code;
|
request.priority = priorityFind.code;
|
||||||
}
|
}
|
||||||
updateTask(request).then(response => {
|
updateTask(request).then(response => {
|
||||||
console.log('response',response)
|
console.log('response', response)
|
||||||
if (response.status.success) {
|
if (response.status.success) {
|
||||||
message.success("修改任务成功:"+response.data)
|
message.success("修改任务成功:" + response.data)
|
||||||
props.handleCancel()
|
props.handleCancel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,14 +194,16 @@ export const DetailForm: React.FC<DetailFormProps> = (props) => {
|
||||||
<Input name='pPid'/>
|
<Input name='pPid'/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item<DataType> name='name' label="任务名称" rules={[{ required: true, message: '任务名称不能为空' }]}>
|
<Form.Item<DataType> name='name' label="任务名称"
|
||||||
|
rules={[{required: true, message: '任务名称不能为空'}]}>
|
||||||
<Input name='name'/>
|
<Input name='name'/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item<DataType> name='description' label="任务描述">
|
<Form.Item<DataType> name='description' label="任务描述">
|
||||||
<TextArea name='description' rows={4}/>
|
<TextArea name='description' rows={4}/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item<DataType> name='priority' label="任务优先级">
|
<Form.Item<DataType> name='priority' initialValue='3' label="任务优先级">
|
||||||
<Select allowClear={true} options={
|
<Select
|
||||||
|
allowClear={true} options={
|
||||||
taskPriorityList.map(taskState => {
|
taskPriorityList.map(taskState => {
|
||||||
return {
|
return {
|
||||||
'label': taskState.name,
|
'label': taskState.name,
|
||||||
|
@ -209,7 +213,7 @@ export const DetailForm: React.FC<DetailFormProps> = (props) => {
|
||||||
}>
|
}>
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item<DataType> name='state' label="任务状态">
|
<Form.Item<DataType> name='state' initialValue='8' label="任务状态">
|
||||||
<Select allowClear={true} options={
|
<Select allowClear={true} options={
|
||||||
taskStateList.map(taskState => {
|
taskStateList.map(taskState => {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,61 +1,18 @@
|
||||||
'use client'
|
'use client'
|
||||||
import React, {useEffect, useState} from 'react';
|
import React, {useContext, useEffect, useState} from 'react';
|
||||||
import {ConfigProvider, Table} from 'antd';
|
import {ConfigProvider, Table} from 'antd';
|
||||||
import type {TableColumnsType, TableProps} from 'antd';
|
import type {TableColumnsType, TableProps} from 'antd';
|
||||||
import {getTaskTreeResult, taskPriorityList, taskStateList, taskTreeResult} from "@/app/lib/task/project/data";
|
import {getTaskTreeResult, taskPriorityList, taskStateList, taskTreeResult} from "@/app/lib/task/project/data";
|
||||||
import {DataType, ResponseVO, ResultPage} from "@/app/lib/definitions";
|
import {DataType, ResponseVO, ResultPage} from "@/app/lib/definitions";
|
||||||
import OperationButton from "@/app/ui/task/OperationButton";
|
import OperationButton from "@/app/ui/task/OperationButton";
|
||||||
import dayjs from "dayjs";
|
|
||||||
import "@/app/ui/task/four/detailForm.modules.css"
|
import "@/app/ui/task/four/detailForm.modules.css"
|
||||||
|
import LocalContext from "@/app/ui/LocalContent";
|
||||||
|
import {useSearchParams} from "next/dist/client/components/navigation";
|
||||||
|
import {RequestDateType} from "@/app/ui/task/RequestDateType";
|
||||||
|
|
||||||
type TableRowSelection<T> = TableProps<T>['rowSelection'];
|
type TableRowSelection<T> = TableProps<T>['rowSelection'];
|
||||||
|
|
||||||
|
|
||||||
const columns: TableColumnsType<DataType> = [
|
|
||||||
{
|
|
||||||
title: '任务编码',
|
|
||||||
dataIndex: 'code',
|
|
||||||
key: 'code',
|
|
||||||
width: '10%',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '任务名称',
|
|
||||||
dataIndex: 'name',
|
|
||||||
key: 'name',
|
|
||||||
width: '20%',
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// title: '任务描述',
|
|
||||||
// dataIndex: 'description',
|
|
||||||
// // width: '30%',
|
|
||||||
// key: 'description',
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
title: '任务状态',
|
|
||||||
dataIndex: 'state',
|
|
||||||
width: '10%',
|
|
||||||
key: 'state',
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// title: '优先级',
|
|
||||||
// dataIndex: 'priority',
|
|
||||||
// width: '10%',
|
|
||||||
// key: 'priority',
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
title: '期望开始时间',
|
|
||||||
dataIndex: 'expectedStartTime',
|
|
||||||
width: '10%',
|
|
||||||
key: 'expectedStartTime',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
dataIndex: 'action',
|
|
||||||
width: '10%',
|
|
||||||
key: 'action',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
// rowSelection objects indicates the need for row selection
|
// rowSelection objects indicates the need for row selection
|
||||||
const rowSelection: TableRowSelection<DataType> = {
|
const rowSelection: TableRowSelection<DataType> = {
|
||||||
onChange: (selectedRowKeys, selectedRows) => {
|
onChange: (selectedRowKeys, selectedRows) => {
|
||||||
|
@ -70,59 +27,121 @@ const rowSelection: TableRowSelection<DataType> = {
|
||||||
};
|
};
|
||||||
|
|
||||||
interface TableSearchType {
|
interface TableSearchType {
|
||||||
search?: any
|
priority: string,
|
||||||
priority:string
|
resultDataTypeList: DataType[],
|
||||||
|
refreshDate?: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const TreeTable: React.FC<TableSearchType> = (props) => {
|
const TreeTable: React.FC<TableSearchType> = (props) => {
|
||||||
function recursionActionChild(children: DataType[]) {
|
const dataLocalContext = useContext(LocalContext);
|
||||||
if (children.length === 0) {
|
console.log('dataLocalContext', dataLocalContext)
|
||||||
return;
|
const checkLocal:boolean = useSearchParams().get('pid')!=undefined;
|
||||||
}
|
const columns: TableColumnsType<DataType> = [
|
||||||
for (let item of children) {
|
{
|
||||||
item.key = item.id;
|
title: '任务编码',
|
||||||
item.action = (
|
dataIndex: 'code',
|
||||||
<OperationButton itemId={item.id} pid={item.pid} pPid={item.pPid} refreshDate={refreshDate}/>)
|
key: 'code',
|
||||||
item.state = taskStateList.find(taskState => taskState.code === item.state?.toString())?.name;
|
width: '10%',
|
||||||
item.priority = taskPriorityList.find(taskPriority => taskPriority.code === item.priority?.toString())?.name;
|
},
|
||||||
if (item.expectedStartTime) {
|
{
|
||||||
item.expectedStartTime = dayjs(item.expectedStartTime).format('YYYY-MM-DD HH:mm:ss')
|
title: '任务名称',
|
||||||
}
|
dataIndex: 'name',
|
||||||
if (item.children && item.children.length > 0) {
|
key: 'name',
|
||||||
if (item.children && item.children.length > 0) {
|
width: '20%',
|
||||||
recursionActionChild(item.children)
|
},
|
||||||
} else {
|
// {
|
||||||
item.children = undefined
|
// title: '任务描述',
|
||||||
|
// dataIndex: 'description',
|
||||||
|
// // width: '30%',
|
||||||
|
// key: 'description',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: '任务状态',
|
||||||
|
dataIndex: 'state',
|
||||||
|
width: '10%',
|
||||||
|
key: 'state',
|
||||||
|
filtered: checkLocal&&dataLocalContext.taskState.length > 0,
|
||||||
|
defaultFilteredValue: dataLocalContext.taskState.split(','),
|
||||||
|
onFilter: (text, record) => {
|
||||||
|
// console.log('&record.priority.toString()===props.priority',record.priority,text,props.priority)
|
||||||
|
// &record.priority.toString()===props.priority 不重要紧急 0 0
|
||||||
|
if (dataLocalContext.taskState.length === 0) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
var dataLocalContextTaskStateList = dataLocalContext.taskState.split(",");
|
||||||
|
console.log('dataLocalContextTaskStateList', dataLocalContext.taskState.length > 0, dataLocalContextTaskStateList);
|
||||||
|
return taskStateList.filter(taskState => dataLocalContextTaskStateList.includes(taskState.code))
|
||||||
|
.find(taskState => taskState.name === record.state) != undefined;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
{
|
||||||
// const [checkStrictly, setCheckStrictly] = useState(false);
|
title: '优先级',
|
||||||
const [data, setData] = useState<DataType[]>([]);
|
dataIndex: 'priority',
|
||||||
const [pageNumber, setPageNumber] = useState<number>(1);
|
width: '10%',
|
||||||
const [pageSize, setPageSize] = useState<number>(100);
|
key: 'priority',
|
||||||
const refreshDate = (): void => {
|
hidden: true,
|
||||||
getTaskTreeResult(JSON.stringify({
|
filters: taskPriorityList.map(taskState => {
|
||||||
pageSize,
|
return {
|
||||||
pageNumber,
|
'text': taskState.name,
|
||||||
data: props.search
|
'value': taskState.code
|
||||||
})).then((result: ResponseVO<ResultPage<DataType>>) => {
|
}
|
||||||
if (result.status.success) {
|
}),
|
||||||
recursionActionChild(result.data.content);
|
filtered: true,
|
||||||
setData(result.data.content)
|
defaultFilteredValue: [props.priority],
|
||||||
|
onFilter: (text, record) => {
|
||||||
|
console.log('&record.priority.toString()===props.priority',record.priority,text,props.priority,props.priority === record.priority)
|
||||||
|
// &record.priority.toString()===props.priority 不重要紧急 0 0
|
||||||
|
return props.priority === record.priority+''
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
}
|
{
|
||||||
useEffect(() => {
|
title: '期望开始时间',
|
||||||
refreshDate();
|
dataIndex: 'expectedStartTime',
|
||||||
}, [props.search]);
|
width: '10%',
|
||||||
|
key: 'expectedStartTime',
|
||||||
|
filtered: checkLocal&&dataLocalContext.expectedStartTime.length > 0,
|
||||||
|
// defaultFilteredValue: JSON.parse(dataLocalContext.expectedStartTime),
|
||||||
|
onFilter: (text, record) => {
|
||||||
|
console.log('dataLocalContext.expectedStartTime',dataLocalContext.expectedStartTime)
|
||||||
|
if (dataLocalContext.expectedStartTime.length === 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const expectStartTimeParseResult:RequestDateType[] = JSON.parse(dataLocalContext.expectedStartTime);
|
||||||
|
console.log('expectStartTimeParseResult',expectStartTimeParseResult)
|
||||||
|
if (expectStartTimeParseResult[0]!=undefined){
|
||||||
|
let le:boolean;
|
||||||
|
if (expectStartTimeParseResult[0].operateType==='<='){
|
||||||
|
le=record.expectedStartTime!=undefined&&record.expectedStartTime<=expectStartTimeParseResult[0].value
|
||||||
|
}else {
|
||||||
|
le=record.expectedStartTime!=undefined&&record.expectedStartTime>=expectStartTimeParseResult[0].value
|
||||||
|
}
|
||||||
|
if (!le){
|
||||||
|
return le;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(expectStartTimeParseResult[1]!=undefined){
|
||||||
|
let ge:boolean = record.expectedStartTime!=undefined&&record.expectedStartTime<=expectStartTimeParseResult[1].value
|
||||||
|
if (!ge){
|
||||||
|
return ge;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
dataIndex: 'action',
|
||||||
|
width: '10%',
|
||||||
|
key: 'action',
|
||||||
|
},
|
||||||
|
];
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ConfigProvider
|
<ConfigProvider
|
||||||
theme={{
|
theme={{
|
||||||
components: {
|
components: {
|
||||||
Table: {
|
Table: {
|
||||||
headerBg:taskPriorityList.find((item)=>item.code===props.priority)?.color
|
headerBg: taskPriorityList.find((item) => item.code === props.priority)?.color
|
||||||
/* 这里是你的组件 token */
|
/* 这里是你的组件 token */
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -131,9 +150,34 @@ const TreeTable: React.FC<TableSearchType> = (props) => {
|
||||||
<Table
|
<Table
|
||||||
columns={columns}
|
columns={columns}
|
||||||
// rowSelection={{ ...rowSelection, checkStrictly}}
|
// rowSelection={{ ...rowSelection, checkStrictly}}
|
||||||
dataSource={data}
|
dataSource={props.resultDataTypeList.filter(resultDataType=>{
|
||||||
pagination={{ pageSize: 5 }}
|
resultDataType.action= <OperationButton itemId={resultDataType.id} pid={resultDataType.pid} pPid={resultDataType.pPid} refreshDate={props.refreshDate}/>
|
||||||
scroll={{ y: 280 }}
|
if (dataLocalContext.expectedStartTime.length === 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const expectStartTimeParseResult:RequestDateType[] = JSON.parse(dataLocalContext.expectedStartTime);
|
||||||
|
if (expectStartTimeParseResult[0]!=undefined){
|
||||||
|
let le:boolean;
|
||||||
|
if (expectStartTimeParseResult[0].operateType==='<='){
|
||||||
|
le=resultDataType.expectedStartTime!=undefined&&resultDataType.expectedStartTime<=expectStartTimeParseResult[0].value
|
||||||
|
}else {
|
||||||
|
le=resultDataType.expectedStartTime!=undefined&&resultDataType.expectedStartTime>=expectStartTimeParseResult[0].value
|
||||||
|
}
|
||||||
|
if (!le){
|
||||||
|
return le;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(expectStartTimeParseResult[1]!=undefined){
|
||||||
|
let ge:boolean = resultDataType.expectedStartTime!=undefined&&resultDataType.expectedStartTime<=expectStartTimeParseResult[1].value
|
||||||
|
if (!ge){
|
||||||
|
return ge;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
|
})}
|
||||||
|
pagination={{pageSize: 5}}
|
||||||
|
scroll={{y: 280}}
|
||||||
/>
|
/>
|
||||||
</ConfigProvider>
|
</ConfigProvider>
|
||||||
{/*<Space align="center" style={{ marginBottom: 16 }}>*/}
|
{/*<Space align="center" style={{ marginBottom: 16 }}>*/}
|
||||||
|
|
|
@ -2,29 +2,28 @@ import { PlusOutlined } from '@ant-design/icons';
|
||||||
import {
|
import {
|
||||||
ModalForm,
|
ModalForm,
|
||||||
ProForm,
|
ProForm,
|
||||||
ProFormDateRangePicker,
|
ProFormDateRangePicker, ProFormDateTimeRangePicker,
|
||||||
ProFormSelect,
|
ProFormSelect,
|
||||||
ProFormText, ProFormTextArea, ProFormTreeSelect,
|
ProFormText, ProFormTextArea, ProFormTreeSelect,
|
||||||
} from '@ant-design/pro-components';
|
} from '@ant-design/pro-components';
|
||||||
import { Button, Form, message } from 'antd';
|
import { Button, Form, message } from 'antd';
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {getTaskTreeResult, OPERATION_BUTTON_TYPE, taskPriorityList, taskStateList} from "@/app/lib/task/project/data";
|
import {
|
||||||
|
addTask,
|
||||||
|
getTaskTreeResult,
|
||||||
|
OPERATION_BUTTON_TYPE,
|
||||||
|
taskPriorityList,
|
||||||
|
taskStateList
|
||||||
|
} from "@/app/lib/task/project/data";
|
||||||
import {DataType} from "@/app/lib/definitions";
|
import {DataType} from "@/app/lib/definitions";
|
||||||
import {string} from "prop-types";
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
const waitTime = (time: number = 100) => {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve(true);
|
|
||||||
}, time);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
export type DetailModelFormProps={
|
export type DetailModelFormProps={
|
||||||
itemId?: number,
|
itemId?: number,
|
||||||
pPid?:number,
|
pPid?:number,
|
||||||
operationId: number,
|
operationId: number,
|
||||||
description:string,
|
description:string,
|
||||||
handleCancel?: () => void
|
reloadData?: () => void
|
||||||
}
|
}
|
||||||
export type PidSelectTree= { label: string; value: number; children?: PidSelectTree[] }
|
export type PidSelectTree= { label: string; value: number; children?: PidSelectTree[] }
|
||||||
export const DetailModelForm: React.FC<DetailModelFormProps> = (props) => {
|
export const DetailModelForm: React.FC<DetailModelFormProps> = (props) => {
|
||||||
|
@ -61,15 +60,24 @@ export const DetailModelForm: React.FC<DetailModelFormProps> = (props) => {
|
||||||
}}
|
}}
|
||||||
// submitTimeout={2000}
|
// submitTimeout={2000}
|
||||||
onFinish={async (values) => {
|
onFinish={async (values) => {
|
||||||
await waitTime(2000);
|
addTask(values).then(response => {
|
||||||
console.log(values.name);
|
console.log('response', response)
|
||||||
message.success('提交成功');
|
if (response.status.success) {
|
||||||
|
message.success("添加任务成功:" + response.data)
|
||||||
|
// 树任务重新刷新
|
||||||
|
// 四象限任务重新刷新
|
||||||
|
// 如果可以直接更新列表而不请求。。。。。。
|
||||||
|
console.log('props.reloadData?.()',props.reloadData)
|
||||||
|
props.reloadData?.()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
return true;
|
return true;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ProFormText width="sm" name="id" hidden={true} label="主键" />
|
<ProFormText width="sm" name="id" hidden={true} label="主键" />
|
||||||
<ProFormText width="sm" name="code" hidden={true} label="任务编码" />
|
<ProFormText width="sm" name="code" hidden={true} label="任务编码" />
|
||||||
<ProFormText width="sm" name="pPid" hidden={true} label="祖宗id" />
|
<ProFormText width="sm" name="pPid" initialValue={props.pPid} hidden={true} label="祖宗id" />
|
||||||
<ProForm.Group>
|
<ProForm.Group>
|
||||||
<ProFormTreeSelect
|
<ProFormTreeSelect
|
||||||
width="md"
|
width="md"
|
||||||
|
@ -111,6 +119,7 @@ export const DetailModelForm: React.FC<DetailModelFormProps> = (props) => {
|
||||||
width="sm"
|
width="sm"
|
||||||
name="priority"
|
name="priority"
|
||||||
label="任务优先级"
|
label="任务优先级"
|
||||||
|
initialValue='3'
|
||||||
disabled ={props.operationId === OPERATION_BUTTON_TYPE.DETAIL}
|
disabled ={props.operationId === OPERATION_BUTTON_TYPE.DETAIL}
|
||||||
/>
|
/>
|
||||||
<ProFormSelect
|
<ProFormSelect
|
||||||
|
@ -123,19 +132,24 @@ export const DetailModelForm: React.FC<DetailModelFormProps> = (props) => {
|
||||||
})}
|
})}
|
||||||
name="state"
|
name="state"
|
||||||
label="任务状态"
|
label="任务状态"
|
||||||
|
initialValue='8'
|
||||||
disabled ={props.operationId === OPERATION_BUTTON_TYPE.DETAIL}
|
disabled ={props.operationId === OPERATION_BUTTON_TYPE.DETAIL}
|
||||||
/>
|
/>
|
||||||
</ProForm.Group>
|
</ProForm.Group>
|
||||||
|
|
||||||
<ProForm.Group>
|
<ProForm.Group>
|
||||||
<ProFormDateRangePicker
|
<ProFormDateTimeRangePicker
|
||||||
name="expectedTimeRange"
|
name="expectedTimeRange"
|
||||||
label="期望时间"
|
label="期望时间"
|
||||||
|
fieldProps={{allowEmpty:[true, true],defaultValue:[dayjs(), undefined]}}
|
||||||
|
placeholder={['开始时间','结束时间']}
|
||||||
disabled ={props.operationId === OPERATION_BUTTON_TYPE.DETAIL}
|
disabled ={props.operationId === OPERATION_BUTTON_TYPE.DETAIL}
|
||||||
/>
|
/>
|
||||||
<ProFormDateRangePicker
|
<ProFormDateTimeRangePicker
|
||||||
name="actualTimeRange"
|
name="actualTimeRange"
|
||||||
label="实际时间"
|
label="实际时间"
|
||||||
|
fieldProps={ {allowEmpty:[true, true]}}
|
||||||
|
placeholder={['开始时间','结束时间']}
|
||||||
disabled ={props.operationId === OPERATION_BUTTON_TYPE.DETAIL}
|
disabled ={props.operationId === OPERATION_BUTTON_TYPE.DETAIL}
|
||||||
/>
|
/>
|
||||||
</ProForm.Group>
|
</ProForm.Group>
|
||||||
|
|
|
@ -1,9 +1,16 @@
|
||||||
'use client'
|
'use client'
|
||||||
import {CheckSquareFilled, EllipsisOutlined, HeartFilled, HeartOutlined, PlusOutlined} from '@ant-design/icons';
|
import {
|
||||||
|
CheckSquareFilled,
|
||||||
|
EllipsisOutlined,
|
||||||
|
HeartFilled,
|
||||||
|
HeartOutlined,
|
||||||
|
PlusOutlined,
|
||||||
|
QuestionCircleOutlined
|
||||||
|
} from '@ant-design/icons';
|
||||||
import type {ActionType, ProColumns} from '@ant-design/pro-components';
|
import type {ActionType, ProColumns} from '@ant-design/pro-components';
|
||||||
import {ProTable, TableDropdown} from '@ant-design/pro-components';
|
import {ProTable, TableDropdown} from '@ant-design/pro-components';
|
||||||
import {Button, Dropdown, Space, Switch, Tag} from 'antd';
|
import {Button, Dropdown, Space, Switch, Tag, Tooltip} from 'antd';
|
||||||
import React, {useRef} from 'react';
|
import React, {useContext, useEffect, useRef} from 'react';
|
||||||
import {DataType} from "@/app/lib/definitions";
|
import {DataType} from "@/app/lib/definitions";
|
||||||
import {
|
import {
|
||||||
getTaskTreeResult,
|
getTaskTreeResult,
|
||||||
|
@ -14,118 +21,134 @@ import {
|
||||||
} from "@/app/lib/task/project/data";
|
} from "@/app/lib/task/project/data";
|
||||||
import {DetailModelForm} from "@/app/ui/task/project/DetailModelForm";
|
import {DetailModelForm} from "@/app/ui/task/project/DetailModelForm";
|
||||||
import OperationButton from "@/app/ui/task/OperationButton";
|
import OperationButton from "@/app/ui/task/OperationButton";
|
||||||
|
import LocalContext from "@/app/ui/LocalContent";
|
||||||
|
|
||||||
|
|
||||||
const columns: ProColumns<DataType>[] = [
|
|
||||||
{
|
|
||||||
title: '任务编码',
|
|
||||||
dataIndex: 'code',
|
|
||||||
width: '10%',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '任务名称',
|
|
||||||
dataIndex: 'name',
|
|
||||||
width: '15%',
|
|
||||||
copyable: true,
|
|
||||||
ellipsis: true,
|
|
||||||
tooltip: '标题过长会自动收缩',
|
|
||||||
formItemProps: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '此项为必填项',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '任务描述',
|
|
||||||
dataIndex: 'description',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '任务优先级',
|
|
||||||
dataIndex: 'priority',
|
|
||||||
valueType: 'select',
|
|
||||||
fieldProps: {
|
|
||||||
options: taskPriorityList.map(item => {
|
|
||||||
return {label: item.name, value: item.code}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
renderFormItem: (_, { defaultRender }) => {
|
|
||||||
return defaultRender(_);
|
|
||||||
},
|
|
||||||
render: (_, record) => (
|
|
||||||
<Space>
|
|
||||||
{
|
|
||||||
// <Tag color={taskPriorityList.find(item => item.code === record.priority?.toString())?.color}
|
|
||||||
// key={taskPriorityList.find(item => item.code === record.priority?.toString())?.code}>
|
|
||||||
// {taskPriorityList.find(item => item.code === record.priority?.toString())?.name}
|
|
||||||
// </Tag>
|
|
||||||
<div>
|
|
||||||
{/*< HeartFilled/>*/}
|
|
||||||
<CheckSquareFilled style={{color:taskPriorityList.find(item => item.code === record.priority?.toString())?.color}}/>
|
|
||||||
{taskPriorityList.find(item => item.code === record.priority?.toString())?.name}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '任务状态',
|
|
||||||
dataIndex: 'state',
|
|
||||||
valueType: 'select',
|
|
||||||
initialValue:['8','9'],
|
|
||||||
fieldProps: {
|
|
||||||
defaultValue:['8','9'],
|
|
||||||
mode:"tags",
|
|
||||||
options: taskStateList.map(item => {
|
|
||||||
return {label: item.name, value: item.code}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// renderFormItem: (_, { defaultRender }) => {
|
|
||||||
// return defaultRender(_);
|
|
||||||
// },
|
|
||||||
// render: (_, record) => (
|
|
||||||
// <Space>
|
|
||||||
// {
|
|
||||||
// <Tag color={taskStateList.find(item => item.code === record.state?.toString())?.color}
|
|
||||||
// key={taskStateList.find(item => item.code === record.state?.toString())?.code}>
|
|
||||||
// {taskStateList.find(item => item.code === record.state?.toString())?.name}
|
|
||||||
// </Tag>
|
|
||||||
// }
|
|
||||||
// </Space>
|
|
||||||
// ),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '期望开始时间',
|
|
||||||
dataIndex: 'expectedStartTime',
|
|
||||||
valueType: 'date',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '期望结束时间',
|
|
||||||
dataIndex: 'expectedEndTime',
|
|
||||||
valueType: 'date',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '实际开始时间',
|
|
||||||
dataIndex: 'actualStartTime',
|
|
||||||
valueType: 'date',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '期望结束时间',
|
|
||||||
dataIndex: 'actualEndTime',
|
|
||||||
valueType: 'date',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
key: 'option',
|
|
||||||
valueType: 'option',
|
|
||||||
render: (_, record) => <OperationButton itemId={record.id} pid={record.pid} pPid={record.pPid} refreshDate={()=>{}}/>,
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
const TreeTablePro: React.FC = () => {
|
const TreeTablePro: React.FC = () => {
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
const [switchChecked, setSwitchChecked] = React.useState(true);
|
const [switchChecked, setSwitchChecked] = React.useState(true);
|
||||||
|
const [filterChecked, setFilterChecked] = React.useState(true);
|
||||||
|
const columns: ProColumns<DataType>[] = [
|
||||||
|
{
|
||||||
|
title: '任务编码',
|
||||||
|
dataIndex: 'code',
|
||||||
|
width: '10%',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '任务名称',
|
||||||
|
dataIndex: 'name',
|
||||||
|
width: '15%',
|
||||||
|
copyable: true,
|
||||||
|
ellipsis: true,
|
||||||
|
tooltip: '标题过长会自动收缩',
|
||||||
|
formItemProps: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '此项为必填项',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '任务描述',
|
||||||
|
dataIndex: 'description',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '任务优先级',
|
||||||
|
dataIndex: 'priority',
|
||||||
|
order:1,
|
||||||
|
valueType: 'select',
|
||||||
|
fieldProps: {
|
||||||
|
mode:"tags",
|
||||||
|
options: taskPriorityList.map(item => {
|
||||||
|
return {label: item.name, value: item.code}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// renderFormItem: (_, { defaultRender }) => {
|
||||||
|
// return defaultRender(_);
|
||||||
|
// },
|
||||||
|
render: (_, record) => (
|
||||||
|
<Space>
|
||||||
|
{
|
||||||
|
// <Tag color={taskPriorityList.find(item => item.code === record.priority?.toString())?.color}
|
||||||
|
// key={taskPriorityList.find(item => item.code === record.priority?.toString())?.code}>
|
||||||
|
// {taskPriorityList.find(item => item.code === record.priority?.toString())?.name}
|
||||||
|
// </Tag>
|
||||||
|
<div>
|
||||||
|
{/*< HeartFilled/>*/}
|
||||||
|
<CheckSquareFilled style={{color:taskPriorityList.find(item => item.code === record.priority?.toString())?.color}}/>
|
||||||
|
{taskPriorityList.find(item => item.code === record.priority?.toString())?.name}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '任务状态',
|
||||||
|
dataIndex: 'state',
|
||||||
|
valueType: 'select',
|
||||||
|
order:2,
|
||||||
|
initialValue:['8','9'],
|
||||||
|
fieldProps: {
|
||||||
|
defaultValue:['8','9'],
|
||||||
|
mode:"tags",
|
||||||
|
options: taskStateList.map(item => {
|
||||||
|
return {label: item.name, value: item.code}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// renderFormItem: (_, { defaultRender }) => {
|
||||||
|
// return defaultRender(_);
|
||||||
|
// },
|
||||||
|
// render: (_, record) => (
|
||||||
|
// <Space>
|
||||||
|
// {
|
||||||
|
// <Tag color={taskStateList.find(item => item.code === record.state?.toString())?.color}
|
||||||
|
// key={taskStateList.find(item => item.code === record.state?.toString())?.code}>
|
||||||
|
// {taskStateList.find(item => item.code === record.state?.toString())?.name}
|
||||||
|
// </Tag>
|
||||||
|
// }
|
||||||
|
// </Space>
|
||||||
|
// ),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '期望开始时间',
|
||||||
|
dataIndex: 'expectedStartTime',
|
||||||
|
valueType: 'date',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '期望结束时间',
|
||||||
|
dataIndex: 'expectedEndTime',
|
||||||
|
valueType: 'date',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '实际开始时间',
|
||||||
|
dataIndex: 'actualStartTime',
|
||||||
|
valueType: 'date',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '期望结束时间',
|
||||||
|
dataIndex: 'actualEndTime',
|
||||||
|
valueType: 'date',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'option',
|
||||||
|
valueType: 'option',
|
||||||
|
render: (_, record) => <OperationButton itemId={record.id} pid={record.pid} pPid={record.pPid} refreshDate={actionRef.current?.reload}/>,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
let toolBarRenderList = [
|
||||||
|
<DetailModelForm operationId={OPERATION_BUTTON_TYPE.ADD} description='添加主线任务' reloadData={actionRef.current?.reload}/>,
|
||||||
|
<Switch checkedChildren="树" unCheckedChildren="列表" checked={switchChecked}
|
||||||
|
onChange={(checked, event) => {setSwitchChecked(checked);actionRef.current?.reset?.();}} />,
|
||||||
|
];
|
||||||
|
if (switchChecked){
|
||||||
|
toolBarRenderList.push(<><span>树子集是否参与过滤</span> <Tooltip title="开启树子集过滤后儿子不满足条件,孙子满足条件,儿子和孙子都不会显示。"><QuestionCircleOutlined /></Tooltip>
|
||||||
|
<Switch checkedChildren="是" unCheckedChildren="否" checked={filterChecked}
|
||||||
|
onChange={(checked, event) => {setFilterChecked(checked);actionRef.current?.reload();}} /></>)
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<ProTable<DataType>
|
<ProTable<DataType>
|
||||||
columns={columns}
|
columns={columns}
|
||||||
|
@ -137,10 +160,13 @@ const TreeTablePro: React.FC = () => {
|
||||||
if (switchChecked) {
|
if (switchChecked) {
|
||||||
searchList.push({name:'pid',value:'0',operateType:"="},{name:'tree',value:'TRUE',operateType:"TREE"})
|
searchList.push({name:'pid',value:'0',operateType:"="},{name:'tree',value:'TRUE',operateType:"TREE"})
|
||||||
}
|
}
|
||||||
if (params.state){
|
if (filterChecked) {
|
||||||
|
searchList.push({name:'tree',value:'TRUE',operateType:"TREE-FILTER"})
|
||||||
|
}
|
||||||
|
if (params.state instanceof Array&¶ms.state.length>0){
|
||||||
searchList.push({name:'state',value:params.state.join(','),operateType:"IN"})
|
searchList.push({name:'state',value:params.state.join(','),operateType:"IN"})
|
||||||
}
|
}
|
||||||
if (params.priority){
|
if (params.priority instanceof Array&¶ms.state.length>0){
|
||||||
searchList.push({name:'priority',value:params.priority.join(','),operateType:"IN"})
|
searchList.push({name:'priority',value:params.priority.join(','),operateType:"IN"})
|
||||||
}
|
}
|
||||||
if (params.name){
|
if (params.name){
|
||||||
|
@ -184,11 +210,8 @@ const TreeTablePro: React.FC = () => {
|
||||||
}}
|
}}
|
||||||
dateFormatter="string"
|
dateFormatter="string"
|
||||||
// headerTitle="任务管理"
|
// headerTitle="任务管理"
|
||||||
toolBarRender={() => [
|
toolBarRender={()=>toolBarRenderList}>
|
||||||
<DetailModelForm operationId={OPERATION_BUTTON_TYPE.ADD} description='添加主线任务'/>,
|
</ProTable>
|
||||||
<Switch checkedChildren="树" unCheckedChildren="列表" checked={switchChecked}
|
|
||||||
onChange={(checked, event) => {setSwitchChecked(checked);actionRef.current?.reload();}} />
|
|
||||||
]}></ProTable>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default TreeTablePro
|
export default TreeTablePro
|
||||||
|
|
Loading…
Reference in New Issue