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,11 +1,17 @@
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, DatePicker, Form, Input, message, Modal, Row, Spin, Upload } from "antd"
import React, { useEffect, useRef, useState } from "react"
import style from './style.less'
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 { getProMethod } from "@/utils/session";
import WebOffice0609, { WebOfficeRefProps } from "@/pages/webOffice/weboffice0609";
import moment from "moment";
import { AnnouncementGetMsg1, AnnouncementGetMsg2, AnnouncementGetMsg3, AnnouncementGetMsg4 } from "@/utils/AboutAnnouncementHelp";
interface BiddingDocumentProps {
modalVisible: boolean;
@ -18,29 +24,67 @@ interface BiddingDocumentProps {
}
const layout = {
labelCol: {span: 7},
wrapperCol: {span: 10},
labelCol: { span: 7 },
wrapperCol: { span: 10 },
};
const BiddingDocument: React.FC<BiddingDocumentProps> = (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<any[]>([]); //标包信息
const [spinning, setSping] = useState<boolean>();//加载遮罩
const [editInformation, setEditInformation] = useState<boolean>(false);//是否可编
const [form] = Form.useForm();
const [docFileCode, setDocFileCode] = useState<string>("");//文档id
const [docBtnName, setDocBtnName] = useState<any>("");//文档按钮文字
const [docReadOnly, setDocReadOnly] = useState<string>("false");//是否可编辑
const [docReadOnly, setDocReadOnly] = useState<boolean>(false);//是否可编辑
const [docSaveBtn, setDocSaveBtn] = useState<string>("compact");//保存按钮是否展示
const [UploadList, setUploadList] = useState<any>(); //存upload列表
const [UploadID, setUploadID] = useState<any>(); //upload 业务id
const [UploadID, setUploadID] = useState<any>("empty"); //upload 业务id
/*weboffice 相关*/
const WebofficeRef = useRef<Weboffice>(null);
const onRef = (ref) => {
/* this.child= ref;*/
const UploadProps: UploadProps = {
name: "file",
disabled: editInformation
}
let pktittle = "";
let name1 = "招标";
let proDict = getProMethod();
if (proDict == "procurement_mode_1" || proDict == "procurement_mode_2") {
pktittle = "标段";
name1 = "招标";
} else if (proDict == "procurement_mode_3") {
pktittle = "采购包"
name1 = "采购";
} else if (proDict == "procurement_mode_5" || proDict == "procurement_mode_6" || proDict == "procurement_mode_9") {
pktittle = "采购包"
name1 = "采购";
} else if (proDict == "procurement_mode_4") {
pktittle = "包件"
name1 = "招募";
}
/*weboffice 相关*/
const ref = useRef<WebOfficeRefProps>();
// const WebofficeRef = useRef<Weboffice>(null);
// const onRef = (ref) => {
// /* this.child= ref;*/
// }
//DatePicker
function disabledDate(current: any) {//日期选择
// 不能选今天之前
return current && current < moment().startOf('day');
}
const ReplyEndTimechange1 = (data?: any) => {
if (data != undefined) {
form.setFieldsValue({
"openingTime": moment(data, 'yyyy-MM-DD HH:mm:ss'),
});
}
};
useEffect(() => {
SnowflakeID().then(res => {
@ -48,111 +92,99 @@ const BiddingDocument: React.FC<BiddingDocumentProps> = (props) => {
});
form.resetFields();//清除form中数据
}, [type, pkId]);
useEffect(() => {
UploadMethod();
}, [UploadID]);
const Int = () => {
setSping(true);
if (type == "cease") {
return;
} else if (type == "new") {//==========================================================新建
if (type == "new") {//==========================================================新建
GetfileUsablePackage(tpId).then(res => {
if (res != null && res.message == "success") {
if (res.code == 200) {
let thisData = [];
if (res.data.length == 0) {
message.warn("没有可关联的标包!")
onCancel();
}
for (const item of res.data) {
thisData.push({"label": item.bsName, "value": item.bsId})
thisData.push({ "label": item.bsName, "value": item.bsId })
}
SnowflakeID().then(res => {
setUploadID(res.id);
});
setUploadID("")
setTpPackageId(thisData);
setDocReadOnly("false")
setDocReadOnly(false)
setDocSaveBtn("compact")
setSping(false);
setEditInformation(false);//可编辑
setDocBtnName("新建")
} else {
message.error('程序出错,请您稍后再试:'+res.message);
onCancel();
}
setSping(false);
setEditInformation(false);//可编辑
});
} else if (type == "edit") {//=========================================================修改
let thisData1:any [];
GetfileUsablePackage(tpId).then(res => {
if (res != null && res.message == "success") {
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 })
}
thisData1=thisData2;
} else {
message.error('程序出错,请您稍后再试:'+res.message);
onCancel();
setTpPackageId(thisData2);
}
GetfileMsg(pkId).then(res => {
if (res != null && res.message == "success") {
if (res.code == 200) {
const data = res.data;
let defPak=[];
let defPak = [];
for (const item of data.sections) {
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,
});
if (proDict == "procurement_mode_9") {
form.setFieldsValue({
"docStartTime": moment(data.docStartTime, 'yyyy-MM-DD HH:mm:ss'),
"replyEndTime": moment(data.replyEndTime, 'yyyy-MM-DD HH:mm:ss'),
"openingTime": moment(data.openingTime, 'yyyy-MM-DD HH:mm:ss'),
"docEndTime": moment(data.docEndTime, 'yyyy-MM-DD HH:mm:ss'),
})
}
setUploadID(data.documentSetId);
setSping(false);
setEditInformation(false);//可编辑
setDocFileCode(data.contentFileId);
setDocReadOnly("false")
setDocReadOnly(false)
setDocSaveBtn("compact")
setDocBtnName("编辑")
} else {
message.error('程序出错,请您稍后再试:'+res.message);
onCancel();
}
});
});
} else if (type == "read") {//=========================================================查看
GetfileMsg(pkId).then(res => {
if (res != null && res.message == "success") {
if (res.code == 200) {
const data = res.data;
let thisData1 = [];
let defPak=[];
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,
})
if (proDict == "procurement_mode_9") {
form.setFieldsValue({
"docStartTime": moment(data.docStartTime, 'yyyy-MM-DD HH:mm:ss'),
"replyEndTime": moment(data.replyEndTime, 'yyyy-MM-DD HH:mm:ss'),
"openingTime": moment(data.openingTime, 'yyyy-MM-DD HH:mm:ss'),
"docEndTime": moment(data.docEndTime, 'yyyy-MM-DD HH:mm:ss'),
})
}
setSping(false);
setEditInformation(true)
setDocFileCode(data.contentFileId);
setUploadID(data.documentSetId);
setDocReadOnly("true")
setDocReadOnly(true)
setDocSaveBtn("none")
setDocBtnName("查看")
} else {
message.error('程序出错,请您稍后再试:'+res.message);
onCancel();
}
});
}
@ -164,52 +196,43 @@ const BiddingDocument: React.FC<BiddingDocumentProps> = (props) => {
const onFinish = async (values: any) => {
form.validateFields().then(res => {
if (type == "new") {//==========================================================新建
if (WebofficeRef.current!.uninitialized == true) {//
message.warn("您未编辑office文件");
if (ref.current?.DocFileCode == '') {
message.warn("您尚未成功保存office相关文件!");
return;
} else {
if (WebofficeRef.current!.uploadDOCType != "success") {
message.warn("您未保存office文件");
return;
}
}
} else if (type == "edit") {//=========================================================修改
if (WebofficeRef.current!.uninitialized == false) {//
if (WebofficeRef.current!.uploadDOCType != "success") {
message.warn("您未保存office文件");
return;
}
}
}
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})
packageMsg.push({ "bsId": item.value, "bsName": item.label })
}
const fromData = {
let fromData = {
"tpId": tpId,
"documentName": form.getFieldValue("documentName"),
"documentSetId": UploadID,
"documentSetId": form.getFieldValue("documentSetId"),
"sections": packageMsg,
"contentFileId": WebofficeRef.current!.DocfileCode,
"contentFileId": ref.current?.DocFileCode,
"id": pkId
};
if (proDict == "procurement_mode_9") {
fromData["docStartTime"] = form.getFieldValue("docStartTime").format("yyyy-MM-DD HH:mm:ss").toString();
fromData["replyEndTime"] = form.getFieldValue("replyEndTime").format("yyyy-MM-DD HH:mm:ss").toString();
fromData["openingTime"] = form.getFieldValue("openingTime").format("yyyy-MM-DD HH:mm:ss").toString();
fromData["docEndTime"] = form.getFieldValue("docEndTime").format("yyyy-MM-DD HH:mm:ss").toString();
}
setSping(true);
creatfile(type, fromData).then(res => {
if (res != null && res.message == "success") {
creatfile(type, fromData).then(res => {
if (res.code == 200) {
message.success("成功");
setSping(true);
onCancel();
SX();
} else {
message.error("保存失败:"+res.message);
setSping(true);
}
});
}).finally(() => setSping(false));
}).catch(res => {
message.warn("您有未填写的选项!")
})
@ -218,13 +241,13 @@ const BiddingDocument: React.FC<BiddingDocumentProps> = (props) => {
if (type == "read") {
return (
<>
<Button onClick={onCancel}></Button>
<Button onClick={onCancel}></Button>
</>
);
} else {
return (
<>
<Button onClick={onFinish}></Button>
<Button type="primary" loading={spinning} onClick={onFinish}></Button>
<Button onClick={onCancel}></Button>
</>
);
@ -232,25 +255,6 @@ const BiddingDocument: React.FC<BiddingDocumentProps> = (props) => {
}
const UploadMethod = () => {
getFileBidList(UploadID).then(res => {
setUploadList(res)
})
}
const UploadOnchange = async (file:any) => {
let fileMsg = file.file;
if (fileMsg.status === 'removed') {
await deleteFileObjId(fileMsg.uid)
setUploadList(file.fileList)
}
if (fileMsg.status === 'done') {
message.success("上传成功");
await UploadMethod();
} else if (fileMsg.status === 'error') {
message.error("上传失败");
}
}
// @ts-ignore
return (
<Modal
@ -260,80 +264,142 @@ const BiddingDocument: React.FC<BiddingDocumentProps> = (props) => {
visible={modalVisible}
onCancel={() => onCancel()}
className="返回"
width={1000}
bodyStyle={{padding: '32px 40px 48px', height: "600px", overflowY: 'auto'}}
width={"60%"}
/*style={{top: "2%", height: "96%", overflowY: "auto"}}
bodyStyle={{paddingTop: "16px"}}*/
centered
footer={renderFooter()}
>
<Spin spinning={spinning}>
<Card>
<Form
{...layout}
name="basic"
form={form}
<Form
{...layout}
name="basic"
form={form}
>
<Form.Item
label="文件名称"
name="documentName"
rules={[
{
required: true,
message: '当前项不可为空',
},
]}
>
<Form.Item
label="文件名称"
name="documentName"
rules={[
{
required: true,
message: '当前项不可为空',
},
]}
>
<Input readOnly={editInformation}/>
</Form.Item>
<Form.Item
label="关联标段"
name="sectionIds"
rules={[
{
required: true,
message: '当前项不可为空',
},
]}
>
<Checkbox.Group
<Input maxLength={200} readOnly={editInformation} />
</Form.Item>
options={TpPackageId}
style={{width: '100%'}}
disabled={editInformation}
{//单一来源简化流程
proDict == "procurement_mode_9" &&
<>
<Form.Item
label={name1 + "文件获取开始时间"}
name="docStartTime"
rules={[
{
required: true,
message: '当前项不可为空',
},
]}
>
</Checkbox.Group>
</Form.Item>
<Form.Item
label="招标文件附件"
name="documentSetId"
<DatePicker showNow={false} disabled={editInformation} showTime={{ defaultValue: moment().startOf('minute') }}
style={{ width: "100%" }} disabledDate={disabledDate} format={"yyyy-MM-DD HH:mm"} />
</Form.Item>
<Form.Item
label={name1 + "文件获取截止时间"}
name="docEndTime"
rules={[
{
required: true,
message: '当前项不可为空',
},
]}
>
<DatePicker showNow={false} disabled={editInformation} showTime={{ defaultValue: moment().startOf('minute') }}
style={{ width: "100%" }} disabledDate={disabledDate} format={"yyyy-MM-DD HH:mm"} />
</Form.Item>
<Form.Item
label={"应答截止时间"}
name="replyEndTime"
rules={[
{
required: true,
message: '当前项不可为空',
},
]}
>
<DatePicker showNow={false} disabled={editInformation} showTime={{ defaultValue: moment().startOf('minute') }}
style={{ width: "100%" }} disabledDate={disabledDate} format={"yyyy-MM-DD HH:mm"} onChange={(data: any) => ReplyEndTimechange1(data)} />
</Form.Item>
<Form.Item
label={"评审开始时间"}
name="openingTime"
rules={[
{
required: true,
message: '当前项不可为空',
},
]}
>
<DatePicker showNow={false} disabled={editInformation} showTime={{ defaultValue: moment().startOf('minute') }}
style={{ width: "100%" }} disabledDate={disabledDate} format={"yyyy-MM-DD HH:mm"} />
</Form.Item>
<Form.Item
label="采购文件获取方式"
name="documentGetWay"
>
线
</Form.Item>
<Form.Item
label="应答文件递交方式"
name="documentSubmitWay"
>
线
</Form.Item>
</>
}
<Form.Item
label={"关联" + pktittle}
name="sectionIds"
rules={[
{
required: true,
message: '当前项不可为空',
},
]}
>
<Checkbox.Group
options={TpPackageId}
style={{ width: '100%' }}
disabled={editInformation}
>
<div className={style.bidding}>
<div className="uploadTotal">
<Upload
{...UploadMethod}
action={'/api/core-service-ebtp-updownload/v1/attachment/upload'}
data={{"businessId": UploadID}}
fileList={UploadList}
onChange={UploadOnchange}
>
<Button type="primary" disabled={editInformation} className="upload"><UploadOutlined/></Button>
</Upload>
<p className="uploadLabel">100M文件</p>
</div>
</div>
</Form.Item>
</Form>
<Collapse defaultActiveKey={['1']} ghost expandIcon={() => <BarsOutlined/>}>
<Panel header="招标文件内容" key="1">
<Card style={{textAlign: "center"}}>
<div>
{docBtnName != "" ?
<Weboffice memberBtnName={docBtnName} readonly={docReadOnly} btnStyle={docSaveBtn} btnName={"保存"}
DocfileCode={docFileCode} ref={WebofficeRef} onRef={onRef}/>
: null
}
</div>
</Card>
</Panel>
</Collapse>
</Checkbox.Group>
</Form.Item>
<Form.Item
label="附件"
name="documentSetId"
extra="单个附件最大30MB"
>
{UploadID != "empty" ? <ExtendUpload uploadProps={UploadProps} bid={UploadID} /> : null}
</Form.Item>
</Form>
<h3 className="first-title">{name1}</h3>
<Card style={{ textAlign: "center" }}>
<div>
{/* {docBtnName != "" ? (
<Weboffice key={""} memberBtnName={docBtnName} readonly={docReadOnly} btnStyle={docSaveBtn}
btnName={"保存"}
DocfileCode={docFileCode} saveHTML={"0"} savePDF={"0"} ref={WebofficeRef}
onRef={onRef} />) : null} */}
{docBtnName != "" ? (
<WebOffice0609
readOnly={docReadOnly}
DOCFileCode={docFileCode}
webOfficeRef={ref}
/>
) : null}
</div>
</Card>
</Spin>
</Modal>