lyp
This commit is contained in:
parent
2bb1064a7c
commit
ea0b30554c
265
src/components/EditModal/EditModal.tsx
Normal file
265
src/components/EditModal/EditModal.tsx
Normal file
@ -0,0 +1,265 @@
|
|||||||
|
import './proj-config-list-mod.css';
|
||||||
|
import {
|
||||||
|
Alert,
|
||||||
|
Button, Col, Flex, Form, Input,
|
||||||
|
message, Modal, Row, Spin,
|
||||||
|
} from "antd";
|
||||||
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import FaiconSelect from "../faicon/FaIconSelect.tsx";
|
||||||
|
import ModField, { IModField } from "../modfield/ModField.tsx";
|
||||||
|
import { get, put } from "../../util/AjaxUtils.ts";
|
||||||
|
import { MAX_MOD_SIZE, MAX_MOD_SIZE_FREE, MIN_MOD_SIZE, MIN_MOD_SIZE_FREE } from "../../route/proj/edit/ProjConfigModList.tsx";
|
||||||
|
|
||||||
|
type FormFieldType = {
|
||||||
|
projId: string;
|
||||||
|
modName: string;
|
||||||
|
modDesc: string;
|
||||||
|
modIcon: string;
|
||||||
|
fields: IModField[];
|
||||||
|
}
|
||||||
|
|
||||||
|
type idType = {
|
||||||
|
isFree?: boolean;
|
||||||
|
id: string;
|
||||||
|
onConfirm: any
|
||||||
|
setUpdata:any
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function ProjConfigModEdit(props: idType) {
|
||||||
|
// const nav = useNavigate();
|
||||||
|
const pathParams = useParams();
|
||||||
|
const [messageApi, contextHolder] = message.useMessage();
|
||||||
|
const [form] = Form.useForm<FormFieldType>();
|
||||||
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
|
const [isModIconModalOpen, setIsModIconModalOpen] = useState(false);
|
||||||
|
const [isEditModalOpen, setIsEditModalOpen] = useState(false);
|
||||||
|
const [selectedModIcon, setSelectedModIcon] = useState<string>('fa fa-list');
|
||||||
|
const [fields, setFields] = useState<IModField[]>([]);
|
||||||
|
const minSize = props.isFree ? MIN_MOD_SIZE_FREE : MIN_MOD_SIZE;
|
||||||
|
const maxSize = props.isFree ? MAX_MOD_SIZE_FREE : MAX_MOD_SIZE;
|
||||||
|
const [projId, setprojId] = useState('')
|
||||||
|
const height = window.innerHeight - 205;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
get<any>({
|
||||||
|
messageApi,
|
||||||
|
url: `api/proj-mod/get/${props.id}`,
|
||||||
|
onSuccess({ data }) {
|
||||||
|
console.log(data);
|
||||||
|
form.setFieldsValue({
|
||||||
|
projId: data.projId,
|
||||||
|
modName: data.modName,
|
||||||
|
modDesc: data.modDesc,
|
||||||
|
modIcon: data.modIcon,
|
||||||
|
fields: data.fields,
|
||||||
|
});
|
||||||
|
setprojId(data.projId)
|
||||||
|
setSelectedModIcon(data.modIcon);
|
||||||
|
setFields(data.fields)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{contextHolder}
|
||||||
|
{/* <Breadcrumb
|
||||||
|
items={[
|
||||||
|
{title: <Link to={'/'}>首页</Link>},
|
||||||
|
{title: <Link to={'/proj-create'}>创建项目</Link>},
|
||||||
|
{
|
||||||
|
title: <a onClick={() => {
|
||||||
|
if(props.isFree) {
|
||||||
|
nav(`/proj-efree/${pathParams.projId}`)
|
||||||
|
} else {
|
||||||
|
`/proj-edit/${pathParams.projId}`
|
||||||
|
}
|
||||||
|
}}>编辑项目</a>
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: <a onClick={() => {
|
||||||
|
nav(-1);
|
||||||
|
}}>系统菜单管理</a>
|
||||||
|
},
|
||||||
|
{title: '编辑菜单'},
|
||||||
|
]}
|
||||||
|
/> */}
|
||||||
|
<div className="mod-edit-container" style={{ overflow: 'auto' }}>
|
||||||
|
<Alert message={`菜单指的是系统的功能,最少${minSize}个菜单,最多${maxSize}个菜单`} type="info" />
|
||||||
|
<div className="mod-content">
|
||||||
|
<Form
|
||||||
|
name="basic"
|
||||||
|
form={form}
|
||||||
|
layout="vertical"
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
wrapperCol={{ span: 24 }}
|
||||||
|
style={{ width: '100%' }}
|
||||||
|
onFinish={() => {
|
||||||
|
setIsEditModalOpen(true);
|
||||||
|
}}
|
||||||
|
autoComplete="off"
|
||||||
|
>
|
||||||
|
<Row gutter={15}>
|
||||||
|
<Col span={10}>
|
||||||
|
<Form.Item<FormFieldType>
|
||||||
|
label="菜单名称"
|
||||||
|
name="modName"
|
||||||
|
extra="此内容会作为菜单名生成菜单,最多8个字"
|
||||||
|
rules={[{ required: true, message: '请输入菜单名称' }]}
|
||||||
|
>
|
||||||
|
<Input placeholder="请输入菜单名称" maxLength={8} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item<FormFieldType>
|
||||||
|
label="菜单说明"
|
||||||
|
name="modDesc"
|
||||||
|
extra="此内容会作为功能描述生成到操作手册中,请详细描述,最多600字"
|
||||||
|
rules={[{ required: true, message: '请输入菜单说明' }]}
|
||||||
|
>
|
||||||
|
<Input.TextArea placeholder="请输入菜单说明" rows={6} maxLength={600} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item<FormFieldType>
|
||||||
|
label="菜单图标"
|
||||||
|
name="modIcon"
|
||||||
|
extra="菜单图标会显示在菜单栏中"
|
||||||
|
rules={[{ required: true, message: '请输入菜单图标' }]}
|
||||||
|
>
|
||||||
|
<Button size="large" onClick={() => {
|
||||||
|
setIsModIconModalOpen(true);
|
||||||
|
}}><i className={selectedModIcon}></i></Button>
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
<Col span={14}>
|
||||||
|
<Form.Item<FormFieldType>
|
||||||
|
name="fields"
|
||||||
|
rules={[{ required: true, message: '请添加菜单属性' }]}
|
||||||
|
>
|
||||||
|
<ModField modFiledArray={fields}
|
||||||
|
isEdit={true}
|
||||||
|
scrollHeight={height - 380}
|
||||||
|
handleChange={(dataArray) => {
|
||||||
|
if (!dataArray) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
form.setFieldValue('fields', dataArray);
|
||||||
|
}} />
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
|
||||||
|
<Form.Item wrapperCol={{ span: 24 }}>
|
||||||
|
<div style={{ paddingTop: '15px' }}>
|
||||||
|
<Flex align="center" justify="center" gap="large">
|
||||||
|
<Button type="primary"
|
||||||
|
htmlType="submit"
|
||||||
|
size='large'
|
||||||
|
// style={{backgroundColor: 'var(--color-primary)'}}
|
||||||
|
>
|
||||||
|
保存
|
||||||
|
</Button>
|
||||||
|
<Button type="default" htmlType="button"
|
||||||
|
size='large'
|
||||||
|
onClick={() => {
|
||||||
|
props.onConfirm()
|
||||||
|
}}>
|
||||||
|
返回
|
||||||
|
</Button>
|
||||||
|
</Flex>
|
||||||
|
</div>
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Modal title="提示"
|
||||||
|
okText="确定"
|
||||||
|
cancelText="取消"
|
||||||
|
open={isEditModalOpen}
|
||||||
|
onOk={() => {
|
||||||
|
setIsEditModalOpen(false);
|
||||||
|
|
||||||
|
// const reg = /^[\u4e00-\u9fa5]+$/; // 中文字符的正则表达式
|
||||||
|
console.log(((form.getFieldValue('fields'))[0].fieldDesc));
|
||||||
|
const isChinese =
|
||||||
|
(form.getFieldValue('fields')).every((item: { fieldDesc: string; }) => {
|
||||||
|
return /[\u4e00-\u9fa5]/.test(item.fieldDesc);
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(isChinese);
|
||||||
|
|
||||||
|
if (!isChinese) {
|
||||||
|
messageApi.error('描述必须含有中文')
|
||||||
|
} else {
|
||||||
|
console.log(projId);
|
||||||
|
|
||||||
|
put({
|
||||||
|
messageApi,
|
||||||
|
url: `/api/proj-mod/update/${props.id}`,
|
||||||
|
body: {
|
||||||
|
projId: projId,
|
||||||
|
modName: form.getFieldValue('modName'),
|
||||||
|
modDesc: form.getFieldValue('modDesc'),
|
||||||
|
modIcon: form.getFieldValue('modIcon'),
|
||||||
|
fields: form.getFieldValue('fields'),
|
||||||
|
},
|
||||||
|
onBefore() {
|
||||||
|
setLoading(true);
|
||||||
|
},
|
||||||
|
onSuccess() {
|
||||||
|
messageApi.success('编辑成功');
|
||||||
|
// setTimeout(function () {
|
||||||
|
// // 刷新当前页面
|
||||||
|
// // location.reload();
|
||||||
|
// // 返回上一页
|
||||||
|
// }, 1000);
|
||||||
|
get({
|
||||||
|
messageApi,
|
||||||
|
url: '/api/proj-mod/list',
|
||||||
|
config: {
|
||||||
|
params: {
|
||||||
|
projId: pathParams.projId
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onSuccess({ data }) {
|
||||||
|
console.log('更新',data);
|
||||||
|
props.setUpdata(data)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
props.onConfirm()
|
||||||
|
|
||||||
|
},
|
||||||
|
onFinally() {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}}
|
||||||
|
onCancel={() => {
|
||||||
|
setIsEditModalOpen(false);
|
||||||
|
}}>
|
||||||
|
<div>确定提交吗?</div>
|
||||||
|
</Modal>
|
||||||
|
<Modal title="选择图标"
|
||||||
|
footer={false}
|
||||||
|
open={isModIconModalOpen}
|
||||||
|
onCancel={() => {
|
||||||
|
setIsModIconModalOpen(false);
|
||||||
|
}}>
|
||||||
|
<div style={{ maxHeight: '400px', overflow: 'auto' }}>
|
||||||
|
<FaiconSelect selectedIcon={selectedModIcon}
|
||||||
|
handleClick={(icon) => {
|
||||||
|
form.setFieldValue('modIcon', icon);
|
||||||
|
setSelectedModIcon(icon);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
<Spin tip="正在提交..." spinning={loading} fullscreen />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
22
src/components/EditModal/proj-config-list-mod.css
Normal file
22
src/components/EditModal/proj-config-list-mod.css
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
.mod-list-container {
|
||||||
|
background-color: var(--color-light);
|
||||||
|
padding: 15px 15px 0 15px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mod-list-container .mod-list .table-btn-group {
|
||||||
|
margin: 15px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mod-list-container .mod-list .table-btn-group .ant-btn {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mod-edit-container {
|
||||||
|
background-color: var(--color-light);
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mod-edit-container .mod-content {
|
||||||
|
margin-top: 15px;
|
||||||
|
}
|
@ -1,8 +1,14 @@
|
|||||||
import {Button, Divider, Dropdown, Space, Table, TableProps} from "antd";
|
import { Button, Divider, Dropdown, Space, Table, TableProps, Modal } from "antd";
|
||||||
import { CheckOutlined, LoadingOutlined, ReloadOutlined, RedoOutlined } from "@ant-design/icons";
|
import { CheckOutlined, LoadingOutlined, ReloadOutlined, RedoOutlined } from "@ant-design/icons";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { IProjMod } from "../../../interfaces/proj/IProj.ts";
|
import { IProjMod } from "../../../interfaces/proj/IProj.ts";
|
||||||
|
import EditModal from '../../EditModal/EditModal.tsx'
|
||||||
|
import { get } from "../../../util/AjaxUtils.ts";
|
||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
import {
|
||||||
|
|
||||||
|
message
|
||||||
|
} from "antd";
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
mods: IProjMod[];
|
mods: IProjMod[];
|
||||||
newMods: ProjModType[],
|
newMods: ProjModType[],
|
||||||
@ -19,14 +25,40 @@ type ProjModType = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function AiHelperMod(props: PropsType) {
|
export default function AiHelperMod(props: PropsType) {
|
||||||
|
// 菜单状态是否可以编辑
|
||||||
|
const [messageApi, contextHolder] = message.useMessage();
|
||||||
const [modArray, setModArray] = useState<IProjMod[]>([]);
|
const [modArray, setModArray] = useState<IProjMod[]>([]);
|
||||||
const [newModArray, setNewModArray] = useState<ProjModType[]>([]);
|
const [newModArray, setNewModArray] = useState<ProjModType[]>([]);
|
||||||
|
const [id, setId] = useState('')
|
||||||
|
const [editModal, setEditModal] = useState(false)
|
||||||
|
const [updata, setUpdata] = useState<any[]>([])
|
||||||
|
const [status, setStatus] = useState('')
|
||||||
|
// const [items, setItems] = useState<any[]>([])
|
||||||
|
const pathParams = useParams();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log('mods', props.mods);
|
||||||
|
|
||||||
setModArray(props.mods);
|
setModArray(props.mods);
|
||||||
setNewModArray(props.newMods);
|
setNewModArray(props.newMods);
|
||||||
}, [props.mods, props.newMods]);
|
}, [props.mods, props.newMods]);
|
||||||
|
useEffect(() => {
|
||||||
|
if (updata.length != 0) {
|
||||||
|
console.log('更新数据', updata);
|
||||||
|
setModArray(updata)
|
||||||
|
}
|
||||||
|
|
||||||
|
}, [updata])
|
||||||
|
useEffect(() => {
|
||||||
|
get<any>({
|
||||||
|
messageApi,
|
||||||
|
url: `/api/proj/get/${pathParams.projId}`,
|
||||||
|
onSuccess({ data }) {
|
||||||
|
console.log('其他页面状态判断', data);
|
||||||
|
setStatus(data.generate.generateStatus)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}, [])
|
||||||
const modColumnArray: TableProps<IProjMod>['columns'] = [
|
const modColumnArray: TableProps<IProjMod>['columns'] = [
|
||||||
{
|
{
|
||||||
title: '序号',
|
title: '序号',
|
||||||
@ -65,6 +97,17 @@ export default function AiHelperMod(props: PropsType) {
|
|||||||
width: 80,
|
width: 80,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
render: (_value, record, index) => {
|
render: (_value, record, index) => {
|
||||||
|
if(status == 'SUCCESS' ){
|
||||||
|
return(
|
||||||
|
<Button disabled>已成功</Button>
|
||||||
|
)
|
||||||
|
}else if(status == 'GENERATING'){
|
||||||
|
return(
|
||||||
|
<LoadingOutlined />
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
else{
|
||||||
if (record.aiFieldStatus == 'GENERATING') {
|
if (record.aiFieldStatus == 'GENERATING') {
|
||||||
return <LoadingOutlined />
|
return <LoadingOutlined />
|
||||||
}
|
}
|
||||||
@ -74,12 +117,15 @@ export default function AiHelperMod(props: PropsType) {
|
|||||||
}}><RedoOutlined /></Button>
|
}}><RedoOutlined /></Button>
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Dropdown menu={{ items: [
|
<Dropdown menu={{
|
||||||
|
items: [
|
||||||
{
|
{
|
||||||
key: 'edit',
|
key: 'edit',
|
||||||
label: '编辑',
|
label: '编辑',
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
props.handleEdit(index, record.projModId, record);
|
// props.handleEdit(index, record.projModId, record);
|
||||||
|
setId(record.projModId)
|
||||||
|
setEditModal(true)
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: 'remove',
|
key: 'remove',
|
||||||
@ -88,11 +134,79 @@ export default function AiHelperMod(props: PropsType) {
|
|||||||
props.handleRemove(index, record.projModId, record);
|
props.handleRemove(index, record.projModId, record);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
] }} placement="bottom" arrow>
|
]
|
||||||
|
}} placement="bottom" arrow>
|
||||||
<Button>…</Button>
|
<Button>…</Button>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
// if (record.aiFieldStatus == 'GENERATING') {
|
||||||
|
// return <LoadingOutlined />
|
||||||
|
// }
|
||||||
|
// if (record.aiFieldStatus == 'FAILED') {
|
||||||
|
// return <Button onClick={() => {
|
||||||
|
// props.handleResaveField(index, record.projModId);
|
||||||
|
// }}><RedoOutlined /></Button>
|
||||||
|
// }
|
||||||
|
// return (
|
||||||
|
// <Dropdown menu={{
|
||||||
|
// items: [
|
||||||
|
// {
|
||||||
|
// key: 'edit',
|
||||||
|
// label: '编辑',
|
||||||
|
// onClick: () => {
|
||||||
|
// // props.handleEdit(index, record.projModId, record);
|
||||||
|
// setId(record.projModId)
|
||||||
|
// setEditModal(true)
|
||||||
|
// }
|
||||||
|
// }, {
|
||||||
|
// key: 'remove',
|
||||||
|
// label: '删除',
|
||||||
|
// onClick: () => {
|
||||||
|
// props.handleRemove(index, record.projModId, record);
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// ]
|
||||||
|
// }} placement="bottom" arrow>
|
||||||
|
// <Button>…</Button>
|
||||||
|
// </Dropdown>
|
||||||
|
// )
|
||||||
|
// if (record.aiFieldStatus == 'SUCCESS' || status == 'GENERATING') {
|
||||||
|
// return (
|
||||||
|
// <Dropdown menu={{
|
||||||
|
// items: [
|
||||||
|
|
||||||
|
// ]
|
||||||
|
// }} placement="bottom" arrow>
|
||||||
|
// <Button>…</Button>
|
||||||
|
// </Dropdown>
|
||||||
|
// )
|
||||||
|
// }else{
|
||||||
|
// return(
|
||||||
|
// <Dropdown menu={{
|
||||||
|
// items: [
|
||||||
|
// {
|
||||||
|
// key: 'edit',
|
||||||
|
// label: '编辑',
|
||||||
|
// onClick: () => {
|
||||||
|
// // props.handleEdit(index, record.projModId, record);
|
||||||
|
// setId(record.projModId)
|
||||||
|
// setEditModal(true)
|
||||||
|
// }
|
||||||
|
// }, {
|
||||||
|
// key: 'remove',
|
||||||
|
// label: '删除',
|
||||||
|
// onClick: () => {
|
||||||
|
// props.handleRemove(index, record.projModId, record);
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// ]
|
||||||
|
// }} placement="bottom" arrow>
|
||||||
|
// <Button>…</Button>
|
||||||
|
// </Dropdown>
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
}
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -153,12 +267,17 @@ export default function AiHelperMod(props: PropsType) {
|
|||||||
props.handleGenerate();
|
props.handleGenerate();
|
||||||
}}><ReloadOutlined /> 重新生成</Button>
|
}}><ReloadOutlined /> 重新生成</Button>
|
||||||
</Space>
|
</Space>
|
||||||
) : <Button type="link" style={{cursor: 'pointer'}}
|
) : <Button type="link" disabled={status=='SUCCESS' || status=='GENERATING' ? true : false} style={{ cursor: 'pointer' }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
props.handleGenerate();
|
props.handleGenerate();
|
||||||
}}>AI生成</Button>
|
}}>AI生成</Button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
<Modal title="编辑" open={editModal} footer={null} onCancel={() => { setEditModal(false) }} width={1200} >
|
||||||
|
|
||||||
|
< EditModal id={id} onConfirm={() => setEditModal(false)} setUpdata={setUpdata} />
|
||||||
|
|
||||||
|
</Modal>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
@ -2,7 +2,12 @@ import {Button, Divider, Empty, Space} from "antd";
|
|||||||
import TextArea from "antd/es/input/TextArea";
|
import TextArea from "antd/es/input/TextArea";
|
||||||
import {useEffect, useState} from "react";
|
import {useEffect, useState} from "react";
|
||||||
import {CheckOutlined, EditOutlined, ReloadOutlined} from "@ant-design/icons";
|
import {CheckOutlined, EditOutlined, ReloadOutlined} from "@ant-design/icons";
|
||||||
|
import { get } from "../../../util/AjaxUtils.ts";
|
||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
import {
|
||||||
|
|
||||||
|
message
|
||||||
|
} from "antd";
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
title: string;
|
title: string;
|
||||||
maxLength: number;
|
maxLength: number;
|
||||||
@ -13,6 +18,22 @@ type PropsType = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function AiHelperText(props: PropsType) {
|
export default function AiHelperText(props: PropsType) {
|
||||||
|
const pathParams = useParams();
|
||||||
|
const [status, setStatus] = useState('')
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
get<any>({
|
||||||
|
messageApi,
|
||||||
|
url: `/api/proj/get/${pathParams.projId}`,
|
||||||
|
onSuccess({ data }) {
|
||||||
|
console.log('其他页面状态判断', data);
|
||||||
|
setStatus(data.generate.generateStatus)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const [messageApi, contextHolder] = message.useMessage();
|
||||||
|
|
||||||
const [text, setText] = useState('');
|
const [text, setText] = useState('');
|
||||||
const [newText, setNewText] = useState('');
|
const [newText, setNewText] = useState('');
|
||||||
@ -29,12 +50,16 @@ export default function AiHelperText(props: PropsType) {
|
|||||||
if (!isTextEdit) {
|
if (!isTextEdit) {
|
||||||
return (
|
return (
|
||||||
<Space>
|
<Space>
|
||||||
<Button type="link" style={{cursor: 'pointer'}} onClick={() => {
|
<Button type="link" style={{cursor: 'pointer'}}
|
||||||
|
disabled={status=='SUCCESS' || status=='GENERATING' ? true : false}
|
||||||
|
onClick={() => {
|
||||||
props.handleGenerate();
|
props.handleGenerate();
|
||||||
}}>AI生成</Button>
|
}}>AI生成</Button>
|
||||||
{
|
{
|
||||||
text ? (
|
text ? (
|
||||||
<Button type="link" style={{cursor: 'pointer'}} onClick={() => {
|
<Button type="link" style={{cursor: 'pointer'}}
|
||||||
|
disabled={status=='SUCCESS' || status=='GENERATING' ? true : false}
|
||||||
|
onClick={() => {
|
||||||
setIsTextEdit(true);
|
setIsTextEdit(true);
|
||||||
}}><EditOutlined/> 编辑</Button>
|
}}><EditOutlined/> 编辑</Button>
|
||||||
) : <></>
|
) : <></>
|
||||||
|
@ -188,7 +188,7 @@ export default function CardProj(props: { item: IProj }) {
|
|||||||
</div>
|
</div>
|
||||||
<div className='cp-bot'>
|
<div className='cp-bot'>
|
||||||
<div className='cpb-left'>
|
<div className='cpb-left'>
|
||||||
<img src={testImg} className='cpb-left-img' alt="" />
|
<img src={data.img} className='cpb-left-img' alt="" />
|
||||||
<div className='cpbl-right'>
|
<div className='cpbl-right'>
|
||||||
<div className='cpbl-money'>
|
<div className='cpbl-money'>
|
||||||
<span className='money'>金额(¥) : </span>
|
<span className='money'>金额(¥) : </span>
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
import './list-proj.css'
|
import './list-proj.css'
|
||||||
import CardProj from "../card/CardProj.tsx";
|
import CardProj from "../card/CardProj.tsx";
|
||||||
import { useRef, MutableRefObject, useState, useEffect, useContext } from "react";
|
import { useRef, MutableRefObject, useState, useEffect, useContext } from "react";
|
||||||
import { Pagination, message, Spin, Image } from 'antd';
|
import { Pagination, message, Spin, Image, Empty } from 'antd';
|
||||||
import { get } from "../../util/AjaxUtils.ts";
|
import { get } from "../../util/AjaxUtils.ts";
|
||||||
import { IndexListContext } from "../../context/IndexListContext.ts";
|
import { IndexListContext } from "../../context/IndexListContext.ts";
|
||||||
import { IListPage } from "../../interfaces/listpage/IListPage.ts";
|
import { IListPage } from "../../interfaces/listpage/IListPage.ts";
|
||||||
import { IProj } from "../../interfaces/proj/IProj.ts";
|
import { IProj } from "../../interfaces/proj/IProj.ts";
|
||||||
import NoData from "../../assets/no-data.png";
|
import NoData from "../../assets/no-data.png";
|
||||||
import { useLocation } from 'react-router-dom';
|
import { useLocation } from 'react-router-dom';
|
||||||
|
import syminga from '../../static/homeimg/homeimga.png'
|
||||||
|
import symingb from '../../static/homeimg/homeimgb.png'
|
||||||
|
import symingc from '../../static/homeimg/homeimgc.png'
|
||||||
|
import symingd from '../../static/homeimg/homeimgd.png'
|
||||||
// import gpsImg from '../../static/right/gps.png'
|
// import gpsImg from '../../static/right/gps.png'
|
||||||
// import { Link } from "react-router-dom";
|
// import { Link } from "react-router-dom";
|
||||||
// import { Breadcrumb } from 'antd';
|
// import { Breadcrumb } from 'antd';
|
||||||
@ -25,7 +28,7 @@ export default function ListProj() {
|
|||||||
// }
|
// }
|
||||||
const keywords = state ? state.keyword : ''
|
const keywords = state ? state.keyword : ''
|
||||||
// console.log(keywords);
|
// console.log(keywords);
|
||||||
|
const images = [syminga,symingb,symingc,symingd]
|
||||||
const listProjRef: MutableRefObject<HTMLDivElement | null> = useRef(null);
|
const listProjRef: MutableRefObject<HTMLDivElement | null> = useRef(null);
|
||||||
const listRef: MutableRefObject<HTMLDivElement | null> = useRef(null);
|
const listRef: MutableRefObject<HTMLDivElement | null> = useRef(null);
|
||||||
|
|
||||||
@ -57,7 +60,14 @@ export default function ListProj() {
|
|||||||
console.log('看看结果', data);
|
console.log('看看结果', data);
|
||||||
setPage(data.page);
|
setPage(data.page);
|
||||||
setTotal(data.total);
|
setTotal(data.total);
|
||||||
setProjs(data.rows);
|
// setProjs(data.rows);
|
||||||
|
const updatedArr = (data.rows).map((item, index) => ({
|
||||||
|
...item,
|
||||||
|
img: images[index % images.length] // 利用取余来循环填充图片
|
||||||
|
}));
|
||||||
|
console.log('循环数组',updatedArr);
|
||||||
|
setProjs(updatedArr);
|
||||||
|
|
||||||
},
|
},
|
||||||
onFinally() {
|
onFinally() {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
@ -77,8 +87,7 @@ export default function ListProj() {
|
|||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
alignItems: 'center'
|
alignItems: 'center'
|
||||||
}}>
|
}}>
|
||||||
<Image src={NoData} preview={false} />
|
<Empty description='暂无内容' />
|
||||||
<span>暂无数据</span>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import {IListPage} from "../../interfaces/listpage/IListPage.ts";
|
|||||||
import {IndexListContext} from "../../context/IndexListContext.ts";
|
import {IndexListContext} from "../../context/IndexListContext.ts";
|
||||||
import {IAgent} from "../../interfaces/agent/IAgent.ts";
|
import {IAgent} from "../../interfaces/agent/IAgent.ts";
|
||||||
import NoData from "../../assets/no-data.png";
|
import NoData from "../../assets/no-data.png";
|
||||||
|
// import { Empty } from 'antd';
|
||||||
// const {Search} = Input;
|
// const {Search} = Input;
|
||||||
|
|
||||||
export default function ListProjAgent() {
|
export default function ListProjAgent() {
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
.menu-tree {
|
.menu-tree {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
padding-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-tree ul {
|
.menu-tree ul {
|
||||||
/* margin-left: 10px; */
|
/* margin-left: 10px; */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-tree ul li {
|
.menu-tree ul li {
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
padding-right: 10px;
|
/* padding-right: 10px; */
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
/* background-color: aquamarine; */
|
/* background-color: aquamarine; */
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ export interface IProjMod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IProj {
|
export interface IProj {
|
||||||
|
img?:string
|
||||||
projId: string,
|
projId: string,
|
||||||
projName: string;
|
projName: string;
|
||||||
projContext: string;
|
projContext: string;
|
||||||
|
@ -11,6 +11,7 @@ import PasswordChange from "../../components/password/PasswordChange.tsx";
|
|||||||
// import headRightBg from '../../assets/head-right-bg.png';
|
// import headRightBg from '../../assets/head-right-bg.png';
|
||||||
import InvoiceList from "../../components/invoice/InvoiceList.tsx";
|
import InvoiceList from "../../components/invoice/InvoiceList.tsx";
|
||||||
import logoImg from '../../static/head/logo.png'
|
import logoImg from '../../static/head/logo.png'
|
||||||
|
import userImg from '../../static/homeimg/userimg.png'
|
||||||
export default function Head() {
|
export default function Head() {
|
||||||
const globalContext = useContext(GlobalContext);
|
const globalContext = useContext(GlobalContext);
|
||||||
const globalDispatchContext = useContext(GlobalDispatchContext);
|
const globalDispatchContext = useContext(GlobalDispatchContext);
|
||||||
@ -96,7 +97,9 @@ export default function Head() {
|
|||||||
<RechargeHead />
|
<RechargeHead />
|
||||||
{/*<MessageHead/>*/}
|
{/*<MessageHead/>*/}
|
||||||
<div style={{ display: 'flex', alignContent: 'center', padding: '0 10px', cursor: 'pointer' }}>
|
<div style={{ display: 'flex', alignContent: 'center', padding: '0 10px', cursor: 'pointer' }}>
|
||||||
<div style={{ width: '50px', height: '50px', borderRadius: '25px', backgroundColor: '#c4c1c0', marginLeft: '20px', marginRight: '10px' }} />
|
<div style={{ width: '50px', height: '50px', borderRadius: '25px', marginLeft: '20px', marginRight: '10px' }} >
|
||||||
|
<img src={userImg} alt="" width={50} height={50}/>
|
||||||
|
</div>
|
||||||
<Dropdown menu={{
|
<Dropdown menu={{
|
||||||
items: items
|
items: items
|
||||||
}}>
|
}}>
|
||||||
|
@ -29,7 +29,7 @@ type ProjModType = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function ProjEdit() {
|
export default function ProjEdit() {
|
||||||
|
// 判断是否完成状态 成功未处理/失败/正在处理
|
||||||
// 模块数量
|
// 模块数量
|
||||||
const [projModCount, setprojModCount] = useState(0)
|
const [projModCount, setprojModCount] = useState(0)
|
||||||
const height = window.innerHeight - 180;
|
const height = window.innerHeight - 180;
|
||||||
|
@ -5,7 +5,7 @@ import { useContext, useEffect, useState } from "react";
|
|||||||
import { get, post } from "../../util/AjaxUtils.ts";
|
import { get, post } from "../../util/AjaxUtils.ts";
|
||||||
import { IProjCharge, ProjAdditionalType, ProjChargeType } from "../../interfaces/proj/IProj.ts";
|
import { IProjCharge, ProjAdditionalType, ProjChargeType } from "../../interfaces/proj/IProj.ts";
|
||||||
import { GlobalDispatchContext, reloadUser } from "../../context/GlobalContext.ts";
|
import { GlobalDispatchContext, reloadUser } from "../../context/GlobalContext.ts";
|
||||||
const { TextArea } = Input;
|
// const { TextArea } = Input;
|
||||||
type ProjInfo = {
|
type ProjInfo = {
|
||||||
projName: string;
|
projName: string;
|
||||||
projIntroduction: string;
|
projIntroduction: string;
|
||||||
@ -100,7 +100,7 @@ export default function ProjNew() {
|
|||||||
layout={'vertical'}
|
layout={'vertical'}
|
||||||
labelCol={{ span: 24 }}
|
labelCol={{ span: 24 }}
|
||||||
wrapperCol={{ span: 24 }}
|
wrapperCol={{ span: 24 }}
|
||||||
style={{ width: 500 }}
|
style={{ width: '100%' }}
|
||||||
onFinish={(formData) => {
|
onFinish={(formData) => {
|
||||||
setIsCreateModalOpen(true);
|
setIsCreateModalOpen(true);
|
||||||
setProjInfo({
|
setProjInfo({
|
||||||
@ -116,20 +116,18 @@ export default function ProjNew() {
|
|||||||
name="projName"
|
name="projName"
|
||||||
rules={[{ required: true, message: '请输入系统标题' }]}
|
rules={[{ required: true, message: '请输入系统标题' }]}
|
||||||
>
|
>
|
||||||
<Input style={{ background: '#eeeeee', width: '328px', height: '50px' ,fontSize:'16px'}} placeholder="请输入系统标题" />
|
<Input style={{ background: '#eeeeee', width: '1000px', height: '50px' ,fontSize:'16px'}} placeholder="请输入系统标题" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</div>
|
</div>
|
||||||
<div className='formItemTwo'>
|
{/* <div className='formItemTwo'>
|
||||||
<div className='formItem-title '>简单描述</div>
|
<div className='formItem-title '>简单描述</div>
|
||||||
<Form.Item<ProjInfo>
|
<Form.Item<ProjInfo>
|
||||||
name="projIntroduction"
|
name="projIntroduction"
|
||||||
// rules={[{required: true, message: '请输入系统标题'}]}
|
|
||||||
>
|
>
|
||||||
<TextArea rows={10} style={{ background: '#eeeeee', resize: 'none',width:"328px",height:'220px',fontSize:'16px' }} placeholder="请对系统作出简单的描述,以使可准确生成资料..." />
|
<TextArea rows={10} style={{ background: '#eeeeee', resize: 'none',width:"328px",height:'220px',fontSize:'16px' }} placeholder="请对系统作出简单的描述,以使可准确生成资料..." />
|
||||||
{/* <Input placeholder="请对系统作出简单的描述,以使可准确生成资料..."/> */}
|
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</div>
|
</div> */}
|
||||||
<div style={{ marginTop: '156px' }}>
|
<div style={{ marginTop: '20px' }}>
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
<Flex align="center" justify="center" gap="large">
|
<Flex align="center" justify="center" gap="large">
|
||||||
<Button
|
<Button
|
||||||
|
@ -175,16 +175,18 @@ export default function ProjConfigModEdit(props: PropsType) {
|
|||||||
setIsEditModalOpen(false);
|
setIsEditModalOpen(false);
|
||||||
|
|
||||||
// const reg = /^[\u4e00-\u9fa5]+$/; // 中文字符的正则表达式
|
// const reg = /^[\u4e00-\u9fa5]+$/; // 中文字符的正则表达式
|
||||||
console.log( ((form.getFieldValue('fields'))[0].fieldDesc ));
|
console.log( ((form.getFieldValue('fields')) ));
|
||||||
|
|
||||||
|
|
||||||
const isChinese =
|
const isChinese =
|
||||||
( form.getFieldValue('fields')).every((item: { fieldDesc: string; }) => {
|
( form.getFieldValue('fields')).every((item: { fieldDesc: string; }) => {
|
||||||
return /^[\u4e00-\u9fa5]+$/.test(item.fieldDesc);
|
return /[\u4e00-\u9fa5]/.test(item.fieldDesc);
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log(isChinese);
|
// console.log(isChinese);
|
||||||
|
|
||||||
if (!isChinese) {
|
if (!isChinese) {
|
||||||
messageApi.error('描述必须为中文')
|
messageApi.error('描述必须含有中文')
|
||||||
}else{
|
}else{
|
||||||
put({
|
put({
|
||||||
messageApi,
|
messageApi,
|
||||||
@ -213,6 +215,7 @@ export default function ProjConfigModEdit(props: PropsType) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}}
|
}}
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
setIsEditModalOpen(false);
|
setIsEditModalOpen(false);
|
||||||
|
@ -465,6 +465,8 @@ export default function ProjEditStep2() {
|
|||||||
getProjOwnerList()
|
getProjOwnerList()
|
||||||
getProjContactList()
|
getProjContactList()
|
||||||
listArea('0').then(data => {
|
listArea('0').then(data => {
|
||||||
|
console.log('省市1', data);
|
||||||
|
// data.slice(0, 2).map
|
||||||
const options: Option[] = data.map(item => {
|
const options: Option[] = data.map(item => {
|
||||||
return {
|
return {
|
||||||
value: item.name,
|
value: item.name,
|
||||||
@ -474,7 +476,9 @@ export default function ProjEditStep2() {
|
|||||||
pId: item.pId
|
pId: item.pId
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
setAreaArray(options);
|
setAreaArray(options);
|
||||||
|
console.log('省市2', options);
|
||||||
});
|
});
|
||||||
|
|
||||||
}, [])
|
}, [])
|
||||||
@ -1178,12 +1182,14 @@ export default function ProjEditStep2() {
|
|||||||
|
|
||||||
loadData={(selectedOptions: Option[]) => {
|
loadData={(selectedOptions: Option[]) => {
|
||||||
const targetOption = selectedOptions[selectedOptions.length - 1];
|
const targetOption = selectedOptions[selectedOptions.length - 1];
|
||||||
|
// console.log(targetOption.id);
|
||||||
|
|
||||||
listArea(targetOption.id).then(data => {
|
listArea(targetOption.id).then(data => {
|
||||||
targetOption.children = data.map(item => {
|
targetOption.children = data.map(item => {
|
||||||
return {
|
return {
|
||||||
value: item.name,
|
value: item.name,
|
||||||
label: item.name,
|
label: item.name,
|
||||||
isLeaf: !item.isParent,
|
isLeaf: true, //二级判断这个 以前不是 以前是 !item.isParent
|
||||||
id: item.id,
|
id: item.id,
|
||||||
pId: item.pId
|
pId: item.pId
|
||||||
}
|
}
|
||||||
@ -1192,7 +1198,9 @@ export default function ProjEditStep2() {
|
|||||||
...areaArray
|
...areaArray
|
||||||
])
|
])
|
||||||
});
|
});
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
placeholder="请选择省市"
|
placeholder="请选择省市"
|
||||||
changeOnSelect
|
changeOnSelect
|
||||||
disabled={belongTitle == '查看所属者' ? true : false}
|
disabled={belongTitle == '查看所属者' ? true : false}
|
||||||
|
BIN
src/static/homeimg/homeimga.png
Normal file
BIN
src/static/homeimg/homeimga.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.8 KiB |
BIN
src/static/homeimg/homeimgb.png
Normal file
BIN
src/static/homeimg/homeimgb.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
src/static/homeimg/homeimgc.png
Normal file
BIN
src/static/homeimg/homeimgc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
BIN
src/static/homeimg/homeimgd.png
Normal file
BIN
src/static/homeimg/homeimgd.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
BIN
src/static/homeimg/userimg.png
Normal file
BIN
src/static/homeimg/userimg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
Loading…
Reference in New Issue
Block a user