4.23 调接口
This commit is contained in:
@ -2,12 +2,12 @@ import React, { useEffect, useState } from 'react';
|
|||||||
import logo from '@/images/opening/logo.svg';
|
import logo from '@/images/opening/logo.svg';
|
||||||
import styles from './style.less';
|
import styles from './style.less';
|
||||||
import './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 { 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 { isNotEmpty } from '@/utils/CommonUtils';
|
||||||
import ExtendUpload from '@/utils/ExtendUpload';
|
import ExtendUpload from '@/utils/ExtendUpload';
|
||||||
import { getPublicData } from '../service';
|
import { getPublicData, savePublicData } from '../service';
|
||||||
|
|
||||||
const layout = {
|
const layout = {
|
||||||
labelCol: {
|
labelCol: {
|
||||||
@ -22,59 +22,6 @@ const validateMessages = {
|
|||||||
required: '请填写当前项内容',
|
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<{}> = () => {
|
const PublicPlatform: React.FC<{}> = () => {
|
||||||
//loading
|
//loading
|
||||||
const [loading, setLoading] = useState<boolean>(false);
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
@ -84,6 +31,8 @@ const PublicPlatform: React.FC<{}> = () => {
|
|||||||
const [initialData, setInitialData] = useState<any>({});
|
const [initialData, setInitialData] = useState<any>({});
|
||||||
//只读状态readOnly 默认只读
|
//只读状态readOnly 默认只读
|
||||||
const [readOnly, setReadOnly] = useState<boolean>(true);
|
const [readOnly, setReadOnly] = useState<boolean>(true);
|
||||||
|
//公示or公告 true-公示 false-公告
|
||||||
|
const [annoType, setAnnoType] = useState<boolean>(false);
|
||||||
|
|
||||||
const { TextArea } = Input;
|
const { TextArea } = Input;
|
||||||
const { Panel } = Collapse;
|
const { Panel } = Collapse;
|
||||||
@ -144,8 +93,6 @@ const PublicPlatform: React.FC<{}> = () => {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//公示-标段(包)遍历
|
//公示-标段(包)遍历
|
||||||
const sectionsRender = (sections: any[] | null, readonly: boolean) => {
|
const sectionsRender = (sections: any[] | null, readonly: boolean) => {
|
||||||
if (isNotEmpty(sections)) {
|
if (isNotEmpty(sections)) {
|
||||||
@ -177,7 +124,6 @@ const PublicPlatform: React.FC<{}> = () => {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//公示-中标候选人遍历
|
//公示-中标候选人遍历
|
||||||
const suppliersRender = (suppliers: any[] | null, readonly: boolean) => {
|
const suppliersRender = (suppliers: any[] | null, readonly: boolean) => {
|
||||||
if (isNotEmpty(suppliers)) {
|
if (isNotEmpty(suppliers)) {
|
||||||
@ -213,38 +159,60 @@ const PublicPlatform: React.FC<{}> = () => {
|
|||||||
//公告&公示信息
|
//公告&公示信息
|
||||||
const annoRender = (anno: any, readonly: boolean) => {
|
const annoRender = (anno: any, readonly: boolean) => {
|
||||||
if (isNotEmpty(anno)) {
|
if (isNotEmpty(anno)) {
|
||||||
return returnUpload("ctpspFileid", "PDF公示文件", readonly, anno.ctpspFileid, [{ required: !readonly }])
|
return returnUpload("ctpspFileId", "PDF公示文件", readonly, anno.ctpspFileId, [{ required: !readonly }])
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
//保存方法
|
||||||
const onSave = () => {
|
const onSave = () => {
|
||||||
form.validateFields()
|
form.validateFields()
|
||||||
.then(values => {
|
.then(values => {
|
||||||
console.log('success', values)
|
setLoading(true);
|
||||||
/*
|
console.log('success', values);
|
||||||
values:
|
const data = JSON.parse(JSON.stringify(initialData));//深拷贝
|
||||||
{
|
console.log('init', data);
|
||||||
username: 'username',
|
//项目
|
||||||
password: 'password',
|
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 => {
|
.catch(errorInfo => {
|
||||||
console.log('error', 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(() => {
|
useEffect(() => {
|
||||||
|
setLoading(true);
|
||||||
//获取公共服务平台数据
|
//获取公共服务平台数据
|
||||||
getPublicData('1516966126268026880').then(res => {
|
getPublicData('1516966126268026880').then(res => {
|
||||||
if (res?.code == 200) {
|
if (res?.code == 200) {
|
||||||
const data = res?.data
|
const data = res?.data;
|
||||||
setInitialData(data);
|
setInitialData(data);
|
||||||
if (isNotEmpty(data.anno)) {
|
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<{}> = () => {
|
|||||||
<PageHeader
|
<PageHeader
|
||||||
title={
|
title={
|
||||||
<Space>
|
<Space>
|
||||||
<Button type='primary' key='save' onClick={() => onSave()}>保存</Button>
|
<Button type='primary' key='save' hidden={btnAuthority(['ebtp-agency-project-manager', 'ebtp-purchase'])} onClick={() => onSave()}>保存</Button>
|
||||||
<Button key='close' onClick={() => { }}>关闭</Button>
|
<Button key='close' onClick={() => window.close()}>关闭</Button>
|
||||||
</Space>
|
</Space>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@ -296,7 +268,7 @@ const PublicPlatform: React.FC<{}> = () => {
|
|||||||
title={<Text strong>公共服务平台</Text>}
|
title={<Text strong>公共服务平台</Text>}
|
||||||
/>
|
/>
|
||||||
<div style={{ height: innerHeight - 180, overflowY: 'auto' }} ref={setContainer}>
|
<div style={{ height: innerHeight - 180, overflowY: 'auto' }} ref={setContainer}>
|
||||||
<Form {...layout} form={form} scrollToFirstError name="public-platform" className="noticeFile-label" validateMessages={validateMessages}>
|
<Form {...layout} form={form} scrollToFirstError name="public-platform" validateMessages={validateMessages}>
|
||||||
<Collapse
|
<Collapse
|
||||||
defaultActiveKey={['1', '2', '3', '4']}
|
defaultActiveKey={['1', '2', '3', '4']}
|
||||||
expandIcon={({ isActive }) => <CaretRightOutlined rotate={isActive ? 90 : 0} />}
|
expandIcon={({ isActive }) => <CaretRightOutlined rotate={isActive ? 90 : 0} />}
|
||||||
@ -308,25 +280,18 @@ const PublicPlatform: React.FC<{}> = () => {
|
|||||||
>
|
>
|
||||||
{projectRender(initialData?.project, initialData?.tenderer, readOnly)}
|
{projectRender(initialData?.project, initialData?.tenderer, readOnly)}
|
||||||
</Panel>
|
</Panel>
|
||||||
<Panel
|
{annoType && <Panel
|
||||||
header={<Text strong>中标候选人信息</Text>}
|
header={<Text strong>中标候选人信息</Text>}
|
||||||
id="panel2"
|
id="panel2"
|
||||||
key="2"
|
key="2"
|
||||||
>
|
>
|
||||||
{sectionsRender(initialData?.sections, readOnly)}
|
{sectionsRender(initialData?.sections, readOnly)}
|
||||||
</Panel>
|
</Panel>}
|
||||||
<Panel
|
<Panel
|
||||||
header={<Text strong>公告信息</Text>}
|
header={<Text strong>{annoType ? "公示信息" : "公告信息"}</Text>}
|
||||||
id="panel3"
|
id="panel3"
|
||||||
key="3"
|
key="3"
|
||||||
>
|
>
|
||||||
|
|
||||||
</Panel>
|
|
||||||
<Panel
|
|
||||||
header={<Text strong>公示信息</Text>}
|
|
||||||
id="panel4"
|
|
||||||
key="4"
|
|
||||||
>
|
|
||||||
{annoRender(initialData?.anno, readOnly)}
|
{annoRender(initialData?.anno, readOnly)}
|
||||||
</Panel>
|
</Panel>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
@ -338,9 +303,8 @@ const PublicPlatform: React.FC<{}> = () => {
|
|||||||
{container && (
|
{container && (
|
||||||
<Anchor getContainer={() => container} style={{ overflow: 'hidden' }} onClick={handleClick}>
|
<Anchor getContainer={() => container} style={{ overflow: 'hidden' }} onClick={handleClick}>
|
||||||
<Link href="#panel1" title="项目信息" />
|
<Link href="#panel1" title="项目信息" />
|
||||||
<Link href="#panel2" title="中标候选人信息" />
|
{annoType && <Link href="#panel2" title="中标候选人信息" />}
|
||||||
<Link href="#panel3" title="公告信息" />
|
<Link href="#panel3" title={annoType ? "公示信息" : "公告信息"} />
|
||||||
<Link href="#panel4" title="公示信息" />
|
|
||||||
</Anchor>
|
</Anchor>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user