From 54335a40ac1ebf35b30467c031e27be9cb374b72 Mon Sep 17 00:00:00 2001 From: jl-zhoujl2 Date: Wed, 11 May 2022 12:50:39 +0800 Subject: [PATCH] =?UTF-8?q?5.11=20=E6=8B=9B=E6=A0=87=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=EF=BC=8C=E5=BB=BA=E6=A1=A3=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E6=A0=87=E6=AE=B5=E5=90=8D=E7=A7=B0=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=A9=BA=E6=A0=BC=E6=8D=A2=E8=A1=8C=E7=AC=A6=E5=88=B6?= =?UTF-8?q?=E8=A1=A8=E7=AC=A6=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6=E8=BF=87?= =?UTF-8?q?=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/BiddingDocument.tsx | 3 +- .../ProjectManage/PackageDivided/utils.ts | 2 + .../components/ProcurementMethod1.tsx | 15 ++-- .../components/ProcurementMethod2.tsx | 3 +- .../components/ProcurementMethod3.tsx | 3 +- .../components/ProcurementMethod4.tsx | 3 +- .../components/ProcurementMethod5.tsx | 3 +- .../components/ProcurementMethod6.tsx | 3 +- .../components/ProcurementMethod9.tsx | 3 +- .../components/BiddingDocument.tsx | 65 +++++++++--------- src/utils/CommonUtils.ts | 68 +++++++++++-------- 11 files changed, 96 insertions(+), 75 deletions(-) diff --git a/src/pages/Bid/BiddingAnnouncement/components/BiddingDocument.tsx b/src/pages/Bid/BiddingAnnouncement/components/BiddingDocument.tsx index 88793e0..f65c443 100644 --- a/src/pages/Bid/BiddingAnnouncement/components/BiddingDocument.tsx +++ b/src/pages/Bid/BiddingAnnouncement/components/BiddingDocument.tsx @@ -12,6 +12,7 @@ import { getProMethod } from "@/utils/session"; import WebOffice0609, { WebOfficeRefProps } from "@/pages/webOffice/weboffice0609"; import moment from "moment"; import { AnnouncementGetMsg1, AnnouncementGetMsg2, AnnouncementGetMsg3, AnnouncementGetMsg4 } from "@/utils/AboutAnnouncementHelp"; +import { trim } from "@/utils/CommonUtils"; interface BiddingDocumentProps { modalVisible: boolean; @@ -213,7 +214,7 @@ const BiddingDocument: React.FC = (props) => { let fromData = { "tpId": tpId, - "documentName": form.getFieldValue("documentName"), + "documentName": trim(form.getFieldValue("documentName")), "documentSetId": form.getFieldValue("documentSetId"), "sections": packageMsg, "contentFileId": ref.current?.DocFileCode, diff --git a/src/pages/Project/ProjectManage/PackageDivided/utils.ts b/src/pages/Project/ProjectManage/PackageDivided/utils.ts index ebf0042..51f063c 100644 --- a/src/pages/Project/ProjectManage/PackageDivided/utils.ts +++ b/src/pages/Project/ProjectManage/PackageDivided/utils.ts @@ -1,3 +1,4 @@ +import { trim } from '@/utils/CommonUtils'; import { message } from 'antd'; import { updateForm } from './service'; @@ -22,6 +23,7 @@ export const changeDict = (dictList: any[], code: any) => { */ export const handleUpdate = async (fields: any) => { + fields.bidSectName = trim(fields.bidSectName); const success = await updateForm(fields).then((res) => { if (res.code == 200) { message.success('编辑成功'); diff --git a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod1.tsx b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod1.tsx index d500861..db5b0d3 100644 --- a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod1.tsx +++ b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod1.tsx @@ -7,7 +7,7 @@ import { getSelectName, ProcurementMethodItem, updateUtils } from '../utils'; import { getBudgetAmountById, getByProvincesNumber, getDictRegion, getId, getProvince, getProvinces } from '../service'; import { getDicData } from '@/utils/session'; import '@/assets/lq_style.less'; -import { isEmpty } from '@/utils/CommonUtils'; +import { isEmpty, trim } from '@/utils/CommonUtils'; import { btnAuthority } from '@/utils/authority'; const { Option } = Select; @@ -203,6 +203,7 @@ const ProjectDocumentation: React.FC = (props) => { values.regionDictId = isEmpty(values.regionDictId) ? values.regionDictCity : values.regionDictId; } values.regionDictName = regionDictName; + values.projectName = trim(values.projectName); !isIPassDecode && (values['isIPassDecode'] = '1'); updateUtils(values); //tab标段页解除禁用 @@ -355,12 +356,12 @@ const ProjectDocumentation: React.FC = (props) => { - // /[\u4E00-\u9FA5]/i.test(value) ? Promise.reject('不能输入汉字') : Promise.resolve() - // } - // ]} + // rules={[ + // { + // validator: (_, value) => + // /[\u4E00-\u9FA5]/i.test(value) ? Promise.reject('不能输入汉字') : Promise.resolve() + // } + // ]} > diff --git a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod2.tsx b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod2.tsx index eb64a81..0d81816 100644 --- a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod2.tsx +++ b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod2.tsx @@ -7,7 +7,7 @@ import { getSelectName, ProcurementMethodItem, updateUtils } from '../utils'; import { getBudgetAmountById, getByProvincesNumber, getDictRegion, getId, getProvince, getProvinces } from '../service'; import { getDicData } from '@/utils/session'; import '@/assets/lq_style.less'; -import { isEmpty } from '@/utils/CommonUtils'; +import { isEmpty, trim } from '@/utils/CommonUtils'; import { btnAuthority } from '@/utils/authority'; const { Option } = Select; @@ -194,6 +194,7 @@ const ProjectDocumentation: React.FC = (props) => { values.regionDictId = isEmpty(values.regionDictId) ? values.regionDictCity : values.regionDictId; } values.regionDictName = regionDictName; + values.projectName = trim(values.projectName); updateUtils(values); //tab标段页解除禁用 setTabFlag(false); diff --git a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod3.tsx b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod3.tsx index ec74deb..cf7c8f0 100644 --- a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod3.tsx +++ b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod3.tsx @@ -7,7 +7,7 @@ import { getSelectName, ProcurementMethodItem, updateUtils } from '../utils'; import { getBudgetAmountById, getByProvincesNumber, getDictRegion, getId, getProvince, getProvinces } from '../service'; import { getDicData } from '@/utils/session'; import '@/assets/lq_style.less'; -import { isEmpty } from '@/utils/CommonUtils'; +import { isEmpty, trim } from '@/utils/CommonUtils'; import { btnAuthority } from '@/utils/authority'; const { Option } = Select; @@ -202,6 +202,7 @@ const ProjectDocumentation: React.FC = (props) => { values.regionDictId = isEmpty(values.regionDictId) ? values.regionDictCity : values.regionDictId; } values.regionDictName = regionDictName; + values.projectName = trim(values.projectName); !isIPassDecode && (values['isIPassDecode'] = '1'); updateUtils(values); //tab标段页解除禁用 diff --git a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod4.tsx b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod4.tsx index 32952fc..d6e99f4 100644 --- a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod4.tsx +++ b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod4.tsx @@ -7,7 +7,7 @@ import { getSelectName, ProcurementMethodItem, updateUtils } from '../utils'; import { getByProvincesNumber, getDictRegion, getId, getProvince, getProvinces } from '../service'; import { getDicData } from '@/utils/session'; import '@/assets/lq_style.less'; -import { isEmpty } from '@/utils/CommonUtils'; +import { isEmpty, trim } from '@/utils/CommonUtils'; import { btnAuthority } from '@/utils/authority'; const { Option } = Select; @@ -200,6 +200,7 @@ const ProjectDocumentation: React.FC = (props) => { values.regionDictId = isEmpty(values.regionDictId) ? values.regionDictCity : values.regionDictId; } values.regionDictName = regionDictName; + values.projectName = trim(values.projectName); !isIPassDecode && (values['isIPassDecode'] = '1'); updateUtils(values); //tab标段页解除禁用 diff --git a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod5.tsx b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod5.tsx index 356881c..1327a5a 100644 --- a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod5.tsx +++ b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod5.tsx @@ -7,7 +7,7 @@ import { getSelectName, ProcurementMethodItem, updateUtils } from '../utils'; import { getBudgetAmountById, getByProvincesNumber, getDictRegion, getId, getProvince, getProvinces } from '../service'; import { getDicData } from '@/utils/session'; import '@/assets/lq_style.less'; -import { isEmpty } from '@/utils/CommonUtils'; +import { isEmpty, trim } from '@/utils/CommonUtils'; import { btnAuthority } from '@/utils/authority'; const { Option } = Select; @@ -204,6 +204,7 @@ const ProjectDocumentation: React.FC = (props) => { values.regionDictId = isEmpty(values.regionDictId) ? values.regionDictCity : values.regionDictId; } values.regionDictName = regionDictName; + values.projectName = trim(values.projectName); !isIPassDecode && (values['isIPassDecode'] = '1'); updateUtils(values); //tab标段页解除禁用 diff --git a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod6.tsx b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod6.tsx index f6515ad..442f619 100644 --- a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod6.tsx +++ b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod6.tsx @@ -5,7 +5,7 @@ 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 } from '@/utils/CommonUtils'; +import { isEmpty, trim } from '@/utils/CommonUtils'; import { getDicData } from '@/utils/session'; import '@/assets/lq_style.less'; import { btnAuthority } from '@/utils/authority'; @@ -203,6 +203,7 @@ const ProjectDocumentation: React.FC = (props) => { values.regionDictId = isEmpty(values.regionDictId) ? values.regionDictCity : values.regionDictId; } values.regionDictName = regionDictName; + values.projectName = trim(values.projectName); !isIPassDecode && (values['isIPassDecode'] = '1'); updateUtils(values); //tab标段页解除禁用 diff --git a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod9.tsx b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod9.tsx index cd83338..dcc65a8 100644 --- a/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod9.tsx +++ b/src/pages/Project/ProjectManage/ProjectManager/ProjectInformationManagement/components/ProcurementMethod9.tsx @@ -5,7 +5,7 @@ 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 } from '@/utils/CommonUtils'; + import { isEmpty, trim } from '@/utils/CommonUtils'; import { getDicData } from '@/utils/session'; import '@/assets/lq_style.less'; import { btnAuthority } from '@/utils/authority'; @@ -203,6 +203,7 @@ import { btnAuthority } from '@/utils/authority'; values.regionDictId = isEmpty(values.regionDictId) ? values.regionDictCity : values.regionDictId; } values.regionDictName = regionDictName; + values.projectName = trim(values.projectName); !isIPassDecode && (values['isIPassDecode'] = '1'); updateUtils(values); //tab标段页解除禁用 diff --git a/src/pages/ZYuShen/Bid/BiddingAnnouncement/components/BiddingDocument.tsx b/src/pages/ZYuShen/Bid/BiddingAnnouncement/components/BiddingDocument.tsx index 7de69a9..75eb8c8 100644 --- a/src/pages/ZYuShen/Bid/BiddingAnnouncement/components/BiddingDocument.tsx +++ b/src/pages/ZYuShen/Bid/BiddingAnnouncement/components/BiddingDocument.tsx @@ -1,14 +1,15 @@ -import {BarsOutlined, UploadOutlined} from "@ant-design/icons" -import {Button, Card, Checkbox, Col, Collapse, Form, Input, message, Modal, Row, Spin, Upload} from "antd" -import React, {useEffect, useRef, useState} from "react" +import { BarsOutlined, UploadOutlined } from "@ant-design/icons" +import { Button, Card, Checkbox, Col, Collapse, Form, Input, message, Modal, Row, Spin, Upload } from "antd" +import React, { useEffect, useRef, useState } from "react" -import {GetfileUsablePackage, GetfileMsg, creatfile, creatNotice} from "../service"; +import { GetfileUsablePackage, GetfileMsg, creatfile, creatNotice } from "../service"; import Weboffice from "@/pages/webOffice/weboffice"; -import {deleteFileObjId, getFileBidList, SnowflakeID} from "@/services/untilService"; +import { deleteFileObjId, getFileBidList, SnowflakeID } from "@/services/untilService"; import ExtendUpload from "@/utils/ExtendUpload"; -import {UploadProps} from "antd/lib/upload/interface"; +import { UploadProps } from "antd/lib/upload/interface"; import WebOffice0609, { WebOfficeRefProps } from "@/pages/webOffice/weboffice0609"; +import { trim } from "@/utils/CommonUtils"; interface BiddingDocumentProps { modalVisible: boolean; @@ -21,12 +22,12 @@ interface BiddingDocumentProps { } const layout = { - labelCol: {span: 7}, - wrapperCol: {span: 10}, + labelCol: { span: 7 }, + wrapperCol: { span: 10 }, }; const BiddingDocument: React.FC = (props) => { - const {Panel} = Collapse; - const {titleName, modalVisible, onCancel, type, tpId, pkId, SX} = props; + const { Panel } = Collapse; + const { titleName, modalVisible, onCancel, type, tpId, pkId, SX } = props; const [TpPackageId, setTpPackageId] = useState([]); //标包信息 const [spinning, setSping] = useState();//加载遮罩 const [editInformation, setEditInformation] = useState(false);//是否可编 @@ -38,7 +39,7 @@ const BiddingDocument: React.FC = (props) => { const [UploadList, setUploadList] = useState(); //存upload列表 const [UploadID, setUploadID] = useState("empty"); //upload 业务id const UploadProps: UploadProps = { - name:"file", + name: "file", disabled: editInformation } @@ -51,7 +52,7 @@ const BiddingDocument: React.FC = (props) => { useEffect(() => { - Int(); + Int(); form.resetFields();//清除form中数据 }, [type, pkId]); const Int = () => { @@ -67,7 +68,7 @@ const BiddingDocument: React.FC = (props) => { onCancel(); } for (const item of res.data) { - thisData.push({"label": item.bsName, "value": item.bsId}) + thisData.push({ "label": item.bsName, "value": item.bsId }) } setSping(false); setEditInformation(false);//可编辑 @@ -83,11 +84,11 @@ const BiddingDocument: React.FC = (props) => { }); } else if (type == "edit") {//=========================================================修改 - GetfileUsablePackage(tpId,pkId).then(res => { + GetfileUsablePackage(tpId, pkId).then(res => { if (res.code == 200) { let thisData2 = []; for (const item of res.data) { - thisData2.push({"label": item.bsName, "value": item.bsId}) + thisData2.push({ "label": item.bsName, "value": item.bsId }) } setTpPackageId(thisData2); } @@ -100,10 +101,10 @@ const BiddingDocument: React.FC = (props) => { } form.setFieldsValue({ - "documentName": data.documentName, - "documentSetId": data.documentSetId, - "sectionIds": defPak, - }, + "documentName": data.documentName, + "documentSetId": data.documentSetId, + "sectionIds": defPak, + }, ) setUploadID(data.documentSetId); setSping(false); @@ -125,15 +126,15 @@ const BiddingDocument: React.FC = (props) => { let thisData1 = []; let defPak = []; for (const item of data.sections) { - thisData1.push({"label": item.bsName, "value": item.bsId}) + thisData1.push({ "label": item.bsName, "value": item.bsId }) defPak.push(item.bsId); } setTpPackageId(thisData1); form.setFieldsValue({ - "documentName": data.documentName, - "documentSetId": data.documentSetId, - "sectionIds": defPak, - }, + "documentName": data.documentName, + "documentSetId": data.documentSetId, + "sectionIds": defPak, + }, ) @@ -167,12 +168,12 @@ const BiddingDocument: React.FC = (props) => { for (const item of TpPackageId) {//包数据 for (const item1 of form.getFieldValue("sectionIds")) if (item.value == item1) - packageMsg.push({"bsId": item.value, "bsName": item.label}) + packageMsg.push({ "bsId": item.value, "bsName": item.label }) } const fromData = { "tpId": tpId, - "documentName": form.getFieldValue("documentName"), + "documentName": trim(form.getFieldValue("documentName")), "documentSetId": form.getFieldValue("documentSetId"), "sections": packageMsg, "contentFileId": ref.current?.DocFileCode, @@ -243,7 +244,7 @@ const BiddingDocument: React.FC = (props) => { }, ]} > - + = (props) => { @@ -268,11 +269,11 @@ const BiddingDocument: React.FC = (props) => { name="documentSetId" extra="单个附件最大30MB" > - {UploadID!="empty"? :null} + {UploadID != "empty" ? : null}

资审文件内容

- +
{/* {docBtnName != "" ? = (props) => { : null } */} {docBtnName != "" ? ( - - ): null} + ) : null}
diff --git a/src/utils/CommonUtils.ts b/src/utils/CommonUtils.ts index c82ecc3..cb56df7 100644 --- a/src/utils/CommonUtils.ts +++ b/src/utils/CommonUtils.ts @@ -11,7 +11,7 @@ * 判断是否等于空 * @param value */ - export function isEmpty(value: any) { +export function isEmpty(value: any) { return value === null || value === void 0 || value === ''; } /** @@ -223,7 +223,7 @@ projectTypeCodeMaps.set("/Comparison", ["procurement_mode_3"]); //招募 projectTypeCodeMaps.set("/Recruit", ["procurement_mode_4"]); //谈判 -projectTypeCodeMaps.set("/Negotiation", ["procurement_mode_5", "procurement_mode_6", ]); +projectTypeCodeMaps.set("/Negotiation", ["procurement_mode_5", "procurement_mode_6",]); //询价 projectTypeCodeMaps.set("/Inquiry", ["procurement_mode_7"]); @@ -265,40 +265,50 @@ export const numberToChinese = (num: any) => { var AA = new Array("零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"); var BB = new Array("", "十", "百", "仟", "萬", "億", "点", ""); var a = ("" + num).replace(/(^0*)/g, "").split("."), - k = 0, - re = ""; + k = 0, + re = ""; for (var i = a[0].length - 1; i >= 0; i--) { - switch (k) { - case 0: - re = BB[7] + re; - break; - case 4: - if (!new RegExp("0{4}//d{" + (a[0].length - i - 1) + "}$") - .test(a[0])) - re = BB[4] + re; - break; - case 8: - re = BB[5] + re; - BB[7] = BB[5]; - k = 0; - break; - } - if (k % 4 == 2 && a[0].charAt(i + 2) != '0' && a[0].charAt(i + 1) == '0') - re = AA[0] + re; - if (a[0].charAt(i) != '0') - re = AA[a[0].charAt(i)] + BB[k % 4] + re; - k++; + switch (k) { + case 0: + re = BB[7] + re; + break; + case 4: + if (!new RegExp("0{4}//d{" + (a[0].length - i - 1) + "}$") + .test(a[0])) + re = BB[4] + re; + break; + case 8: + re = BB[5] + re; + BB[7] = BB[5]; + k = 0; + break; + } + if (k % 4 == 2 && a[0].charAt(i + 2) != '0' && a[0].charAt(i + 1) == '0') + re = AA[0] + re; + if (a[0].charAt(i) != '0') + re = AA[a[0].charAt(i)] + BB[k % 4] + re; + k++; } if (a.length > 1) // 加上小数部分(如果有小数部分) { - re += BB[6]; - for (var i = 0; i < a[1].length; i++) - re += AA[a[1].charAt(i)]; + re += BB[6]; + for (var i = 0; i < a[1].length; i++) + re += AA[a[1].charAt(i)]; } if (re == '一十') - re = "十"; + re = "十"; if (re.match(/^一/) && re.length == 3) - re = re.replace("一", ""); + re = re.replace("一", ""); return re; +} +/** + * 删除行首行尾的空白字符方法(包括空格、制表符、换页符等等) + * @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; } \ No newline at end of file