From d4a75e7933f10774ae85063634c51ef2f7251276 Mon Sep 17 00:00:00 2001
From: WenC <450292408@qq.com>
Date: Fri, 12 Apr 2024 14:12:38 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package-lock.json | 7 +-
package.json | 1 +
src/components/card/CardProj.tsx | 52 ++-
src/components/card/CardProjAgent.tsx | 26 +-
src/components/card/CardProjLoading.tsx | 24 +-
src/components/card/CardProjResult.tsx | 2 +-
src/components/card/card-proj.css | 1 +
src/components/list/ListProjAgent.tsx | 1 +
src/components/menu/MenuTree.tsx | 62 ++-
src/components/menu/MenuTreeWithTopButton.tsx | 222 ++++++----
src/components/menu/menu-tree.css | 11 +-
src/index.css | 6 +-
src/interfaces/agent/IAgent.ts | 1 +
src/interfaces/menu/IMenuTree.ts | 6 +-
src/layout/head/Head.tsx | 3 +
src/main.tsx | 3 +
src/route/index/Index.tsx | 2 +-
src/route/proj/ProjEdit.tsx | 23 +-
src/route/proj/ProjEditAll.tsx | 390 ++++++++++++++++++
src/route/proj/edit/ProjConfigModList.tsx | 2 +-
src/util/AjaxUtils.ts | 3 +-
21 files changed, 666 insertions(+), 182 deletions(-)
create mode 100644 src/route/proj/ProjEditAll.tsx
diff --git a/package-lock.json b/package-lock.json
index 30334db..ebe964a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,6 +8,7 @@
"name": "ai-copyright",
"version": "0.0.0",
"dependencies": {
+ "@ant-design/cssinjs": "^1.19.1",
"antd": "^5.15.2",
"axios": "^1.6.7",
"localforage": "^1.10.0",
@@ -70,9 +71,9 @@
}
},
"node_modules/@ant-design/cssinjs": {
- "version": "1.18.4",
- "resolved": "https://registry.npmjs.org/@ant-design/cssinjs/-/cssinjs-1.18.4.tgz",
- "integrity": "sha512-IrUAOj5TYuMG556C9gdbFuOrigyhzhU5ZYpWb3gYTxAwymVqRbvLzFCZg6OsjLBR6GhzcxYF3AhxKmjB+rA2xA==",
+ "version": "1.19.1",
+ "resolved": "https://registry.npmjs.org/@ant-design/cssinjs/-/cssinjs-1.19.1.tgz",
+ "integrity": "sha512-hgQ3wiys3X0sqDKWkqCJ6EYdF79i9JCvtavmIGwuuPUKmoJXV8Ff0sY+yQQSxk2dRmMyam/bYKo/Bwor45hnZw==",
"dependencies": {
"@babel/runtime": "^7.11.1",
"@emotion/hash": "^0.8.0",
diff --git a/package.json b/package.json
index 6e2bfc0..83c8fdb 100644
--- a/package.json
+++ b/package.json
@@ -10,6 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
+ "@ant-design/cssinjs": "^1.19.1",
"antd": "^5.15.2",
"axios": "^1.6.7",
"localforage": "^1.10.0",
diff --git a/src/components/card/CardProj.tsx b/src/components/card/CardProj.tsx
index 2b2a6bc..b2f8478 100644
--- a/src/components/card/CardProj.tsx
+++ b/src/components/card/CardProj.tsx
@@ -13,10 +13,10 @@ import {
WarningOutlined
} from '@ant-design/icons';
import {Button, ConfigProvider, Dropdown, Tag} from 'antd';
-import {GenerateStatus, IProj, PayStatus} from "../../interfaces/proj/IProj.ts";
+import {GenerateStatus, IProj, PayStatus, ProjChargeType} from "../../interfaces/proj/IProj.ts";
import {useNavigate} from "react-router-dom";
import {Axios, put} from "../../util/AjaxUtils.ts";
-import {useContext, useState} from "react";
+import {useContext, useEffect, useState} from "react";
import {IndexListContext} from "../../context/IndexListContext.ts";
import useMessage from "antd/es/message/useMessage";
@@ -26,6 +26,7 @@ export default function CardProj(props: { item: IProj }) {
const [messageApi, messageContext] = useMessage();
const [projCategoryId, setProjCategoryId] = useState(data.projCategoryId);
const [projCategoryName, setProjCategoryName] = useState(data.projCategoryName);
+ const [payCharge, setPayCharge] = useState('');
const indexListContext = useContext(IndexListContext);
/**
@@ -108,12 +109,31 @@ export default function CardProj(props: { item: IProj }) {
)
}
+ 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 = '免费试用';
+ }
+ setPayCharge(chargeName);
+ }, [])
+
return (
<>
-
{data.projName}
+
{
+ nav(`/proj-edit/${data.projId}`)
+ }}>{data.projName}
上下文:{data.projContext}
@@ -125,34 +145,32 @@ export default function CardProj(props: { item: IProj }) {
- 金额¥:{data.pay.payment / 100}
+ {payCharge}
+ ¥{data.pay.payment / 100}
@@ -162,10 +180,10 @@ export default function CardProj(props: { item: IProj }) {
data.generate.generateStatus == GenerateStatus.SUCCESS ? (
- {
+ {
e.preventDefault();
nav(`/agent-select/${data.projId}`);
- }}>找代理
+ }}>找代理
) : <>>
}
@@ -187,7 +205,7 @@ export default function CardProj(props: { item: IProj }) {
}
}}>
- {projCategoryId ? projCategoryName : '无目录'}
+ {projCategoryId ? projCategoryName : '无目录'}
diff --git a/src/components/card/CardProjAgent.tsx b/src/components/card/CardProjAgent.tsx
index 428eff6..2c0f563 100644
--- a/src/components/card/CardProjAgent.tsx
+++ b/src/components/card/CardProjAgent.tsx
@@ -1,6 +1,6 @@
import './card-proj-agent.css'
import {OrderedListOutlined, BarsOutlined, SearchOutlined} from "@ant-design/icons";
-import {Tag} from 'antd';
+import {Badge, Tag} from 'antd';
import {IAgent} from "../../interfaces/agent/IAgent.ts";
import {useNavigate} from "react-router-dom";
@@ -74,21 +74,25 @@ export default function CardProjAgent(props: IAgent) {
{props.gmtCreate}
-
+
{
diff --git a/src/components/card/CardProjLoading.tsx b/src/components/card/CardProjLoading.tsx
index d6ae47b..2f8d329 100644
--- a/src/components/card/CardProjLoading.tsx
+++ b/src/components/card/CardProjLoading.tsx
@@ -1,22 +1,22 @@
import './card-proj-loading.css';
import {Loading3QuartersOutlined} from '@ant-design/icons';
import {IProjLoading} from "../../interfaces/card/ICardProj.ts";
-import {useState} from "react";
+import {useEffect, useState} from "react";
export default function CardProjLoading(props: IProjLoading) {
-
const [duration, setDuration] = useState(props.duration);
- const interval = setInterval(() => {
- const last = duration - 1000;
- if (last <= 0) {
- setDuration(0);
- clearInterval(interval);
- props.handleCountDownOver();
- return;
- }
- setDuration(last);
- }, 1000);
+ useEffect(() => {
+ setTimeout(() => {
+ const last = duration - 1000;
+ if (last <= 0) {
+ setDuration(0);
+ props.handleCountDownOver();
+ return;
+ }
+ setDuration(last);
+ }, 1000);
+ }, [duration])
return (
diff --git a/src/components/card/CardProjResult.tsx b/src/components/card/CardProjResult.tsx
index 80d35aa..e366e86 100644
--- a/src/components/card/CardProjResult.tsx
+++ b/src/components/card/CardProjResult.tsx
@@ -15,7 +15,7 @@ export default function CardProjResult(props: IProjResult) {
{
e.preventDefault();
props.handleFeedback?.();
- }}>反馈
+ }}>查看详情
}
) : <>>
diff --git a/src/components/card/card-proj.css b/src/components/card/card-proj.css
index 3f5530d..d999840 100644
--- a/src/components/card/card-proj.css
+++ b/src/components/card/card-proj.css
@@ -62,6 +62,7 @@
}
.card-proj .body .line .left {
+ width: unset;
display: flex;
}
diff --git a/src/components/list/ListProjAgent.tsx b/src/components/list/ListProjAgent.tsx
index 36c2e52..fb5dbd7 100644
--- a/src/components/list/ListProjAgent.tsx
+++ b/src/components/list/ListProjAgent.tsx
@@ -92,6 +92,7 @@ export default function ListProjAgent() {
orderTypeName={item.orderTypeName}
overTime={item.overTime}
gmtCreate={item.gmtCreate}
+ orderAgreementStatus={item.orderAgreementStatus}
/>
)
}
diff --git a/src/components/menu/MenuTree.tsx b/src/components/menu/MenuTree.tsx
index e871b20..23af276 100644
--- a/src/components/menu/MenuTree.tsx
+++ b/src/components/menu/MenuTree.tsx
@@ -5,9 +5,9 @@ import {
PlusOutlined,
CloseOutlined,
EditOutlined,
- CheckOutlined
} from '@ant-design/icons';
import {IMenuTree, IMenuTreeItem} from "../../interfaces/menu/IMenuTree.ts";
+import {Popconfirm} from "antd";
export default function MenuTree(props: IMenuTree) {
@@ -22,20 +22,6 @@ export default function MenuTree(props: IMenuTree) {
}
const renderBtnGroup = (item: IMenuTreeItem, index: number, parent?: IMenuTreeItem) => {
- if (item.isEdit) {
- return (
- <>
-
{
- e.stopPropagation();
- props.handleEditSaveClick(item);
- }}/>
- {
- e.stopPropagation();
- props.handleEditCancelClick(item);
- }}/>
- >
- )
- }
return (
<>
{
@@ -46,25 +32,33 @@ export default function MenuTree(props: IMenuTree) {
e.stopPropagation();
props.handleAddClick(item);
}}/>
- {
- e.stopPropagation();
- props.handleRemoveClick(item, index, parent);
- }}/>
+ {
+ e?.stopPropagation();
+ props.handleRemoveClick(item, index, parent);
+ }}
+ onCancel={(e) => {
+ e?.stopPropagation();
+ }}
+ >
+ {
+ e.stopPropagation();
+ }}/>
+
+
>
);
}
const renderLabel = (item: IMenuTreeItem) => {
- if (item.isEdit) {
- const width = 180 - 30 - item.level * 10;
- return {
- item.name = e.target.value;
- props.handleNameChange(item);
- }}/>
- }
const icon = item.isOpen ? {
triggerChildren(item)
}}/> : {
@@ -75,7 +69,12 @@ export default function MenuTree(props: IMenuTree) {
<>
{item.isParent ? icon : <>>}
{
+ e.stopPropagation();
+ props.handleClick(item);
+ }}
onDoubleClick={() => {
triggerChildren(item)
}}>{item.name}
@@ -90,10 +89,7 @@ export default function MenuTree(props: IMenuTree) {
const lis = children.map((item, index) => {
const renderChildrenMenu = renderMenu(item.children, item);
return (
- {
- e.stopPropagation();
- props.handleClick(item);
- }}>
+
{renderLabel(item)}
{renderBtnGroup(item, index, parent)}
diff --git a/src/components/menu/MenuTreeWithTopButton.tsx b/src/components/menu/MenuTreeWithTopButton.tsx
index 8680338..7dd1d4c 100644
--- a/src/components/menu/MenuTreeWithTopButton.tsx
+++ b/src/components/menu/MenuTreeWithTopButton.tsx
@@ -5,7 +5,7 @@ import {useContext, useEffect, useState} from "react";
import {del, get, post, put} from "../../util/AjaxUtils.ts";
import useMessage from "antd/es/message/useMessage";
import {IndexListDataType, IndexListDispatchContext,} from "../../context/IndexListContext.ts";
-import {MenuProps} from "antd";
+import {Input, MenuProps, Modal} from "antd";
type ProjCategoryDTO = {
@@ -24,11 +24,11 @@ class MenuTreeItem implements IMenuTreeItem {
id: string;
pId: string;
level: number;
- isEdit: boolean;
isOpen: boolean;
isParent: boolean;
name: string;
oldName: string;
+ parent?: IMenuTreeItem | null;
constructor(id: string, pId: string, name: string, level: number) {
this.id = id;
@@ -36,10 +36,10 @@ class MenuTreeItem implements IMenuTreeItem {
this.level = level;
this.name = name;
this.oldName = name;
- this.isEdit = false;
this.isOpen = false;
this.isParent = false;
this.children = null;
+ this.parent = null;
}
}
@@ -50,7 +50,10 @@ export default function MenuTreeWithTopButton() {
const [messageApi, messageContext] = useMessage();
const menuTrees: Array
= [];
const [menuTreeArray, setMenuTreeArray] = useState(menuTrees);
- const newCategoryName: string = '新目录';
+ const [saveCategory, setSaveCategory] = useState(new MenuTreeItem('-1', '0', '新目录', 1));
+ const [editCategory, setEditCategory] = useState(new MenuTreeItem('-1', '0', '新目录', 1));
+ const [saveModal, setSaveModal] = useState(false);
+ const [editModal, setEditModal] = useState(false);
const menuArray = (datas: ProjCategoryDTO[], level: number) => {
const menus: MenuTreeItem[] = [];
@@ -65,7 +68,7 @@ export default function MenuTreeWithTopButton() {
return menus;
}
- const menus2Dropdowns = (datas: MenuTreeItem[] | null) => {
+ const menus2Dropdowns = (datas: IMenuTreeItem[] | null) => {
if (!datas) {
return;
}
@@ -82,6 +85,15 @@ export default function MenuTreeWithTopButton() {
return dropdowns;
}
+ const clearActive = (array: IMenuTreeItem[]) => {
+ array.forEach(item => {
+ item.active = false;
+ if(item.children) {
+ clearActive(item.children)
+ }
+ })
+ }
+
useEffect(() => {
get({
messageApi,
@@ -101,25 +113,8 @@ export default function MenuTreeWithTopButton() {
<>
{
const isActive = item.active;
- menuTreeArray.forEach(item => item.active = false);
- if(!isActive) {
+ clearActive(menuTreeArray);
+ if (!isActive) {
item.active = true;
}
setMenuTreeArray([
@@ -143,42 +138,18 @@ export default function MenuTreeWithTopButton() {
type: IndexListDataType.CATEGORY_CHANGE,
value: item.active ? item.id : ''
})
- console.log(item)
}}
handleExpand={() => {
}}
handleAddClick={(item) => {
- post({
- messageApi,
- url: '/api/proj/category/save',
- body: {
- projCategoryParentId: item.id,
- projCategoryName: newCategoryName
- },
- onSuccess({data}) {
- item.isParent = true;
- item.isOpen = true;
- if (!item.children) {
- item.children = new Array();
- }
- const menuTreeItem = new MenuTreeItem(`${data.data}`, item.id, newCategoryName, item.level + 1);
- menuTreeItem.isParent = false;
- item.children.push(menuTreeItem);
- setMenuTreeArray([
- ...menuTreeArray
- ])
- indexListDispatchContext({
- type: IndexListDataType.CATEGORY,
- value: menus2Dropdowns(menuTreeArray)
- })
- }
- })
+ const menuTreeItem = new MenuTreeItem('-1', item.id, '新目录', item.level + 1);
+ menuTreeItem.parent = item;
+ setSaveCategory(menuTreeItem);
+ setSaveModal(true)
}}
handleEditClick={(item) => {
- item.isEdit = true;
- setMenuTreeArray([
- ...menuTreeArray
- ])
+ setEditCategory(item);
+ setEditModal(true);
}}
handleRemoveClick={(item, index, parent) => {
del({
@@ -200,38 +171,7 @@ export default function MenuTreeWithTopButton() {
}
})
}}
- handleEditSaveClick={(item) => {
- // 这里发请求,成功之后修改,失败还原
- if (item.name === '') {
- return;
- }
- put({
- messageApi,
- url: `/api/proj/category/update/${item.id}`,
- body: {
- projCategoryParentId: item.pId,
- projCategoryName: item.name
- },
- onSuccess() {
- item.oldName = item.name;
- item.isEdit = false;
- setMenuTreeArray([
- ...menuTreeArray
- ])
- indexListDispatchContext({
- type: IndexListDataType.CATEGORY,
- value: menus2Dropdowns(menuTreeArray)
- })
- }
- })
- }}
- handleEditCancelClick={(item) => {
- item.name = item.oldName;
- item.isEdit = false;
- setMenuTreeArray([
- ...menuTreeArray
- ])
- }}
+
handleNameChange={(item) => {
indexListDispatchContext({
type: IndexListDataType.CATEGORY_CHANGE,
@@ -240,6 +180,112 @@ export default function MenuTreeWithTopButton() {
}}
/>
+ {
+ setSaveModal(false);
+ }}
+ onOk={() => {
+ if(!saveCategory.name) {
+ messageApi.error('请输入名称');
+ return;
+ }
+ // 新增
+ post({
+ messageApi,
+ url: '/api/proj/category/save',
+ body: {
+ projCategoryParentId: saveCategory.pId,
+ projCategoryName: saveCategory.name
+ },
+ onSuccess({data}) {
+ if (!saveCategory.parent) {
+ const menuTreeItem = new MenuTreeItem(`${data.data}`, '0', saveCategory.name, 1);
+ menuTreeItem.isParent = false;
+ menuTreeArray.push(menuTreeItem);
+ setMenuTreeArray([...menuTreeArray]);
+ indexListDispatchContext({
+ type: IndexListDataType.CATEGORY,
+ value: menus2Dropdowns(menuTreeArray)
+ })
+ } else {
+ saveCategory.parent.isParent = true;
+ saveCategory.parent.isOpen = true;
+ if (!saveCategory.parent.children) {
+ saveCategory.parent.children = new Array();
+ }
+ const menuTreeItem = new MenuTreeItem(`${data.data}`, saveCategory.id, saveCategory.name, saveCategory.level);
+ menuTreeItem.isParent = false;
+ saveCategory.parent.children.push(menuTreeItem);
+ setMenuTreeArray([
+ ...menuTreeArray
+ ])
+ indexListDispatchContext({
+ type: IndexListDataType.CATEGORY,
+ value: menus2Dropdowns(menuTreeArray)
+ })
+ }
+
+ setSaveModal(false);
+ }
+ })
+ }}
+ >
+ {
+ saveCategory.name = e.target.value;
+ setSaveCategory({...saveCategory})
+ }}/>
+
+ {
+ setEditModal(false);
+ }}
+ onOk={() => {
+ if (editCategory.name === '') {
+ messageApi.error('请输入名称');
+ return;
+ }
+ put({
+ messageApi,
+ url: `/api/proj/category/update/${editCategory.id}`,
+ body: {
+ projCategoryParentId: editCategory.pId,
+ projCategoryName: editCategory.name
+ },
+ onSuccess() {
+ editCategory.oldName = editCategory.name;
+ setMenuTreeArray([
+ ...menuTreeArray
+ ])
+ indexListDispatchContext({
+ type: IndexListDataType.CATEGORY,
+ value: menus2Dropdowns(menuTreeArray)
+ })
+ setEditModal(false);
+ }
+ })
+ }}
+ >
+ {
+ editCategory.name = e.target.value;
+ setEditCategory({...editCategory})
+ }}/>
+
{messageContext}
>
)
diff --git a/src/components/menu/menu-tree.css b/src/components/menu/menu-tree.css
index 4c84127..7fa89b9 100644
--- a/src/components/menu/menu-tree.css
+++ b/src/components/menu/menu-tree.css
@@ -5,11 +5,6 @@
margin-left: 10px;
}
.menu-tree ul li {
-
-}
-.menu-tree ul li.active {
- text-decoration-line: underline;
- text-underline-offset: 5px;
}
.menu-tree ul li .menu-title {
@@ -33,6 +28,12 @@
white-space: nowrap;
height: 22px;
line-height: 22px;
+ user-select: none;
+ -webkit-user-select: none;
+}
+.menu-tree ul li .menu-title .label span.active {
+ text-decoration-line: underline;
+ text-underline-offset: 5px;
}
.menu-tree ul li .menu-title .label .menu-name-input {
diff --git a/src/index.css b/src/index.css
index 08de4fe..3af24fe 100644
--- a/src/index.css
+++ b/src/index.css
@@ -28,7 +28,7 @@ html, body {
}
a {
- color: var(--color-dark);
+ color: var(--color-blue);
text-decoration-line: none;
}
@@ -38,6 +38,10 @@ ul {
padding: 0;
}
+.text-btn {
+ cursor: pointer;
+}
+
.btn {
border: none;
border-radius: 3px;
diff --git a/src/interfaces/agent/IAgent.ts b/src/interfaces/agent/IAgent.ts
index f220a24..232e546 100644
--- a/src/interfaces/agent/IAgent.ts
+++ b/src/interfaces/agent/IAgent.ts
@@ -18,4 +18,5 @@ export interface IAgent {
orderTypeName: string;
overTime: string;
gmtCreate: string;
+ orderAgreementStatus: string;
}
\ No newline at end of file
diff --git a/src/interfaces/menu/IMenuTree.ts b/src/interfaces/menu/IMenuTree.ts
index e65b93b..67fbbbc 100644
--- a/src/interfaces/menu/IMenuTree.ts
+++ b/src/interfaces/menu/IMenuTree.ts
@@ -4,11 +4,11 @@ export interface IMenuTreeItem {
level: number;
name: string;
oldName: string;
- isEdit: boolean;
isOpen: boolean;
isParent: boolean;
active?: boolean;
children: Array | null;
+ parent?: IMenuTreeItem | null
}
export interface IMenuTree {
@@ -27,10 +27,6 @@ export interface IMenuTree {
handleRemoveClick(item: IMenuTreeItem, index: number, parent?: IMenuTreeItem): void;
- handleEditSaveClick(item: IMenuTreeItem): void;
-
- handleEditCancelClick(tem: IMenuTreeItem): void;
-
handleNameChange(item: IMenuTreeItem): void;
}
\ No newline at end of file
diff --git a/src/layout/head/Head.tsx b/src/layout/head/Head.tsx
index 480937e..31e5f7a 100644
--- a/src/layout/head/Head.tsx
+++ b/src/layout/head/Head.tsx
@@ -75,6 +75,9 @@ export default function Head() {
退出系统
),
+ onClick: () => {
+ window.location.href = '/copyright/logout'
+ }
},
]
diff --git a/src/main.tsx b/src/main.tsx
index 08b21dc..2edeb40 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -1,9 +1,12 @@
import ReactDOM from 'react-dom/client'
import App from './App.tsx'
import './index.css'
+import {StyleProvider, legacyLogicalPropertiesTransformer} from "@ant-design/cssinjs";
ReactDOM.createRoot(document.getElementById('root')!).render(
+
+
//
//
// ,
diff --git a/src/route/index/Index.tsx b/src/route/index/Index.tsx
index 4c1c991..cc27f63 100644
--- a/src/route/index/Index.tsx
+++ b/src/route/index/Index.tsx
@@ -55,7 +55,7 @@ export default function Index() {
}
},
list: [
- {id: 'ALL', name: '全部项目', active: true},
+ {id: 'ALL', name: '全部项目'},
{id: 'PROCESSING', name: '进行中的'},
{id: 'COMPLETE', name: '已完成的'}
],
diff --git a/src/route/proj/ProjEdit.tsx b/src/route/proj/ProjEdit.tsx
index 507fc47..b3dae78 100644
--- a/src/route/proj/ProjEdit.tsx
+++ b/src/route/proj/ProjEdit.tsx
@@ -23,12 +23,13 @@ export default function ProjEdit() {
const [configArray, setConfigArray] = useState([]);
const [isEditStepEdited, setIsEditStepEdited] = useState(false);
const [isConfigEdited, setIsConfigEdited] = useState(false);
- // const [isAllStepEdited, setIsAllStepEdited] = useState(false);
const [canGenerate, setCanGenerate] = useState(false);
const [generateStatus, setGenerateStatus] = useState(GenerateStatus.NONE);
const [generateEmainingTime, setGenerateEmainingTime] = useState(0);
const [isGenerateModalOpen, setIsGenerateModalOpen] = useState(false);
const [previewUrl, setPreviewUrl] = useState('');
+ const [generateErrorModal, setGenerateErrorModal] = useState(false);
+ const [generateErrorMsg, setGenerateErrorMsg] = useState('');
const height = window.innerHeight - 240;
@@ -185,7 +186,7 @@ export default function ProjEdit() {
&& data.editSteps[3].editStatus == EditStepEnum.EDITED
&& data.editSteps[4].editStatus == EditStepEnum.EDITED
&& data.editSteps[5].editStatus == EditStepEnum.EDITED;
- const isConfig = data.loginpage.loginpageId && MAX_MOD_SIZE > 0;
+ const isConfig = data.loginpage.loginpageId && data.projModCount > MAX_MOD_SIZE;
const isGenerate = isEdited && isConfig;
const isGenerateSuccess: boolean = data.generate.generateStatus == GenerateStatus.SUCCESS;
renderEditStep(data.editSteps, isEdited, isGenerateSuccess);
@@ -193,7 +194,8 @@ export default function ProjEdit() {
setCanGenerate(isGenerate);
setGenerateStatus(data.generate.generateStatus);
setPreviewUrl(data.previewUrl);
- setGenerateEmainingTime(data.generate.emainingTime);
+ setGenerateEmainingTime(data.generate.generateEmainingTime);
+ setGenerateErrorMsg(data.generate.generateMsg);
}
})
}
@@ -309,6 +311,7 @@ export default function ProjEdit() {
{
+ setGenerateErrorModal(true);
console.log('反馈')
}}
/>
@@ -385,6 +388,20 @@ export default function ProjEdit() {
}}>
点击“确定按钮”后,项目便无法再次修改,建议通过预览查看系统,确认无误后点击“确定按钮”。
+ {setGenerateErrorModal(false)}}
+ >
+ {generateErrorMsg}
+
>
)
}
\ No newline at end of file
diff --git a/src/route/proj/ProjEditAll.tsx b/src/route/proj/ProjEditAll.tsx
new file mode 100644
index 0000000..5fea7aa
--- /dev/null
+++ b/src/route/proj/ProjEditAll.tsx
@@ -0,0 +1,390 @@
+import './proj-edit.css';
+import {Link, useNavigate, useParams} from "react-router-dom";
+import {Breadcrumb, Button, message, Modal} from "antd";
+import StepProjEdit from "../../components/step/StepProjEdit.tsx";
+import CardProjEdit from "../../components/card/CardProjEdit.tsx";
+import {Process} from "../../interfaces/step/IStepProj.ts";
+import CardProjLoading from "../../components/card/CardProjLoading.tsx";
+import CardProjResult from "../../components/card/CardProjResult.tsx";
+import CardProjDownload from "../../components/card/CardProjDownload.tsx";
+import CardProjJump from "../../components/card/CardProjJump.tsx";
+import {useEffect, useState} from "react";
+import {Axios, get, post} from "../../util/AjaxUtils.ts";
+import {EditStepEnum, IProjEdit} from "../../interfaces/card/ICardProj.ts";
+import {MAX_MOD_SIZE} from "./edit/ProjConfigModList.tsx";
+import {GenerateStatus} from "../../interfaces/proj/IProj.ts";
+
+export default function ProjEditAll() {
+ const nav = useNavigate();
+ const pathParams = useParams();
+
+ const [messageApi, contextHolder] = message.useMessage();
+ const [editStepArray, setEditStepArray] = useState([]);
+ const [configArray, setConfigArray] = useState([]);
+ const [isEditStepEdited, setIsEditStepEdited] = useState(false);
+ const [isConfigEdited, setIsConfigEdited] = useState(false);
+ // const [isAllStepEdited, setIsAllStepEdited] = useState(false);
+ const [canGenerate, setCanGenerate] = useState(false);
+ const [generateStatus, setGenerateStatus] = useState(GenerateStatus.NONE);
+ const [generateEmainingTime, setGenerateEmainingTime] = useState(0);
+ const [isGenerateModalOpen, setIsGenerateModalOpen] = useState(false);
+ const [previewUrl, setPreviewUrl] = useState('');
+
+ const height = window.innerHeight - 240;
+
+ const renderEditStep = (editSteps: any[], isEdited: boolean, isGenerateSuccess: boolean) => {
+ const editStepArray: IProjEdit[] = [];
+ editStepArray.push(
+ {
+ title: '标题简介',
+ desc: '完善代码、样式类型和详细介绍等内容',
+ step: 1,
+ btnName: !isGenerateSuccess ? '设置' : '查看',
+ status: editSteps[0].editStatus,
+ handleEdit() {
+ if (!isGenerateSuccess) {
+ nav(`/proj-edit/step1/${pathParams.projId}`)
+ } else {
+ nav(`/proj-edit/step1-show/${pathParams.projId}`)
+ }
+ }
+ },
+ {
+ title: '基本信息',
+ desc: '完善项目简介、编程语言、版本、公司等内容',
+ step: 2,
+ btnName: !isGenerateSuccess ? '设置' : '查看',
+ status: editSteps[1].editStatus,
+ handleEdit() {
+ if (generateStatus != GenerateStatus.SUCCESS) {
+ nav(`/proj-edit/step2/${pathParams.projId}`)
+ } else {
+ nav(`/proj-edit/step2-show/${pathParams.projId}`)
+ }
+ }
+ },
+ {
+ title: '软件功能特点',
+ desc: '请完善软件功能特点',
+ step: 3,
+ btnName: !isGenerateSuccess ? '设置' : '查看',
+ status: editSteps[2].editStatus,
+ handleEdit() {
+ if (!isGenerateSuccess) {
+ nav(`/proj-edit/step3/${pathParams.projId}`)
+ } else {
+ nav(`/proj-edit/step3-show/${pathParams.projId}`)
+ }
+ }
+ },
+ {
+ title: '著作人信息',
+ desc: '请完善著作人相关信息',
+ step: 4,
+ btnName: !isGenerateSuccess ? '设置' : '查看',
+ status: editSteps[3].editStatus,
+ handleEdit() {
+ if (!isGenerateSuccess) {
+ nav(`/proj-edit/step4/${pathParams.projId}`)
+ } else {
+ nav(`/proj-edit/step4-show/${pathParams.projId}`)
+ }
+ }
+ },
+ {
+ title: '申请人信息',
+ desc: '请完善申请人信息',
+ step: 5,
+ btnName: !isGenerateSuccess ? '设置' : '查看',
+ status: editSteps[4].editStatus,
+ handleEdit() {
+ if (!isGenerateSuccess) {
+ nav(`/proj-edit/step5/${pathParams.projId}`)
+ } else {
+ nav(`/proj-edit/step5-show/${pathParams.projId}`)
+ }
+ }
+ },
+ {
+ title: '选择登录页面',
+ desc: '选择软件的登录页面模板',
+ step: 6,
+ btnName: !isGenerateSuccess ? '设置' : '查看',
+ status: editSteps[5].editStatus,
+ handleEdit() {
+ if (!isGenerateSuccess) {
+ nav(`/proj-edit/step6/${pathParams.projId}`)
+ } else {
+ nav(`/proj-edit/step6-show/${pathParams.projId}`)
+ }
+ }
+ }
+ )
+ setEditStepArray(editStepArray);
+ setIsEditStepEdited(isEdited);
+ }
+
+ const renderSetting = (data: any, isConfig: boolean, isGenerateSuccess: boolean) => {
+ const configArray: IProjEdit[] = [];
+ configArray.push(
+ {
+ title: '登录界面设置',
+ desc: '请对登录界面完成个性化设置',
+ step: 1,
+ btnName: !isGenerateSuccess ? '设置' : '查看',
+ status: data.loginpage.loginpageId ? EditStepEnum.EDITED : EditStepEnum.UN_EDIT,
+ handleEdit() {
+ if (!isGenerateSuccess) {
+ nav(`/proj-edit/config-loginpage/${pathParams.projId}`)
+ } else {
+ nav(`/proj-edit/config-loginpage-show/${pathParams.projId}`)
+ }
+ }
+ },
+ {
+ title: '系统菜单管理',
+ desc: '请对系统菜单进行设置',
+ step: 2,
+ btnName: !isGenerateSuccess ? '设置' : '查看',
+ status: data.projModCount > MAX_MOD_SIZE ? EditStepEnum.EDITED : EditStepEnum.UN_EDIT,
+ handleEdit() {
+ if (!isGenerateSuccess) {
+ nav(`/proj-edit/config-mod-list/${pathParams.projId}`)
+ } else {
+ nav(`/proj-edit/config-mod-list-show/${pathParams.projId}`)
+ }
+ }
+ },
+ {
+ title: '菜单顺序',
+ desc: '调整菜单顺序',
+ step: 3,
+ btnName: !isGenerateSuccess ? '设置' : '查看',
+ status: data.projModCount > MAX_MOD_SIZE ? EditStepEnum.EDITED : EditStepEnum.UN_EDIT,
+ handleEdit() {
+ if (!isGenerateSuccess) {
+ nav(`/proj-edit/config-menu-list/${pathParams.projId}`)
+ } else {
+ nav(`/proj-edit/config-menu-list-show/${pathParams.projId}`)
+ }
+ }
+ }
+ )
+ setConfigArray(configArray);
+ setIsConfigEdited(isConfig);
+ }
+
+ const renderData = () => {
+ get({
+ messageApi: messageApi,
+ url: `/api/proj/get/${pathParams.projId}`,
+ onSuccess({data}) {
+ const isEdited = data.editSteps[0].editStatus == EditStepEnum.EDITED
+ && data.editSteps[1].editStatus == EditStepEnum.EDITED
+ && data.editSteps[2].editStatus == EditStepEnum.EDITED
+ && data.editSteps[3].editStatus == EditStepEnum.EDITED
+ && data.editSteps[4].editStatus == EditStepEnum.EDITED
+ && data.editSteps[5].editStatus == EditStepEnum.EDITED;
+ const isConfig = data.loginpage.loginpageId && MAX_MOD_SIZE > 0;
+ const isGenerate = isEdited && isConfig;
+ const isGenerateSuccess: boolean = data.generate.generateStatus == GenerateStatus.SUCCESS;
+ renderEditStep(data.editSteps, isEdited, isGenerateSuccess);
+ renderSetting(data, isConfig, isGenerateSuccess);
+ setCanGenerate(isGenerate);
+ setGenerateStatus(data.generate.generateStatus);
+ setPreviewUrl(data.previewUrl);
+ setGenerateEmainingTime(data.generate.emainingTime);
+ }
+ })
+ }
+
+ useEffect(() => {
+ renderData();
+ }, [])
+
+ return (
+ <>
+ {contextHolder}
+ 首页},
+ {title: 创建项目},
+ {title: '编辑项目'},
+ ]}
+ />
+
+
+ {
+ editStepArray.map((item, index) => {
+ return
+ })
+ }
+
+
+
+ {
+ configArray.map((item, index) => {
+ return
+ })
+ }
+ {
+ isEditStepEdited && isConfigEdited ? (
+ {
+ window.open(`${Axios.defaults?.baseURL}/${previewUrl}`, '_blank')
+ }}
+ />
+ ) : <>>
+ }
+
+
+ {
+ generateStatus == GenerateStatus.NONE || generateStatus == GenerateStatus.FAILED ? (
+ {
+ setIsGenerateModalOpen(true);
+ }}
+ />
+ ) : <>>
+ }
+ {
+ generateStatus == GenerateStatus.PENDING ? (
+ {
+ renderData();
+ }}
+ />
+ ) : <>>
+ }
+ {
+ generateStatus == GenerateStatus.GENERATING ? (
+ {
+ renderData();
+ }}
+
+ />
+ ) : <>>
+ }
+ {
+ generateStatus == GenerateStatus.SUCCESS ? (
+
+ ) : <>>
+ }
+ {
+ generateStatus == GenerateStatus.FAILED ? (
+ {
+ console.log('反馈')
+ }}
+ />
+ ) : <>>
+ }
+
+
+ {
+ window.open(`${Axios.defaults?.baseURL}/route/proj/download/apply/${pathParams.projId}`)
+ }}
+ />
+ {
+ window.open(`${Axios.defaults?.baseURL}/route/proj/download/manual/${pathParams.projId}`)
+ }}
+ />
+ {
+ window.open(`${Axios.defaults?.baseURL}/route/proj/download/code-zip/${pathParams.projId}`)
+ }}
+ />
+ {
+ window.open(`${Axios.defaults?.baseURL}/route/proj/download/code/${pathParams.projId}`)
+ }}
+ />
+ {
+ nav(`/agent-select/${pathParams.projId}`);
+ }}
+ />
+
+
+
+
+
+ {
+ post({
+ messageApi,
+ url: `/api/proj/generate/proj-id/${pathParams.projId}`,
+ body: {},
+ onSuccess() {
+ messageApi.success('提交成功');
+ setIsGenerateModalOpen(false);
+ renderData();
+ }
+ })
+ }}
+ onCancel={() => {
+ setIsGenerateModalOpen(false);
+ }}>
+ 点击“确定按钮”后,项目便无法再次修改,建议通过预览查看系统,确认无误后点击“确定按钮”。
+
+ >
+ )
+}
\ No newline at end of file
diff --git a/src/route/proj/edit/ProjConfigModList.tsx b/src/route/proj/edit/ProjConfigModList.tsx
index e386f78..714c2cb 100644
--- a/src/route/proj/edit/ProjConfigModList.tsx
+++ b/src/route/proj/edit/ProjConfigModList.tsx
@@ -10,7 +10,7 @@ import {useEffect, useState} from "react";
import {EditOutlined, PlusOutlined, DeleteOutlined, SearchOutlined} from "@ant-design/icons";
import {del, get} from "../../../util/AjaxUtils.ts";
-export const MAX_MOD_SIZE = 15;
+export const MAX_MOD_SIZE = 5;
interface DataType {
projModId: string;
diff --git a/src/util/AjaxUtils.ts b/src/util/AjaxUtils.ts
index e9a84ad..fb57f1e 100644
--- a/src/util/AjaxUtils.ts
+++ b/src/util/AjaxUtils.ts
@@ -5,7 +5,8 @@ export const Axios = axios;
axios.defaults.baseURL = 'http://127.0.0.1:7025/copyright';
// axios.defaults.baseURL = '/copyright';
-export const DevUserId: string = '80d3365e-0597-4988-979e-18ef1c3ec671';
+// export const DevUserId: string = '80d3365e-0597-4988-979e-18ef1c3ec671'; // 18634604067
+export const DevUserId: string = 'c2438eb8-2685-49a9-bf02-5111a5192d96'; // 18647109157
// export const DevUserId: string = '';
type Req = {