ai窗口一键生成
This commit is contained in:
parent
13d9a760c2
commit
10803f293c
@ -4,8 +4,14 @@ import { GlobalContext } from "../../context/GlobalContext.ts";
|
|||||||
import { del, get, post, put, websocketUrl, Axios } from "../../util/AjaxUtils.ts";
|
import { del, get, post, put, websocketUrl, Axios } from "../../util/AjaxUtils.ts";
|
||||||
import {
|
import {
|
||||||
// Col, Divider, Row,
|
// Col, Divider, Row,
|
||||||
Spin, Image, Pagination
|
Spin, Image, Pagination,
|
||||||
|
Button, Dropdown, notification
|
||||||
} from "antd";
|
} from "antd";
|
||||||
|
const close = () => {
|
||||||
|
console.log(
|
||||||
|
'Notification was closed. Either the close button was clicked or duration time elapsed.',
|
||||||
|
);
|
||||||
|
};
|
||||||
import { AxiosResponse } from "axios";
|
import { AxiosResponse } from "axios";
|
||||||
import useMessage from "antd/es/message/useMessage";
|
import useMessage from "antd/es/message/useMessage";
|
||||||
import AiHelperText from "./text/AiHelperText.tsx";
|
import AiHelperText from "./text/AiHelperText.tsx";
|
||||||
@ -17,7 +23,7 @@ import {
|
|||||||
// useParams
|
// useParams
|
||||||
} from "react-router-dom";
|
} from "react-router-dom";
|
||||||
import { uuid } from "../../util/CommonUtil.ts";
|
import { uuid } from "../../util/CommonUtil.ts";
|
||||||
|
const key = `open${Date.now()}`;
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
projId: string;
|
projId: string;
|
||||||
projIntroduction?: string;
|
projIntroduction?: string;
|
||||||
@ -33,6 +39,7 @@ type ProjModType = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function AiHelper(props: PropsType) {
|
export default function AiHelper(props: PropsType) {
|
||||||
|
|
||||||
// 页面样式相关
|
// 页面样式相关
|
||||||
const [pageImgArray, setpageImgArray] = useState<any[]>([])
|
const [pageImgArray, setpageImgArray] = useState<any[]>([])
|
||||||
const [pageTotal, setPageTotal] = useState(0)
|
const [pageTotal, setPageTotal] = useState(0)
|
||||||
@ -76,6 +83,8 @@ export default function AiHelper(props: PropsType) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const height = window.innerHeight - 265;
|
const height = window.innerHeight - 265;
|
||||||
|
// 是否点击了快速生成
|
||||||
|
const [isFast, setIsFast] = useState(false)
|
||||||
// 提示是否可以生成模块
|
// 提示是否可以生成模块
|
||||||
// const [modal, setModal] = useState(false)
|
// const [modal, setModal] = useState(false)
|
||||||
// const pathParams = useParams();
|
// const pathParams = useParams();
|
||||||
@ -188,6 +197,7 @@ export default function AiHelper(props: PropsType) {
|
|||||||
if (data.type == 'REFRESH_PROJ_INTRODUCTION') {
|
if (data.type == 'REFRESH_PROJ_INTRODUCTION') {
|
||||||
setIsProjIntroductionLoading(false);
|
setIsProjIntroductionLoading(false);
|
||||||
setNewProjIntroduction(data.content);
|
setNewProjIntroduction(data.content);
|
||||||
|
|
||||||
// if (!projIntroduction) {
|
// if (!projIntroduction) {
|
||||||
// setProjIntroduction(data.content)
|
// setProjIntroduction(data.content)
|
||||||
// updateProjIntroduction(data.content);
|
// updateProjIntroduction(data.content);
|
||||||
@ -203,6 +213,31 @@ export default function AiHelper(props: PropsType) {
|
|||||||
// }
|
// }
|
||||||
} else if (data.type == 'REFRESH_PROJ_MODS') {
|
} else if (data.type == 'REFRESH_PROJ_MODS') {
|
||||||
setIsProjModArrayLoading(false);
|
setIsProjModArrayLoading(false);
|
||||||
|
notification.open({
|
||||||
|
message: '提示',
|
||||||
|
description:
|
||||||
|
`功能列表已生成完毕,是否前去查看?`,
|
||||||
|
btn: (
|
||||||
|
<div>
|
||||||
|
<Button size="small" type="primary" onClick={() => {
|
||||||
|
notification.destroy(key)
|
||||||
|
setActiveTab('模块')
|
||||||
|
}}>
|
||||||
|
确定
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
),
|
||||||
|
key,
|
||||||
|
onClose: close,
|
||||||
|
duration: null,
|
||||||
|
placement: 'bottomRight', // 设置通知框显示在右下角
|
||||||
|
style: {
|
||||||
|
width: 300, // 设置通知框的宽度
|
||||||
|
height: 130, // 设置通知框的高度
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
const projMods = JSON.parse(data.content) as ProjModType[];
|
const projMods = JSON.parse(data.content) as ProjModType[];
|
||||||
projMods.forEach(projMod => projMod.id = uuid())
|
projMods.forEach(projMod => projMod.id = uuid())
|
||||||
setNewProjModArray(projMods);
|
setNewProjModArray(projMods);
|
||||||
@ -258,6 +293,17 @@ export default function AiHelper(props: PropsType) {
|
|||||||
ping();
|
ping();
|
||||||
setIsProjIntroductionLoading(true);
|
setIsProjIntroductionLoading(true);
|
||||||
}
|
}
|
||||||
|
const xixi = () => {
|
||||||
|
setIsFast(true)
|
||||||
|
ws.current?.send(JSON.stringify({
|
||||||
|
type: 'REFRESH_AI_PROJ',
|
||||||
|
projId: props.projId
|
||||||
|
}));
|
||||||
|
ping();
|
||||||
|
setIsProjIntroductionLoading(true);
|
||||||
|
setIsProjDescLoading(true);
|
||||||
|
setIsProjModArrayLoading(true);
|
||||||
|
}
|
||||||
|
|
||||||
const generateProjDesc = () => {
|
const generateProjDesc = () => {
|
||||||
|
|
||||||
@ -277,7 +323,11 @@ export default function AiHelper(props: PropsType) {
|
|||||||
ping();
|
ping();
|
||||||
setIsProjModArrayLoading(true);
|
setIsProjModArrayLoading(true);
|
||||||
}
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
if (isFast && !isProjIntroductionLoading && !isProjDescLoading && !isProjModArrayLoading) {
|
||||||
|
setIsFast(false)
|
||||||
|
}
|
||||||
|
}, [isFast, isProjIntroductionLoading, isProjDescLoading, isProjModArrayLoading])
|
||||||
/**
|
/**
|
||||||
* 保存简介
|
* 保存简介
|
||||||
*/
|
*/
|
||||||
@ -292,7 +342,7 @@ export default function AiHelper(props: PropsType) {
|
|||||||
setIsProjIntroductionLoading(true);
|
setIsProjIntroductionLoading(true);
|
||||||
},
|
},
|
||||||
onSuccess(data) {
|
onSuccess(data) {
|
||||||
messageApi.success('保存成功,点击编辑按钮可继续修改项目简介');
|
messageApi.success('项目简介保存成功,点击编辑按钮可继续修改项目简介');
|
||||||
setProjIntroduction(content);
|
setProjIntroduction(content);
|
||||||
setNewProjIntroduction('');
|
setNewProjIntroduction('');
|
||||||
console.log('更新成功', data);
|
console.log('更新成功', data);
|
||||||
@ -319,7 +369,7 @@ export default function AiHelper(props: PropsType) {
|
|||||||
setIsProjDescLoading(true);
|
setIsProjDescLoading(true);
|
||||||
},
|
},
|
||||||
onSuccess() {
|
onSuccess() {
|
||||||
messageApi.success('保存成功,点击编辑按钮可继续修改项目详情').then();
|
messageApi.success('项目详情保存成功,点击编辑按钮可继续修改项目详情').then();
|
||||||
setProjDesc(content);
|
setProjDesc(content);
|
||||||
setNewProjDesc('');
|
setNewProjDesc('');
|
||||||
},
|
},
|
||||||
@ -476,72 +526,115 @@ export default function AiHelper(props: PropsType) {
|
|||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
</Row> */}
|
</Row> */}
|
||||||
<div className="aiTabBtnBox">
|
<div style={{
|
||||||
<div className={activeTab == '简介' ? 'tabActive' : "aiTabBtn"}
|
display: 'flex',
|
||||||
onClick={() => {
|
justifyContent: 'space-between',
|
||||||
setActiveTab('简介')
|
}}>
|
||||||
}}
|
<div className="aiTabBtnBox">
|
||||||
>
|
<div className={activeTab == '简介' ? 'tabActive' : "aiTabBtn"}
|
||||||
系统简介
|
onClick={() => {
|
||||||
</div>
|
setActiveTab('简介')
|
||||||
<div className={activeTab == '详情' ? 'tabActive' : "aiTabBtn"}
|
}}
|
||||||
onClick={() => {
|
>
|
||||||
setActiveTab('详情')
|
系统简介
|
||||||
}}
|
</div>
|
||||||
>
|
<div className={activeTab == '详情' ? 'tabActive' : "aiTabBtn"}
|
||||||
系统详情
|
onClick={() => {
|
||||||
</div>
|
setActiveTab('详情')
|
||||||
<div className={activeTab == '模块' ? 'tabActive' : "aiTabBtn"}
|
}}
|
||||||
onClick={() => {
|
>
|
||||||
setActiveTab('模块')
|
系统详情
|
||||||
}}
|
</div>
|
||||||
>
|
<div className={activeTab == '模块' ? 'tabActive' : "aiTabBtn"}
|
||||||
功能列表
|
onClick={() => {
|
||||||
</div>
|
setActiveTab('模块')
|
||||||
<div className={activeTab == '登录' ? 'tabActive' : "aiTabBtn"}
|
}}
|
||||||
onClick={() => {
|
>
|
||||||
setActiveTab('登录')
|
功能列表
|
||||||
getLoginPageInfo()
|
</div>
|
||||||
}}
|
<div className={activeTab == '登录' ? 'tabActive' : "aiTabBtn"}
|
||||||
>
|
onClick={() => {
|
||||||
登录页面
|
setActiveTab('登录')
|
||||||
</div>
|
getLoginPageInfo()
|
||||||
<div className={activeTab == '页面' ? 'tabActive' : "aiTabBtn"}
|
}}
|
||||||
onClick={() => {
|
>
|
||||||
setActiveTab('页面')
|
登录页面
|
||||||
getData()
|
</div>
|
||||||
|
<div className={activeTab == '页面' ? 'tabActive' : "aiTabBtn"}
|
||||||
|
onClick={() => {
|
||||||
|
setActiveTab('页面')
|
||||||
|
getData()
|
||||||
|
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
页面样式
|
||||||
|
</div>
|
||||||
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
页面样式
|
|
||||||
</div>
|
</div>
|
||||||
|
{/*
|
||||||
|
<Dropdown menu={{
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
key: '1',
|
||||||
|
label: (
|
||||||
|
<div >
|
||||||
|
<div
|
||||||
|
|
||||||
|
onClick={() => {
|
||||||
|
setIsFast(true)
|
||||||
|
xixi()
|
||||||
|
}}>简介、详情、功能列表
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}} placement="bottomLeft" arrow>
|
||||||
|
<Button className=''
|
||||||
|
>一键生成
|
||||||
|
</Button>
|
||||||
|
</Dropdown> */}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='aiTabContent'>
|
<div className='aiTabContent'>
|
||||||
<div style={{ display: activeTab == '简介' ? 'block' : 'none' }}>
|
{/* <Spin tip="正在处理,请稍后..." size="small" className='fastmask' spinning={isFast} > */}
|
||||||
|
<div className='masksmall' style={{ display: activeTab == '简介' ? 'block' : 'none' }}>
|
||||||
<Spin tip="正在处理,请稍后..." size="small" spinning={isProjIntroductionLoading}>
|
<Spin tip="正在处理,请稍后..." size="small" spinning={isProjIntroductionLoading}>
|
||||||
<AiHelperText
|
<AiHelperText
|
||||||
|
isFast={isFast}
|
||||||
title="系统简介"
|
title="系统简介"
|
||||||
text={projIntroduction}
|
text={projIntroduction}
|
||||||
|
projIntroduction={projIntroduction}
|
||||||
newText={newProjIntroduction}
|
newText={newProjIntroduction}
|
||||||
maxLength={1500}
|
maxLength={1500}
|
||||||
handleGenerate={() => {
|
handleGenerate={() => {
|
||||||
generateProjIntroduction();
|
// xixi()
|
||||||
// setProjIntroduction(newProjIntroduction)
|
setProjIntroduction(newProjIntroduction)
|
||||||
|
}}
|
||||||
|
xixi={() => {
|
||||||
|
xixi()
|
||||||
}}
|
}}
|
||||||
handleSave={(text) => {
|
handleSave={(text) => {
|
||||||
updateProjIntroduction(text);
|
updateProjIntroduction(text);
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
setActiveTab={
|
||||||
|
(data: string) => {
|
||||||
|
setActiveTab(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
></AiHelperText>
|
></AiHelperText>
|
||||||
</Spin>
|
</Spin>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ display: activeTab == '详情' ? 'block' : 'none' }}>
|
<div className='masksmall' style={{ display: activeTab == '详情' ? 'block' : 'none' }}>
|
||||||
<Spin tip="正在处理,请稍后..." size="small" spinning={isProjDescLoading}>
|
<Spin tip="正在处理,请稍后..." size="small" spinning={isProjDescLoading}>
|
||||||
<AiHelperText title="系统详情"
|
<AiHelperText title="系统详情"
|
||||||
|
isFast={isFast}
|
||||||
text={projDesc}
|
text={projDesc}
|
||||||
|
projIntroduction={projIntroduction}
|
||||||
newText={newProjDesc}
|
newText={newProjDesc}
|
||||||
maxLength={1500}
|
maxLength={1500}
|
||||||
handleGenerate={() => {
|
handleGenerate={() => {
|
||||||
@ -550,13 +643,31 @@ export default function AiHelper(props: PropsType) {
|
|||||||
handleSave={(text) => {
|
handleSave={(text) => {
|
||||||
updateProjDesc(text);
|
updateProjDesc(text);
|
||||||
}}
|
}}
|
||||||
|
setActiveTab={
|
||||||
|
(data: string) => {
|
||||||
|
setActiveTab(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xixi={() => {
|
||||||
|
xixi()
|
||||||
|
}}
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</Spin>
|
</Spin>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: activeTab == '模块' ? 'block' : 'none' }}>
|
<div className='masksmall' style={{ display: activeTab == '模块' ? 'block' : 'none' }}>
|
||||||
<Spin tip="正在处理,请稍后..." size="small" spinning={isProjModArrayLoading}>
|
<Spin tip="正在处理,请稍后..." size="small" spinning={isProjModArrayLoading}>
|
||||||
<AiHelperMod mods={projModArray}
|
<AiHelperMod mods={projModArray}
|
||||||
|
isFast={isFast}
|
||||||
|
projIntroduction={projIntroduction}
|
||||||
|
xixi={() => {
|
||||||
|
xixi()
|
||||||
|
}}
|
||||||
|
setActiveTab={
|
||||||
|
(data: string) => {
|
||||||
|
setActiveTab(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
newMods={newProjModArray}
|
newMods={newProjModArray}
|
||||||
handleGenerate={() => {
|
handleGenerate={() => {
|
||||||
// getProjDesc()
|
// getProjDesc()
|
||||||
@ -584,6 +695,31 @@ export default function AiHelper(props: PropsType) {
|
|||||||
setNewProjModArray([
|
setNewProjModArray([
|
||||||
...newProjModArray
|
...newProjModArray
|
||||||
]);
|
]);
|
||||||
|
// notification.open({
|
||||||
|
// message: '提示',
|
||||||
|
// description:
|
||||||
|
// `功能列表已生成完毕,是否前去查看?`,
|
||||||
|
// btn: (
|
||||||
|
// <div>
|
||||||
|
// <Button size="small" type="primary" onClick={() => {
|
||||||
|
// notification.destroy(key)
|
||||||
|
// setActiveTab('模块')
|
||||||
|
// }}>
|
||||||
|
// 确定
|
||||||
|
// </Button>
|
||||||
|
// </div>
|
||||||
|
|
||||||
|
// ),
|
||||||
|
// key,
|
||||||
|
// onClose: close,
|
||||||
|
// duration: null,
|
||||||
|
// placement: 'bottomRight', // 设置通知框显示在右下角
|
||||||
|
// style: {
|
||||||
|
// width: 300, // 设置通知框的宽度
|
||||||
|
// height: 150, // 设置通知框的高度
|
||||||
|
// },
|
||||||
|
|
||||||
|
// });
|
||||||
},
|
},
|
||||||
onFinally() {
|
onFinally() {
|
||||||
setIsProjModArrayLoading(false);
|
setIsProjModArrayLoading(false);
|
||||||
@ -640,7 +776,9 @@ export default function AiHelper(props: PropsType) {
|
|||||||
/>
|
/>
|
||||||
</Spin>
|
</Spin>
|
||||||
</div>
|
</div>
|
||||||
|
{/* </Spin> */}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ display: activeTab == '登录' ? 'block' : 'none' }}>
|
<div style={{ display: activeTab == '登录' ? 'block' : 'none' }}>
|
||||||
<div style={{ height: `${height - 80}px`, overflow: 'auto', display: '', justifyContent: '', flexWrap: 'wrap', marginTop: 10 }}>
|
<div style={{ height: `${height - 80}px`, overflow: 'auto', display: '', justifyContent: '', flexWrap: 'wrap', marginTop: 10 }}>
|
||||||
{
|
{
|
||||||
|
@ -46,3 +46,17 @@
|
|||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
/* .aiTabContent .css-dev-only-do-not-override-11lehqq.ant-spin-nested-loading .ant-spin-container::after{
|
||||||
|
|
||||||
|
background: rgba(189, 84, 84, 0);
|
||||||
|
transition: all 0.3s;
|
||||||
|
}
|
||||||
|
.masksmall .css-dev-only-do-not-override-11lehqq.ant-spin-nested-loading .ant-spin-container::after{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
.ant-spin-spinning {
|
||||||
|
background: rgba(189, 84, 84, 0);
|
||||||
|
|
||||||
|
transition: transform 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86)
|
||||||
|
} */
|
@ -2,8 +2,14 @@ import './ai-helper-mod.css'
|
|||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
// Divider, Dropdown, Space,
|
// Divider, Dropdown, Space,
|
||||||
Table, TableProps, Modal
|
Table, TableProps, Modal,
|
||||||
|
// notification
|
||||||
} from "antd";
|
} from "antd";
|
||||||
|
// const close = () => {
|
||||||
|
// console.log(
|
||||||
|
// 'Notification was closed. Either the close button was clicked or duration time elapsed.',
|
||||||
|
// );
|
||||||
|
// };
|
||||||
import {
|
import {
|
||||||
// CheckOutlined,
|
// CheckOutlined,
|
||||||
LoadingOutlined,
|
LoadingOutlined,
|
||||||
@ -29,6 +35,10 @@ type PropsType = {
|
|||||||
handleResaveField: (index: number, projModId: string) => void;
|
handleResaveField: (index: number, projModId: string) => void;
|
||||||
handleRemove: (index: number, projModId: string, item: IProjMod) => void;
|
handleRemove: (index: number, projModId: string, item: IProjMod) => void;
|
||||||
handleEdit: (index: number, projModId: string, item: IProjMod) => void;
|
handleEdit: (index: number, projModId: string, item: IProjMod) => void;
|
||||||
|
setActiveTab: (key: string) => void;
|
||||||
|
xixi: any;
|
||||||
|
projIntroduction: string;
|
||||||
|
isFast: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProjModType = {
|
type ProjModType = {
|
||||||
@ -51,12 +61,80 @@ export default function AiHelperMod(props: PropsType) {
|
|||||||
|
|
||||||
// const [items, setItems] = useState<any[]>([])
|
// const [items, setItems] = useState<any[]>([])
|
||||||
const pathParams = useParams();
|
const pathParams = useParams();
|
||||||
|
// useEffect(() => {
|
||||||
|
// // console.log('mods', props.mods);
|
||||||
|
|
||||||
|
// if( newModArray.length > 0){
|
||||||
|
// alert('请先保存')
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }, [modArray, newModArray]);
|
||||||
|
// const key = `open${Date.now()}`;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// console.log('mods', props.mods);
|
// console.log('mods', props.mods);
|
||||||
|
|
||||||
setModArray(props.mods);
|
setModArray(props.mods);
|
||||||
setNewModArray(props.newMods);
|
setNewModArray(props.newMods);
|
||||||
|
// if (props.newMods.length > 0 ) {
|
||||||
|
// notification.open({
|
||||||
|
// message: '提示',
|
||||||
|
// description:
|
||||||
|
// `功能列表已生成完毕,是否前去查看?`,
|
||||||
|
// btn: (
|
||||||
|
// <div>
|
||||||
|
// <Button size="small" type="primary" onClick={() => {
|
||||||
|
// notification.destroy(key)
|
||||||
|
// props.setActiveTab('模块')
|
||||||
|
// }}>
|
||||||
|
// 确定
|
||||||
|
// </Button>
|
||||||
|
// </div>
|
||||||
|
|
||||||
|
// ),
|
||||||
|
// key,
|
||||||
|
// onClose: close,
|
||||||
|
// // duration: null,
|
||||||
|
// placement: 'bottomRight', // 设置通知框显示在右下角
|
||||||
|
// style: {
|
||||||
|
// width: 300, // 设置通知框的宽度
|
||||||
|
// height: 150, // 设置通知框的高度
|
||||||
|
// },
|
||||||
|
|
||||||
|
// });
|
||||||
|
// }
|
||||||
}, [props.mods, props.newMods]);
|
}, [props.mods, props.newMods]);
|
||||||
|
// useEffect(() => {
|
||||||
|
// // console.log('mods', props.mods);
|
||||||
|
// if (newModArray.length > 0 && newModArray != props.newMods) {
|
||||||
|
// notification.open({
|
||||||
|
// message: '提示',
|
||||||
|
// description:
|
||||||
|
// `功能列表已生成完毕,是否前去查看?`,
|
||||||
|
// btn: (
|
||||||
|
// <div>
|
||||||
|
// <Button size="small" type="primary" onClick={() => {
|
||||||
|
// notification.destroy(key)
|
||||||
|
// props.setActiveTab('模块')
|
||||||
|
// }}>
|
||||||
|
// 确定
|
||||||
|
// </Button>
|
||||||
|
// </div>
|
||||||
|
|
||||||
|
// ),
|
||||||
|
// key,
|
||||||
|
// onClose: close,
|
||||||
|
// duration: null,
|
||||||
|
// placement: 'bottomRight', // 设置通知框显示在右下角
|
||||||
|
// style: {
|
||||||
|
// width: 300, // 设置通知框的宽度
|
||||||
|
// height: 150, // 设置通知框的高度
|
||||||
|
// },
|
||||||
|
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }, [newModArray]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (updata.length != 0) {
|
if (updata.length != 0) {
|
||||||
// console.log('更新数据', updata);
|
// console.log('更新数据', updata);
|
||||||
@ -126,7 +204,7 @@ export default function AiHelperMod(props: PropsType) {
|
|||||||
title: '操作',
|
title: '操作',
|
||||||
dataIndex: 'option',
|
dataIndex: 'option',
|
||||||
key: 'option',
|
key: 'option',
|
||||||
// width: 120,
|
width: 100,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
render: (_value, record, index) => {
|
render: (_value, record, index) => {
|
||||||
if (status == 'SUCCESS') {
|
if (status == 'SUCCESS') {
|
||||||
@ -160,7 +238,7 @@ export default function AiHelperMod(props: PropsType) {
|
|||||||
style={{
|
style={{
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
// background: 'pink',
|
// background: 'pink',
|
||||||
width:40,
|
width: 40,
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
props.handleResaveField(index, record.projModId);
|
props.handleResaveField(index, record.projModId);
|
||||||
@ -170,7 +248,7 @@ export default function AiHelperMod(props: PropsType) {
|
|||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
marginLeft: 19,
|
marginLeft: 19,
|
||||||
color: '#FF4040',
|
color: '#FF4040',
|
||||||
width:40,
|
width: 40,
|
||||||
|
|
||||||
|
|
||||||
}}
|
}}
|
||||||
@ -184,7 +262,7 @@ export default function AiHelperMod(props: PropsType) {
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
whiteSpace: 'nowrap' , display: 'flex',
|
whiteSpace: 'nowrap', display: 'flex',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
|
|
||||||
@ -193,7 +271,7 @@ export default function AiHelperMod(props: PropsType) {
|
|||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
width:40,
|
width: 40,
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setId(record.projModId)
|
setId(record.projModId)
|
||||||
@ -203,9 +281,9 @@ export default function AiHelperMod(props: PropsType) {
|
|||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
marginLeft: 19,
|
marginLeft: 5,
|
||||||
color: '#FF4040',
|
color: '#FF4040',
|
||||||
width:40,
|
width: 40,
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
props.handleRemove(index, record.projModId, record);
|
props.handleRemove(index, record.projModId, record);
|
||||||
@ -437,7 +515,17 @@ export default function AiHelperMod(props: PropsType) {
|
|||||||
暂无内容,点击
|
暂无内容,点击
|
||||||
<span style={{ color: '#FF9D00', cursor: 'pointer' }}
|
<span style={{ color: '#FF9D00', cursor: 'pointer' }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
props.handleGenerate()
|
if (props.isFast) {
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
if (props.projIntroduction) {
|
||||||
|
props.handleGenerate()
|
||||||
|
} else {
|
||||||
|
props.xixi()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}}
|
}}
|
||||||
>自动生成</span>
|
>自动生成</span>
|
||||||
|
|
||||||
@ -481,12 +569,13 @@ export default function AiHelperMod(props: PropsType) {
|
|||||||
marginLeft: 15,
|
marginLeft: 15,
|
||||||
width: 109,
|
width: 109,
|
||||||
}}
|
}}
|
||||||
disabled={status == 'SUCCESS' || status == 'GENERATING' ? true : false}
|
disabled={status == 'SUCCESS' || status == 'GENERATING' || props.isFast ? true : false}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
props.handleGenerate()
|
props.handleGenerate()
|
||||||
}}
|
}}
|
||||||
>AI生成</Button>
|
>AI生成</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<Modal title="编辑"
|
<Modal title="编辑"
|
||||||
destroyOnClose={true}
|
destroyOnClose={true}
|
||||||
|
@ -1,8 +1,15 @@
|
|||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
// Divider, Empty, Space
|
// Divider, Empty, Space
|
||||||
Modal
|
// Modal,
|
||||||
|
notification
|
||||||
} from "antd";
|
} from "antd";
|
||||||
|
const close = () => {
|
||||||
|
console.log(
|
||||||
|
'Notification was closed. Either the close button was clicked or duration time elapsed.',
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
import './ai-helper-text.css'
|
import './ai-helper-text.css'
|
||||||
import TextArea from "antd/es/input/TextArea";
|
import TextArea from "antd/es/input/TextArea";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
@ -20,7 +27,10 @@ type PropsType = {
|
|||||||
newText: string;
|
newText: string;
|
||||||
handleGenerate: () => void;
|
handleGenerate: () => void;
|
||||||
handleSave: (newText: string) => void;
|
handleSave: (newText: string) => void;
|
||||||
|
xixi?: any;
|
||||||
|
setActiveTab: (key: string) => void;
|
||||||
|
projIntroduction: string;
|
||||||
|
isFast: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function AiHelperText(props: PropsType) {
|
export default function AiHelperText(props: PropsType) {
|
||||||
@ -44,9 +54,10 @@ export default function AiHelperText(props: PropsType) {
|
|||||||
const [text, setText] = useState('');
|
const [text, setText] = useState('');
|
||||||
const [newText, setNewText] = useState('');
|
const [newText, setNewText] = useState('');
|
||||||
const [isShow, setIsShow] = useState(false) //替换按钮是否显示
|
const [isShow, setIsShow] = useState(false) //替换按钮是否显示
|
||||||
const [modal, setModal] = useState(false) //提示替换弹窗
|
// const [modal, setModal] = useState(false) //提示替换弹窗
|
||||||
const [isTextEdit, setIsTextEdit] = useState(false);
|
const [isTextEdit, setIsTextEdit] = useState(false);
|
||||||
// const [isNewTextEdit, setIsNewTextEdit] = useState(false);
|
// const [isNewTextEdit, setIsNewTextEdit] = useState(false);
|
||||||
|
const key = `${props.title}`;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setText(props.text);
|
setText(props.text);
|
||||||
@ -55,7 +66,93 @@ export default function AiHelperText(props: PropsType) {
|
|||||||
setIsShow(true)
|
setIsShow(true)
|
||||||
}
|
}
|
||||||
if (props.text && props.newText) {
|
if (props.text && props.newText) {
|
||||||
setModal(true)
|
// console.log(props.text, props.newText);
|
||||||
|
// notification.open({
|
||||||
|
// message: '提示',
|
||||||
|
// description: (
|
||||||
|
// <div>
|
||||||
|
// 是否替换当前{props.title}?
|
||||||
|
// <div>
|
||||||
|
// <Button
|
||||||
|
// type="link"
|
||||||
|
// onClick={() => {
|
||||||
|
// // setModal(false);
|
||||||
|
// setText(newText)
|
||||||
|
// props.handleSave(newText);
|
||||||
|
// setNewText('')
|
||||||
|
// api.destroy(key)
|
||||||
|
// }}
|
||||||
|
// >
|
||||||
|
// 替换
|
||||||
|
// </Button>
|
||||||
|
// <Button
|
||||||
|
// type="link"
|
||||||
|
// onClick={() => api.destroy(key)}
|
||||||
|
// >
|
||||||
|
// 取消
|
||||||
|
// </Button>
|
||||||
|
|
||||||
|
// </div>
|
||||||
|
// </div>
|
||||||
|
// ),
|
||||||
|
// key,
|
||||||
|
// onClose: close,
|
||||||
|
// // onClose: () => {
|
||||||
|
// // close();
|
||||||
|
// // },
|
||||||
|
// });
|
||||||
|
notification.open({
|
||||||
|
message: '提示',
|
||||||
|
description:
|
||||||
|
`${props.title}已生成完毕,是否替换当前${props.title}?`,
|
||||||
|
btn: (
|
||||||
|
<div>
|
||||||
|
<Button size="small" onClick={() => {
|
||||||
|
if (props.title == key) {
|
||||||
|
notification.destroy(key)
|
||||||
|
}
|
||||||
|
// if (props.title == '系统简介') {
|
||||||
|
// props.setActiveTab('简介')
|
||||||
|
// }
|
||||||
|
// if (props.title == '系统详情') {
|
||||||
|
// props.setActiveTab('详情')
|
||||||
|
// }
|
||||||
|
}}>
|
||||||
|
取消
|
||||||
|
</Button>
|
||||||
|
<Button type="primary" size="small"
|
||||||
|
style={{ marginLeft: 8 }}
|
||||||
|
onClick={() => {
|
||||||
|
setText(props.newText)
|
||||||
|
props.handleSave(props.newText);
|
||||||
|
setNewText('')
|
||||||
|
if (props.title == key) {
|
||||||
|
notification.destroy(key)
|
||||||
|
}
|
||||||
|
if (props.title == '系统简介') {
|
||||||
|
props.setActiveTab('简介')
|
||||||
|
}
|
||||||
|
if (props.title == '系统详情') {
|
||||||
|
props.setActiveTab('详情')
|
||||||
|
}
|
||||||
|
|
||||||
|
}}>
|
||||||
|
替换
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
),
|
||||||
|
key,
|
||||||
|
onClose: close,
|
||||||
|
// duration: null,
|
||||||
|
placement: 'bottomRight', // 设置通知框显示在右下角
|
||||||
|
style: {
|
||||||
|
width: 300, // 设置通知框的宽度
|
||||||
|
height: 150, // 设置通知框的高度
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!props.text && props.newText) {
|
if (!props.text && props.newText) {
|
||||||
// console.log('aaaaaaaa',props.newText);
|
// console.log('aaaaaaaa',props.newText);
|
||||||
@ -144,16 +241,30 @@ export default function AiHelperText(props: PropsType) {
|
|||||||
暂无内容,点击
|
暂无内容,点击
|
||||||
<span style={{ color: '#FF9D00', cursor: 'pointer' }}
|
<span style={{ color: '#FF9D00', cursor: 'pointer' }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
props.handleGenerate();
|
if (props.isFast) {
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
if (props.title == '系统简介') {
|
||||||
|
props.xixi()
|
||||||
|
}
|
||||||
|
if (props.title == '系统详情') {
|
||||||
|
if (!props.projIntroduction) {
|
||||||
|
props.xixi()
|
||||||
|
} else {
|
||||||
|
props.handleGenerate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}}
|
}}
|
||||||
>自动生成</span>
|
>自动生成</span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div className="aiNotext-tip"
|
<div className="aiNotext-tip"
|
||||||
style={{
|
style={{
|
||||||
display:props.title=='系统详情'? 'block' : 'none'
|
display: props.title == '系统详情' ? 'block' : 'none'
|
||||||
}}
|
}}
|
||||||
>为了合理生成系统详情,建议在系统简介生成完成后再生系统详情</div>
|
>为了合理生成系统详情,建议在系统简介生成完成后再生系统详情</div>
|
||||||
</div>
|
</div>
|
||||||
{/* <div style={{color:'red',position: 'absolute', bottom: 70,textAlign:'center',width:600 , left: -140}}>为了合理生成功能列表,建议在项目简介生成完成后再生成功能列表</div> */}
|
{/* <div style={{color:'red',position: 'absolute', bottom: 70,textAlign:'center',width:600 , left: -140}}>为了合理生成功能列表,建议在项目简介生成完成后再生成功能列表</div> */}
|
||||||
</div>
|
</div>
|
||||||
@ -209,7 +320,7 @@ export default function AiHelperText(props: PropsType) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div className="aiText" style={{ height: `${height}px`,overflow:'auto' }}>
|
<div className="aiText" style={{ height: `${height}px`, overflow: 'auto' }}>
|
||||||
<div className="aiText-top">
|
<div className="aiText-top">
|
||||||
{renderTextDom()}
|
{renderTextDom()}
|
||||||
<div className="aiText-top-btn" style={{ display: props.text ? 'block' : 'none' }}>
|
<div className="aiText-top-btn" style={{ display: props.text ? 'block' : 'none' }}>
|
||||||
@ -284,26 +395,41 @@ export default function AiHelperText(props: PropsType) {
|
|||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
||||||
|
setText(newText)
|
||||||
setModal(true)
|
props.handleSave(newText);
|
||||||
|
setNewText('')
|
||||||
|
// setModal(true)
|
||||||
// setNewText('')
|
// setNewText('')
|
||||||
|
notification.destroy(key)
|
||||||
}}
|
}}
|
||||||
>替换</Button>
|
>替换</Button>
|
||||||
<Button
|
<Button
|
||||||
disabled={status == 'SUCCESS' || status == 'GENERATING' ? true : false}
|
disabled={status == 'SUCCESS' || status == 'GENERATING' || props.isFast ? true : false}
|
||||||
// size="large"
|
// size="large"
|
||||||
type="primary" style={{
|
type="primary" style={{
|
||||||
width: 109,
|
width: 109,
|
||||||
marginLeft: 15,
|
marginLeft: 15,
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
props.handleGenerate()
|
if (props.title == '系统简介') {
|
||||||
|
props.xixi()
|
||||||
|
}
|
||||||
|
if (props.title == '系统详情') {
|
||||||
|
if (!props.projIntroduction) {
|
||||||
|
props.xixi()
|
||||||
|
} else {
|
||||||
|
props.handleGenerate()
|
||||||
|
}
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>AI生成</Button>
|
>{props.title == '系统简介' ? '一键生成' : 'AI生成'}</Button>
|
||||||
|
{/* <Button
|
||||||
|
onClick={() => {
|
||||||
|
props.xixi()
|
||||||
|
}}>嘻嘻</Button> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Modal
|
{/* <Modal
|
||||||
title={'提示'}
|
title={'提示'}
|
||||||
destroyOnClose={true}
|
destroyOnClose={true}
|
||||||
open={modal}
|
open={modal}
|
||||||
@ -332,7 +458,7 @@ export default function AiHelperText(props: PropsType) {
|
|||||||
是否替换当前{props.title}
|
是否替换当前{props.title}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal> */}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
@ -5,7 +5,8 @@ import { useNavigate, useParams } from "react-router-dom";
|
|||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
// FloatButton,
|
// FloatButton,
|
||||||
message, Modal
|
message, Modal,
|
||||||
|
notification
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import StepProjEdit from "../../components/step/StepProjEdit.tsx";
|
import StepProjEdit from "../../components/step/StepProjEdit.tsx";
|
||||||
import CardProjEdit from "../../components/card/CardProjEdit.tsx";
|
import CardProjEdit from "../../components/card/CardProjEdit.tsx";
|
||||||
@ -701,6 +702,7 @@ export default function ProjEdit() {
|
|||||||
maskClosable={false}
|
maskClosable={false}
|
||||||
destroyOnClose={true}
|
destroyOnClose={true}
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
|
notification.destroy()
|
||||||
getListMods()
|
getListMods()
|
||||||
// if (aiHelper.projIntroduction && aiHelper.projDesc && listMods.length > 0) {
|
// if (aiHelper.projIntroduction && aiHelper.projDesc && listMods.length > 0) {
|
||||||
// setAiHelperModalOpen(false);
|
// setAiHelperModalOpen(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user