3.10 工程代码同步master

This commit is contained in:
jl-zhoujl2
2022-03-10 14:24:13 +08:00
parent 41ab55a4ac
commit 62f6b07ee2
914 changed files with 143121 additions and 29110 deletions

View File

@ -1,4 +1,4 @@
import {BarsOutlined, UploadOutlined} from "@ant-design/icons"
import { BarsOutlined, ExclamationCircleOutlined, UploadOutlined } from "@ant-design/icons"
import {
Button,
Card, Carousel,
@ -15,42 +15,48 @@ import {
Spin,
Upload
} from "antd"
import React, {useEffect, useRef, useState} from "react"
import React, { useEffect, useRef, useState } from "react"
import style from './style.less'
import {GetNoticeMsg, GetNoticeUsablePackage, creatNotice, getChooseRoom, GetPublicityUsablePackage} from '../service'
import { GetNoticeMsg, GetNoticeUsablePackage, creatNotice, getChooseRoom, GetPublicityUsablePackage } from '../service'
import moment from "moment";
import Weboffice from "@/pages/webOffice/weboffice";
import {deleteFileObjId, getFileBidList, SnowflakeID} from "@/services/untilService";
import { deleteFileObjId, getFileBidList, SnowflakeID } from "@/services/untilService";
import { getDefId, getProMethod } from "@/utils/session";
import ExtendUpload from "@/utils/ExtendUpload";
import { UploadProps } from "antd/lib/upload/interface";
import Medias from "@/pages/Bid/BiddingAnnouncement/components/Medias"
import BraftText from "@/components/richText/wang";
import RiskPrevention from "@/utils/RiskPrevention"
interface BiddingAnnouncementProps {
modalVisible: boolean;
titleName: string;
onCancel: () => void;
type: string;
tpId: "4419993030303037111";
tpId: string;
pkId: string;
SX:()=>void;
SX: () => void;
}
const layout = {
labelCol: {span: 7},
wrapperCol: {span: 10},
labelCol: { span: 7 },
wrapperCol: { span: 10 },
};
const BidPublicityResults: React.FC<BiddingAnnouncementProps> = (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 [form] = Form.useForm();
const [spinning, setSping] = useState<boolean>(true);//加载遮罩
const [TpPackageId, setTpPackageId] = useState<any[]>([]); //标包信息
const [editInformation, setEditInformation] = useState<boolean>(false);//是否可编
const [editInformation4Change, setEditInformation4Change] = useState<boolean>(false);//是否可编
const [TpPackageName, setTpPackageName] = useState<string>("招标");
const [UploadList, setUploadList] = useState<any>(); //存upload列表
const [UploadID, setUploadID] = useState<any>(); //upload 业务id
const [htmlFileCode, setHtmlFileCode] = useState<string>("");//文档id
const [docFileCode, setDocFileCode] = useState<string>("");//文档id
const [docBtnName, setDocBtnName] = useState<any>("");//文档按钮文字
@ -59,12 +65,50 @@ const BidPublicityResults: React.FC<BiddingAnnouncementProps> = (props) => {
/*20210112 新增 发布媒体限制*/
const [mediaType, setmediaType] = useState<any>();
// 2021-06-17 新增 发布媒体显示发布成功失败
const [mediaReleases, mediaReleasesSet] = useState<any>([]);
/*weboffice 相关*/
const WebofficeRef = useRef<Weboffice>(null);
const onRef = (ref) => {
/* this.child= ref;*/
// const WebofficeRef = useRef<Weboffice>(null);
// const onRef = (ref) => {
// /* this.child= ref;*/
// }
// 2021-07-28 新增 富文本
const braftRef = useRef<any>(null);
const [echo, echoSet] = useState('')
const [riskVisible, setRiskVisible] = useState<boolean>(false);//风控弹窗 2021.9.7 zhoujianlong
const [riskData, setRiskData] = useState<any[]>([]);//风控数据 2021.9.7 zhoujianlong
const UploadProps: UploadProps = {
name: "file",
disabled: editInformation
}
let name4 = "标段";
let TpPackageName = "";
let proDict = getProMethod();
let defId = getDefId();
let intervalDate = defId == 'negotiation_single' ? '1' : '3' //20210622 zhoujianlong新增日期间隔参数
if (proDict == "procurement_mode_1" || proDict == "procurement_mode_2") {
TpPackageName = "招标";
name4 = "标段";
} else if (proDict == "procurement_mode_3") {
TpPackageName = "比选";
name4 = "采购包";
} else if (proDict == "procurement_mode_5" || proDict == "procurement_mode_6") {
TpPackageName = "谈判";
name4 = "采购包";
} else if (proDict == "procurement_mode_4") {
TpPackageName = "招募";
name4 = "包件";
} else if (proDict == "procurement_mode_7") {
TpPackageName = "询价";
name4 = "包件";
}
/*拉取数据 beg*/
@ -72,19 +116,16 @@ const BidPublicityResults: React.FC<BiddingAnnouncementProps> = (props) => {
Int();
form.resetFields();//清除form中数据
}, [pkId, type]);
useEffect(() => {
UploadMethod();
}, [UploadID]);
const Int = () => {
const Int = async () => {
setSping(true);
if (type == "cease") {
return;
} else if (type == "new") {//==========================================================新建
GetPublicityUsablePackage(tpId).then(res => {
if (res != null && res.message == "success") {
if (res.code == 200) {
let value = [];
for (const item of res.data) {
value.push({"label": item.bsName, "value": item.bsId})
value.push({ "label": item.bsName, "value": item.bsId })
}
SnowflakeID().then(res => {
setUploadID(res.id);
@ -93,81 +134,77 @@ const BidPublicityResults: React.FC<BiddingAnnouncementProps> = (props) => {
setDocReadOnly("false");
setDocSaveBtn("compact");
setDocBtnName("新建")
setSping(false);
} else {
message.error('数据拉取失败:'+res.message);
onCancel();
}
}).finally(() => {
setSping(false);
});
setEditInformation(false);//可编辑
} else if (type == "edit" || type == "change") {//==========================================================编辑
GetPublicityUsablePackage(tpId).then(res => {
if (res != null && res.message == "success") {
await GetPublicityUsablePackage(tpId, pkId).then(res => {
if (res.code == 200) {
let thisData1 = [];
for (const item of res.data) {
thisData1.push({"label": item.bsName, "value": item.bsId})
thisData1.push({ "label": item.bsName, "value": item.bsId })
}
GetNoticeMsg(pkId).then(res => {
if (res != null && res.message == "success") {
const data = res.data
for (const item of data.sections) {
thisData1.push({"label": item.bsName, "value": item.bsId})
}
setTpPackageId(thisData1);
form.setFieldsValue({
"docStartTime": moment(data.docStartTime, 'yyyy-MM-DD HH:mm:ss'),
"docEndTime": moment(data.docEndTime, 'yyyy-MM-DD HH:mm:ss'),
"annoTitle": data.annoTitle,
"medias": data.medias,
"sectionIds": data.sectionIds
});
setUploadID(data.attDatasetId)
setDocFileCode(data.contentFileId);
setDocReadOnly("false");
setDocSaveBtn("compact");
setDocBtnName("编辑");
setSping(false);
} else {
onCancel();
message.error('数据拉取失败:'+res.message);
}
});
} else {
onCancel();
message.error('数据拉取失败:'+res.message);
setTpPackageId(thisData1);
}
});
GetNoticeMsg(pkId).then(res => {
if (res.code == 200) {
const data = res.data
let defPak = [];
for (const item of data.sections) {
defPak.push(item.bsId);
}
form.setFieldsValue({
"attDatasetId": data.attDatasetId,
"docStartTime": moment(data.docStartTime, 'yyyy-MM-DD HH:mm:ss'),
"docEndTime": moment(data.docEndTime, 'yyyy-MM-DD HH:mm:ss'),
"annoTitle": data.annoTitle,
"medias": data.medias,
"sectionIds": defPak
});
echoSet(data.contentWithStyle);
setUploadID(data.attDatasetId);
setHtmlFileCode(data.contentHtmlId)
setDocFileCode(data.contentFileId);
setDocReadOnly("false");
setDocSaveBtn("compact");
setDocBtnName("编辑");
}
}).finally(() => {
setSping(false);
});
setEditInformation(false);//可编辑
} else if (type == "read") {//==========================================================查看
GetNoticeMsg(pkId).then(res => {
if (res != null && res.message == "success") {
if (res.code == 200) {
const data = res.data
let value = [];
for (const item of data.sections) {
value.push({"label": item.bsName, "value": item.bsId})
value.push({ "label": item.bsName, "value": item.bsId })
}
setTpPackageId(value);
form.setFieldsValue({
"attDatasetId": data.attDatasetId,
"docStartTime": moment(data.docStartTime, 'yyyy-MM-DD HH:mm:ss'),
"docEndTime": moment(data.docEndTime, 'yyyy-MM-DD HH:mm:ss'),
"annoTitle": data.annoTitle,
"medias": data.medias,
"sectionIds": data.sectionIds
});
setUploadID(data.attDatasetId)
echoSet(data.contentWithStyle);
setUploadID(data.attDatasetId);
setDocFileCode(data.contentFileId);
mediaReleasesSet(data.mediaReleases);
setDocReadOnly("true");
setDocSaveBtn("none");
setDocBtnName("查看");
setSping(false);
} else {
message.error('数据拉取失败:'+res.message);
onCancel();
}
}).finally(() => {
setSping(false);
});
setEditInformation(true);//只读
}
@ -179,53 +216,101 @@ const BidPublicityResults: React.FC<BiddingAnnouncementProps> = (props) => {
/*提交数据*/
const onFinish = (data: any) => {
if (check("") == "true") {
const packageMsg = [];
for (const item of TpPackageId) {//包数据
for (const item1 of form.getFieldValue("sectionIds")) {
if (item.value == item1) {
packageMsg.push({"bsId": item.value, "bsName": item.label})
form.validateFields().then(() => {
check();
})
// if (checkResult) {
// saveData()
// }
}
//提交数据复用方法
const saveData = () => {
setSping(true);
const packageMsg = [];
for (const item of TpPackageId) {//包数据
if (form.getFieldValue("sectionIds")) {
if (Array.isArray(form.getFieldValue("sectionIds"))) {
for (const item1 of form.getFieldValue("sectionIds")) {
if (item.value == item1) {
packageMsg.push({ "bsId": item.value, "bsName": item.label })
}
}
} else {
if (item.value == form.getFieldValue("sectionIds")) {
packageMsg.push({ "bsId": item.value, "bsName": item.label })
}
}
} else {
message.warn("您未选择" + name4);
setSping(false);
}
const fromData = {
"id":pkId,
"annoNature": 201,
"tpId": tpId,
"attDatasetId": UploadID,
"source": 12,//来源1预审公示2预审公示11资审公示12资审公示21邀请函
"annoTitle": form.getFieldValue("annoTitle"),
"docStartTime": form.getFieldValue("docStartTime").format("yyyy-MM-DD HH:mm:ss").toString(),
"docEndTime": form.getFieldValue("docEndTime").format("yyyy-MM-DD HH:mm:ss").toString(),
"medias": form.getFieldValue("medias").toString(),
"sections": packageMsg,
"contentFileId":WebofficeRef.current!.DocfileCode,
}
creatNotice(type, fromData).then(res => {
if (res != null && res.message == "success") {
message.success("成功");
onCancel();
SX();
} else {
message.error("保存失败:"+res.message);
}
});
}
if (type == "new" || type == "changeNew" || type == 'edit') {//==========================================================新建
if (braftRef.current.getHtml() == '') {
message.warn("您尚未编辑公示内容");
setSping(false);
return;
}
}
const fromData = {
"id": pkId,
"annoNature": 201,
"tpId": tpId,
"attDatasetId": form.getFieldValue("attDatasetId"),//
"contentWithStyle": braftRef.current.getHtml().replace(/<table border="0"/, '<table border="1"'),//富文本正文
"source": 12,//来源1预审公示2预审公示11资审公示12资审公示21邀请函
"annoTitle": form.getFieldValue("annoTitle"),
"docStartTime": form.getFieldValue("docStartTime").format("yyyy-MM-DD HH:mm:ss").toString(),
"docEndTime": form.getFieldValue("docEndTime").format("yyyy-MM-DD HH:mm:ss").toString(),
"medias": form.getFieldValue("medias").toString(),
"sections": packageMsg,
// "contentFileId": WebofficeRef.current!.DocfileCode,
// "contentHtmlId": WebofficeRef.current!.HTMLfileCode,//html id
}
creatNotice(type, fromData).then(res => {
if(res?.code == 4004 && res?.success == false) { //2021.9.7 zhoujianlong 新增和修改公示增加风控
const data = res?.data?.result == undefined ? [] : res?.data?.result
setRiskData(data)
setRiskVisible(true)
}
if (res.code == 200) {
message.success("成功");
onCancel();
SX();
}
}).finally(() => {
setSping(false);
});
}
/*提交数据 end*/
/*提交数据校验 beg*/
const check = (data: any) => {
let msg = "false";
if (form.getFieldValue("docStartTime") < moment().format('YYYY-MM-DD')) {
const check = () => {
if (form.getFieldValue("docStartTime") < moment().startOf('day')) {
message.warn('公示开始时间需大于当前时间');
} else if (moment(form.getFieldValue("docEndTime")).diff(form.getFieldValue("docStartTime"), "days") < 3) {
message.warn('公示结束时间与公示开始时间需大于3天');
} else {
msg = "true"
if (defId == 'negotiation_single') {
if (moment(form.getFieldValue("docEndTime")).startOf('day').diff(moment(form.getFieldValue("docStartTime")).startOf('day'), "days") < 1) { //20210622 zhoujianlong 修改单一来源时间校验为大于一天
message.warn('公示结束时间需要在公示开始时间的1天以后');
} else {
saveData()
}
} else {
if (moment(form.getFieldValue("docEndTime")).startOf('day').diff(moment(form.getFieldValue("docStartTime")).startOf('day'), "days") < 3) {
message.warn('公示结束时间需要在公示开始时间的3天以后');
} else {
saveData()
}
}
}
return msg;
}
/*提交数据校验 end*/
@ -233,13 +318,13 @@ const BidPublicityResults: React.FC<BiddingAnnouncementProps> = (props) => {
if (type == "read") {
return (
<>
<Button onClick={onCancel}></Button>
<Button onClick={onCancel}></Button>
</>
);
} else {
return (
<>
<Button onClick={onFinish}></Button>
<Button type="primary" onClick={onFinish}></Button>
<Button onClick={onCancel}></Button>
</>
);
@ -252,7 +337,7 @@ const BidPublicityResults: React.FC<BiddingAnnouncementProps> = (props) => {
setUploadList(res)
})
}
const UploadOnchange = async (file) => {
const UploadOnchange = async (file: any) => {
let fileMsg = file.file;
if (fileMsg.status === 'removed') {
await deleteFileObjId(fileMsg.uid)
@ -265,147 +350,141 @@ const BidPublicityResults: React.FC<BiddingAnnouncementProps> = (props) => {
message.error("上传失败");
}
}
//修改发布媒体 触发方法-邢书源
const medias9 = (dis: any) => {
if (dis) {
form.setFieldsValue({
"medias": "9",
});
}
setmediaType(dis);
}
const testCheck = (checkedParam: any) => {
if (checkedParam.indexOf("9") > -1) {
form.setFieldsValue({
"medias":"9",
"medias": "9",
});
setmediaType(true);
} else{
} else {
setmediaType(false);
}
}
const modalHeight = (window.innerHeight * 96) / 100;
return (
<Modal forceRender
destroyOnClose
title={titleName}
visible={modalVisible}
className="返回"
onCancel={() => onCancel()}
width={1000}
bodyStyle={{padding: '32px 40px 48px', height: "600px", overflowY: 'auto'}}
footer={renderFooter()}
destroyOnClose
title={titleName}
visible={modalVisible}
className="返回"
onCancel={() => onCancel()}
width={"60%"}
style={{ maxHeight: modalHeight }}
bodyStyle={{ maxHeight: modalHeight - 107, overflowY: 'auto' }}
centered
footer={renderFooter()}
><Spin spinning={spinning}>
<Card>
<Form
{...layout}
name="basic"
form={form}
>
<div>
<Form
{...layout}
name="basic"
form={form}
>
<Form.Item
label="公示名称"
name="annoTitle"
validateStatus="error"
rules={[
{
required: true,
message: '当前项不可为空',
},
]}
>
<Input readOnly={editInformation || editInformation4Change}/>
</Form.Item>
<Form.Item
label={"公示开始时间"}
name="docStartTime"
rules={[
{
required: true,
message: '当前项不可为空',
},
]}
>
<DatePicker disabled={editInformation || editInformation4Change} format={"yyyy-MM-DD HH:mm:ss"} showTime
style={{width: "100%"}}/>
</Form.Item>
<Form.Item
label={"公示结束时间"}
name="docEndTime"
rules={[
{
required: true,
message: '当前项不可为空',
},
]}
>
<DatePicker disabled={editInformation} showTime style={{width: "100%"}}/>
</Form.Item>
<Form.Item
label="关联标段"
name="sectionIds"
>
{/*标包信息*/}
<Checkbox.Group
options={TpPackageId}
disabled={editInformation || editInformation4Change}
<Form.Item
label="公示名称"
name="annoTitle"
rules={[
{
required: true,
message: '当前项不可为空',
},
]}
>
<Input maxLength={200} readOnly={editInformation || editInformation4Change} />
</Form.Item>
<Form.Item
label={"公示开始时间"}
name="docStartTime"
rules={[
{
required: true,
message: '当前项不可为空',
},
]}
>
<DatePicker showNow={false} disabled={editInformation || editInformation4Change} format={"yyyy-MM-DD HH:mm"} showTime={{ defaultValue: moment().startOf('minute') }} disabledDate={(current) => current && current < moment().startOf('day')}
style={{ width: "100%" }} />
</Form.Item>
<Form.Item
label={"公示结束时间"}
name="docEndTime"
rules={[
{
required: true,
message: '当前项不可为空',
},
]}
extra={`公示结束时间需要在公示开始时间的${intervalDate}天以后`}
>
<DatePicker showNow={false} disabled={editInformation} showTime={{ defaultValue: moment().startOf('minute') }} format={"yyyy-MM-DD HH:mm"} style={{ width: "100%" }} />
</Form.Item>
<Form.Item
label={"关联" + name4}
name="sectionIds"
rules={[
{
required: true,
message: '当前项不可为空',
},
]}
>
{/*标包信息*/}
<Checkbox.Group
options={TpPackageId}
disabled={editInformation || editInformation4Change}
/>
</Form.Item>
<Form.Item
label="附件文件"
name="attDatasetId"
extra="单个附件最大30MB"
>
{UploadID != "empty" ? <ExtendUpload uploadProps={UploadProps} bid={UploadID} /> : null}
</Form.Item>
{/* 发布媒体 */}
<Medias
vis={modalVisible}
h3Vis={true}
editInformation={editInformation}
editInformation4Change={editInformation4Change}
mediaType={mediaType}
mediaReleases={mediaReleases}
medias9={(dis: boolean) => medias9(dis)}
/>
</Form.Item>
<Form.Item
label="附件文件"
name="attDatasetId"
>
<div className={style.bidding}>
<div className="uploadTotal">
<Upload
action={'/api/core-service-ebtp-updownload/v1/attachment/upload'}
data={{"businessId": UploadID}}
fileList={UploadList}
onChange={UploadOnchange}
>
<Button type="primary" disabled={editInformation || editInformation4Change}
className="upload"><UploadOutlined/></Button>
</Upload>
<p className="uploadLabel">10M文件</p>
</div>
</div>
</Form.Item>
<Collapse defaultActiveKey={['1', '2']} ghost expandIcon={() => <BarsOutlined/>}>
<Panel header="公示发布媒体" key="1">
<Form.Item
name="medias"
>
<Checkbox.Group style={{width: '100%'}} className={style.bidding}
onChange={testCheck}
disabled={editInformation || editInformation4Change}>
<Row>
<Col span={24}>
<Checkbox disabled={mediaType} key={"1"} value="1"></Checkbox>
</Col>
<Col span={24}>
<Checkbox disabled={mediaType} key={"2"} value="2"></Checkbox>
</Col>
<Col span={24}>
<Checkbox disabled={mediaType} key={"3"} value="3"></Checkbox>
</Col>
<Col span={24}>
<Checkbox disabled={mediaType} key={"5"} value="5"></Checkbox>
</Col>
<Col span={24}>
<Checkbox disabled={mediaType} key={"6"} value="6"></Checkbox>
</Col>
<Col span={24}>
<Checkbox key={"9"} value="9"></Checkbox>
</Col>
</Row>
</Checkbox.Group>
</Form.Item>
</Panel>
<Panel header="公示发布内容" key="2">
<Card style={{textAlign: "center"}}>
{docBtnName != "" ? (
<Weboffice key={""} memberBtnName={docBtnName} readonly={docReadOnly} btnStyle={docSaveBtn}
btnName={"保存"}
DocfileCode={docFileCode} PDFfileCode={""} ref={WebofficeRef} onRef={onRef}/>) : null}
</Card>
</Panel>
</Collapse>
</Form>
</Card>
</Spin>
<h3 className="first-title"></h3>
{/* <Card style={{ textAlign: "center" }}> */}
{/* {docBtnName != "" ? (
<Weboffice key={""} memberBtnName={docBtnName} readonly={docReadOnly} btnStyle={docSaveBtn}
btnName={"保存"}
DocfileCode={docFileCode} PDFfileCode={""} HTMLfileCode={htmlFileCode} saveHTML={"1"} ref={WebofficeRef} onRef={onRef} />) : null} */}
<BraftText braftRef={braftRef} echo={echo} disabled={editInformation} />
{/* </Card> */}
</Form>
{/**风控组件 */}
{riskVisible && <RiskPrevention
modalVisible={riskVisible}
onCancel={() => {
setRiskVisible(false)
setRiskData([])
}}
data={riskData}
/>}
</div>
</Spin>
</Modal>
)