diff --git a/src/components/list/ListProj.tsx b/src/components/list/ListProj.tsx index d2b4ee9..1df002f 100644 --- a/src/components/list/ListProj.tsx +++ b/src/components/list/ListProj.tsx @@ -54,7 +54,7 @@ export default function ListProj() { setIsLoading(true); }, onSuccess({ data }) { - console.log('看看结果', data); + // console.log('看看结果', data); setPage(data.page); setTotal(data.total); diff --git a/src/index.css b/src/index.css index 06028c8..d1add56 100644 --- a/src/index.css +++ b/src/index.css @@ -26,7 +26,7 @@ html, body { padding: 0; font-size: 14px; background-color: #EEEEEE; - /* 禁止书香滚动条占位 隐藏浏览器默认的滚动条样式 */ + /* 禁止滚动条占位 隐藏浏览器默认的滚动条样式 */ scrollbar-width: none; } diff --git a/src/layout/Type/statedata.d.ts b/src/layout/Type/statedata.d.ts new file mode 100644 index 0000000..03a93ea --- /dev/null +++ b/src/layout/Type/statedata.d.ts @@ -0,0 +1,3 @@ +interface BelongDataType{ + +} \ No newline at end of file diff --git a/src/route/proj/edit/ProjEditStep2.tsx b/src/route/proj/edit/ProjEditStep2.tsx index e583464..98409ae 100644 --- a/src/route/proj/edit/ProjEditStep2.tsx +++ b/src/route/proj/edit/ProjEditStep2.tsx @@ -1,5 +1,5 @@ import './proj-edit-step.css'; -import { Breadcrumb, Col, DatePicker, Flex, message, Modal, Row, Spin, Select, Table, Space } from "antd"; +import { Breadcrumb, Cascader, Col, DatePicker, Flex, message, Modal, Row, Spin, Select, Table, Space } from "antd"; import { FolderAddOutlined } from '@ant-design/icons'; import locale from 'antd/es/date-picker/locale/zh_CN'; import { Link, useNavigate, useParams } from "react-router-dom"; @@ -9,9 +9,11 @@ import { Button, Form, Input } from 'antd'; import { AxiosResponse } from "axios"; import dayjs, { Dayjs } from 'dayjs'; import type { SearchProps } from 'antd/es/input/Search'; -import type { TableColumnsType } from 'antd'; +// import type { TableColumnsType } from 'antd'; +import { ITree } from "../../../interfaces/dict/IDict.ts"; const { Search } = Input; const { Column } = Table; +// 基本信息文件类型 type FieldType = { projSubName: string; projVersion: string; @@ -19,25 +21,45 @@ type FieldType = { companyName: string; companyNameEn: string; }; +// 所属人信息类型 +type BelongPeopleType = { + authorName: string; + authorIdCardType: string; + authorIdCard: string; + authorNation: string; + authorProvince: string; + authorEstablishDate: Dayjs; +} interface DataType { key: React.Key; name: string; age: number; address: string; + select: boolean; +} +interface Option { + value?: string | number | null; + label: React.ReactNode; + children?: Option[]; + isLeaf?: boolean; + id: string; + pId: string; } export default function ProjEditStep2() { const nav = useNavigate(); const pathParams = useParams(); const [messageApi, contextHolder] = message.useMessage(); - const [form] = Form.useForm(); + const [formInfo] = Form.useForm(); + const [formBelong] = Form.useForm(); const [loading, setLoading] = useState(false); const [isEditModalOpen, setIsEditModalOpen] = useState(false); - const height = window.innerHeight - 180; + const [isNewBelongOpen, setIsNewBelongOpen] = useState(false) + const height = window.innerHeight - 220; const dateFormat = 'YYYY年MM月DD日'; // 表格第几行数据 - const [clom,setClom] = useState('') + // const [clom, setClom] = useState('') // 著作人搜索 const belongPeopleSearch: SearchProps['onSearch'] = (value, _e, info) => ( console.log(info?.source, value), @@ -55,46 +77,120 @@ export default function ProjEditStep2() { // selectedRowKeys: React.Key[] onChange: (selectedRowKeys: React.Key[], selectedRows: DataType[]) => { console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows); - setClom(String(selectedRowKeys)) + // setClom(String(selectedRowKeys)) + setSelectedKeyst(selectedRowKeys) }, - + }; - // 表格数据 + const datanew = [] + // 所属着表格数据 + const [tableBelongData, setTableBelongData] = useState([]) const data: DataType[] = [ { key: '1', name: 'John Brown', age: 32, address: 'New York No. 1 Lake Park', + select: false }, { key: '2', name: 'Jim Green', age: 42, address: 'London No. 1 Lake Park', + select: true + }, { key: '3', name: 'Joe Black', age: 32, address: 'Sydney No. 1 Lake Park', + select: false + }, { key: '4', name: 'Disabled User', age: 99, address: 'Sydney No. 1 Lake Park', - }, - ]; + select: false + }, + { + key: '5', + name: '嘻嘻', + age: 99, + address: 'Sydney No. 1 Lake Park', + select: false + + }, + { + key: '6', + name: '呵呵', + age: 99, + address: 'Sydney No. 1 Lake Park', + select: false + + }, + + + + ]; + const [selectedKeys, setSelectedKeyst] = useState(data.filter(item => item.select).map(item => item.key)) + // const selectedKeys = data.filter(item => item.select).map(item => item.key); + console.log('selectedKeys:', selectedKeys); + + // 创建所属者弹窗数据 + const [belongTitle, setbelongTitle] = useState('') + const [areaArray, setAreaArray] = useState([]); + const listArea = (pId: string) => { + return new Promise((resolve) => { + get({ + messageApi, + url: '/api/area/list-area-ztree', + config: { + params: { + id: pId + } + }, + onSuccess({ data }) { + resolve(data); + } + }) + }) + } + + + // 验证创建著作人表单信息 + const handleOk = () => { + formBelong.validateFields().then(() => { + // 如果验证通过,则执行确认操作 + // 这里可以放置你的确认操作逻辑 + // alert(formBelong.getFieldValue('authorName')); + + // 关闭 弹窗 + setIsNewBelongOpen(false) + // 初始化数据 + formBelong.resetFields(); // 重置表单字段为初始值 + // alert('嘻嘻') + + }).catch(() => { + // 如果验证不通过,可以根据需要处理错误信息 + // (errorInfo); + }); + }; useEffect(() => { + // 基本信息页面信息 get({ messageApi, url: `/api/proj/get/edit-step2/${pathParams.projId}`, onSuccess({ data }: AxiosResponse) { - form.setFieldsValue({ + // console.log('基本信息',data); + + formInfo.setFieldsValue({ projSubName: data.projSubName, projVersion: data.projVersion, projDevCompleteDate: data.projDevCompleteDate ? dayjs(data.projDevCompleteDate, 'YYYY-MM-DD') : '', @@ -103,11 +199,49 @@ export default function ProjEditStep2() { }) } }) + // 所属者信息 + get({ + messageApi, + url: `/api/proj/get/edit-step4/${pathParams.projId}`, + onSuccess({data}: AxiosResponse) { + console.log('所属者信息',data); + + } + }) + // 所属者表格 + get({ + messageApi, + // url: `/api/proj/get/edit-step2/${pathParams.projId}`, + + url: `/api/proj-owner/listpage`, + // config: { + // params: { + // } + // }, + onSuccess({ data }: AxiosResponse) { + console.log('所属者表格', data); + + } + }) + + + listArea('0').then(data => { + const options: Option[] = data.map(item => { + return { + value: item.name, + label: item.name, + isLeaf: !item.isParent, + id: item.id, + pId: item.pId + } + }) + setAreaArray(options); + }); }, []) return ( <> -
+
{contextHolder} @@ -119,7 +253,7 @@ export default function ProjEditStep2() { {title: '基本信息'}, ]} /> */} -
+
@@ -128,8 +262,8 @@ export default function ProjEditStep2() {
@@ -264,8 +399,10 @@ export default function ProjEditStep2() {
@@ -311,24 +448,74 @@ export default function ProjEditStep2() { rowSelection={{ type: 'radio', ...rowSelection, + selectedRowKeys: selectedKeys // 设置默认选中的行 }} // columns={columns} - + dataSource={data} + pagination={{ + defaultPageSize: 5, // 设置默认一页显示 5 条数据 + }} + style={{ textAlign: 'center' }} // 设置表格内容居中显示 > - + {/* */} ( + render={(text, record: any) => ( - { alert(`编辑第${clom}行数据`)}}>编辑 - | - { alert(`查看第${clom}行数据`)}}>查看 + { + console.log('text:', text); + console.log('record:', record); + + + setbelongTitle('编辑所属者') + setIsNewBelongOpen(true) + // 发起请求给formBelong 表单赋值 + formBelong.setFieldsValue({ + // 公司名 + authorName: '嘻嘻', + // 证件类型 + authorIdCardType: 'BUSINESS_LICENSE', + // 证件号 + authorIdCard: '12345678', + // 国籍 + authorNation: '中国', + // 地区 + authorProvince: '', + // 成立日期 + authorEstablishDate: '', + }) + }}>编辑 + | + { + alert('删除' + record.key) + }}>删除 + | + { + setbelongTitle('查看所属者') + setIsNewBelongOpen(true) + // 发起请求给formBelong 表单赋值 + formBelong.setFieldsValue({ + // 公司名 + authorName: '查看', + // 证件类型 + authorIdCardType: 'BUSINESS_LICENSE', + // 证件号 + authorIdCard: '12345678', + // 国籍 + authorNation: '中国', + // 地区 + authorProvince: '', + // 成立日期 + authorEstablishDate: '', + }) + }}>查看 + )} /> @@ -357,68 +544,309 @@ export default function ProjEditStep2() {
{/* 表格 */} + + + + + + {/* */} + ( + + { + alert(text) + + }}>编辑 + | + { alert(record.key) }}>查看 + + )} + /> +
-
+
- + +
+
+ + {/* 总体选择保存的提示 */} { - setIsEditModalOpen(false); - put({ - messageApi, - url: `/api/proj/update/edit-step2/${pathParams.projId}`, - body: { - projSubName: form.getFieldValue('projSubName'), - projVersion: form.getFieldValue('projVersion'), - projDevCompleteDate: dayjs(form.getFieldValue('projDevCompleteDate')).format(dateFormat), - companyName: form.getFieldValue('companyName'), - companyNameEn: form.getFieldValue('companyNameEn'), - }, - onBefore() { - setLoading(true); - }, - onSuccess() { - messageApi.open({ - type: 'success', - content: '编辑成功' - }) - }, - onFinally() { - setLoading(false); - } - }) + // 美哟u创建所属者 应该还得判断一下没选中所属者 + if (data.length == 0) { + // alert('所属者不能为空') + messageApi.open({ + type: 'error', + content: '所属者不能为空' + }) + setIsEditModalOpen(false); + // 没有申请人 应该还得判断一下没选中申请人 + } else if (datanew.length == 0) { + // alert('申请人不能为空') + messageApi.open({ + type: 'error', + content: '申请人不能为空' + }) + setIsEditModalOpen(false); + } else if (selectedKeys.length == 0) { + messageApi.open({ + type: 'error', + content: '请选择所属者' + }) + setIsEditModalOpen(false); + + } else { + setIsEditModalOpen(false); + put({ + messageApi, + url: `/api/proj/update/edit-step2/${pathParams.projId}`, + body: { + projSubName: formInfo.getFieldValue('projSubName'), + projVersion: formInfo.getFieldValue('projVersion'), + projDevCompleteDate: dayjs(formInfo.getFieldValue('projDevCompleteDate')).format(dateFormat), + companyName: formInfo.getFieldValue('companyName'), + companyNameEn: formInfo.getFieldValue('companyNameEn'), + }, + onBefore() { + setLoading(true); + }, + onSuccess() { + messageApi.open({ + type: 'success', + content: '编辑成功' + }) + }, + onFinally() { + setLoading(false); + } + }) + } + // setIsEditModalOpen(false); + // put({ + // messageApi, + // url: `/api/proj/update/edit-step2/${pathParams.projId}`, + // body: { + // projSubName: form.getFieldValue('projSubName'), + // projVersion: form.getFieldValue('projVersion'), + // projDevCompleteDate: dayjs(form.getFieldValue('projDevCompleteDate')).format(dateFormat), + // companyName: form.getFieldValue('companyName'), + // companyNameEn: form.getFieldValue('companyNameEn'), + // }, + // onBefore() { + // setLoading(true); + // }, + // onSuccess() { + // messageApi.open({ + // type: 'success', + // content: '编辑成功' + // }) + // }, + // onFinally() { + // setLoading(false); + // } + // }) }} onCancel={() => { setIsEditModalOpen(false); }}>
确定提交吗?
+ + + {/* 选择创建所属者 */} + { + // }} + onOk={ + handleOk + } + width={'66.67%'} + // 确认按钮样式 + okButtonProps={{ style: { width: '102px', height: '49px', background: '#FFBA00', fontSize: '18px', color: '#FFFFFF', display: belongTitle == '查看所属者' ? 'none' : 'block' } }} + // 返回按钮样式 + cancelButtonProps={{ style: { border: 'none', width: '102px', height: '49px', background: '#F3F3F3', fontSize: '18px', color: '#8C8C8C' } }} + onCancel={() => { setIsNewBelongOpen(false) }} + > +
+
+ {belongTitle} +
+
+
{ + // setIsNewBelongOpen(true); + }} + autoComplete="off" + > + + + + label="姓名或公司名称" + name="authorName" + rules={[{ required: true, message: '请输入姓名或公司名称' }]} + > + + + + + + label="成立日期" + name="authorEstablishDate" + rules={[{ required: true, message: '请选择成立日期' }]} + > + + + + + + + + label="证件类型" + name="authorIdCardType" + rules={[{ required: true, message: '请选择证件类型' }]} + > + + + + + + + + label="国籍" + name="authorNation" + rules={[{ required: true, message: '请选择国籍' }]} + > +