diff --git a/src/pages/Bid/BiddingAnnouncement/components/PublicPlatform.tsx b/src/pages/Bid/BiddingAnnouncement/components/PublicPlatform.tsx index b381d5a..8b42f02 100644 --- a/src/pages/Bid/BiddingAnnouncement/components/PublicPlatform.tsx +++ b/src/pages/Bid/BiddingAnnouncement/components/PublicPlatform.tsx @@ -6,6 +6,8 @@ import { Affix, Anchor, BackTop, Button, Checkbox, Col, Collapse, DatePicker, De import { btnAuthority } from '@/utils/authority'; import { ArrowUpOutlined, CaretRightOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; import { isNotEmpty } from '@/utils/CommonUtils'; +import ExtendUpload from '@/utils/ExtendUpload'; +import { getPublicData } from '../service'; const layout = { labelCol: { @@ -80,6 +82,8 @@ const PublicPlatform: React.FC<{}> = () => { const [container, setContainer] = useState(null); //初始数据 const [initialData, setInitialData] = useState({}); + //只读状态readOnly 默认只读 + const [readOnly, setReadOnly] = useState(true); const { TextArea } = Input; const { Panel } = Collapse; @@ -127,11 +131,24 @@ const PublicPlatform: React.FC<{}> = () => { ) } + //Upload + function returnUpload(name: string | string[], label: string, readonly: boolean, initialValue?: string, rules?: any[], extra?: React.ReactNode) { + return ( + + + + ) + } - //公示-中标候选人遍历 - const suppliersRender = (suppliers: any[] | null, readonly: boolean) => { - if (isNotEmpty(suppliers)) { + //公示-标段(包)遍历 + const sectionsRender = (sections: any[] | null, readonly: boolean) => { + if (isNotEmpty(sections)) { const activeKeyList = (length: number) => { const list: number[] = [] for (let i = 0; i < length; i++) { @@ -139,7 +156,7 @@ const PublicPlatform: React.FC<{}> = () => { } return list; } - return suppliers?.map((item, index) => ( + return sections?.map((item, index) => ( {item.bidSectName} @@ -152,7 +169,7 @@ const PublicPlatform: React.FC<{}> = () => { defaultActiveKey={isNotEmpty(item.suppliers) ? activeKeyList(item.suppliers.length) : []} expandIcon={({ isActive }) => } > - {sectionsRender(item.suppliers, readonly)} + {suppliersRender(item.suppliers, readonly)} @@ -161,10 +178,10 @@ const PublicPlatform: React.FC<{}> = () => { return null; } - //公示-标段(包)遍历 - const sectionsRender = (sections: any[] | null, readonly: boolean) => { - if (isNotEmpty(sections)) { - return sections?.map((item, index) => ( + //公示-中标候选人遍历 + const suppliersRender = (suppliers: any[] | null, readonly: boolean) => { + if (isNotEmpty(suppliers)) { + return suppliers?.map((item, index) => ( {returnInput([item.sectionId, item.id, 'pmName'], "项目负责人姓名", readonly, item.pmName, [{ required: !readonly }], "项目负责人姓名")} {returnInput([item.sectionId, item.id, 'pmCode'], "项目负责人证件号码", readonly, item.pmCode, [{ required: !readonly }], "项目负责人证件号码")} @@ -178,18 +195,27 @@ const PublicPlatform: React.FC<{}> = () => { } return null; } - //项目 - const projectRender = (project: any, readonly: boolean) => { - if (typeof project === 'object') { + //项目信息 + const projectRender = (project: any, tenderer: any, readonly: boolean) => { + if (isNotEmpty(project) && isNotEmpty(tenderer)) { + const rel: boolean = readonly || project.readonly; return ( <> - {returnInput("name", "纳税人名称", project.readonly, null, [{ required: true }], "纳税人名称")} - {returnInput("code", "纳税人识别号", false, null, [{ required: true }], "纳税人识别号")} - {returnArea("projectScale", "项目规模", false, null, [{ required: true }], "项目规模")} - {returnArea("tenderContent", "招标内容与范围及招标方案说明", false, null, [{ required: true }], "招标内容与范围及招标方案说明")} + {returnInput("name", "纳税人名称", rel, tenderer.name, [{ required: !rel }], "纳税人名称")} + {returnInput("code", "纳税人识别号", rel, tenderer.code, [{ required: !rel }], "纳税人识别号")} + {returnArea("projectScale", "项目规模", rel, project.projectScale, [{ required: !rel }], "项目规模")} + {returnArea("tenderContent", "招标内容与范围及招标方案说明", rel, project.tenderContent, [{ required: !rel }], "招标内容与范围及招标方案说明")} ) } + return null; + } + //公告&公示信息 + const annoRender = (anno: any, readonly: boolean) => { + if (isNotEmpty(anno)) { + return returnUpload("ctpspFileid", "PDF公示文件", readonly, anno.ctpspFileid, [{ required: !readonly }]) + } + return null; } const onSave = () => { @@ -234,7 +260,16 @@ const PublicPlatform: React.FC<{}> = () => { }; useEffect(() => { - setInitialData(defaultData); + //获取公共服务平台数据 + getPublicData('1516966126268026880').then(res => { + if (res?.code == 200) { + const data = res?.data + setInitialData(data); + if (isNotEmpty(data.anno)) { + setReadOnly(data.anno.status != 1 && data.anno.status != 4) + } + } + }) }, []); return ( @@ -271,14 +306,14 @@ const PublicPlatform: React.FC<{}> = () => { id="panel1" key="1" > - + {projectRender(initialData?.project, initialData?.tenderer, readOnly)} 中标候选人信息} id="panel2" key="2" > - + {sectionsRender(initialData?.sections, readOnly)} 公告信息} @@ -292,7 +327,7 @@ const PublicPlatform: React.FC<{}> = () => { id="panel4" key="4" > - + {annoRender(initialData?.anno, readOnly)} diff --git a/src/pages/Bid/BiddingAnnouncement/service.ts b/src/pages/Bid/BiddingAnnouncement/service.ts index ea5ef23..bc87e77 100644 --- a/src/pages/Bid/BiddingAnnouncement/service.ts +++ b/src/pages/Bid/BiddingAnnouncement/service.ts @@ -203,4 +203,23 @@ export async function TOrF(params: any, id: any) {//{skip:'true/false'} method: "POST", data: params }); +} +/** + * 公共服务平台-获取数据 + * @param params + * @returns + */ +export async function getPublicData(params: any) { + return request('/api/biz-service-ebtp-bid/v1/ctpsp/get/' + params); +} +/** + * 公共服务平台-保存数据 + * @param params + * @returns + */ +export async function savePublicData(params: any) { + return request('/api/biz-service-ebtp-bid/v1/ctpsp/save', { + method: "POST", + data: params + }); } \ No newline at end of file