2024-03-13 16:11:28 +08:00
|
|
|
|
import './card-proj.css';
|
2024-03-19 19:19:07 +08:00
|
|
|
|
import {
|
2024-03-26 21:09:41 +08:00
|
|
|
|
CheckOutlined,
|
|
|
|
|
ClockCircleOutlined,
|
|
|
|
|
CloseCircleOutlined,
|
|
|
|
|
CreditCardOutlined,
|
2024-04-01 20:39:22 +08:00
|
|
|
|
DownloadOutlined, DownOutlined,
|
2024-03-19 19:19:07 +08:00
|
|
|
|
EditOutlined,
|
|
|
|
|
EyeOutlined,
|
2024-03-26 21:09:41 +08:00
|
|
|
|
LoadingOutlined,
|
2024-03-19 19:19:07 +08:00
|
|
|
|
SearchOutlined,
|
|
|
|
|
SettingOutlined,
|
2024-03-26 21:09:41 +08:00
|
|
|
|
WarningOutlined
|
2024-03-19 19:19:07 +08:00
|
|
|
|
} from '@ant-design/icons';
|
2024-04-01 20:39:22 +08:00
|
|
|
|
import {Button, ConfigProvider, Dropdown, Tag} from 'antd';
|
2024-03-19 19:19:07 +08:00
|
|
|
|
import {GenerateStatus, IProj, PayStatus} from "../../interfaces/proj/IProj.ts";
|
2024-03-26 21:09:41 +08:00
|
|
|
|
import {useNavigate} from "react-router-dom";
|
2024-04-01 20:39:22 +08:00
|
|
|
|
import {Axios, put} from "../../util/AjaxUtils.ts";
|
|
|
|
|
import {useContext, useState} from "react";
|
|
|
|
|
import {IndexListContext} from "../../context/IndexListContext.ts";
|
|
|
|
|
import useMessage from "antd/es/message/useMessage";
|
2024-03-19 19:19:07 +08:00
|
|
|
|
|
|
|
|
|
export default function CardProj(props: { item: IProj }) {
|
2024-03-26 21:09:41 +08:00
|
|
|
|
const nav = useNavigate();
|
2024-03-19 19:19:07 +08:00
|
|
|
|
const data = props.item;
|
2024-04-01 20:39:22 +08:00
|
|
|
|
const [messageApi, messageContext] = useMessage();
|
|
|
|
|
const [projCategoryName, setProjCategoryName] = useState(data.projCategoryName);
|
|
|
|
|
const indexListContext = useContext(IndexListContext);
|
|
|
|
|
|
2024-03-19 19:19:07 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生成状态
|
|
|
|
|
*/
|
|
|
|
|
const renderGenerateStatus = () => {
|
2024-03-26 21:09:41 +08:00
|
|
|
|
if (data.generate.generateStatus == GenerateStatus.PENDING) {
|
2024-03-19 19:19:07 +08:00
|
|
|
|
return <Tag color="cyan"><ClockCircleOutlined/> 等待生成</Tag>
|
|
|
|
|
}
|
2024-03-26 21:09:41 +08:00
|
|
|
|
if (data.generate.generateStatus == GenerateStatus.GENERATING) {
|
2024-03-19 19:19:07 +08:00
|
|
|
|
return <Tag color="magenta"><LoadingOutlined/> 正在生成</Tag>
|
|
|
|
|
}
|
2024-03-26 21:09:41 +08:00
|
|
|
|
if (data.generate.generateStatus == GenerateStatus.SUCCESS) {
|
2024-03-19 19:19:07 +08:00
|
|
|
|
return <Tag color="green"><CheckOutlined/> 生成成功</Tag>
|
|
|
|
|
}
|
2024-03-26 21:09:41 +08:00
|
|
|
|
if (data.generate.generateStatus == GenerateStatus.FAILED) {
|
2024-03-19 19:19:07 +08:00
|
|
|
|
return <Tag color="red"><WarningOutlined/> 生成失败</Tag>
|
|
|
|
|
}
|
2024-03-26 21:09:41 +08:00
|
|
|
|
if (data.generate.generateStatus == GenerateStatus.NONE) {
|
2024-03-19 19:19:07 +08:00
|
|
|
|
return <Tag color="cyan">未生成</Tag>
|
|
|
|
|
}
|
|
|
|
|
return <Tag color="red"><CloseCircleOutlined/> 错误</Tag>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const renderOption = () => {
|
2024-04-01 20:39:22 +08:00
|
|
|
|
if (data.pay.payStatus == PayStatus.UNPAID) {
|
2024-03-19 19:19:07 +08:00
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<div className="option">
|
2024-04-01 20:39:22 +08:00
|
|
|
|
<Button size="small" type="text"><CreditCardOutlined/> 待付款</Button>
|
2024-03-19 19:19:07 +08:00
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<div className="option">
|
2024-03-26 21:09:41 +08:00
|
|
|
|
<Button size="small" type="text" onClick={() => {
|
2024-04-01 20:39:22 +08:00
|
|
|
|
if (data.generate.generateStatus == GenerateStatus.SUCCESS) {
|
2024-03-26 21:09:41 +08:00
|
|
|
|
nav(`/proj-edit/config-loginpage-show/${data.projId}`)
|
|
|
|
|
} else {
|
|
|
|
|
nav(`/proj-edit/config-loginpage/${data.projId}`)
|
|
|
|
|
}
|
|
|
|
|
}}><SettingOutlined/> 登录界面设置</Button>
|
|
|
|
|
<Button size="small" type="text" onClick={() => {
|
2024-04-01 20:39:22 +08:00
|
|
|
|
if (data.generate.generateStatus == GenerateStatus.SUCCESS) {
|
2024-03-26 21:09:41 +08:00
|
|
|
|
nav(`/proj-edit/config-mod-list-show/${data.projId}`)
|
|
|
|
|
} else {
|
|
|
|
|
nav(`/proj-edit/config-mod-list/${data.projId}`)
|
|
|
|
|
}
|
2024-03-28 19:35:54 +08:00
|
|
|
|
}}><SettingOutlined/> 系统菜单管理({data.projModCount})</Button>
|
2024-03-26 21:09:41 +08:00
|
|
|
|
<Button size="small" type="text" onClick={() => {
|
2024-04-01 20:39:22 +08:00
|
|
|
|
if (data.generate.generateStatus == GenerateStatus.SUCCESS) {
|
2024-03-26 21:09:41 +08:00
|
|
|
|
nav(`/proj-edit/config-menu-list-show/${data.projId}`)
|
|
|
|
|
} else {
|
|
|
|
|
nav(`/proj-edit/config-menu-list/${data.projId}`)
|
|
|
|
|
|
|
|
|
|
}
|
2024-03-28 19:35:54 +08:00
|
|
|
|
}}><SettingOutlined/> 菜单排序({data.projModCount})</Button>
|
2024-03-19 19:19:07 +08:00
|
|
|
|
</div>
|
|
|
|
|
{
|
2024-03-26 21:09:41 +08:00
|
|
|
|
data.generate.generateStatus == GenerateStatus.SUCCESS ? (
|
2024-03-19 19:19:07 +08:00
|
|
|
|
<div className="option">
|
2024-03-26 21:09:41 +08:00
|
|
|
|
<Button size="small" type="text" onClick={() => {
|
|
|
|
|
window.open(`${Axios.defaults?.baseURL}/route/proj/download/apply/${data.projId}`)
|
|
|
|
|
}}><DownloadOutlined/> 申请表</Button>
|
|
|
|
|
<Button size="small" type="text" onClick={() => {
|
|
|
|
|
window.open(`${Axios.defaults?.baseURL}/route/proj/download/manual/${data.projId}`)
|
|
|
|
|
}}><DownloadOutlined/> 操作手册</Button>
|
|
|
|
|
<Button size="small" type="text" onClick={() => {
|
|
|
|
|
window.open(`${Axios.defaults?.baseURL}/route/proj/download/code-zip/${data.projId}`)
|
|
|
|
|
}}><DownloadOutlined/> 代码压缩包</Button>
|
|
|
|
|
<Button size="small" type="text" onClick={() => {
|
|
|
|
|
window.open(`${Axios.defaults?.baseURL}/route/proj/download/code/${data.projId}`)
|
|
|
|
|
}}><DownloadOutlined/> 代码文档</Button>
|
2024-03-19 19:19:07 +08:00
|
|
|
|
</div>
|
|
|
|
|
) : <></>
|
|
|
|
|
}
|
|
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
|
}
|
2024-03-13 16:11:28 +08:00
|
|
|
|
|
|
|
|
|
return (
|
2024-04-01 20:39:22 +08:00
|
|
|
|
<>
|
|
|
|
|
{messageContext}
|
|
|
|
|
<div className="card-proj">
|
|
|
|
|
<div className="title">
|
2024-03-13 16:11:28 +08:00
|
|
|
|
<div className="left">
|
2024-04-01 20:39:22 +08:00
|
|
|
|
<a href="/#">{data.projName}</a>
|
2024-03-13 16:11:28 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div className="right">
|
2024-04-01 20:39:22 +08:00
|
|
|
|
<span className="context">上下文:{data.projContext}</span>
|
|
|
|
|
<span className="date">{data.gmtCreate}</span>
|
|
|
|
|
<span className="status">{renderGenerateStatus()}</span>
|
2024-03-13 16:11:28 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-04-01 20:39:22 +08:00
|
|
|
|
<hr/>
|
|
|
|
|
<div className="body">
|
|
|
|
|
<div className="line">
|
|
|
|
|
<div className="left">
|
|
|
|
|
<span>金额¥:{data.pay.payment / 100}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="right">
|
|
|
|
|
{
|
|
|
|
|
data.generate.generateStatus == GenerateStatus.SUCCESS ? (
|
|
|
|
|
<span>
|
|
|
|
|
<SearchOutlined/>
|
|
|
|
|
<a href="/#" onClick={(e) => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
nav(`/proj-edit/${data.projId}`)
|
|
|
|
|
}}>查看</a>
|
|
|
|
|
</span>
|
|
|
|
|
) : (
|
|
|
|
|
<span>
|
|
|
|
|
<EditOutlined/>
|
|
|
|
|
<a href="/#" onClick={(e) => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
nav(`/proj-edit/${data.projId}`)
|
|
|
|
|
}}>编辑</a>
|
|
|
|
|
</span>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
<span>
|
|
|
|
|
<EyeOutlined/>
|
|
|
|
|
<a href="/#" onClick={(e) => {
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
window.open(`${Axios.defaults?.baseURL}/${data.previewUrl}`, '_blank')
|
|
|
|
|
}}>预览</a>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
2024-03-28 19:35:54 +08:00
|
|
|
|
</div>
|
2024-04-01 20:39:22 +08:00
|
|
|
|
<div className="line">
|
|
|
|
|
<div className="left">
|
|
|
|
|
{
|
|
|
|
|
data.generate.generateStatus == GenerateStatus.SUCCESS ? (
|
|
|
|
|
<span>
|
|
|
|
|
<SearchOutlined/>
|
|
|
|
|
<a href="/#" onClick={(e) => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
nav(`/agent-select/${data.projId}`);
|
|
|
|
|
}}>找代理</a>
|
|
|
|
|
</span>
|
|
|
|
|
) : <></>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="right">
|
|
|
|
|
<Dropdown menu={{
|
|
|
|
|
items: indexListContext.categorys,
|
|
|
|
|
onClick: (e) => {
|
|
|
|
|
const span = e.domEvent.target as HTMLSpanElement;
|
|
|
|
|
put<any>({
|
|
|
|
|
messageApi,
|
|
|
|
|
url: `/api/proj/update-category/${data.projId}/${e.key}`,
|
|
|
|
|
onSuccess() {
|
|
|
|
|
messageApi.success('修改成功');
|
|
|
|
|
setProjCategoryName(span.innerText);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}}>
|
|
|
|
|
<span onClick={() => {
|
|
|
|
|
put<any>({
|
|
|
|
|
messageApi,
|
|
|
|
|
url: `/api/proj/cancel-category/${data.projId}`,
|
|
|
|
|
onSuccess() {
|
|
|
|
|
messageApi.success('取消成功');
|
|
|
|
|
setProjCategoryName('');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}}>
|
|
|
|
|
<a href="/#">{projCategoryName ? projCategoryName : '无目录'}</a>
|
|
|
|
|
<DownOutlined/>
|
|
|
|
|
</span>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
|
|
|
|
|
</div>
|
2024-03-13 16:11:28 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-04-01 20:39:22 +08:00
|
|
|
|
<hr/>
|
|
|
|
|
<div className="foot">
|
|
|
|
|
<ConfigProvider theme={{
|
|
|
|
|
components: {
|
|
|
|
|
Button: {
|
|
|
|
|
contentFontSizeSM: 12,
|
|
|
|
|
}
|
2024-03-18 18:50:36 +08:00
|
|
|
|
}
|
2024-04-01 20:39:22 +08:00
|
|
|
|
}}>
|
|
|
|
|
{renderOption()}
|
|
|
|
|
</ConfigProvider>
|
|
|
|
|
</div>
|
2024-03-18 18:50:36 +08:00
|
|
|
|
</div>
|
2024-04-01 20:39:22 +08:00
|
|
|
|
</>
|
2024-03-13 16:11:28 +08:00
|
|
|
|
)
|
|
|
|
|
}
|