From ba2777bfd74a705217298bcde246c8290f4eca40 Mon Sep 17 00:00:00 2001 From: jl-zhoujl2 Date: Tue, 24 May 2022 13:06:41 +0800 Subject: [PATCH] 5.24 --- .../components/BiddingDocument.tsx | 3 +- .../components/PackageInformationChoose.tsx | 37 +- .../components/PackageInformationEnquiry.tsx | 19 +- .../components/PackageInformationInvite.tsx | 21 +- .../PackageInformationInviteBid.tsx | 21 +- .../PackageInformationNegotiate.tsx | 20 +- .../components/PackageInformationOnly.tsx | 6 +- .../components/PackageInformationRecruit.tsx | 21 +- .../components/ProcurementMethod1.tsx | 4 +- .../components/ProcurementMethod2.tsx | 4 +- .../components/ProcurementMethod3.tsx | 28 +- .../components/ProcurementMethod4.tsx | 4 +- .../components/ProcurementMethod5.tsx | 4 +- .../components/ProcurementMethod6.tsx | 4 +- .../components/ProcurementMethod9.tsx | 1074 +++++++++-------- .../components/BiddingDocument.tsx | 3 +- src/utils/CommonUtils.ts | 11 +- 17 files changed, 661 insertions(+), 623 deletions(-) diff --git a/src/pages/Bid/BiddingAnnouncement/components/BiddingDocument.tsx b/src/pages/Bid/BiddingAnnouncement/components/BiddingDocument.tsx index f65c443..d6e4064 100644 --- a/src/pages/Bid/BiddingAnnouncement/components/BiddingDocument.tsx +++ b/src/pages/Bid/BiddingAnnouncement/components/BiddingDocument.tsx @@ -41,6 +41,7 @@ const BiddingDocument: React.FC = (props) => { const [docSaveBtn, setDocSaveBtn] = useState("compact");//保存按钮是否展示 const [UploadList, setUploadList] = useState(); //存upload列表 const [UploadID, setUploadID] = useState("empty"); //upload 业务id + const [docName, setDocName] = useState('');//文件名称格式化 const UploadProps: UploadProps = { name: "file", @@ -287,7 +288,7 @@ const BiddingDocument: React.FC = (props) => { }, ]} > - + setDocName(trim(e.target.value))} /> {//单一来源简化流程 diff --git a/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationChoose.tsx b/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationChoose.tsx index 6a8cf7e..baf0dd0 100644 --- a/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationChoose.tsx +++ b/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationChoose.tsx @@ -3,6 +3,7 @@ import { Button, Form, Input, Modal, Select, Spin } from 'antd'; import { PackageInformationProps } from '../data'; import SelectProcess from './SelectProcess'; import { getChooseProcess } from '../service'; +import { trim } from '@/utils/CommonUtils'; /** * 公开比选编辑 @@ -45,6 +46,8 @@ const PackageInformationChoose: React.FC = (props) => { const [spinningload, setSpinningload] = useState(false); //保存loading const [saveLoading, setSaveLoading] = useState(false); + //名称格式化 + const [bidSectName, setBidSectName] = useState(''); useEffect(() => { if (values.status == 0 || values.status == 1) { setStatus(false); @@ -64,15 +67,15 @@ const PackageInformationChoose: React.FC = (props) => { //判断评审规则是否存在(比选多阶段) if (values?.reviewRules == null) { //判断资格审查方法是否存在(比选一阶段预审) - if (values?.ptcpMode == null) {} else { + if (values?.ptcpMode == null) { } else { params['levelFour'] = values?.ptcpMode; } } else { params['levelThree'] = values?.reviewRules; } //判断应不应该显示选择流程按钮 - if(projectItems?.biddingSignDict == 'selection_method_1') {//比选一阶段 - if(projectItems?.examinationMethodDict == 'examination_method_2') {//资格后审 + if (projectItems?.biddingSignDict == 'selection_method_1') {//比选一阶段 + if (projectItems?.examinationMethodDict == 'examination_method_2') {//资格后审 values?.evalMethodDict == null ? setShowSelect(true) : setShowSelect(false); } else { values?.evalMethodDict == null || values?.ptcpMode == null ? setShowSelect(true) : setShowSelect(false); @@ -143,18 +146,18 @@ const PackageInformationChoose: React.FC = (props) => { //判断评审规则是否存在(比选多阶段) if (form.getFieldValue('reviewRules') == null || form.getFieldValue('reviewRules') == '') { //判断资格审查方法是否存在(比选一阶段预审) - if (form.getFieldValue('ptcpMode') == null || form.getFieldValue('ptcpMode') == '') {} else { + if (form.getFieldValue('ptcpMode') == null || form.getFieldValue('ptcpMode') == '') { } else { params['levelFour'] = form.getFieldValue('ptcpMode'); } } else { params['levelThree'] = form.getFieldValue('reviewRules'); } - //判断应不应该显示选择流程按钮 - if(projectItems?.biddingSignDict == 'selection_method_1') {//比选一阶段 - if(projectItems?.examinationMethodDict == 'examination_method_2') {//资格后审 + //判断应不应该显示选择流程按钮 + if (projectItems?.biddingSignDict == 'selection_method_1') {//比选一阶段 + if (projectItems?.examinationMethodDict == 'examination_method_2') {//资格后审 form.getFieldValue('evalMethodDict') == null || form.getFieldValue('evalMethodDict') == '' ? setShowSelect(true) : setShowSelect(false); } else { - form.getFieldValue('evalMethodDict') == null || form.getFieldValue('evalMethodDict') == ''|| form.getFieldValue('ptcpMode') == null || form.getFieldValue('ptcpMode') == '' ? setShowSelect(true) : setShowSelect(false); + form.getFieldValue('evalMethodDict') == null || form.getFieldValue('evalMethodDict') == '' || form.getFieldValue('ptcpMode') == null || form.getFieldValue('ptcpMode') == '' ? setShowSelect(true) : setShowSelect(false); } } else { form.getFieldValue('evalMethodDict') == null || form.getFieldValue('evalMethodDict') == '' || form.getFieldValue('reviewRules') == null || form.getFieldValue('reviewRules') == '' ? setShowSelect(true) : setShowSelect(false); @@ -228,13 +231,13 @@ const PackageInformationChoose: React.FC = (props) => { !controlDisplay ? false : [ - , - , - ] + , + , + ] } > @@ -256,7 +259,7 @@ const PackageInformationChoose: React.FC = (props) => { label="采购包名称" rules={[{ required: controlDisplay }, { max: 100, message: '最大不能超过100字' }]} > - + setBidSectName(trim(e.target.value))} /> @@ -279,7 +282,7 @@ const PackageInformationChoose: React.FC = (props) => { {projectItems?.biddingSignDict == 'selection_method_1' && - projectItems?.examinationMethodDict == 'examination_method_1' ? ( + projectItems?.examinationMethodDict == 'examination_method_1' ? ( = (props) => const [spinningload, setSpinningload] = useState(false); //loading const [saveLoading, setSaveLoading] = useState(false); + //名称格式化 + const [bidSectName, setBidSectName] = useState(''); useEffect(() => { if (values.status == 1 || values.status == 0) { setStatus(false); @@ -130,13 +133,13 @@ const PackageInformationEnquiry: React.FC = (props) => !controlDisplay ? false : [ - , - , - ] + , + , + ] } >
= (props) => label="采购包名称" rules={[{ required: controlDisplay }, { max: 100, message: '最大不能超过100字' }]} > - + setBidSectName(trim(e.target.value))} /> = (props) => { const [spinningload, setSpinningload] = useState(false); //loading const [saveLoading, setSaveLoading] = useState(false); + //名称格式化 + const [bidSectName, setBidSectName] = useState(''); useEffect(() => { if (values.status == 0 || values.status == 1) { setStatus(false); @@ -139,7 +142,7 @@ const PackageInformationInvite: React.FC = (props) => { }); if (form.getFieldValue('evalMethodDict') == null) { } else { - (false); + (false); } }; return ( @@ -157,13 +160,13 @@ const PackageInformationInvite: React.FC = (props) => { !controlDisplay ? false : [ - , - , - ] + , + , + ] } > @@ -185,7 +188,7 @@ const PackageInformationInvite: React.FC = (props) => { label="标段名称" rules={[{ required: controlDisplay }, { max: 100, message: '最大不能超过100字' }]} > - + setBidSectName(trim(e.target.value))} /> diff --git a/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationInviteBid.tsx b/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationInviteBid.tsx index 6985591..5e98156 100644 --- a/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationInviteBid.tsx +++ b/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationInviteBid.tsx @@ -3,6 +3,7 @@ import { Button, Form, Input, Modal, Select, Spin } from 'antd'; import { PackageInformationProps } from '../data'; import { getChooseProcess } from '../service'; import SelectProcess from './SelectProcess'; +import { trim } from '@/utils/CommonUtils'; /** * 公开招标编辑 * @@ -46,6 +47,8 @@ const PackageInformationInviteBid: React.FC = (props) = const [spinningload, setSpinningload] = useState(false); //loading const [saveLoading, setSaveLoading] = useState(false); + //名称格式化 + const [bidSectName, setBidSectName] = useState(''); useEffect(() => { if (values.status == 1 || values.status == 0) { setStatus(false); @@ -146,7 +149,7 @@ const PackageInformationInviteBid: React.FC = (props) = setChooseProcessList(res.data); } }).finally(() => { - setSpinningload(false); + setSpinningload(false); }); }; //评价方法 @@ -238,13 +241,13 @@ const PackageInformationInviteBid: React.FC = (props) = !controlDisplay ? false : [ - , - , - ] + , + , + ] } > @@ -266,7 +269,7 @@ const PackageInformationInviteBid: React.FC = (props) = label="标段名称" rules={[{ required: controlDisplay }, { max: 100, message: '最大不能超过100字' }]} > - + setBidSectName(trim(e.target.value))} /> diff --git a/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationNegotiate.tsx b/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationNegotiate.tsx index 6c0770b..e7a772f 100644 --- a/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationNegotiate.tsx +++ b/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationNegotiate.tsx @@ -3,6 +3,7 @@ import { Button, Form, Input, Modal, Select, Spin } from 'antd'; import { PackageInformationProps } from '../data'; import { getChooseProcess } from '../service'; import SelectProcess from './SelectProcess'; +import { trim } from '@/utils/CommonUtils'; /** * 竞争性谈判编辑 @@ -46,7 +47,8 @@ const PackageInformationNegotiate: React.FC = (props) = const [spinningload, setSpinningload] = useState(false); //保存loading const [saveLoading, setSaveLoading] = useState(false); - + //名称格式化 + const [bidSectName, setBidSectName] = useState(''); useEffect(() => { if (values.status == 0 || values.status == 1) { setStatus(false); @@ -148,13 +150,13 @@ const PackageInformationNegotiate: React.FC = (props) = !controlDisplay ? false : [ - , - , - ] + , + , + ] } > @@ -176,7 +178,7 @@ const PackageInformationNegotiate: React.FC = (props) = label="采购包名称" rules={[{ required: controlDisplay }, { max: 100, message: '最大不能超过100字' }]} > - + setBidSectName(trim(e.target.value))} /> diff --git a/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationOnly.tsx b/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationOnly.tsx index f96acb6..08ac3e8 100644 --- a/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationOnly.tsx +++ b/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationOnly.tsx @@ -3,6 +3,7 @@ import { Button, Form, Input, Modal, Select, Spin } from 'antd'; import { PackageInformationProps } from '../data'; import { getChooseProcess } from '../service'; import SelectProcess from './SelectProcess'; +import { trim } from '@/utils/CommonUtils'; /** * 单一来源编辑 * @@ -43,7 +44,8 @@ const PackageInformationOnly: React.FC = (props) => { const [spinningload, setSpinningload] = useState(false); //保存loading const [saveLoading, setSaveLoading] = useState(false); - + //名称格式化 + const [bidSectName, setBidSectName] = useState(''); useEffect(() => { if (values.status == 0 || values.status == 1) { setStatus(false); @@ -144,7 +146,7 @@ const PackageInformationOnly: React.FC = (props) => { - + setBidSectName(trim(e.target.value))} /> diff --git a/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationRecruit.tsx b/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationRecruit.tsx index ecf911d..5794157 100644 --- a/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationRecruit.tsx +++ b/src/pages/Project/ProjectManage/PackageDivided/components/PackageInformationRecruit.tsx @@ -3,6 +3,7 @@ import { Button, Form, Input, Modal, Select, Spin } from 'antd'; import { PackageInformationProps } from '../data'; import SelectProcess from './SelectProcess'; import { getChooseProcess } from '../service'; +import { trim } from '@/utils/CommonUtils'; /** * 公开招募编辑 * @@ -45,6 +46,8 @@ const PackageInformationRecruit: React.FC = (props) => const [spinningload, setSpinningload] = useState(false); //保存loading const [saveLoading, setSaveLoading] = useState(false); + //名称格式化 + const [bidSectName, setBidSectName] = useState(''); useEffect(() => { if (values.status == 0 || values.status == 1) { setStatus(false); @@ -68,7 +71,7 @@ const PackageInformationRecruit: React.FC = (props) => } } }).finally(() => { - setSpinningload(false); + setSpinningload(false); }); values?.reviewRules == null ? setShowSelect(true) : setShowSelect(false); form.setFieldsValue({ @@ -159,13 +162,13 @@ const PackageInformationRecruit: React.FC = (props) => !controlDisplay ? false : [ - , - , - ] + , + , + ] } > @@ -187,7 +190,7 @@ const PackageInformationRecruit: React.FC = (props) => label="包件名称" rules={[{ required: controlDisplay }, { max: 100, message: '最大不能超过100字' }]} > - + setBidSectName(trim(e.target.value))} /> = (props) => { const openTenderFormSelect = createSelect(dictData['open_tender_form=record']); //是否需要供应商ipass解密显隐 const [isIPassDecode, isIPassDecodeSet] = useState(false); + //项目名称格式化 + const [projectName, setProjectName] = useState(''); function onChangeIpass(e: any) {//是否使用ipass制作 isIPassDecodeSet(e.target.value === '0'); } @@ -305,7 +307,7 @@ const ProjectDocumentation: React.FC = (props) => { name="projectName" rules={[{ required: true }]} > - + setProjectName(trim(e.target.value))} /> diff --git a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod2.tsx b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod2.tsx index 0d81816..df33145 100644 --- a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod2.tsx +++ b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod2.tsx @@ -71,6 +71,8 @@ const ProjectDocumentation: React.FC = (props) => { const bidMethodSubDictSelect = createSelect(dictData['bid_method_sub=record']); //适用法律 const openTenderFormSelect = createSelect(dictData['open_tender_form=record']); + //项目名称格式化 + const [projectName, setProjectName] = useState(''); useEffect(() => { /** * 根据id获取数据 @@ -295,7 +297,7 @@ const ProjectDocumentation: React.FC = (props) => { name="projectName" rules={[{ required: true }]} > - + setProjectName(trim(e.target.value))} /> diff --git a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod3.tsx b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod3.tsx index cf7c8f0..2d96eac 100644 --- a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod3.tsx +++ b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod3.tsx @@ -34,10 +34,10 @@ function createSelect(data: any) { function createSelectArea(data: any) { let value = []; for (let i = 0; i < data.length; i++) { - if (i === 0 && data[i].pid !== '0') { - value.push() - } - value.push() + if (i === 0 && data[i].pid !== '0') { + value.push() + } + value.push() } return value; } @@ -77,6 +77,8 @@ const ProjectDocumentation: React.FC = (props) => { const [noInformationFlag, setNoInformationFlag] = useState(String(status) === '0'); //是否需要供应商ipass解密显隐 const [isIPassDecode, isIPassDecodeSet] = useState(false); + //项目名称格式化 + const [projectName, setProjectName] = useState(''); useEffect(() => { /** * 根据id获取数据 @@ -255,15 +257,15 @@ const ProjectDocumentation: React.FC = (props) => { */ const onSecondCityChange = (value: any) => { form.resetFields(["regionDictId"]); - if (value) { - getProvinces(value).then(res => { - if (res.code === 200) { - setDistrict(createSelectArea(res.data)); - } - }) - } else { - setDistrict(createSelectArea([])); + if (value) { + getProvinces(value).then(res => { + if (res.code === 200) { + setDistrict(createSelectArea(res.data)); } + }) + } else { + setDistrict(createSelectArea([])); + } }; /** * 区回调 @@ -308,7 +310,7 @@ const ProjectDocumentation: React.FC = (props) => { name="projectName" rules={[{ required: true }]} > - + setProjectName(trim(e.target.value))} /> diff --git a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod4.tsx b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod4.tsx index d6e99f4..6a1fc54 100644 --- a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod4.tsx +++ b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod4.tsx @@ -74,6 +74,8 @@ const ProjectDocumentation: React.FC = (props) => { const [noInformationFlag, setNoInformationFlag] = useState(String(status) === '0'); //是否需要供应商ipass解密显隐 const [isIPassDecode, isIPassDecodeSet] = useState(false); + //项目名称格式化 + const [projectName, setProjectName] = useState(''); useEffect(() => { /** * 根据id获取数据 @@ -281,7 +283,7 @@ const ProjectDocumentation: React.FC = (props) => { name="projectName" rules={[{ required: true }]} > - + setProjectName(trim(e.target.value))} /> diff --git a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod5.tsx b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod5.tsx index 1327a5a..6aaacc7 100644 --- a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod5.tsx +++ b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod5.tsx @@ -73,6 +73,8 @@ const ProjectDocumentation: React.FC = (props) => { const [noInformationFlag, setNoInformationFlag] = useState(String(status) === '0'); //是否需要供应商ipass解密显隐 const [isIPassDecode, isIPassDecodeSet] = useState(false); + //项目名称格式化 + const [projectName, setProjectName] = useState(''); function onChangeIpass(e: any) {//是否使用ipass制作 isIPassDecodeSet(e.target.value === '0'); } @@ -306,7 +308,7 @@ const ProjectDocumentation: React.FC = (props) => { name="projectName" rules={[{ required: true }]} > - + setProjectName(trim(e.target.value))} /> diff --git a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod6.tsx b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod6.tsx index 442f619..da4adf8 100644 --- a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod6.tsx +++ b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod6.tsx @@ -71,6 +71,8 @@ const ProjectDocumentation: React.FC = (props) => { const [noInformationFlag, setNoInformationFlag] = useState(String(status) === '0'); //是否需要供应商ipass解密显隐 const [isIPassDecode, isIPassDecodeSet] = useState(false); + //项目名称格式化 + const [projectName, setProjectName] = useState(''); function onChangeIpass(e: any) {//是否使用ipass制作 isIPassDecodeSet(e.target.value === '0'); } @@ -305,7 +307,7 @@ const ProjectDocumentation: React.FC = (props) => { name="projectName" rules={[{ required: true }]} > - + setProjectName(trim(e.target.value))} /> diff --git a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod9.tsx b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod9.tsx index dcc65a8..861f96f 100644 --- a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod9.tsx +++ b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod9.tsx @@ -1,541 +1,543 @@ /** * 单一来源-简化流程 */ - import React, { useEffect, useState } from 'react'; - import { Form, Input, Button, Select, Radio, Col, Row, Modal } from 'antd'; - import { getSelectName, ProcurementMethodItem, updateUtils } from '../utils'; - import { getBudgetAmountById, getByProvincesNumber, getDictRegion, getId, getProvince, getProvinces } from '../service'; - import { isEmpty, trim } from '@/utils/CommonUtils'; - import { getDicData } from '@/utils/session'; - import '@/assets/lq_style.less'; +import React, { useEffect, useState } from 'react'; +import { Form, Input, Button, Select, Radio, Col, Row, Modal } from 'antd'; +import { getSelectName, ProcurementMethodItem, updateUtils } from '../utils'; +import { getBudgetAmountById, getByProvincesNumber, getDictRegion, getId, getProvince, getProvinces } from '../service'; +import { isEmpty, trim } from '@/utils/CommonUtils'; +import { getDicData } from '@/utils/session'; +import '@/assets/lq_style.less'; import { btnAuthority } from '@/utils/authority'; - const { Option } = Select; - - const layout = { - labelCol: { span: 10 }, - wrapperCol: { span: 13 }, - }; - /** - * 加载Option - * @param data 数据源 - */ - function createSelect(data: any) { - let value = []; - for (const item of data) { - value.push( - - ) - } - return value; - } - - function createSelectArea(data: any) { - let value = []; - for (let i = 0; i < data.length; i++) { - if (i === 0 && data[i].pid !== '0') { - value.push() - } - value.push() - } - return value; - } - - const ProjectDocumentation: React.FC = (props) => { - const { id, whetherReadonly, status, setTabFlag, setActiveKey, setCurrentPage } = props; - //获取字典 - const getDict: any = getDicData(); - const dictData = JSON.parse(getDict); - //表单数据 - const [formData, setFormData] = useState(null); - //省数据 - const [province, setProvince] = useState([]); - //区下拉选数据 - const [district, setDistrict] = useState([]); - //市下拉选数据 - const [city, setCity] = useState([]); - - const [form] = Form.useForm(); - //省默认值 - const [initialProvince, setInitialProvince] = useState(null); - //组织方式字典项 - const bidOrgDictSelect = createSelect(dictData['organization=entrust']); - //采购类型字典项 - const procurementTypeSelect = createSelect(dictData['procurement_type=entrust']); - //采购方式 - const bidMethodDictSelect = createSelect(dictData['procurement_mode=entrust']); - //资金来源 - const fundsProviderDictSelect = createSelect(dictData['funds_provider=record']); - //业务类型 - const bidMethodSubDictSelect = createSelect(dictData['bid_method_sub=record']); - //标段信息禁用标识 - const [noInformationFlag, setNoInformationFlag] = useState(String(status) === '0'); - //是否需要供应商ipass解密显隐 - const [isIPassDecode, isIPassDecodeSet] = useState(false); - function onChangeIpass(e: any) {//是否使用ipass制作 - isIPassDecodeSet(e.target.value === '0'); - } - useEffect(() => { - /** - * 根据id获取数据 - */ - getId(id).then(res => { - if (res.code === 200) { - let data = res.data; - if (data.isIPassFile === '0') {//是否需要供应商ipass解密显隐 - isIPassDecodeSet(true) - } - setFormData(data); - // data.isApproval = isEmpty(data.isApproval) ? '0' : data.isApproval; - data.isApproval = '1'; - data.isIPassDecode = isEmpty(data.isIPassDecode) ? '1' : data.isIPassDecode; - form.setFieldsValue(data); - //查询省份 - getByProvincesNumber(data.province).then(res => { - if (res.code === 200) { - let data = res.data; - form.setFieldsValue({ provinceName: data?.provincesName }); - } - }) - //回显省市区 - getProvinceCityDistrict(data.regionDictId); - - } - }) - /** - * 获取省份 - */ - getProvince().then(res => { - if (res.code === 200) { - setProvince(createSelectArea(res.data)); - } - }) - - }, []); - - /** - * 获取省市区数据 - * @param regionDictId - * @returns - */ - const getProvinceCityDistrict = (regionDictId: string) => { - if (isEmpty(regionDictId)) { - return; - } - //省 - if (regionDictId.substring(regionDictId.length - 4) === '0000') { - setInitialProvince(regionDictId); - form.setFieldsValue({ - regionDictId: null, - regionDictProvince: regionDictId - }); - getProvinces(regionDictId).then(res => { - if (res.code === 200) { - setCity(createSelectArea(res.data)); - } - }) - //市 - } else if (regionDictId.substring(regionDictId.length - 1) === '0') { - let pId = regionDictId.substring(0, regionDictId.length - 4) + '0000'; - //获取省数据 - getProvinces(pId).then(res => { - if (res.code === 200) { - setCity(createSelectArea(res.data)); - form.setFieldsValue({ - regionDictCity: regionDictId, - regionDictId: null, - regionDictProvince: pId - }); - setInitialProvince(pId); - //获取区数据 - getProvinces(regionDictId).then(res => { - if (res.code === 200) { - setDistrict(createSelectArea(res.data)); - } - }) - } - }) - //区 - } else { - //回显省市区数据 - getDictRegion(regionDictId).then(response => { - let region = response.data; - //获取区数据 - getProvinces(region.pid).then(res => { - if (res.code === 200) { - setDistrict(createSelectArea(res.data)); - let pid = ''; - pid = res.data[0].pid; - pid = pid.substring(0, pid.length - 3) + '000'; - setInitialProvince(pid); - form.setFieldsValue({ - regionDictCity: region.pid, - regionDictProvince: pid - }); - //获取市数据 - getProvinces(pid).then(res => { - if (res.code === 200) { - setCity(createSelectArea(res.data)); - } - }) - } - }) - }) - } - } - - - - //提交表单 - const onFinish = (values: any) => { - const submit = () => { - //获取行政区域名称 - let regionDictName = - getSelectName(values.regionDictProvince, province) + '-' + - getSelectName(values.regionDictCity, city) + '-' + - getSelectName(values.regionDictId, district); - regionDictName = regionDictName.replaceAll('全部', ''); - regionDictName = regionDictName.replace(/(-){2,}/, ''); - regionDictName = regionDictName.endsWith("-") ? regionDictName.substring(0, regionDictName.length - 1) : regionDictName; - //获取省市区的值存入regionDictId - if (isEmpty(values.regionDictCity)) { - values.regionDictId = values.regionDictProvince; - } else { - values.regionDictId = isEmpty(values.regionDictId) ? values.regionDictCity : values.regionDictId; - } - values.regionDictName = regionDictName; - values.projectName = trim(values.projectName); - !isIPassDecode && (values['isIPassDecode'] = '1'); - updateUtils(values); - //tab标段页解除禁用 - setTabFlag(false); - setNoInformationFlag(false); - noInformation(); - } - //验证 - getBudgetAmountById(id).then(res => { - if (res.code === 200) { - let data = res.data; - let budgetAmount = form.getFieldValue("budgetAmount"); - if (Number(data) === Number(budgetAmount)) { - submit(); - } else { - Modal.confirm({ - content: `您输入的项目预算金额(${budgetAmount})与标段预算总金额(${data})不符!请确认!`, - okText: '确认', - cancelText: '取消', - keyboard: false, - centered: true, - onCancel: () => { }, - onOk: () => submit() - }); - } - } - }) - }; - - const onFinishFailed = (errorInfo: any) => { - - }; - /** - * 省回调 - */ - const handleProvinceChange = (value: any) => { - setInitialProvince(value); - form.resetFields(["regionDictId"]); - form.resetFields(["regionDictCity"]); - getProvinces(value).then(res => { - if (res.code === 200) { - setCity(createSelectArea(res.data)); - } - }) - }; - /** - * 市回调 - * @param value - */ - const onSecondCityChange = (value: any) => { - form.resetFields(["regionDictId"]); - if (value) { - getProvinces(value).then(res => { - if (res.code === 200) { - setDistrict(createSelectArea(res.data)); - } - }) - } else { - setDistrict(createSelectArea([])); - } - }; - /** - * 区回调 - * @param value - */ - const handleCityChange = (value: any) => { - - }; - - - /** - * 标段信息 - */ - const noInformation = () => { - setActiveKey('2'); - setCurrentPage('2'); - } - - //项目基本信息 招标 - const formEditBidding = () => { - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {formData !== null && formData.bidOrgDict === 'organization_1' ? ( - - - - ) : (<>) - } - - - - - - - - - - - - { return '1' } }]}> - - - - - - - - - - - - - - - - - - - - - - - - Number(value) - }, - { - pattern: /^\d+.?\d{0,4}$/, - message: '小数点后最多只能输入四位' - }, - { - pattern: /^[0-9]/, - message: '请输入正确的数字金额' - }, - ]} - > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +const { Option } = Select; - - - - { - whetherReadonly ? null : - () - } - - - - - - - - ) - } - - return formEditBidding(); - - } - - export default ProjectDocumentation; \ No newline at end of file +const layout = { + labelCol: { span: 10 }, + wrapperCol: { span: 13 }, +}; +/** + * 加载Option + * @param data 数据源 + */ +function createSelect(data: any) { + let value = []; + for (const item of data) { + value.push( + + ) + } + return value; +} + +function createSelectArea(data: any) { + let value = []; + for (let i = 0; i < data.length; i++) { + if (i === 0 && data[i].pid !== '0') { + value.push() + } + value.push() + } + return value; +} + +const ProjectDocumentation: React.FC = (props) => { + const { id, whetherReadonly, status, setTabFlag, setActiveKey, setCurrentPage } = props; + //获取字典 + const getDict: any = getDicData(); + const dictData = JSON.parse(getDict); + //表单数据 + const [formData, setFormData] = useState(null); + //省数据 + const [province, setProvince] = useState([]); + //区下拉选数据 + const [district, setDistrict] = useState([]); + //市下拉选数据 + const [city, setCity] = useState([]); + + const [form] = Form.useForm(); + //省默认值 + const [initialProvince, setInitialProvince] = useState(null); + //组织方式字典项 + const bidOrgDictSelect = createSelect(dictData['organization=entrust']); + //采购类型字典项 + const procurementTypeSelect = createSelect(dictData['procurement_type=entrust']); + //采购方式 + const bidMethodDictSelect = createSelect(dictData['procurement_mode=entrust']); + //资金来源 + const fundsProviderDictSelect = createSelect(dictData['funds_provider=record']); + //业务类型 + const bidMethodSubDictSelect = createSelect(dictData['bid_method_sub=record']); + //标段信息禁用标识 + const [noInformationFlag, setNoInformationFlag] = useState(String(status) === '0'); + //是否需要供应商ipass解密显隐 + const [isIPassDecode, isIPassDecodeSet] = useState(false); + //项目名称格式化 + const [projectName, setProjectName] = useState(''); + function onChangeIpass(e: any) {//是否使用ipass制作 + isIPassDecodeSet(e.target.value === '0'); + } + useEffect(() => { + /** + * 根据id获取数据 + */ + getId(id).then(res => { + if (res.code === 200) { + let data = res.data; + if (data.isIPassFile === '0') {//是否需要供应商ipass解密显隐 + isIPassDecodeSet(true) + } + setFormData(data); + // data.isApproval = isEmpty(data.isApproval) ? '0' : data.isApproval; + data.isApproval = '1'; + data.isIPassDecode = isEmpty(data.isIPassDecode) ? '1' : data.isIPassDecode; + form.setFieldsValue(data); + //查询省份 + getByProvincesNumber(data.province).then(res => { + if (res.code === 200) { + let data = res.data; + form.setFieldsValue({ provinceName: data?.provincesName }); + } + }) + //回显省市区 + getProvinceCityDistrict(data.regionDictId); + + } + }) + /** + * 获取省份 + */ + getProvince().then(res => { + if (res.code === 200) { + setProvince(createSelectArea(res.data)); + } + }) + + }, []); + + /** + * 获取省市区数据 + * @param regionDictId + * @returns + */ + const getProvinceCityDistrict = (regionDictId: string) => { + if (isEmpty(regionDictId)) { + return; + } + //省 + if (regionDictId.substring(regionDictId.length - 4) === '0000') { + setInitialProvince(regionDictId); + form.setFieldsValue({ + regionDictId: null, + regionDictProvince: regionDictId + }); + getProvinces(regionDictId).then(res => { + if (res.code === 200) { + setCity(createSelectArea(res.data)); + } + }) + //市 + } else if (regionDictId.substring(regionDictId.length - 1) === '0') { + let pId = regionDictId.substring(0, regionDictId.length - 4) + '0000'; + //获取省数据 + getProvinces(pId).then(res => { + if (res.code === 200) { + setCity(createSelectArea(res.data)); + form.setFieldsValue({ + regionDictCity: regionDictId, + regionDictId: null, + regionDictProvince: pId + }); + setInitialProvince(pId); + //获取区数据 + getProvinces(regionDictId).then(res => { + if (res.code === 200) { + setDistrict(createSelectArea(res.data)); + } + }) + } + }) + //区 + } else { + //回显省市区数据 + getDictRegion(regionDictId).then(response => { + let region = response.data; + //获取区数据 + getProvinces(region.pid).then(res => { + if (res.code === 200) { + setDistrict(createSelectArea(res.data)); + let pid = ''; + pid = res.data[0].pid; + pid = pid.substring(0, pid.length - 3) + '000'; + setInitialProvince(pid); + form.setFieldsValue({ + regionDictCity: region.pid, + regionDictProvince: pid + }); + //获取市数据 + getProvinces(pid).then(res => { + if (res.code === 200) { + setCity(createSelectArea(res.data)); + } + }) + } + }) + }) + } + } + + + + //提交表单 + const onFinish = (values: any) => { + const submit = () => { + //获取行政区域名称 + let regionDictName = + getSelectName(values.regionDictProvince, province) + '-' + + getSelectName(values.regionDictCity, city) + '-' + + getSelectName(values.regionDictId, district); + regionDictName = regionDictName.replaceAll('全部', ''); + regionDictName = regionDictName.replace(/(-){2,}/, ''); + regionDictName = regionDictName.endsWith("-") ? regionDictName.substring(0, regionDictName.length - 1) : regionDictName; + //获取省市区的值存入regionDictId + if (isEmpty(values.regionDictCity)) { + values.regionDictId = values.regionDictProvince; + } else { + values.regionDictId = isEmpty(values.regionDictId) ? values.regionDictCity : values.regionDictId; + } + values.regionDictName = regionDictName; + values.projectName = trim(values.projectName); + !isIPassDecode && (values['isIPassDecode'] = '1'); + updateUtils(values); + //tab标段页解除禁用 + setTabFlag(false); + setNoInformationFlag(false); + noInformation(); + } + //验证 + getBudgetAmountById(id).then(res => { + if (res.code === 200) { + let data = res.data; + let budgetAmount = form.getFieldValue("budgetAmount"); + if (Number(data) === Number(budgetAmount)) { + submit(); + } else { + Modal.confirm({ + content: `您输入的项目预算金额(${budgetAmount})与标段预算总金额(${data})不符!请确认!`, + okText: '确认', + cancelText: '取消', + keyboard: false, + centered: true, + onCancel: () => { }, + onOk: () => submit() + }); + } + } + }) + }; + + const onFinishFailed = (errorInfo: any) => { + + }; + /** + * 省回调 + */ + const handleProvinceChange = (value: any) => { + setInitialProvince(value); + form.resetFields(["regionDictId"]); + form.resetFields(["regionDictCity"]); + getProvinces(value).then(res => { + if (res.code === 200) { + setCity(createSelectArea(res.data)); + } + }) + }; + /** + * 市回调 + * @param value + */ + const onSecondCityChange = (value: any) => { + form.resetFields(["regionDictId"]); + if (value) { + getProvinces(value).then(res => { + if (res.code === 200) { + setDistrict(createSelectArea(res.data)); + } + }) + } else { + setDistrict(createSelectArea([])); + } + }; + /** + * 区回调 + * @param value + */ + const handleCityChange = (value: any) => { + + }; + + + /** + * 标段信息 + */ + const noInformation = () => { + setActiveKey('2'); + setCurrentPage('2'); + } + + //项目基本信息 招标 + const formEditBidding = () => { + return ( +
+ + + + + + setProjectName(trim(e.target.value))} /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {formData !== null && formData.bidOrgDict === 'organization_1' ? ( + + + + ) : (<>) + } + + + + + + + + + + + + { return '1' } }]}> + + + + + + + + + + + + + + + + + + + + + + + + Number(value) + }, + { + pattern: /^\d+.?\d{0,4}$/, + message: '小数点后最多只能输入四位' + }, + { + pattern: /^[0-9]/, + message: '请输入正确的数字金额' + }, + ]} + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { + whetherReadonly ? null : + () + } + + + + + + +
+ ) + } + + return formEditBidding(); + +} + +export default ProjectDocumentation; \ No newline at end of file diff --git a/src/pages/ZYuShen/Bid/BiddingAnnouncement/components/BiddingDocument.tsx b/src/pages/ZYuShen/Bid/BiddingAnnouncement/components/BiddingDocument.tsx index 75eb8c8..6a36ae1 100644 --- a/src/pages/ZYuShen/Bid/BiddingAnnouncement/components/BiddingDocument.tsx +++ b/src/pages/ZYuShen/Bid/BiddingAnnouncement/components/BiddingDocument.tsx @@ -38,6 +38,7 @@ const BiddingDocument: React.FC = (props) => { const [docSaveBtn, setDocSaveBtn] = useState("compact");//保存按钮是否展示 const [UploadList, setUploadList] = useState(); //存upload列表 const [UploadID, setUploadID] = useState("empty"); //upload 业务id + const [docName, setDocName] = useState('');//文件名称格式化 const UploadProps: UploadProps = { name: "file", disabled: editInformation @@ -244,7 +245,7 @@ const BiddingDocument: React.FC = (props) => { }, ]} > - + setDocName(trim(e.target.value))} />
{ * @param str * @returns */ -export const trim = (str: string | undefined) => { - let _str = str?.replace(/(^\s*)|(\s*$)/g, ""); - _str = _str?.replace(/[<>|\\/??::*""“”\s\r\n\t]/, ""); - return _str; +export const trim = (str: string): string => { + if (isNotEmpty(str)) { + let _str = str.replace(/(^\s*)|(\s*$)/g, ""); + _str = _str.replace(/[<>|\\/??::*""“”\s\r\n\t]/, ""); + return _str; + } + return ''; } \ No newline at end of file