feat:发布backup
This commit is contained in:
parent
7fa8bb49d6
commit
784001ed4f
|
@ -1,4 +1,3 @@
|
|||
# 前缀为NEXT_PUBLIC_才可以被浏览器使用
|
||||
NEXT_PUBLIC_TODO_REQUEST_URL=http://localhost:8090
|
||||
NEXT_PUBLIC_TODO_REQUEST_URL=http://localhost:8092
|
||||
NEXT_PUBLIC_SECURITY_REQUEST_URL=http://localhost:8091
|
||||
NEXT_PUBLIC_PRIVATE_KEY=
|
|
@ -1 +1,2 @@
|
|||
NEXT_PUBLIC_TODO_REQUEST_URL=http://taskmanagerserver.com:8090
|
||||
NEXT_PUBLIC_TODO_REQUEST_URL=http://www.huaruyu.com/todo-server
|
||||
NEXT_PUBLIC_SECURITY_REQUEST_URL=http://www.huaruyu.com/security-server
|
|
@ -5,4 +5,4 @@ COPY out /usr/share/nginx/html
|
|||
EXPOSE 3001
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
# docker build -t task-manager-nginx .
|
||||
# docker run -d -p 3001:3001 --restart unless-stopped -v ./out:/usr/share/nginx/html --name task-manager-nginx task-manager-nginx
|
||||
# docker run -d -p 3001:3001 --network task-manager --restart unless-stopped -v ./out:/usr/share/nginx/html --name task-manager-nginx task-manager-nginx
|
||||
|
|
|
@ -30,6 +30,48 @@ http {
|
|||
try_files $uri $uri.html $uri/ =404;
|
||||
# try_files $uri $uri/ =404;
|
||||
}
|
||||
location ^~ /todo-server {
|
||||
rewrite ^/todo-server/(.*)$ /$1 break;
|
||||
proxy_pass http://huayu-platform-todo:8092;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
client_body_buffer_size 16k;
|
||||
client_max_body_size 100M;
|
||||
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'Origin, Authorization, Content-Type, Accept, X-Requested-With';
|
||||
|
||||
# 如果请求方法为 OPTIONS,则直接返回 204 状态码
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'Origin, Authorization, Content-Type, Accept, X-Requested-With';
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
location ^~ /security-server {
|
||||
rewrite ^/security-server/(.*)$ /$1 break;
|
||||
proxy_pass http://huayu-platform-security:8091;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
client_body_buffer_size 16k;
|
||||
client_max_body_size 100M;
|
||||
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'Origin, Authorization, Content-Type, Accept, X-Requested-With';
|
||||
|
||||
# 如果请求方法为 OPTIONS,则直接返回 204 状态码
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'Origin, Authorization, Content-Type, Accept, X-Requested-With';
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
location /task/ {
|
||||
rewrite ^/task/(.*)$ /task/$1.html break;
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 25 KiB |
|
@ -20,6 +20,10 @@ export default function RootLayout({
|
|||
<html>
|
||||
<Script src="https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js"/>
|
||||
<Script src="https://cdn.jsdelivr.net/npm/dayjs@1/locale/zh-cn.js"/>
|
||||
<head>
|
||||
<title>任务管理</title>
|
||||
<link rel="icon" href="/favicon.ico"/>
|
||||
</head>
|
||||
<body style={{margin: 0}}>{children}</body>
|
||||
</html>
|
||||
);
|
||||
|
|
|
@ -8,18 +8,18 @@ import {
|
|||
WeiboOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import {
|
||||
LoginForm,
|
||||
LoginFormPage,
|
||||
ProConfigProvider,
|
||||
ProFormCaptcha,
|
||||
ProFormCheckbox,
|
||||
ProFormText,
|
||||
} from '@ant-design/pro-components';
|
||||
import {Button, Divider, Space, Tabs, message, theme} from 'antd';
|
||||
import { Divider, Space, Tabs, message, theme} from 'antd';
|
||||
import type {CSSProperties} from 'react';
|
||||
import {useState} from 'react';
|
||||
import {LoginObject} from "@/lib/login/definitions";
|
||||
import {httpReq} from "@/utils/axiosReq";
|
||||
import Cookies from 'js-cookie';
|
||||
import { useRouter } from 'next/navigation'
|
||||
type LoginType = 'phone' | 'account';
|
||||
|
||||
|
@ -31,9 +31,10 @@ const iconStyles: CSSProperties = {
|
|||
};
|
||||
|
||||
const Page = () => {
|
||||
const [loginType, setLoginType] = useState<LoginType>('phone');
|
||||
const [loginType, setLoginType] = useState<LoginType>('account');
|
||||
const {token} = theme.useToken();
|
||||
const router = useRouter()
|
||||
const [messageApi, contextHolder] = message.useMessage();
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
|
@ -41,25 +42,26 @@ const Page = () => {
|
|||
height: '100vh',
|
||||
}}
|
||||
>
|
||||
<LoginFormPage
|
||||
backgroundImageUrl="https://mdn.alipayobjects.com/huamei_gcee1x/afts/img/A*y0ZTS6WLwvgAAAAAAAAAAAAADml6AQ/fmt.webp"
|
||||
logo="https://github.githubassets.com/favicons/favicon.png"
|
||||
backgroundVideoUrl="https://gw.alipayobjects.com/v/huamei_gcee1x/afts/video/jXRBRK_VAwoAAAAAAAAAAAAAK4eUAQBr"
|
||||
title="Github"
|
||||
{contextHolder}
|
||||
<LoginForm
|
||||
// backgroundImageUrl="https://mdn.alipayobjects.com/huamei_gcee1x/afts/img/A*y0ZTS6WLwvgAAAAAAAAAAAAADml6AQ/fmt.webp"
|
||||
// logo="https://github.githubassets.com/favicons/favicon.png"
|
||||
// backgroundVideoUrl="https://gw.alipayobjects.com/v/huamei_gcee1x/afts/video/jXRBRK_VAwoAAAAAAAAAAAAAK4eUAQBr"
|
||||
title="任务管理"
|
||||
containerStyle={{
|
||||
backgroundColor: 'rgba(0, 0, 0,0.65)',
|
||||
backdropFilter: 'blur(4px)',
|
||||
}}
|
||||
subTitle="全球最大的代码托管平台"
|
||||
activityConfig={{
|
||||
style: {
|
||||
boxShadow: '0px 0px 8px rgba(0, 0, 0, 0.2)',
|
||||
color: token.colorTextHeading,
|
||||
borderRadius: 8,
|
||||
backgroundColor: 'rgba(255,255,255,0.25)',
|
||||
backdropFilter: 'blur(4px)',
|
||||
},
|
||||
}}
|
||||
// subTitle="任务管理"
|
||||
// activityConfig={{
|
||||
// style: {
|
||||
// boxShadow: '0px 0px 8px rgba(0, 0, 0, 0.2)',
|
||||
// color: token.colorTextHeading,
|
||||
// borderRadius: 8,
|
||||
// backgroundColor: 'rgba(255,255,255,0.25)',
|
||||
// backdropFilter: 'blur(4px)',
|
||||
// },
|
||||
// }}
|
||||
onFinish={(formData:LoginObject)=>{
|
||||
console.log("登录信息:"+formData.username+";"+formData.password)
|
||||
httpReq.post(process.env.NEXT_PUBLIC_SECURITY_REQUEST_URL+"/stateless/login/username",{
|
||||
|
@ -73,72 +75,77 @@ const Page = () => {
|
|||
// 删除名为 'platform-security' 的Cookie
|
||||
// Cookies.remove('platform-security');
|
||||
// 设置一个有效期为7天的Cookie
|
||||
Cookies.set('platform-security', response.data.data, { expires: 7 });
|
||||
// Cookies.set('platform-security', response.data.data, { expires: 7 });
|
||||
// 登录成功,跳转到首页或者回调
|
||||
router.push('/task/project')
|
||||
}else{
|
||||
messageApi.open({
|
||||
type: 'error',
|
||||
content: response.data.status.message,
|
||||
})
|
||||
};
|
||||
})
|
||||
}}
|
||||
actions={
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'column',}}>
|
||||
<Divider plain>
|
||||
<span style={{
|
||||
color: token.colorTextPlaceholder,
|
||||
fontWeight: 'normal',
|
||||
fontSize: 14,}}>
|
||||
其他登录方式
|
||||
</span>
|
||||
</Divider>
|
||||
<Space align="center" size={24}>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'column',
|
||||
height: 40,
|
||||
width: 40,
|
||||
border: '1px solid ' + token.colorPrimaryBorder,
|
||||
borderRadius: '50%',
|
||||
}}
|
||||
>
|
||||
<AlipayOutlined style={{...iconStyles, color: '#1677FF'}}/>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'column',
|
||||
height: 40,
|
||||
width: 40,
|
||||
border: '1px solid ' + token.colorPrimaryBorder,
|
||||
borderRadius: '50%',
|
||||
}}
|
||||
>
|
||||
<TaobaoOutlined style={{...iconStyles, color: '#FF6A10'}}/>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
flexDirection: 'column',
|
||||
height: 40,
|
||||
width: 40,
|
||||
border: '1px solid ' + token.colorPrimaryBorder,
|
||||
borderRadius: '50%',
|
||||
}}
|
||||
>
|
||||
<WeiboOutlined style={{...iconStyles, color: '#1890ff'}}/>
|
||||
</div>
|
||||
</Space>
|
||||
</div>
|
||||
}
|
||||
// actions={
|
||||
// <div style={{
|
||||
// display: 'flex',
|
||||
// justifyContent: 'center',
|
||||
// alignItems: 'center',
|
||||
// flexDirection: 'column',}}>
|
||||
// <Divider plain>
|
||||
// <span style={{
|
||||
// color: token.colorTextPlaceholder,
|
||||
// fontWeight: 'normal',
|
||||
// fontSize: 14,}}>
|
||||
// 其他登录方式
|
||||
// </span>
|
||||
// </Divider>
|
||||
// <Space align="center" size={24}>
|
||||
// <div
|
||||
// style={{
|
||||
// display: 'flex',
|
||||
// justifyContent: 'center',
|
||||
// alignItems: 'center',
|
||||
// flexDirection: 'column',
|
||||
// height: 40,
|
||||
// width: 40,
|
||||
// border: '1px solid ' + token.colorPrimaryBorder,
|
||||
// borderRadius: '50%',
|
||||
// }}
|
||||
// >
|
||||
// <AlipayOutlined style={{...iconStyles, color: '#1677FF'}}/>
|
||||
// </div>
|
||||
// <div
|
||||
// style={{
|
||||
// display: 'flex',
|
||||
// justifyContent: 'center',
|
||||
// alignItems: 'center',
|
||||
// flexDirection: 'column',
|
||||
// height: 40,
|
||||
// width: 40,
|
||||
// border: '1px solid ' + token.colorPrimaryBorder,
|
||||
// borderRadius: '50%',
|
||||
// }}
|
||||
// >
|
||||
// <TaobaoOutlined style={{...iconStyles, color: '#FF6A10'}}/>
|
||||
// </div>
|
||||
// <div
|
||||
// style={{
|
||||
// display: 'flex',
|
||||
// justifyContent: 'center',
|
||||
// alignItems: 'center',
|
||||
// flexDirection: 'column',
|
||||
// height: 40,
|
||||
// width: 40,
|
||||
// border: '1px solid ' + token.colorPrimaryBorder,
|
||||
// borderRadius: '50%',
|
||||
// }}
|
||||
// >
|
||||
// <WeiboOutlined style={{...iconStyles, color: '#1890ff'}}/>
|
||||
// </div>
|
||||
// </Space>
|
||||
// </div>
|
||||
// }
|
||||
>
|
||||
<Tabs
|
||||
centered
|
||||
|
@ -272,12 +279,12 @@ const Page = () => {
|
|||
忘记密码
|
||||
</a>
|
||||
</div>
|
||||
</LoginFormPage>
|
||||
</LoginForm>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default () => {
|
||||
export default function Login(){
|
||||
return (
|
||||
<ProConfigProvider dark>
|
||||
<Page/>
|
||||
|
|
|
@ -6,7 +6,7 @@ import {useEffect} from "react";
|
|||
export default function Home() {
|
||||
const {replace} = useRouter();
|
||||
useEffect(()=>{
|
||||
replace("/task/four")
|
||||
replace("/login")
|
||||
},[])
|
||||
dayjs.locale('zh-cn')
|
||||
return (
|
||||
|
|
|
@ -29,9 +29,9 @@ export type ResponseVO<T>={
|
|||
|
||||
export type DataType ={
|
||||
key: React.ReactNode;
|
||||
id: number;
|
||||
pid:number;
|
||||
pPid:number;
|
||||
id: string;
|
||||
pid:string;
|
||||
pPid:string;
|
||||
code: string;
|
||||
name: string;
|
||||
description: string;
|
||||
|
|
|
@ -2,111 +2,67 @@ import {unstable_noStore as noStore} from 'next/cache';
|
|||
import {AxiosResponse} from "axios";
|
||||
import {httpReq} from "@/utils/axiosReq";
|
||||
import {DataType, DictType, ResponseVO, ResultPage} from "@/lib/definitions";
|
||||
export async function getTaskTreeResult(requestParam:string): Promise<ResponseVO<ResultPage<DataType>>> {
|
||||
|
||||
export async function getTaskTreeResult(requestParam: string): Promise<ResponseVO<ResultPage<DataType>>> {
|
||||
noStore();
|
||||
try {
|
||||
// 使用 Axios 发送 POST 请求获取数据
|
||||
const response: AxiosResponse<ResponseVO<ResultPage<DataType>>> = await httpReq.get(
|
||||
process.env.NEXT_PUBLIC_TODO_REQUEST_URL+'/search/task_message_tree?search='+encodeURIComponent(requestParam));
|
||||
// 从响应中提取数据并返回
|
||||
console.log("response.data",response.data)
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
// 处理错误
|
||||
console.error('Error fetching data:', error);
|
||||
// 返回一个默认值或者抛出错误
|
||||
throw new Error('Failed to fetch data');
|
||||
}
|
||||
// 使用 Axios 发送 POST 请求获取数据
|
||||
const response: AxiosResponse<ResponseVO<ResultPage<DataType>>> = await httpReq.get(
|
||||
process.env.NEXT_PUBLIC_TODO_REQUEST_URL + '/search/task_message_tree?search=' + encodeURIComponent(requestParam));
|
||||
// 从响应中提取数据并返回
|
||||
console.log("response.data", response.data)
|
||||
return response.data;
|
||||
}
|
||||
export async function commonUpdate(requestParam:any): Promise<ResponseVO<string>> {
|
||||
|
||||
export async function commonUpdate(requestParam: any): Promise<ResponseVO<string>> {
|
||||
noStore();
|
||||
try {
|
||||
// 使用 Axios 发送 PUT 请求获取数据
|
||||
const response: AxiosResponse<ResponseVO<string>> = await httpReq.put(
|
||||
process.env.NEXT_PUBLIC_TODO_REQUEST_URL+'/search/task_message_tree',requestParam);
|
||||
// 从响应中提取数据并返回
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
// 处理错误
|
||||
console.error('Error fetching data:', error);
|
||||
// 返回一个默认值或者抛出错误
|
||||
throw new Error('Failed to fetch data');
|
||||
}
|
||||
// 使用 Axios 发送 PUT 请求获取数据
|
||||
const response: AxiosResponse<ResponseVO<string>> = await httpReq.put(
|
||||
process.env.NEXT_PUBLIC_TODO_REQUEST_URL + '/search/task_message_tree', requestParam);
|
||||
// 从响应中提取数据并返回
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export async function taskTreeResult(): Promise<ResponseVO<ResultPage<DataType>>> {
|
||||
noStore();
|
||||
try {
|
||||
// 使用 httpReq 发送 POST 请求获取数据
|
||||
const response: AxiosResponse<ResponseVO<ResultPage<DataType>>> = await httpReq.post(process.env.NEXT_PUBLIC_TODO_REQUEST_URL+'/task/tree', {
|
||||
pageSize: 10,
|
||||
pageNumber: 1
|
||||
});
|
||||
// 从响应中提取数据并返回
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
// 处理错误
|
||||
console.error('Error fetching data:', error);
|
||||
// 返回一个默认值或者抛出错误
|
||||
throw new Error('Failed to fetch data');
|
||||
}
|
||||
}
|
||||
export async function getTask(id:number): Promise<ResponseVO<DataType>> {
|
||||
noStore();
|
||||
try {
|
||||
// 使用 Axios 发送 GET 请求获取数据
|
||||
const response: AxiosResponse<ResponseVO<DataType>> = await httpReq.get(process.env.NEXT_PUBLIC_TODO_REQUEST_URL+'/task/'+id);
|
||||
// 从响应中提取数据并返回
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
// 处理错误
|
||||
console.error('Error fetching data:', error);
|
||||
// 返回一个默认值或者抛出错误
|
||||
throw new Error('Failed to fetch data');
|
||||
}
|
||||
// 使用 httpReq 发送 POST 请求获取数据
|
||||
const response: AxiosResponse<ResponseVO<ResultPage<DataType>>> = await httpReq.post(process.env.NEXT_PUBLIC_TODO_REQUEST_URL + '/task/tree', {
|
||||
pageSize: 10,
|
||||
pageNumber: 1
|
||||
});
|
||||
// 从响应中提取数据并返回
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export async function addTask(task:DataType): Promise<ResponseVO<string>> {
|
||||
export async function getTask(id: string): Promise<ResponseVO<DataType>> {
|
||||
noStore();
|
||||
try {
|
||||
// 使用 Axios 发送 POST 请求添加数据
|
||||
const response: AxiosResponse<ResponseVO<string>> = await httpReq.post(process.env.NEXT_PUBLIC_TODO_REQUEST_URL+'/task', task);
|
||||
// 从响应中提取数据并返回
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
// 处理错误
|
||||
console.error('Error fetching data:', error);
|
||||
// 返回一个默认值或者抛出错误
|
||||
throw new Error('Failed to fetch data');
|
||||
}
|
||||
// 使用 Axios 发送 GET 请求获取数据
|
||||
const response: AxiosResponse<ResponseVO<DataType>> = await httpReq.get(process.env.NEXT_PUBLIC_TODO_REQUEST_URL + '/task/' + id);
|
||||
// 从响应中提取数据并返回
|
||||
return response.data;
|
||||
}
|
||||
export async function updateTask(task:DataType): Promise<ResponseVO<string>> {
|
||||
|
||||
export async function addTask(task: DataType): Promise<ResponseVO<string>> {
|
||||
noStore();
|
||||
try {
|
||||
// 使用 Axios 发送 PUT 请求修改数据
|
||||
const response: AxiosResponse<ResponseVO<string>> = await httpReq.put(process.env.NEXT_PUBLIC_TODO_REQUEST_URL+'/task', task);
|
||||
// 从响应中提取数据并返回
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
// 处理错误
|
||||
console.error('Error fetching data:', error);
|
||||
// 返回一个默认值或者抛出错误
|
||||
throw new Error('Failed to fetch data');
|
||||
}
|
||||
// 使用 Axios 发送 POST 请求添加数据
|
||||
const response: AxiosResponse<ResponseVO<string>> = await httpReq.post(process.env.NEXT_PUBLIC_TODO_REQUEST_URL + '/task', task);
|
||||
// 从响应中提取数据并返回
|
||||
return response.data;
|
||||
}
|
||||
export async function deleteTask(id:number): Promise<ResponseVO<string>> {
|
||||
|
||||
export async function updateTask(task: DataType): Promise<ResponseVO<string>> {
|
||||
noStore();
|
||||
try {
|
||||
// 使用 Axios 发送 DELETE 删除数据
|
||||
const response: AxiosResponse<ResponseVO<string>> = await httpReq.delete(process.env.NEXT_PUBLIC_TODO_REQUEST_URL+'/task/'+id);
|
||||
// 从响应中提取数据并返回
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
// 处理错误
|
||||
console.error('Error fetching data:', error);
|
||||
// 返回一个默认值或者抛出错误
|
||||
throw new Error('Failed to fetch data');
|
||||
}
|
||||
// 使用 Axios 发送 PUT 请求修改数据
|
||||
const response: AxiosResponse<ResponseVO<string>> = await httpReq.put(process.env.NEXT_PUBLIC_TODO_REQUEST_URL + '/task', task);
|
||||
// 从响应中提取数据并返回
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export async function deleteTask(id: string): Promise<ResponseVO<string>> {
|
||||
noStore();
|
||||
// 使用 Axios 发送 DELETE 删除数据
|
||||
const response: AxiosResponse<ResponseVO<string>> = await httpReq.delete(process.env.NEXT_PUBLIC_TODO_REQUEST_URL + '/task/' + id);
|
||||
// 从响应中提取数据并返回
|
||||
return response.data;
|
||||
}
|
||||
|
||||
//0,重要紧急红色,1,重要不紧急黄色,2,不重要紧急灰色,3不重要,不紧急绿色
|
||||
|
@ -124,7 +80,7 @@ export const taskPriorityList: DictType[] = [
|
|||
order: 1,
|
||||
color: 'yellow'
|
||||
}, {
|
||||
id:1,
|
||||
id: 1,
|
||||
code: '1',
|
||||
name: '不重要紧急',
|
||||
order: 2,
|
||||
|
@ -210,6 +166,7 @@ export const taskStateList: DictType[] = [
|
|||
color: 'YELLOW'
|
||||
}
|
||||
]
|
||||
|
||||
export enum OPERATION_BUTTON_TYPE {
|
||||
DETAIL,
|
||||
ADD_CHILD,
|
||||
|
|
|
@ -1,23 +1,22 @@
|
|||
import React, {Fragment} from "react";
|
||||
import {Button, Dropdown, MenuProps, message, Modal, Popconfirm, Space} from "antd";
|
||||
import {DownOutlined, QuestionCircleOutlined} from "@ant-design/icons";
|
||||
import {DetailForm} from "@/ui/task/four/DetailForm";
|
||||
import {commonUpdate, deleteTask, OPERATION_BUTTON_TYPE} from "@/lib/task/project/data";
|
||||
import Link from "next/link";
|
||||
import {DetailModelForm} from "@/ui/task/project/DetailModelForm";
|
||||
|
||||
export interface OperationButtonProps {
|
||||
itemId: number,
|
||||
pid: number,
|
||||
pPid: number,
|
||||
itemId: string,
|
||||
pid: string,
|
||||
pPid: string,
|
||||
operationId?: string,
|
||||
refreshDate?: () => void,
|
||||
}
|
||||
|
||||
interface OperationModelProps {
|
||||
operationId: number,
|
||||
pPid: number,
|
||||
pid: number,
|
||||
pPid: string,
|
||||
pid: string,
|
||||
openModal: boolean
|
||||
}
|
||||
|
||||
|
|
|
@ -20,10 +20,10 @@ import dayjs, {Dayjs} from "dayjs";
|
|||
|
||||
export type DetailModelFormProps={
|
||||
// 当前内容id
|
||||
itemId?: number,
|
||||
pid?:number,
|
||||
itemId?: string,
|
||||
pid?:string,
|
||||
// 祖宗任务id
|
||||
pPid?:number,
|
||||
pPid?:string,
|
||||
// 操作id
|
||||
operationId: number,
|
||||
// 标题描述
|
||||
|
@ -37,12 +37,12 @@ export type DetailModelFormProps={
|
|||
// 重新加载数据
|
||||
reloadData?: () => void
|
||||
}
|
||||
export type PidSelectTree= { label: string; value: number;pid:number; children?: PidSelectTree[] }
|
||||
export type PidSelectTree= { label: string; value: string;pid:string; children?: PidSelectTree[] }
|
||||
|
||||
export const DetailModelForm: React.FC<DetailModelFormProps> = (props) => {
|
||||
console.log("DetailModelForm:props:",props)
|
||||
const [form] = Form.useForm<DataType>();
|
||||
const [pid, setPid] = useState<number>(props.pid?props.pid:0);
|
||||
const [pid, setPid] = useState<string>(props.pid?props.pid:'0');
|
||||
const [editFormDisable, setEditFormDisable] = useState(props.operationId === OPERATION_BUTTON_TYPE.DETAIL)
|
||||
useEffect(() => {
|
||||
if (props.itemId!=undefined&&(
|
||||
|
@ -58,6 +58,7 @@ export const DetailModelForm: React.FC<DetailModelFormProps> = (props) => {
|
|||
task.data.expectedTimeRange = [task.data.expectedStartTime ? dayjs(task.data.expectedStartTime) : undefined,
|
||||
task.data.expectedEndTime ? dayjs(task.data.expectedEndTime) : undefined];
|
||||
form.setFieldsValue(task.data)
|
||||
console.log("form.setFieldsValue(task.data)"+JSON.stringify(task.data))
|
||||
} else {
|
||||
message.error(task.status.message);
|
||||
props.reloadData?.()
|
||||
|
@ -99,7 +100,7 @@ export const DetailModelForm: React.FC<DetailModelFormProps> = (props) => {
|
|||
props.reloadData?.();
|
||||
},
|
||||
}}
|
||||
submitter={props.itemId!==undefined&&props.itemId!==-1?{
|
||||
submitter={props.itemId!==undefined&&props.itemId!=='-1'?{
|
||||
render: (prop, defaultDoms) => {
|
||||
return [
|
||||
editFormDisable?<Button
|
||||
|
@ -141,7 +142,7 @@ export const DetailModelForm: React.FC<DetailModelFormProps> = (props) => {
|
|||
onFinish={async (values) => {
|
||||
console.log('Received values of form: ', values);
|
||||
if (values.pid===undefined){
|
||||
values.pid=0
|
||||
values.pid='0'
|
||||
}
|
||||
if (values.expectedTimeRange?.[0]!=undefined) {
|
||||
values.expectedStartTime=dayjs(values.expectedTimeRange[0]).toDate()
|
||||
|
@ -155,7 +156,6 @@ export const DetailModelForm: React.FC<DetailModelFormProps> = (props) => {
|
|||
if (values.actualTimeRange?.[1]!=undefined) {
|
||||
values.actualEndTime=dayjs(values.actualTimeRange[1]).toDate()
|
||||
}
|
||||
values.pid=pid;
|
||||
var result:boolean=false;
|
||||
|
||||
let state = taskStateList.find(taskState => taskState.name === values.state?.toString());
|
||||
|
|
|
@ -25,7 +25,7 @@ const TreeTablePro: React.FC = () => {
|
|||
const [switchChecked, setSwitchChecked] = React.useState(true);
|
||||
const [filterChecked, setFilterChecked] = React.useState(true);
|
||||
const [current,setCurrent] = React.useState(1);
|
||||
const [pageSize,setPageSize] = React.useState(5);
|
||||
const [pageSize,setPageSize] = React.useState(10);
|
||||
const { RangePicker } = DatePicker;
|
||||
const columns: ProColumns<DataType>[] = [
|
||||
{
|
||||
|
|
|
@ -1,46 +1,83 @@
|
|||
import axios, {Canceler, CancelToken, CancelTokenSource} from "axios";
|
||||
import {message} from "antd";
|
||||
|
||||
|
||||
export const httpReq = axios.create({
|
||||
// cancelToken: new CancelToken(function (cancel:Canceler) {
|
||||
// },),
|
||||
// validateStatus: function (status) {
|
||||
// return status >= 200 && status < 300; // default
|
||||
// },
|
||||
validateStatus: function (status) {
|
||||
return status >= 200 && status < 300; // default
|
||||
},
|
||||
timeout: 2000,
|
||||
timeoutErrorMessage: "网络连接超时",
|
||||
withCredentials: false,
|
||||
})
|
||||
// 从cookie获取token
|
||||
|
||||
// 创建一个取消令牌
|
||||
const cancelTokenSource: CancelTokenSource = axios.CancelToken.source();
|
||||
|
||||
// 默认json格式
|
||||
httpReq.defaults.headers.common['Accept'] = 'application/json';
|
||||
// 请求前处理
|
||||
httpReq.interceptors.request.use((config) => {
|
||||
const token = localStorage.getItem('platform-security'); // 从本地存储中获取 token
|
||||
// 从本地存储中获取 token
|
||||
const token = localStorage.getItem('platform-security');
|
||||
if (token) {
|
||||
// config.headers.Authorization = `Bearer ${token}`;
|
||||
config.headers.Authorization = `${token}`;
|
||||
config.headers.Authorization = `Bearer ${token}`;
|
||||
}
|
||||
return config;
|
||||
},
|
||||
(error) => {
|
||||
console.info("interceptors错误提示.request" + error)
|
||||
return Promise.reject(error);
|
||||
})
|
||||
// 响应前处理
|
||||
httpReq.interceptors.response.use(
|
||||
(response) => {
|
||||
// http请求最外层
|
||||
if (response.status >= 500) {
|
||||
console.log("系统异常")
|
||||
message.error('系统异常');
|
||||
} else if (response.status >= 400 && response.status <= 500) {
|
||||
console.log("无权限")
|
||||
message.warning('无权限');
|
||||
}
|
||||
return response;
|
||||
},
|
||||
(error) => {
|
||||
if (error.response && error.response.status === 401) {
|
||||
localStorage.removeItem('authToken');
|
||||
window.location.href = '/login';
|
||||
if (axios.isCancel(error)) {
|
||||
message.error('连接取消');
|
||||
} else if (axios.isAxiosError(error)) {
|
||||
console.error('Axios Error:', error.message);
|
||||
if (error.response) {
|
||||
if (error.response.status >= 500) {
|
||||
message.error('系统异常');
|
||||
} else if (error.response.status >= 400 && error.response.status <= 500) {
|
||||
message.warning('无权限');
|
||||
window.location.href = '/login';
|
||||
}
|
||||
// switch (error.response.status) {
|
||||
// case 401:
|
||||
// localStorage.removeItem('authToken');
|
||||
// window.location.href = '/login';
|
||||
// break;
|
||||
// case 403:
|
||||
// console.error('Forbidden:', error.response.data);
|
||||
// break;
|
||||
// case 404:
|
||||
// console.error('Not Found:', error.response.data);
|
||||
// break;
|
||||
// case 500:
|
||||
// console.error('Internal Server Error:', error.response.data);
|
||||
// break;
|
||||
// default:
|
||||
// console.error('Unknown Error:', error.response.data);
|
||||
// break;
|
||||
// }
|
||||
} else {
|
||||
message.error('No Response:' + error.message);
|
||||
}
|
||||
} else {
|
||||
console.error('Unknown Error:', error);
|
||||
}
|
||||
|
||||
console.info("interceptors.response错误提示" + error)
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
Loading…
Reference in New Issue