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 {CheckOutlined, LoadingOutlined, ReloadOutlined, RedoOutlined} from "@ant-design/icons";
|
||||
import {useEffect, useState} from "react";
|
||||
import {IProjMod} from "../../../interfaces/proj/IProj.ts";
|
||||
import { Button, Divider, Dropdown, Space, Table, TableProps, Modal } from "antd";
|
||||
import { CheckOutlined, LoadingOutlined, ReloadOutlined, RedoOutlined } from "@ant-design/icons";
|
||||
import { useEffect, useState } from "react";
|
||||
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 = {
|
||||
mods: IProjMod[];
|
||||
newMods: ProjModType[],
|
||||
@ -19,14 +25,40 @@ type ProjModType = {
|
||||
}
|
||||
|
||||
export default function AiHelperMod(props: PropsType) {
|
||||
// 菜单状态是否可以编辑
|
||||
const [messageApi, contextHolder] = message.useMessage();
|
||||
const [modArray, setModArray] = useState<IProjMod[]>([]);
|
||||
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(() => {
|
||||
console.log('mods', props.mods);
|
||||
|
||||
setModArray(props.mods);
|
||||
setNewModArray(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'] = [
|
||||
{
|
||||
title: '序号',
|
||||
@ -38,8 +70,8 @@ export default function AiHelperMod(props: PropsType) {
|
||||
return index + 1
|
||||
}
|
||||
},
|
||||
{title: '模块名称', dataIndex: 'modName', key: 'name', width: 200, align: 'center'},
|
||||
{title: '模块描述', dataIndex: 'modDesc', key: 'desc', align: 'center'},
|
||||
{ title: '模块名称', dataIndex: 'modName', key: 'name', width: 200, align: 'center' },
|
||||
{ title: '模块描述', dataIndex: 'modDesc', key: 'desc', align: 'center' },
|
||||
{
|
||||
title: 'AI状态',
|
||||
dataIndex: 'aiFieldStatus',
|
||||
@ -47,13 +79,13 @@ export default function AiHelperMod(props: PropsType) {
|
||||
width: 100,
|
||||
align: 'center',
|
||||
render: (value) => {
|
||||
if(value == 'GENERATING') {
|
||||
if (value == 'GENERATING') {
|
||||
return '处理中'
|
||||
}
|
||||
if(value == 'FAILED') {
|
||||
if (value == 'FAILED') {
|
||||
return '失败'
|
||||
}
|
||||
if(value == 'SUCCESS') {
|
||||
if (value == 'SUCCESS') {
|
||||
return '成功'
|
||||
}
|
||||
}
|
||||
@ -65,33 +97,115 @@ export default function AiHelperMod(props: PropsType) {
|
||||
width: 80,
|
||||
align: 'center',
|
||||
render: (_value, record, index) => {
|
||||
if(record.aiFieldStatus == 'GENERATING') {
|
||||
return <LoadingOutlined />
|
||||
if(status == 'SUCCESS' ){
|
||||
return(
|
||||
<Button disabled>已成功</Button>
|
||||
)
|
||||
}else if(status == 'GENERATING'){
|
||||
return(
|
||||
<LoadingOutlined />
|
||||
)
|
||||
}
|
||||
if(record.aiFieldStatus == 'FAILED') {
|
||||
return <Button onClick={() => {
|
||||
props.handleResaveField(index, record.projModId);
|
||||
}}><RedoOutlined /></Button>
|
||||
|
||||
else{
|
||||
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>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<Dropdown menu={{ items: [
|
||||
{
|
||||
key: 'edit',
|
||||
label: '编辑',
|
||||
onClick: () => {
|
||||
props.handleEdit(index, record.projModId, record);
|
||||
}
|
||||
},{
|
||||
key: 'remove',
|
||||
label: '删除',
|
||||
onClick: () => {
|
||||
props.handleRemove(index, record.projModId, record);
|
||||
}
|
||||
},
|
||||
] }} placement="bottom" arrow>
|
||||
<Button>…</Button>
|
||||
</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>
|
||||
// )
|
||||
// }
|
||||
}
|
||||
},
|
||||
];
|
||||
@ -107,8 +221,8 @@ export default function AiHelperMod(props: PropsType) {
|
||||
return index + 1
|
||||
}
|
||||
},
|
||||
{title: '模块名称', dataIndex: 'name', key: 'name', width: 200, align: 'center'},
|
||||
{title: '模块描述', dataIndex: 'desc', key: 'desc', align: 'center'},
|
||||
{ title: '模块名称', dataIndex: 'name', key: 'name', width: 200, align: 'center' },
|
||||
{ title: '模块描述', dataIndex: 'desc', key: 'desc', align: 'center' },
|
||||
{
|
||||
title: '确认',
|
||||
dataIndex: 'option',
|
||||
@ -129,36 +243,41 @@ export default function AiHelperMod(props: PropsType) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div style={{padding: '5px 0 0 0', fontWeight: 'bold'}}>模块管理</div>
|
||||
<div style={{padding: '5px 0 0 0'}}>
|
||||
<div style={{ padding: '5px 0 0 0', fontWeight: 'bold' }}>模块管理</div>
|
||||
<div style={{ padding: '5px 0 0 0' }}>
|
||||
{newModArray.length > 0 ? <Divider orientation="right" plain>原模块</Divider> : <></>}
|
||||
<Table columns={modColumnArray} dataSource={modArray} size="small" bordered={true} scroll={{y: 240}}
|
||||
pagination={false} rowKey="projModId"/>
|
||||
<Table columns={modColumnArray} dataSource={modArray} size="small" bordered={true} scroll={{ y: 240 }}
|
||||
pagination={false} rowKey="projModId" />
|
||||
{
|
||||
newModArray.length > 0 ? (
|
||||
<>
|
||||
<Divider orientation="right" plain>新模块</Divider>
|
||||
<Table columns={newModColumnArray} dataSource={newModArray} size="small" bordered={true}
|
||||
scroll={{y: 240}} pagination={false} rowKey="id"/>
|
||||
scroll={{ y: 240 }} pagination={false} rowKey="id" />
|
||||
</>
|
||||
) : <></>
|
||||
}
|
||||
</div>
|
||||
<div style={{padding: '5px 0 0 0', textAlign: 'center'}}>
|
||||
<div style={{ padding: '5px 0 0 0', textAlign: 'center' }}>
|
||||
{
|
||||
newModArray.length > 0 ? (
|
||||
<Space>
|
||||
<Button type="link" style={{cursor: 'pointer'}}
|
||||
onClick={() => {
|
||||
props.handleGenerate();
|
||||
}}><ReloadOutlined/> 重新生成</Button>
|
||||
</Space>
|
||||
) : <Button type="link" style={{cursor: 'pointer'}}
|
||||
<Button type="link" style={{ cursor: 'pointer' }}
|
||||
onClick={() => {
|
||||
props.handleGenerate();
|
||||
}}>AI生成</Button>
|
||||
}}><ReloadOutlined /> 重新生成</Button>
|
||||
</Space>
|
||||
) : <Button type="link" disabled={status=='SUCCESS' || status=='GENERATING' ? true : false} style={{ cursor: 'pointer' }}
|
||||
onClick={() => {
|
||||
props.handleGenerate();
|
||||
}}>AI生成</Button>
|
||||
}
|
||||
</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 {useEffect, useState} from "react";
|
||||
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 = {
|
||||
title: string;
|
||||
maxLength: number;
|
||||
@ -13,6 +18,22 @@ type 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 [newText, setNewText] = useState('');
|
||||
@ -29,12 +50,16 @@ export default function AiHelperText(props: PropsType) {
|
||||
if (!isTextEdit) {
|
||||
return (
|
||||
<Space>
|
||||
<Button type="link" style={{cursor: 'pointer'}} onClick={() => {
|
||||
<Button type="link" style={{cursor: 'pointer'}}
|
||||
disabled={status=='SUCCESS' || status=='GENERATING' ? true : false}
|
||||
onClick={() => {
|
||||
props.handleGenerate();
|
||||
}}>AI生成</Button>
|
||||
{
|
||||
text ? (
|
||||
<Button type="link" style={{cursor: 'pointer'}} onClick={() => {
|
||||
<Button type="link" style={{cursor: 'pointer'}}
|
||||
disabled={status=='SUCCESS' || status=='GENERATING' ? true : false}
|
||||
onClick={() => {
|
||||
setIsTextEdit(true);
|
||||
}}><EditOutlined/> 编辑</Button>
|
||||
) : <></>
|
||||
|
@ -188,7 +188,7 @@ export default function CardProj(props: { item: IProj }) {
|
||||
</div>
|
||||
<div className='cp-bot'>
|
||||
<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-money'>
|
||||
<span className='money'>金额(¥) : </span>
|
||||
|
@ -1,14 +1,17 @@
|
||||
import './list-proj.css'
|
||||
import CardProj from "../card/CardProj.tsx";
|
||||
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 { IndexListContext } from "../../context/IndexListContext.ts";
|
||||
import { IListPage } from "../../interfaces/listpage/IListPage.ts";
|
||||
import { IProj } from "../../interfaces/proj/IProj.ts";
|
||||
import NoData from "../../assets/no-data.png";
|
||||
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 { Link } from "react-router-dom";
|
||||
// import { Breadcrumb } from 'antd';
|
||||
@ -25,7 +28,7 @@ export default function ListProj() {
|
||||
// }
|
||||
const keywords = state ? state.keyword : ''
|
||||
// console.log(keywords);
|
||||
|
||||
const images = [syminga,symingb,symingc,symingd]
|
||||
const listProjRef: MutableRefObject<HTMLDivElement | null> = useRef(null);
|
||||
const listRef: MutableRefObject<HTMLDivElement | null> = useRef(null);
|
||||
|
||||
@ -57,7 +60,14 @@ export default function ListProj() {
|
||||
console.log('看看结果', data);
|
||||
setPage(data.page);
|
||||
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() {
|
||||
setIsLoading(false);
|
||||
@ -77,8 +87,7 @@ export default function ListProj() {
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center'
|
||||
}}>
|
||||
<Image src={NoData} preview={false} />
|
||||
<span>暂无数据</span>
|
||||
<Empty description='暂无内容' />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -93,7 +102,7 @@ export default function ListProj() {
|
||||
|
||||
const renderCategory = () => {
|
||||
}
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (indexListContext.categorys) {
|
||||
reqData(page);
|
||||
|
@ -9,7 +9,7 @@ import {IListPage} from "../../interfaces/listpage/IListPage.ts";
|
||||
import {IndexListContext} from "../../context/IndexListContext.ts";
|
||||
import {IAgent} from "../../interfaces/agent/IAgent.ts";
|
||||
import NoData from "../../assets/no-data.png";
|
||||
|
||||
// import { Empty } from 'antd';
|
||||
// const {Search} = Input;
|
||||
|
||||
export default function ListProjAgent() {
|
||||
|
@ -1,16 +1,18 @@
|
||||
.menu-tree {
|
||||
margin-top: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.menu-tree ul {
|
||||
/* margin-left: 10px; */
|
||||
|
||||
}
|
||||
|
||||
.menu-tree ul li {
|
||||
font-size: 15px;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
padding-right: 10px;
|
||||
/* padding-right: 10px; */
|
||||
padding-left: 10px;
|
||||
/* background-color: aquamarine; */
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ export interface IProjMod {
|
||||
}
|
||||
|
||||
export interface IProj {
|
||||
|
||||
img?:string
|
||||
projId: string,
|
||||
projName: string;
|
||||
projContext: string;
|
||||
|
@ -11,6 +11,7 @@ import PasswordChange from "../../components/password/PasswordChange.tsx";
|
||||
// import headRightBg from '../../assets/head-right-bg.png';
|
||||
import InvoiceList from "../../components/invoice/InvoiceList.tsx";
|
||||
import logoImg from '../../static/head/logo.png'
|
||||
import userImg from '../../static/homeimg/userimg.png'
|
||||
export default function Head() {
|
||||
const globalContext = useContext(GlobalContext);
|
||||
const globalDispatchContext = useContext(GlobalDispatchContext);
|
||||
@ -96,7 +97,9 @@ export default function Head() {
|
||||
<RechargeHead />
|
||||
{/*<MessageHead/>*/}
|
||||
<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={{
|
||||
items: items
|
||||
}}>
|
||||
|
@ -29,7 +29,7 @@ type ProjModType = {
|
||||
}
|
||||
|
||||
export default function ProjEdit() {
|
||||
|
||||
// 判断是否完成状态 成功未处理/失败/正在处理
|
||||
// 模块数量
|
||||
const [projModCount, setprojModCount] = useState(0)
|
||||
const height = window.innerHeight - 180;
|
||||
@ -338,7 +338,7 @@ export default function ProjEdit() {
|
||||
status={EditStepEnum.UN_EDIT}
|
||||
canBtnClick={canGenerate}
|
||||
handleEdit={() => {
|
||||
setIsGenerateModalOpen(true);
|
||||
setIsGenerateModalOpen(true);
|
||||
// setTimeout(() => {
|
||||
// window.location.reload();
|
||||
// }, 1000)
|
||||
|
@ -5,7 +5,7 @@ import { useContext, useEffect, useState } from "react";
|
||||
import { get, post } from "../../util/AjaxUtils.ts";
|
||||
import { IProjCharge, ProjAdditionalType, ProjChargeType } from "../../interfaces/proj/IProj.ts";
|
||||
import { GlobalDispatchContext, reloadUser } from "../../context/GlobalContext.ts";
|
||||
const { TextArea } = Input;
|
||||
// const { TextArea } = Input;
|
||||
type ProjInfo = {
|
||||
projName: string;
|
||||
projIntroduction: string;
|
||||
@ -100,7 +100,7 @@ export default function ProjNew() {
|
||||
layout={'vertical'}
|
||||
labelCol={{ span: 24 }}
|
||||
wrapperCol={{ span: 24 }}
|
||||
style={{ width: 500 }}
|
||||
style={{ width: '100%' }}
|
||||
onFinish={(formData) => {
|
||||
setIsCreateModalOpen(true);
|
||||
setProjInfo({
|
||||
@ -116,20 +116,18 @@ export default function ProjNew() {
|
||||
name="projName"
|
||||
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>
|
||||
</div>
|
||||
<div className='formItemTwo'>
|
||||
{/* <div className='formItemTwo'>
|
||||
<div className='formItem-title '>简单描述</div>
|
||||
<Form.Item<ProjInfo>
|
||||
name="projIntroduction"
|
||||
// rules={[{required: true, message: '请输入系统标题'}]}
|
||||
>
|
||||
<TextArea rows={10} style={{ background: '#eeeeee', resize: 'none',width:"328px",height:'220px',fontSize:'16px' }} placeholder="请对系统作出简单的描述,以使可准确生成资料..." />
|
||||
{/* <Input placeholder="请对系统作出简单的描述,以使可准确生成资料..."/> */}
|
||||
</Form.Item>
|
||||
</div>
|
||||
<div style={{ marginTop: '156px' }}>
|
||||
</div> */}
|
||||
<div style={{ marginTop: '20px' }}>
|
||||
<Form.Item>
|
||||
<Flex align="center" justify="center" gap="large">
|
||||
<Button
|
||||
|
@ -175,16 +175,18 @@ export default function ProjConfigModEdit(props: PropsType) {
|
||||
setIsEditModalOpen(false);
|
||||
|
||||
// const reg = /^[\u4e00-\u9fa5]+$/; // 中文字符的正则表达式
|
||||
console.log( ((form.getFieldValue('fields'))[0].fieldDesc ));
|
||||
console.log( ((form.getFieldValue('fields')) ));
|
||||
|
||||
|
||||
const isChinese =
|
||||
( form.getFieldValue('fields')).every((item: { fieldDesc: string; }) => {
|
||||
return /^[\u4e00-\u9fa5]+$/.test(item.fieldDesc);
|
||||
return /[\u4e00-\u9fa5]/.test(item.fieldDesc);
|
||||
});
|
||||
|
||||
// console.log(isChinese);
|
||||
|
||||
if (!isChinese) {
|
||||
messageApi.error('描述必须为中文')
|
||||
messageApi.error('描述必须含有中文')
|
||||
}else{
|
||||
put({
|
||||
messageApi,
|
||||
@ -213,6 +215,7 @@ export default function ProjConfigModEdit(props: PropsType) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}}
|
||||
onCancel={() => {
|
||||
setIsEditModalOpen(false);
|
||||
|
@ -279,7 +279,7 @@ export default function ProjEditStep2() {
|
||||
// const selectBelongArray = data.filter(item => item.name === authorName)
|
||||
// console.log('嘻嘻',selectBelongArray);
|
||||
// setSelectedRowKeys(selectBelongArray)
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -465,6 +465,8 @@ export default function ProjEditStep2() {
|
||||
getProjOwnerList()
|
||||
getProjContactList()
|
||||
listArea('0').then(data => {
|
||||
console.log('省市1', data);
|
||||
// data.slice(0, 2).map
|
||||
const options: Option[] = data.map(item => {
|
||||
return {
|
||||
value: item.name,
|
||||
@ -474,7 +476,9 @@ export default function ProjEditStep2() {
|
||||
pId: item.pId
|
||||
}
|
||||
})
|
||||
|
||||
setAreaArray(options);
|
||||
console.log('省市2', options);
|
||||
});
|
||||
|
||||
}, [])
|
||||
@ -892,13 +896,13 @@ export default function ProjEditStep2() {
|
||||
}}
|
||||
// style={{ height: '49px', width: '104px', color: '#4B4B4B', background: '#D1D1D1', fontSize: '16px' }}
|
||||
size='large'
|
||||
>
|
||||
>
|
||||
返回
|
||||
</Button>
|
||||
<Button type="primary"
|
||||
htmlType="submit"
|
||||
// style={{ height: '49px', width: '104px', color: '#FDFDF2', background: '#1564ED', fontSize: '16px' }}
|
||||
style={{ marginLeft:"-10px" }}
|
||||
style={{ marginLeft: "-10px" }}
|
||||
size='large'
|
||||
onClick={() => {
|
||||
formInfo.validateFields().then(() => {
|
||||
@ -1178,12 +1182,14 @@ export default function ProjEditStep2() {
|
||||
|
||||
loadData={(selectedOptions: Option[]) => {
|
||||
const targetOption = selectedOptions[selectedOptions.length - 1];
|
||||
// console.log(targetOption.id);
|
||||
|
||||
listArea(targetOption.id).then(data => {
|
||||
targetOption.children = data.map(item => {
|
||||
return {
|
||||
value: item.name,
|
||||
label: item.name,
|
||||
isLeaf: !item.isParent,
|
||||
isLeaf: true, //二级判断这个 以前不是 以前是 !item.isParent
|
||||
id: item.id,
|
||||
pId: item.pId
|
||||
}
|
||||
@ -1192,7 +1198,9 @@ export default function ProjEditStep2() {
|
||||
...areaArray
|
||||
])
|
||||
});
|
||||
|
||||
}}
|
||||
|
||||
placeholder="请选择省市"
|
||||
changeOnSelect
|
||||
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