import './proj-new.css'; import { useNavigate, useParams, useSearchParams } from "react-router-dom"; import { Button, Flex, Form, Input, message, Modal, Spin, Checkbox, DatePicker } from "antd"; import { useContext, useEffect, useState } from "react"; import { get, post } from "../../util/AjaxUtils.ts"; // import {GlobalContext} from "../../context/GlobalContext.ts"; import { // IProjCharge, ProjAdditionalType, ProjChargeType } from "../../interfaces/proj/IProj.ts"; import locale from 'antd/es/date-picker/locale/zh_CN'; import { GlobalDispatchContext, reloadUser } from "../../context/GlobalContext.ts"; import BelongPeople from '../../components/BelongPeople/BelongPeople.tsx' import ContactPeople from '../../components/ContactPeople/ContactPeople.tsx' import dayjs from 'dayjs'; // const { TextArea } = Input; type ProjInfo = { projName: string; projIntroduction: string; belongPeople: string; contacts: string; projDevCompleteDate: string; coupon?:string }; export default function ProjNew() { // const globalContext = useContext(GlobalContext); const dateFormat = 'YYYY年MM月DD日'; const globalDispatchContext = useContext(GlobalDispatchContext); const nav = useNavigate(); const pathParams = useParams(); const [queryParams] = useSearchParams(); const [messageApi, contextHolder] = message.useMessage(); const [loading, setLoading] = useState(false); const height = window.innerHeight - 180; const [isCreateModalOpen, setIsCreateModalOpen] = useState(false); const [isEditModalOpen, setIsEditModalOpen] = useState(false); const [chargePrice, setChargePrice] = useState(0); const [projInfo, setProjInfo] = useState({ projName: '', projIntroduction: '', belongPeople: '', contacts: '', projDevCompleteDate: '', }); const [form] = Form.useForm(); // 所属者弹窗 const [belongModal, setBelongModal] = useState(false) // 联系人弹窗 const [concatModal, setConcatModal] = useState(false) // const [belongPeopleName ,setBelongPeopleName] = useState('') const [belongPeopleInfo, setBelongPeopleInfo] = useState({ authorName: '', authorType: '', authorIdCardType: '', authorIdCard: '', authorCrcAccount: '', authorId: '', authorProvinceCity: '' }) const [concatPeopleInfo, setConcatPeopleInfo] = useState({ applyConcatId: '', applyContactCsaNo: '', applyContactEmail: '', applyContactName: '', applyContactPhone: '', applyContactCompany: '' }) // 优惠券弹窗 const [couponModal,setCouponModal] = useState(false) const setValue = (value: string) => { form.setFieldsValue({ belongPeople: value }) } const setConcatValue = (value: string) => { form.setFieldsValue({ contacts: value }) } const [createProjId, setCreateProjId] = useState(''); const oldlistProjChargeAdditional: string[] = []; const [listProjChargeAdditional, setlistProjChargeAdditional] = useState([]) useEffect(() => { get({ messageApi: messageApi, url: '/api/proj/charge/get', onSuccess({ data }) { // console.log(data); const charge = data as any; // console.log('创建页price',charge.proj.materialAgent); let price = 0; switch (pathParams.projChargeType) { case ProjChargeType.ALL: // price = charge.proj.all; price = charge.projTypes[0].price; break; // case ProjChargeType.MATERIAL_AGENT: // price = charge.proj.materialAgent; // break; // case ProjChargeType.MATERIAL_AGENT_URGENT: // price = charge.proj.materialAgentUrgent; // break; case ProjChargeType.MATERIAL: price = charge.projTypes[1].price; break; case ProjChargeType.FREE: price = charge.projTypes[2].price; break; default: messageApi.error({ type: 'error', content: '价格类型错误', }) } const pkg = queryParams.get('pkg') == 'true' ? true : false const videoDemo = queryParams.get('videoDemo') == 'true' ? true : false const urgent = queryParams.get('urgent') == 'true' ? true : false if (pkg) { price += charge.additional.pkg; oldlistProjChargeAdditional.push(ProjAdditionalType.PKG); // console.log(listProjChargeAdditional); } if (videoDemo) { price += charge.additional.videoDemo; oldlistProjChargeAdditional.push(ProjAdditionalType.VIDEO_DEMO); // console.log(listProjChargeAdditional); } if(urgent){ price += charge.additional.urgent; oldlistProjChargeAdditional.push(ProjAdditionalType.URGENT); // console.log(listProjChargeAdditional); } setChargePrice(price); setlistProjChargeAdditional(oldlistProjChargeAdditional) // console.log('传递信息pkg:',pkg,'videoDemo:',videoDemo); // console.log('显示价格',price); } }) }, []); return ( <> {contextHolder} {/* 首页}, {title: 创建项目}, {title: '新建项目'}, ]} /> */}
{/*
请完善项目的基本信息
*/}
{ setIsCreateModalOpen(true); setProjInfo({ projName: formData.projName, projIntroduction: formData.projIntroduction, belongPeople: formData.belongPeople, contacts: formData.contacts, projDevCompleteDate: formData.projDevCompleteDate, }) }} autoComplete="off" >
系统全称*
name="projName" rules={[{ required: true, message: '请输入系统全称' }]} >
知识产权所属者*
name="belongPeople" rules={[{ required: true, message: '请选择/创建知识产权所属者' }]} >
{ setBelongModal(true) }}>选择
知识产权联系人*
name="contacts" rules={[{ required: true, message: '请选择/创建知识产权联系人' }]} >
{ setConcatModal(true) }}>选择
开发完成时间*
// label="开发完成时间" name="projDevCompleteDate" rules={[{ required: true, message: '请输入开发完成时间' }]} >
优惠券*
name="coupon" rules={[{ required: true, message: '请选择优惠券' }]} >
{ setCouponModal(true) }}>选择
value ? Promise.resolve() : Promise.reject(new Error('请阅读并勾选《软件委托开发协议》')), }, ]} > 我同意平台 { window.open('https://www.aimzhu.com/Seda.html') }}>《软件委托开发协议》
{/*
简单描述
name="projIntroduction" >