feat:backup
This commit is contained in:
parent
5848dd2d04
commit
f0347222c3
|
@ -1,6 +1,23 @@
|
||||||
import {unstable_noStore as noStore} from 'next/cache';
|
import {unstable_noStore as noStore} from 'next/cache';
|
||||||
import axios, {AxiosResponse} from "axios";
|
import axios, {AxiosResponse} from "axios";
|
||||||
import {DataType, DictType, ResponseVO, ResultPage} from "@/app/lib/definitions";
|
import {DataType, DictType, ResponseVO, ResultPage} from "@/app/lib/definitions";
|
||||||
|
import { URL } from 'url';
|
||||||
|
export async function getTaskTreeResult(requestParam:string): Promise<ResponseVO<ResultPage<DataType>>> {
|
||||||
|
noStore();
|
||||||
|
try {
|
||||||
|
|
||||||
|
// 使用 Axios 发送 POST 请求获取数据
|
||||||
|
const response: AxiosResponse<ResponseVO<ResultPage<DataType>>> = await axios.get(
|
||||||
|
'http://localhost:8090/search/task_message_tree?search='+encodeURIComponent(requestParam));
|
||||||
|
// 从响应中提取数据并返回
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
// 处理错误
|
||||||
|
console.error('Error fetching data:', error);
|
||||||
|
// 返回一个默认值或者抛出错误
|
||||||
|
throw new Error('Failed to fetch data');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export async function taskTreeResult(): Promise<ResponseVO<ResultPage<DataType>>> {
|
export async function taskTreeResult(): Promise<ResponseVO<ResultPage<DataType>>> {
|
||||||
noStore();
|
noStore();
|
||||||
|
@ -111,26 +128,26 @@ export async function editPriority(id:number,priority:number): Promise<ResponseV
|
||||||
//0,重要紧急红色,1,重要不紧急黄色,2,不重要紧急灰色,3不重要,不紧急绿色
|
//0,重要紧急红色,1,重要不紧急黄色,2,不重要紧急灰色,3不重要,不紧急绿色
|
||||||
export const taskPriorityList: DictType[] = [
|
export const taskPriorityList: DictType[] = [
|
||||||
{
|
{
|
||||||
id: 0,
|
id: 3,
|
||||||
code: '0',
|
code: '3',
|
||||||
name: '重要紧急',
|
name: '重要紧急',
|
||||||
order: 0,
|
order: 0,
|
||||||
color: 'red'
|
color: 'red'
|
||||||
}, {
|
}, {
|
||||||
id: 1,
|
id: 2,
|
||||||
code: '1',
|
code: '2',
|
||||||
name: '重要不紧急',
|
name: '重要不紧急',
|
||||||
order: 1,
|
order: 1,
|
||||||
color: 'yellow'
|
color: 'yellow'
|
||||||
}, {
|
}, {
|
||||||
id: 2,
|
id:1,
|
||||||
code: '2',
|
code: '1',
|
||||||
name: '不重要紧急',
|
name: '不重要紧急',
|
||||||
order: 2,
|
order: 2,
|
||||||
color: 'gary'
|
color: 'gary'
|
||||||
}, {
|
}, {
|
||||||
id: 3,
|
id: 0,
|
||||||
code: '3',
|
code: '0',
|
||||||
name: '不重要不紧急',
|
name: '不重要不紧急',
|
||||||
order: 3,
|
order: 3,
|
||||||
color: 'green'
|
color: 'green'
|
||||||
|
@ -138,54 +155,75 @@ export const taskPriorityList: DictType[] = [
|
||||||
]
|
]
|
||||||
// 0,暂存,1,提交,2,审核,3通过4拒绝5排期中,6进行中,7完成,8bug修复,9修复完成,10确认,11,上线运行
|
// 0,暂存,1,提交,2,审核,3通过4拒绝5排期中,6进行中,7完成,8bug修复,9修复完成,10确认,11,上线运行
|
||||||
export const taskStateList: DictType[] = [
|
export const taskStateList: DictType[] = [
|
||||||
|
// {
|
||||||
|
// id: 0,
|
||||||
|
// code: '0',
|
||||||
|
// name: '暂存',
|
||||||
|
// order: 1,
|
||||||
|
// color: 'red'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 1,
|
||||||
|
// code: '1',
|
||||||
|
// name: '提交',
|
||||||
|
// order: 1,
|
||||||
|
// color: 'red'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 2,
|
||||||
|
// code: '2',
|
||||||
|
// name: '审核',
|
||||||
|
// order: 2,
|
||||||
|
// color: 'red'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 3,
|
||||||
|
// code: '3',
|
||||||
|
// name: '通过',
|
||||||
|
// order: 3,
|
||||||
|
// color: 'red'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 4,
|
||||||
|
// code: '4',
|
||||||
|
// name: '拒绝',
|
||||||
|
// order: 4,
|
||||||
|
// color: 'red'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 5,
|
||||||
|
// code: '5',
|
||||||
|
// name: '排期中',
|
||||||
|
// order: 5,
|
||||||
|
// color: 'red'
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 6,
|
||||||
|
// code: '6',
|
||||||
|
// name: '排期中',
|
||||||
|
// order: 6,
|
||||||
|
// color: 'red'
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
id: 0,
|
|
||||||
code: '0',
|
|
||||||
name: '暂存',
|
|
||||||
order: 1,
|
|
||||||
color: 'red'
|
|
||||||
}, {
|
|
||||||
id: 1,
|
|
||||||
code: '1',
|
|
||||||
name: '提交',
|
|
||||||
order: 1,
|
|
||||||
color: 'red'
|
|
||||||
}, {
|
|
||||||
id: 2,
|
|
||||||
code: '2',
|
|
||||||
name: '审核',
|
|
||||||
order: 2,
|
|
||||||
color: 'red'
|
|
||||||
}, {
|
|
||||||
id: 3,
|
|
||||||
code: '3',
|
|
||||||
name: '通过',
|
|
||||||
order: 3,
|
|
||||||
color: 'red'
|
|
||||||
}, {
|
|
||||||
id: 4,
|
|
||||||
code: '4',
|
|
||||||
name: '拒绝',
|
|
||||||
order: 4,
|
|
||||||
color: 'red'
|
|
||||||
}, {
|
|
||||||
id: 5,
|
|
||||||
code: '5',
|
|
||||||
name: '排期中',
|
|
||||||
order: 5,
|
|
||||||
color: 'red'
|
|
||||||
}, {
|
|
||||||
id: 6,
|
|
||||||
code: '6',
|
|
||||||
name: '排期中',
|
|
||||||
order: 6,
|
|
||||||
color: 'red'
|
|
||||||
}, {
|
|
||||||
id: 7,
|
id: 7,
|
||||||
code: '7',
|
code: '7',
|
||||||
name: '完成',
|
name: '完成',
|
||||||
order: 7,
|
order: 7,
|
||||||
color: 'red'
|
color: 'red'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 8,
|
||||||
|
code: '8',
|
||||||
|
name: '新建',
|
||||||
|
order: 8,
|
||||||
|
color: 'red'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 9,
|
||||||
|
code: '9',
|
||||||
|
name: '进行中',
|
||||||
|
order: 9,
|
||||||
|
color: 'red'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
export enum OPERATION_BUTTON_TYPE {
|
export enum OPERATION_BUTTON_TYPE {
|
||||||
|
@ -194,5 +232,6 @@ export enum OPERATION_BUTTON_TYPE {
|
||||||
UPDATE,
|
UPDATE,
|
||||||
DELETE,
|
DELETE,
|
||||||
COMPLETE,
|
COMPLETE,
|
||||||
SHOW_FOUR
|
SHOW_FOUR,
|
||||||
|
ADD,
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,15 +38,15 @@ export default function Layout({children}: { children: React.ReactNode }) {
|
||||||
<div>
|
<div>
|
||||||
<div className='firstRow' style={{display: 'flex'}}>
|
<div className='firstRow' style={{display: 'flex'}}>
|
||||||
<div className='leftUp'>
|
<div className='leftUp'>
|
||||||
<TreeTable/>
|
<TreeTable search={{name:"priority",value:"3",operateType:"="}}/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id='tenUp' className='up'>
|
<div id='tenUp' className='up'>
|
||||||
<span id='upUp'>向上重要</span>
|
<span id='upUp'>向上重要</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='rightUp'>
|
<div className='rightUp' >
|
||||||
<TreeTable/>
|
<TreeTable search={{name:"priority",value:"2",operateType:"="}}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='left' className='left'>
|
<div id='left' className='left'>
|
||||||
|
@ -54,14 +54,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/>
|
<TreeTable search={{name:"priority",value:"1",operateType:"="}}/>
|
||||||
</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/>
|
<TreeTable search={{name:"priority",value:"0",operateType:"="}}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,119 @@
|
||||||
|
'use client'
|
||||||
|
import {Button, Col, Form, Input, Row, Select, Space, theme} from "antd";
|
||||||
|
import React, {useState} from "react";
|
||||||
|
import {DownOutlined} from "@ant-design/icons";
|
||||||
|
import {OperationButtonProps} from "@/app/ui/task/project/OperationButton";
|
||||||
|
|
||||||
|
const AdvancedSearchForm = () => {
|
||||||
|
const { token } = theme.useToken();
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const [expand, setExpand] = useState(false);
|
||||||
|
const [searchFields, setSearchFields] = useState<any[]>([
|
||||||
|
<Form.Item>
|
||||||
|
<Select
|
||||||
|
defaultValue="state"
|
||||||
|
style={{ width: 120 }}
|
||||||
|
allowClear
|
||||||
|
options={[{ value: 'state', label: '任务状态' }]}
|
||||||
|
/>,
|
||||||
|
<Select
|
||||||
|
defaultValue="="
|
||||||
|
style={{ width: 120 }}
|
||||||
|
allowClear
|
||||||
|
options={[{ value: '=', label: '等于' },{value:'IN',label:"多个选择"}]}
|
||||||
|
/>,
|
||||||
|
<Select
|
||||||
|
mode="tags"
|
||||||
|
defaultValue={['8','9']}
|
||||||
|
style={{ width: 180 }}
|
||||||
|
allowClear
|
||||||
|
options={[{ value: '8', label: '新建' },{ value: '9', label: '进行中' },{ value: '7', label: '完成' },]}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
])
|
||||||
|
|
||||||
|
const formStyle: React.CSSProperties = {
|
||||||
|
maxWidth: 'none',
|
||||||
|
background: token.colorFillAlter,
|
||||||
|
borderRadius: token.borderRadiusLG,
|
||||||
|
};
|
||||||
|
|
||||||
|
const getFields = () => {
|
||||||
|
const count = expand ? 10 : 6;
|
||||||
|
const children = [];
|
||||||
|
for (let i = 0; i < count; i++) {
|
||||||
|
children.push(
|
||||||
|
<Col span={8} key={i}>
|
||||||
|
{i % 3 !== 1 ? (
|
||||||
|
<Form.Item
|
||||||
|
name={`field-${i}`}
|
||||||
|
label={`Field ${i}`}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: 'Input something!',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input placeholder="placeholder" />
|
||||||
|
</Form.Item>
|
||||||
|
) : (
|
||||||
|
<Form.Item
|
||||||
|
name={`field-${i}`}
|
||||||
|
label={`Field ${i}`}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: 'Select something!',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
initialValue="1"
|
||||||
|
>
|
||||||
|
<Select>
|
||||||
|
</Select>
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
|
</Col>,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return children;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onFinish = (values: any) => {
|
||||||
|
console.log('Received values of form: ', values);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Form form={form} name="advanced_search" style={formStyle} onFinish={onFinish}>
|
||||||
|
<Row gutter={24}>{searchFields}</Row>
|
||||||
|
{/*<div style={{ textAlign: 'right' }}>*/}
|
||||||
|
{/* <Space size="small">*/}
|
||||||
|
<Form.Item>
|
||||||
|
<Button type="primary">
|
||||||
|
添加
|
||||||
|
</Button>
|
||||||
|
<Button type="primary" htmlType="submit">
|
||||||
|
搜索
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
form.resetFields();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
清空
|
||||||
|
</Button>
|
||||||
|
</Form.Item>
|
||||||
|
{/*<a*/}
|
||||||
|
{/* style={{ fontSize: 12 }}*/}
|
||||||
|
{/* onClick={() => {*/}
|
||||||
|
{/* setExpand(!expand);*/}
|
||||||
|
{/* }}*/}
|
||||||
|
{/*><DownOutlined rotate={expand ? 180 : 0} /> Collapse*/}
|
||||||
|
{/*</a>*/}
|
||||||
|
{/* </Space>*/}
|
||||||
|
{/*</div>*/}
|
||||||
|
</Form>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default AdvancedSearchForm;
|
|
@ -0,0 +1,26 @@
|
||||||
|
import React from "react";
|
||||||
|
import {Button} from "antd";
|
||||||
|
import {usePathname, useRouter} from "next/navigation";
|
||||||
|
import {DetailFormProps} from "@/app/ui/task/project/DetailForm";
|
||||||
|
import {DetailModelForm} from "@/app/ui/task/project/DetailModelForm";
|
||||||
|
import {OPERATION_BUTTON_TYPE} from "@/app/lib/task/project/data";
|
||||||
|
import AdvancedSearchForm from "@/app/ui/task/AdvancedSearchForm";
|
||||||
|
|
||||||
|
// export const TitleOperation: React.FC<DetailFormProps>= () =>
|
||||||
|
export const TitleOperation: React.FC = () => {
|
||||||
|
const {replace} = useRouter();
|
||||||
|
const [currentPath, setCurrentPath] = React.useState(usePathname());
|
||||||
|
return <div style={{display: 'flex'}}>
|
||||||
|
<DetailModelForm operationId={OPERATION_BUTTON_TYPE.ADD} description='添加主线任务'/>
|
||||||
|
{
|
||||||
|
currentPath.startsWith("/task/project") ? <Button type="primary" onClick={() => {
|
||||||
|
replace("/task/four");
|
||||||
|
setCurrentPath("/task/four");
|
||||||
|
}}>四象限显示</Button> :
|
||||||
|
<Button type="primary" onClick={() => {
|
||||||
|
replace("/task/project");
|
||||||
|
setCurrentPath("/task/project")
|
||||||
|
}}>列表显示</Button>}
|
||||||
|
<AdvancedSearchForm/>
|
||||||
|
</div>
|
||||||
|
}
|
|
@ -199,7 +199,7 @@ export const DetailForm: React.FC<DetailFormProps> = (props) => {
|
||||||
<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' label="任务优先级">
|
||||||
<Select options={
|
<Select allowClear={true} options={
|
||||||
taskPriorityList.map(taskState => {
|
taskPriorityList.map(taskState => {
|
||||||
return {
|
return {
|
||||||
'label': taskState.name,
|
'label': taskState.name,
|
||||||
|
@ -210,7 +210,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' label="任务状态">
|
||||||
<Select options={
|
<Select allowClear={true} options={
|
||||||
taskStateList.map(taskState => {
|
taskStateList.map(taskState => {
|
||||||
return {
|
return {
|
||||||
'label': taskState.name,
|
'label': taskState.name,
|
||||||
|
|
|
@ -0,0 +1,126 @@
|
||||||
|
import { PlusOutlined } from '@ant-design/icons';
|
||||||
|
import {
|
||||||
|
ModalForm,
|
||||||
|
ProForm,
|
||||||
|
ProFormDateRangePicker,
|
||||||
|
ProFormSelect,
|
||||||
|
ProFormText,
|
||||||
|
} from '@ant-design/pro-components';
|
||||||
|
import { Button, Form, message } from 'antd';
|
||||||
|
import React from "react";
|
||||||
|
import {DetailFormProps} from "@/app/ui/task/project/DetailForm";
|
||||||
|
import {OPERATION_BUTTON_TYPE} from "@/app/lib/task/project/data";
|
||||||
|
|
||||||
|
const waitTime = (time: number = 100) => {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
resolve(true);
|
||||||
|
}, time);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
export type DetailModelFormProps={
|
||||||
|
itemId?: number,
|
||||||
|
pPid?:number,
|
||||||
|
operationId: number,
|
||||||
|
description:string,
|
||||||
|
handleCancel?: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export const DetailModelForm: React.FC<DetailModelFormProps> = (props) => {
|
||||||
|
const [form] = Form.useForm<{ name: string; company: string }>();
|
||||||
|
return (
|
||||||
|
<ModalForm<{
|
||||||
|
name: string;
|
||||||
|
company: string;
|
||||||
|
}>
|
||||||
|
title={
|
||||||
|
props.operationId === OPERATION_BUTTON_TYPE.DETAIL ? "任务详情":
|
||||||
|
props.operationId === OPERATION_BUTTON_TYPE.ADD?"添加任务":
|
||||||
|
props.operationId === OPERATION_BUTTON_TYPE.ADD?"修改任务":''
|
||||||
|
}
|
||||||
|
trigger={
|
||||||
|
<Button type="primary">
|
||||||
|
<PlusOutlined />
|
||||||
|
{props.description}
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
form={form}
|
||||||
|
autoFocusFirstInput
|
||||||
|
modalProps={{
|
||||||
|
destroyOnClose: true,
|
||||||
|
onCancel: () => console.log('run'),
|
||||||
|
}}
|
||||||
|
submitTimeout={2000}
|
||||||
|
onFinish={async (values) => {
|
||||||
|
await waitTime(2000);
|
||||||
|
console.log(values.name);
|
||||||
|
message.success('提交成功');
|
||||||
|
return true;
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ProForm.Group>
|
||||||
|
<ProFormText
|
||||||
|
width="md"
|
||||||
|
name="name"
|
||||||
|
label="签约客户名称"
|
||||||
|
tooltip="最长为 24 位"
|
||||||
|
placeholder="请输入名称"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ProFormText
|
||||||
|
width="md"
|
||||||
|
name="company"
|
||||||
|
label="我方公司名称"
|
||||||
|
placeholder="请输入名称"
|
||||||
|
/>
|
||||||
|
</ProForm.Group>
|
||||||
|
<ProForm.Group>
|
||||||
|
<ProFormText
|
||||||
|
width="md"
|
||||||
|
name="contract"
|
||||||
|
label="合同名称"
|
||||||
|
placeholder="请输入名称"
|
||||||
|
/>
|
||||||
|
<ProFormDateRangePicker name="contractTime" label="合同生效时间" />
|
||||||
|
</ProForm.Group>
|
||||||
|
<ProForm.Group>
|
||||||
|
<ProFormSelect
|
||||||
|
request={async () => [
|
||||||
|
{
|
||||||
|
value: 'chapter',
|
||||||
|
label: '盖章后生效',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
width="xs"
|
||||||
|
name="useMode"
|
||||||
|
label="合同约定生效方式"
|
||||||
|
/>
|
||||||
|
<ProFormSelect
|
||||||
|
width="xs"
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
value: 'time',
|
||||||
|
label: '履行完终止',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name="unusedMode"
|
||||||
|
label="合同约定失效效方式"
|
||||||
|
/>
|
||||||
|
</ProForm.Group>
|
||||||
|
<ProFormText width="sm" name="id" label="主合同编号" />
|
||||||
|
<ProFormText
|
||||||
|
name="project"
|
||||||
|
disabled
|
||||||
|
label="项目名称"
|
||||||
|
initialValue="xxxx项目"
|
||||||
|
/>
|
||||||
|
<ProFormText
|
||||||
|
width="xs"
|
||||||
|
name="mangerName"
|
||||||
|
disabled
|
||||||
|
label="商务经理"
|
||||||
|
initialValue="启途"
|
||||||
|
/>
|
||||||
|
</ModalForm>
|
||||||
|
);
|
||||||
|
};
|
|
@ -1,11 +1,11 @@
|
||||||
'use client'
|
'use client'
|
||||||
import React, {useEffect, useState} from 'react';
|
import React, {useEffect, useState} from 'react';
|
||||||
import {Button, ColorPicker, Dropdown, MenuProps, Space, Switch, Table} from 'antd';
|
import {Button, ColorPicker, Dropdown, MenuProps, Space, Switch, Table} from 'antd';
|
||||||
import type { TableColumnsType, TableProps } from 'antd';
|
import type {TableColumnsType, TableProps} from 'antd';
|
||||||
import {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 {DownOutlined} from "@ant-design/icons";
|
import {DownOutlined} from "@ant-design/icons";
|
||||||
import { useSearchParams, usePathname, useRouter } from 'next/navigation';
|
import {useSearchParams, usePathname, useRouter} from 'next/navigation';
|
||||||
import OperationButton from "@/app/ui/task/project/OperationButton";
|
import OperationButton from "@/app/ui/task/project/OperationButton";
|
||||||
|
|
||||||
type TableRowSelection<T> = TableProps<T>['rowSelection'];
|
type TableRowSelection<T> = TableProps<T>['rowSelection'];
|
||||||
|
@ -36,12 +36,12 @@ const columns: TableColumnsType<DataType> = [
|
||||||
width: '10%',
|
width: '10%',
|
||||||
key: 'state',
|
key: 'state',
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
title: '优先级',
|
// title: '优先级',
|
||||||
dataIndex: 'priority',
|
// dataIndex: 'priority',
|
||||||
width: '10%',
|
// width: '10%',
|
||||||
key: 'priority',
|
// key: 'priority',
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
dataIndex: 'action',
|
dataIndex: 'action',
|
||||||
|
@ -51,7 +51,6 @@ const columns: TableColumnsType<DataType> = [
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 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) => {
|
||||||
|
@ -65,30 +64,40 @@ const rowSelection: TableRowSelection<DataType> = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const TreeTable: React.FC = () => {
|
interface TableSearchType {
|
||||||
function recursionActionChild(children:DataType[]){
|
search?: any
|
||||||
if (children.length===0){
|
}
|
||||||
|
|
||||||
|
const TreeTable: React.FC<TableSearchType> = (props) => {
|
||||||
|
function recursionActionChild(children: DataType[]) {
|
||||||
|
if (children.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (let item of children) {
|
for (let item of children) {
|
||||||
item.key=item.id;
|
item.key = item.id;
|
||||||
item.action=(<OperationButton itemId={item.id} pid={item.pid} pPid={item.pPid} refreshDate={refreshDate}/>)
|
item.action = (
|
||||||
item.state=taskStateList.find(taskState=>taskState.code===item.state?.toString())?.name;
|
<OperationButton itemId={item.id} pid={item.pid} pPid={item.pPid} refreshDate={refreshDate}/>)
|
||||||
item.priority=taskPriorityList.find(taskPriority=>taskPriority.code===item.priority?.toString())?.name;
|
item.state = taskStateList.find(taskState => taskState.code === item.state?.toString())?.name;
|
||||||
if (item.children&&item.children.length>0){
|
item.priority = taskPriorityList.find(taskPriority => taskPriority.code === item.priority?.toString())?.name;
|
||||||
|
if (item.children && item.children.length > 0) {
|
||||||
recursionActionChild(item.children)
|
recursionActionChild(item.children)
|
||||||
}else {
|
} else {
|
||||||
item.children=undefined
|
item.children = undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// const [checkStrictly, setCheckStrictly] = useState(false);
|
// const [checkStrictly, setCheckStrictly] = useState(false);
|
||||||
const [data, setData] = useState<DataType[]>([]);
|
const [data, setData] = useState<DataType[]>([]);
|
||||||
const [pageNumber, setPageNumber] = useState<number>(1);
|
const [pageNumber, setPageNumber] = useState<number>(1);
|
||||||
const [pageSize, setPageSize] = useState<number>(10);
|
const [pageSize, setPageSize] = useState<number>(10);
|
||||||
const refreshDate=():void=>{
|
const refreshDate = (): void => {
|
||||||
taskTreeResult().then((result:ResponseVO<ResultPage<DataType>>)=>{
|
getTaskTreeResult(JSON.stringify({
|
||||||
if (result.status.success){
|
pageSize,
|
||||||
|
pageNumber,
|
||||||
|
data: [props.search]
|
||||||
|
})).then((result: ResponseVO<ResultPage<DataType>>) => {
|
||||||
|
if (result.status.success) {
|
||||||
recursionActionChild(result.data.content);
|
recursionActionChild(result.data.content);
|
||||||
setData(result.data.content)
|
setData(result.data.content)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,8 @@ import { ProTable, TableDropdown } from '@ant-design/pro-components';
|
||||||
import { Button, Dropdown, Space, Tag } from 'antd';
|
import { Button, Dropdown, Space, Tag } from 'antd';
|
||||||
import React, { useRef } from 'react';
|
import React, { useRef } from 'react';
|
||||||
import {DataType} from "@/app/lib/definitions";
|
import {DataType} from "@/app/lib/definitions";
|
||||||
import {taskPriorityList, taskStateList, taskTreeResult} from "@/app/lib/task/project/data";
|
import {OPERATION_BUTTON_TYPE, taskPriorityList, taskStateList, taskTreeResult} from "@/app/lib/task/project/data";
|
||||||
|
import {DetailModelForm} from "@/app/ui/task/project/DetailModelForm";
|
||||||
const columns: ProColumns<DataType>[] = [
|
const columns: ProColumns<DataType>[] = [
|
||||||
{
|
{
|
||||||
title: '任务编码',
|
title: '任务编码',
|
||||||
|
@ -64,16 +65,54 @@ const columns: ProColumns<DataType>[] = [
|
||||||
title: '期望开始时间',
|
title: '期望开始时间',
|
||||||
dataIndex: 'expectedStartTime',
|
dataIndex: 'expectedStartTime',
|
||||||
valueType: 'date',
|
valueType: 'date',
|
||||||
hideInTable: true,
|
// hideInTable: true,
|
||||||
search: {
|
// search: {
|
||||||
transform: (value) => {
|
// transform: (value) => {
|
||||||
return {
|
// return {
|
||||||
startTime: value,
|
// startTime: value,
|
||||||
};
|
// };
|
||||||
|
// },
|
||||||
|
// },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '期望结束时间',
|
||||||
|
dataIndex: 'expectedEndTime',
|
||||||
|
valueType: 'date',
|
||||||
|
// hideInTable: true,
|
||||||
|
// search: {
|
||||||
|
// transform: (value) => {
|
||||||
|
// return {
|
||||||
|
// startTime: value,
|
||||||
|
// };
|
||||||
|
// },
|
||||||
|
// },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '实际开始时间',
|
||||||
|
dataIndex: 'actualStartTime',
|
||||||
|
valueType: 'date',
|
||||||
|
// hideInTable: true,
|
||||||
|
// search: {
|
||||||
|
// transform: (value) => {
|
||||||
|
// return {
|
||||||
|
// startTime: value,
|
||||||
|
// };
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '期望结束时间',
|
||||||
|
dataIndex: 'actualEndTime',
|
||||||
|
valueType: 'date',
|
||||||
|
// hideInTable: true,
|
||||||
|
// search: {
|
||||||
|
// transform: (value) => {
|
||||||
|
// return {
|
||||||
|
// startTime: value,
|
||||||
|
// };
|
||||||
|
// },
|
||||||
|
// },
|
||||||
},
|
},
|
||||||
|
|
||||||
// {
|
// {
|
||||||
// title: '创建时间',
|
// title: '创建时间',
|
||||||
// dataIndex: 'created_at',
|
// dataIndex: 'created_at',
|
||||||
|
@ -155,9 +194,10 @@ const TreeTablePro: React.FC = () => {
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
search={{
|
// search={{
|
||||||
labelWidth: 'auto',
|
// labelWidth: 'auto',
|
||||||
}}
|
// }}
|
||||||
|
search={false}
|
||||||
options={{
|
options={{
|
||||||
setting: {
|
setting: {
|
||||||
listsHeight: 400,
|
listsHeight: 400,
|
||||||
|
@ -182,16 +222,7 @@ const TreeTablePro: React.FC = () => {
|
||||||
dateFormatter="string"
|
dateFormatter="string"
|
||||||
headerTitle="任务管理"
|
headerTitle="任务管理"
|
||||||
toolBarRender={() => [
|
toolBarRender={() => [
|
||||||
<Button
|
<DetailModelForm operationId={OPERATION_BUTTON_TYPE.ADD} description='添加主线任务'/>,
|
||||||
key="button"
|
|
||||||
icon={<PlusOutlined />}
|
|
||||||
onClick={() => {
|
|
||||||
actionRef.current?.reload();
|
|
||||||
}}
|
|
||||||
type="primary"
|
|
||||||
>
|
|
||||||
新建
|
|
||||||
</Button>,
|
|
||||||
// <Dropdown
|
// <Dropdown
|
||||||
// key="menu"
|
// key="menu"
|
||||||
// menu={{
|
// menu={{
|
||||||
|
|
Loading…
Reference in New Issue