diff --git a/src/pages/Bid/BiddingAnnouncement/components/PublicPlatform.tsx b/src/pages/Bid/BiddingAnnouncement/components/PublicPlatform.tsx index 8b42f02..062435b 100644 --- a/src/pages/Bid/BiddingAnnouncement/components/PublicPlatform.tsx +++ b/src/pages/Bid/BiddingAnnouncement/components/PublicPlatform.tsx @@ -2,12 +2,12 @@ import React, { useEffect, useState } from 'react'; import logo from '@/images/opening/logo.svg'; import styles from './style.less'; import './style.less'; -import { Affix, Anchor, BackTop, Button, Checkbox, Col, Collapse, DatePicker, Descriptions, Divider, Form, Input, InputNumber, Layout, message, Modal, PageHeader, Radio, Row, Select, Space, Spin, Tag, Timeline, Tooltip, Typography } from 'antd'; +import { Anchor, BackTop, Button, Collapse, Descriptions, Form, Input, message, PageHeader, Space, Spin, Typography } from 'antd'; import { btnAuthority } from '@/utils/authority'; -import { ArrowUpOutlined, CaretRightOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; +import { ArrowUpOutlined, CaretRightOutlined } from '@ant-design/icons'; import { isNotEmpty } from '@/utils/CommonUtils'; import ExtendUpload from '@/utils/ExtendUpload'; -import { getPublicData } from '../service'; +import { getPublicData, savePublicData } from '../service'; const layout = { labelCol: { @@ -22,59 +22,6 @@ const validateMessages = { required: '请填写当前项内容', }; -const defaultData = { - data: { - "project": { - "id": "", - "projectName": "", - "projectScale": "", - "tenderContent": "", - "tenderCode": "", - "readonly": false - }, - "sections": [ - { - "id": "", - "projectId": "", - "bidSectBizNum": "", - "bidSectCode": "", - "bidSectName": "", - "suppliers": [ - { - "id": "", - "projectId": "", - "sectionId": "", - "assessRoomId": "", - "assessRoomSort": 0, - "companyId": "", - "companyName": "", - "sort": "", - "quality": "", - "evaluationStatus": "", - "winCandidateQualification": "", - "timeLimit": 0, - "pmName": "", - "pmCode": "", - "pmCeritficates": "" - } - ] - } - ], - "anno": { - "id": "", - "annoNature": 0, - "hasCtpsp": false, - "ctpspFileid": "", - "status": 0 - }, - "tenderer": { - "id": "", - "code": "", - "name": "" - } - } -} - const PublicPlatform: React.FC<{}> = () => { //loading const [loading, setLoading] = useState(false); @@ -84,6 +31,8 @@ const PublicPlatform: React.FC<{}> = () => { const [initialData, setInitialData] = useState({}); //只读状态readOnly 默认只读 const [readOnly, setReadOnly] = useState(true); + //公示or公告 true-公示 false-公告 + const [annoType, setAnnoType] = useState(false); const { TextArea } = Input; const { Panel } = Collapse; @@ -144,8 +93,6 @@ const PublicPlatform: React.FC<{}> = () => { ) } - - //公示-标段(包)遍历 const sectionsRender = (sections: any[] | null, readonly: boolean) => { if (isNotEmpty(sections)) { @@ -177,7 +124,6 @@ const PublicPlatform: React.FC<{}> = () => { } return null; } - //公示-中标候选人遍历 const suppliersRender = (suppliers: any[] | null, readonly: boolean) => { if (isNotEmpty(suppliers)) { @@ -213,38 +159,60 @@ const PublicPlatform: React.FC<{}> = () => { //公告&公示信息 const annoRender = (anno: any, readonly: boolean) => { if (isNotEmpty(anno)) { - return returnUpload("ctpspFileid", "PDF公示文件", readonly, anno.ctpspFileid, [{ required: !readonly }]) + return returnUpload("ctpspFileId", "PDF公示文件", readonly, anno.ctpspFileId, [{ required: !readonly }]) } return null; } - + //保存方法 const onSave = () => { form.validateFields() .then(values => { - console.log('success', values) - /* - values: - { - username: 'username', - password: 'password', + setLoading(true); + console.log('success', values); + const data = JSON.parse(JSON.stringify(initialData));//深拷贝 + console.log('init', data); + //项目 + if (isNotEmpty(data?.project)) { + data.project.projectScale = values.projectScale; + data.project.tenderContent = values.tenderContent; } - */ + //投标人 + if (isNotEmpty(data?.tenderer)) { + data.tenderer.name = values.name; + data.tenderer.code = values.code; + } + //公告&公示 + if (isNotEmpty(data?.anno)) { + data.anno.ctpspFileId = values.ctpspFileId; + } + //标段 中标候选人公示 + if (isNotEmpty(data?.sections)) { + for (const item of data?.sections) { + if (isNotEmpty(item.suppliers)) { + for (const val of item.suppliers) { + const formData: any = form.getFieldValue(val.id); + val.pmName = formData.pmName; + val.pmCode = formData.pmCode; + val.pmCeritficates = formData.pmCeritficates; + val.quality = formData.quality; + val.evaluationStatus = formData.evaluationStatus; + val.winCandidateQualification = formData.winCandidateQualification; + val.timeLimit = formData.timeLimit; + } + } + } + } + //保存数据 + savePublicData(data).then(res => { + if (res?.code == 200 && res?.success) { + message.success('保存成功'); + } + }).finally(() => { + setLoading(false); + }) }) .catch(errorInfo => { console.log('error', errorInfo) - /* - errorInfo: - { - values: { - username: 'username', - password: 'password', - }, - errorFields: [ - { name: ['password'], errors: ['Please input your Password!'] }, - ], - outOfDate: false, - } - */ }); }; @@ -260,15 +228,19 @@ const PublicPlatform: React.FC<{}> = () => { }; useEffect(() => { + setLoading(true); //获取公共服务平台数据 getPublicData('1516966126268026880').then(res => { if (res?.code == 200) { - const data = res?.data + const data = res?.data; setInitialData(data); if (isNotEmpty(data.anno)) { - setReadOnly(data.anno.status != 1 && data.anno.status != 4) + setAnnoType(data.anno.annoNature === 201); + setReadOnly(data.anno.status != 1 && data.anno.status != 4); } } + }).finally(() => { + setLoading(false); }) }, []); @@ -284,8 +256,8 @@ const PublicPlatform: React.FC<{}> = () => { - - + + } /> @@ -296,7 +268,7 @@ const PublicPlatform: React.FC<{}> = () => { title={公共服务平台} />
-
+ } @@ -308,25 +280,18 @@ const PublicPlatform: React.FC<{}> = () => { > {projectRender(initialData?.project, initialData?.tenderer, readOnly)} - 中标候选人信息} id="panel2" key="2" > {sectionsRender(initialData?.sections, readOnly)} - + } 公告信息} + header={{annoType ? "公示信息" : "公告信息"}} id="panel3" key="3" > - - - 公示信息} - id="panel4" - key="4" - > {annoRender(initialData?.anno, readOnly)} @@ -338,9 +303,8 @@ const PublicPlatform: React.FC<{}> = () => { {container && ( container} style={{ overflow: 'hidden' }} onClick={handleClick}> - - - + {annoType && } + )}