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,
|
2024-04-02 18:45:46 +08:00
|
|
|
|
CreditCardOutlined, DeleteOutlined,
|
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-04-12 14:12:38 +08:00
|
|
|
|
import {GenerateStatus, IProj, PayStatus, ProjChargeType} 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";
|
2024-04-12 14:12:38 +08:00
|
|
|
|
import {useContext, useEffect, useState} from "react";
|
2024-04-01 20:39:22 +08:00
|
|
|
|
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();
|
2024-04-02 18:45:46 +08:00
|
|
|
|
const [projCategoryId, setProjCategoryId] = useState(data.projCategoryId);
|
2024-04-01 20:39:22 +08:00
|
|
|
|
const [projCategoryName, setProjCategoryName] = useState(data.projCategoryName);
|
2024-04-12 18:18:14 +08:00
|
|
|
|
const [charge, setCharge] = useState('');
|
2024-04-12 14:12:38 +08:00
|
|
|
|
const [payCharge, setPayCharge] = useState('');
|
2024-04-01 20:39:22 +08:00
|
|
|
|
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
|
|
|
|
|
2024-04-12 18:18:14 +08:00
|
|
|
|
const goEdit = () => {
|
|
|
|
|
if(charge == ProjChargeType.ALL) {
|
|
|
|
|
nav(`/proj-eall/${data.projId}`);
|
|
|
|
|
} else if(charge == ProjChargeType.FREE) {
|
|
|
|
|
nav(`/proj-efree/${data.projId}`);
|
|
|
|
|
} else {
|
|
|
|
|
nav(`/proj-edit/${data.projId}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-12 14:12:38 +08:00
|
|
|
|
useEffect(() => {
|
|
|
|
|
const charge = props.item.pay.charge.split(':')[0];
|
|
|
|
|
let chargeName = '';
|
|
|
|
|
if (charge == ProjChargeType.ALL) {
|
|
|
|
|
chargeName = '全托管';
|
|
|
|
|
} else if (charge == ProjChargeType.MATERIAL_AGENT) {
|
|
|
|
|
chargeName = '写材料+代理';
|
|
|
|
|
} else if (charge == ProjChargeType.MATERIAL_AGENT_URGENT) {
|
|
|
|
|
chargeName = '写材料+代理(加急)';
|
|
|
|
|
} else if (charge == ProjChargeType.MATERIAL) {
|
|
|
|
|
chargeName = '写材料';
|
|
|
|
|
} else {
|
|
|
|
|
chargeName = '免费试用';
|
|
|
|
|
}
|
2024-04-12 18:18:14 +08:00
|
|
|
|
setCharge(charge)
|
2024-04-12 14:12:38 +08:00
|
|
|
|
setPayCharge(chargeName);
|
|
|
|
|
}, [])
|
|
|
|
|
|
2024-03-13 16:11:28 +08:00
|
|
|
|
return (
|
2024-04-01 20:39:22 +08:00
|
|
|
|
<>
|
|
|
|
|
<div className="card-proj">
|
|
|
|
|
<div className="title">
|
2024-03-13 16:11:28 +08:00
|
|
|
|
<div className="left">
|
2024-04-12 18:18:14 +08:00
|
|
|
|
<span className="text-btn" onClick={goEdit}>{data.projName}</span>
|
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">
|
2024-04-12 14:12:38 +08:00
|
|
|
|
<Tag color="magenta">{payCharge}</Tag>
|
|
|
|
|
<Tag color="gold">¥{data.pay.payment / 100}</Tag>
|
2024-04-01 20:39:22 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div className="right">
|
2024-04-12 14:12:38 +08:00
|
|
|
|
{
|
2024-04-01 20:39:22 +08:00
|
|
|
|
data.generate.generateStatus == GenerateStatus.SUCCESS ? (
|
|
|
|
|
<span>
|
|
|
|
|
<SearchOutlined/>
|
2024-04-12 18:18:14 +08:00
|
|
|
|
<span className="text-btn" onClick={goEdit}>查看</span>
|
2024-04-01 20:39:22 +08:00
|
|
|
|
</span>
|
|
|
|
|
) : (
|
|
|
|
|
<span>
|
|
|
|
|
<EditOutlined/>
|
2024-04-12 18:18:14 +08:00
|
|
|
|
<span className="text-btn" onClick={goEdit}>编辑</span>
|
2024-04-01 20:39:22 +08:00
|
|
|
|
</span>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
<span>
|
|
|
|
|
<EyeOutlined/>
|
2024-04-12 14:12:38 +08:00
|
|
|
|
<span className="text-btn" onClick={() => {
|
2024-04-01 20:39:22 +08:00
|
|
|
|
window.open(`${Axios.defaults?.baseURL}/${data.previewUrl}`, '_blank')
|
2024-04-12 14:12:38 +08:00
|
|
|
|
}}>预览</span>
|
2024-04-01 20:39:22 +08:00
|
|
|
|
</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/>
|
2024-04-12 14:12:38 +08:00
|
|
|
|
<span className="text-btn" onClick={(e) => {
|
2024-04-01 20:39:22 +08:00
|
|
|
|
e.preventDefault();
|
|
|
|
|
nav(`/agent-select/${data.projId}`);
|
2024-04-12 14:12:38 +08:00
|
|
|
|
}}>找代理</span>
|
2024-04-01 20:39:22 +08:00
|
|
|
|
</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('修改成功');
|
2024-04-02 18:45:46 +08:00
|
|
|
|
setProjCategoryId(e.key);
|
2024-04-01 20:39:22 +08:00
|
|
|
|
setProjCategoryName(span.innerText);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}}>
|
2024-04-02 18:45:46 +08:00
|
|
|
|
<span>
|
2024-04-12 14:12:38 +08:00
|
|
|
|
<span className="text-btn">{projCategoryId ? projCategoryName : '无目录'}</span>
|
2024-04-01 20:39:22 +08:00
|
|
|
|
<DownOutlined/>
|
|
|
|
|
</span>
|
|
|
|
|
</Dropdown>
|
2024-04-02 18:45:46 +08:00
|
|
|
|
{
|
|
|
|
|
projCategoryId ? (
|
|
|
|
|
<DeleteOutlined title="移除目录" onClick={() => {
|
|
|
|
|
put<any>({
|
|
|
|
|
messageApi,
|
|
|
|
|
url: `/api/proj/cancel-category/${data.projId}`,
|
|
|
|
|
onSuccess() {
|
|
|
|
|
messageApi.success('取消成功');
|
|
|
|
|
setProjCategoryId('');
|
|
|
|
|
setProjCategoryName('');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}}/>
|
|
|
|
|
) : <></>
|
|
|
|
|
}
|
2024-04-01 20:39:22 +08:00
|
|
|
|
</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-02 18:45:46 +08:00
|
|
|
|
{messageContext}
|
2024-04-01 20:39:22 +08:00
|
|
|
|
</>
|
2024-03-13 16:11:28 +08:00
|
|
|
|
)
|
|
|
|
|
}
|