feat:设置主题变量
This commit is contained in:
parent
9d4a0d059b
commit
a17155a649
|
@ -18,6 +18,21 @@ export async function getTaskTreeResult(requestParam:string): Promise<ResponseVO
|
||||||
throw new Error('Failed to fetch data');
|
throw new Error('Failed to fetch data');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
export async function commonUpdate(requestParam:any): Promise<ResponseVO<string>> {
|
||||||
|
noStore();
|
||||||
|
try {
|
||||||
|
// 使用 Axios 发送 PUT 请求获取数据
|
||||||
|
const response: AxiosResponse<ResponseVO<string>> = await axios.put(
|
||||||
|
'http://localhost:8090/search/task_message_tree',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();
|
||||||
|
|
|
@ -3,6 +3,8 @@ import React from "react";
|
||||||
import {TitleOperation} from "@/app/ui/task/TitleOperation";
|
import {TitleOperation} from "@/app/ui/task/TitleOperation";
|
||||||
import LocalContext from "@/app/ui/LocalContent";
|
import LocalContext from "@/app/ui/LocalContent";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
import {taskPriorityList} from "@/app/lib/task/project/data";
|
||||||
|
import {ConfigProvider} from "antd";
|
||||||
|
|
||||||
export default function Layout({children}: { children: React.ReactNode }) {
|
export default function Layout({children}: { children: React.ReactNode }) {
|
||||||
const [taskState, setTaskState] = React.useState<string>('8,9')
|
const [taskState, setTaskState] = React.useState<string>('8,9')
|
||||||
|
@ -17,11 +19,22 @@ export default function Layout({children}: { children: React.ReactNode }) {
|
||||||
console.log('taskState,expectedStartTime,refreshDataFlag',taskState,expectedStartTime,refreshDataFlag)
|
console.log('taskState,expectedStartTime,refreshDataFlag',taskState,expectedStartTime,refreshDataFlag)
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
<ConfigProvider
|
||||||
|
theme={{
|
||||||
|
components: {
|
||||||
|
Table: {
|
||||||
|
rowHoverBg:'#4096ff'
|
||||||
|
/* 这里是你的组件 token */
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<LocalContext.Provider value={{'taskState':taskState,'expectedStartTime':expectedStartTime,'refreshData':refreshDataFlag}}>
|
||||||
|
<TitleOperation setTaskState={setTaskState} setExpectedStartTime={setExpectedStartTime} refreshData={refreshData}/>
|
||||||
|
{children}
|
||||||
|
</LocalContext.Provider>
|
||||||
|
</ConfigProvider>
|
||||||
|
|
||||||
<LocalContext.Provider value={{'taskState':taskState,'expectedStartTime':expectedStartTime,'refreshData':refreshDataFlag}}>
|
|
||||||
<TitleOperation setTaskState={setTaskState} setExpectedStartTime={setExpectedStartTime} refreshData={refreshData}/>
|
|
||||||
{children}
|
|
||||||
</LocalContext.Provider>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import React, {Fragment} from "react";
|
||||||
import {Button, Dropdown, MenuProps, message, Modal, Popconfirm, Space} from "antd";
|
import {Button, Dropdown, MenuProps, message, Modal, Popconfirm, Space} from "antd";
|
||||||
import {DownOutlined, QuestionCircleOutlined} from "@ant-design/icons";
|
import {DownOutlined, QuestionCircleOutlined} from "@ant-design/icons";
|
||||||
import {DetailForm} from "@/app/ui/task/four/DetailForm";
|
import {DetailForm} from "@/app/ui/task/four/DetailForm";
|
||||||
import {deleteTask, OPERATION_BUTTON_TYPE} from "@/app/lib/task/project/data";
|
import {commonUpdate, deleteTask, OPERATION_BUTTON_TYPE} from "@/app/lib/task/project/data";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|
||||||
export interface OperationButtonProps {
|
export interface OperationButtonProps {
|
||||||
|
@ -87,6 +87,27 @@ class OperationButton extends React.Component<OperationButtonProps, OperationMod
|
||||||
description="确认要完成任务?"
|
description="确认要完成任务?"
|
||||||
okText="确认"
|
okText="确认"
|
||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
|
onConfirm={() => {
|
||||||
|
commonUpdate({
|
||||||
|
updateColoumList:[{
|
||||||
|
name:'state',
|
||||||
|
code:'state',
|
||||||
|
value:'7'
|
||||||
|
}],
|
||||||
|
conditionColoumList:[{
|
||||||
|
name:'id',
|
||||||
|
code:'id',
|
||||||
|
operateType:'=',
|
||||||
|
value:this.props.itemId
|
||||||
|
}]
|
||||||
|
}).then((response => {
|
||||||
|
console.log('response', response)
|
||||||
|
if (response.status.success) {
|
||||||
|
message.success("完成任务成功")
|
||||||
|
this.props.refreshDate?.()
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}}
|
||||||
><a>完成任务</a></Popconfirm>,
|
><a>完成任务</a></Popconfirm>,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
'use client'
|
'use client'
|
||||||
import {
|
import {
|
||||||
CheckSquareFilled,
|
CheckSquareFilled,
|
||||||
EllipsisOutlined,
|
|
||||||
HeartFilled,
|
|
||||||
HeartOutlined,
|
|
||||||
PlusOutlined,
|
|
||||||
QuestionCircleOutlined
|
QuestionCircleOutlined
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import type {ActionType, ProColumns} from '@ant-design/pro-components';
|
import type {ActionType, FormInstance, 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, Tooltip} from 'antd';
|
import {Button, DatePicker, Dropdown, Space, Switch, Tag, Tooltip} from 'antd';
|
||||||
import React, {useContext, useEffect, useRef} from 'react';
|
import React, {useContext, useEffect, useRef} from 'react';
|
||||||
import {DataType} from "@/app/lib/definitions";
|
import {DataType} from "@/app/lib/definitions";
|
||||||
import {
|
import {
|
||||||
|
@ -17,18 +13,22 @@ import {
|
||||||
OPERATION_BUTTON_TYPE,
|
OPERATION_BUTTON_TYPE,
|
||||||
taskPriorityList,
|
taskPriorityList,
|
||||||
taskStateList,
|
taskStateList,
|
||||||
taskTreeResult
|
|
||||||
} 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 TreeTablePro: React.FC = () => {
|
const TreeTablePro: React.FC = () => {
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
|
const formRef = useRef<FormInstance>();
|
||||||
const [switchChecked, setSwitchChecked] = React.useState(true);
|
const [switchChecked, setSwitchChecked] = React.useState(true);
|
||||||
const [filterChecked, setFilterChecked] = React.useState(true);
|
const [filterChecked, setFilterChecked] = React.useState(true);
|
||||||
|
const reloadData=()=>{
|
||||||
|
actionRef.current?.reload();
|
||||||
|
formRef.current?.submit();
|
||||||
|
}
|
||||||
|
const { RangePicker } = DatePicker;
|
||||||
const columns: ProColumns<DataType>[] = [
|
const columns: ProColumns<DataType>[] = [
|
||||||
{
|
{
|
||||||
title: '任务编码',
|
title: '任务编码',
|
||||||
|
@ -116,6 +116,7 @@ const TreeTablePro: React.FC = () => {
|
||||||
title: '期望开始时间',
|
title: '期望开始时间',
|
||||||
dataIndex: 'expectedStartTime',
|
dataIndex: 'expectedStartTime',
|
||||||
valueType: 'date',
|
valueType: 'date',
|
||||||
|
renderFormItem:()=><RangePicker allowEmpty={[true,true]}/>
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '期望结束时间',
|
title: '期望结束时间',
|
||||||
|
@ -136,22 +137,23 @@ const TreeTablePro: React.FC = () => {
|
||||||
title: '操作',
|
title: '操作',
|
||||||
key: 'option',
|
key: 'option',
|
||||||
valueType: 'option',
|
valueType: 'option',
|
||||||
render: (_, record) => <OperationButton itemId={record.id} pid={record.pid} pPid={record.pPid} refreshDate={actionRef.current?.reload}/>,
|
render: (_, record) => <OperationButton itemId={record.id} pid={record.pid} pPid={record.pPid} refreshDate={reloadData}/>,
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
let toolBarRenderList = [
|
let toolBarRenderList = [
|
||||||
<DetailModelForm operationId={OPERATION_BUTTON_TYPE.ADD} description='添加主线任务' reloadData={actionRef.current?.reload}/>,
|
<DetailModelForm operationId={OPERATION_BUTTON_TYPE.ADD} description='添加主线任务' reloadData={reloadData}/>,
|
||||||
<Switch checkedChildren="树" unCheckedChildren="列表" checked={switchChecked}
|
<Switch checkedChildren="树" unCheckedChildren="列表" checked={switchChecked}
|
||||||
onChange={(checked, event) => {setSwitchChecked(checked);actionRef.current?.reset?.();}} />,
|
onChange={(checked, event) => {setSwitchChecked(checked);actionRef.current?.reset?.();formRef.current?.submit();}} />,
|
||||||
];
|
];
|
||||||
if (switchChecked){
|
if (switchChecked){
|
||||||
toolBarRenderList.push(<><span>树子集是否参与过滤</span> <Tooltip title="开启树子集过滤后儿子不满足条件,孙子满足条件,儿子和孙子都不会显示。"><QuestionCircleOutlined /></Tooltip>
|
toolBarRenderList.push(<><span>树子集是否参与过滤</span> <Tooltip title="开启树子集过滤后儿子不满足条件,孙子满足条件,儿子和孙子都不会显示。"><QuestionCircleOutlined /></Tooltip>
|
||||||
<Switch checkedChildren="是" unCheckedChildren="否" checked={filterChecked}
|
<Switch checkedChildren="是" unCheckedChildren="否" checked={filterChecked}
|
||||||
onChange={(checked, event) => {setFilterChecked(checked);actionRef.current?.reload();}} /></>)
|
onChange={(checked, event) => {setFilterChecked(checked);reloadData();}} /></>)
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<ProTable<DataType>
|
<ProTable<DataType>
|
||||||
columns={columns}
|
columns={columns}
|
||||||
|
formRef={formRef}
|
||||||
actionRef={actionRef}
|
actionRef={actionRef}
|
||||||
cardBordered
|
cardBordered
|
||||||
request={async (params, sort, filter) => {
|
request={async (params, sort, filter) => {
|
||||||
|
|
Loading…
Reference in New Issue