3.10 工程代码同步master
This commit is contained in:
251
src/pages/ExamineAndApprove/Announcement/index.tsx
Normal file
251
src/pages/ExamineAndApprove/Announcement/index.tsx
Normal file
@ -0,0 +1,251 @@
|
||||
/*
|
||||
* @Author: liqing
|
||||
* @Date: 2021-03-12 09:39:21
|
||||
* @LastEditTime: 2021-03-15 16:40:55
|
||||
* @Description: In User Settings Edit
|
||||
* @FilePath: \ebtp-cloud-frontend\src\pages\ExamineAndApprove\ProcurementRequirementsArePublicized.tsx
|
||||
*/
|
||||
import { getURLInformation, isEmpty } from '@/utils/CommonUtils';
|
||||
import ExtendUpload from '@/utils/ExtendUpload';
|
||||
import { getSessionRoleData, getUserToken } from '@/utils/session';
|
||||
import { Card, Collapse, Descriptions } from 'antd';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import BasicInformation from '../BasicInformation/BasicInformation';
|
||||
import {
|
||||
changeMedias,
|
||||
selectDefaultNameByBidMethodDict,
|
||||
selectNameByBidMethodDict,
|
||||
} from '../utils';
|
||||
import { getEditStatus, selectAnnoById, selectDocumentsById } from './service';
|
||||
import '@/utils/lq.style.less';
|
||||
import moment from "moment";
|
||||
import ApprovalAttachment from '../ApprovalAttachment/ApprovalAttachment';
|
||||
const { Panel } = Collapse;
|
||||
|
||||
/**
|
||||
* 公告
|
||||
* @returns
|
||||
*/
|
||||
const ProcurementRequirementsArePublicized: React.FC = () => {
|
||||
//公告id
|
||||
const annoId = getURLInformation('id');
|
||||
//url可编辑参数
|
||||
const edit = getURLInformation('switches');
|
||||
//上传组件是否可编辑
|
||||
const isEdit = isEmpty(edit) ? false : edit?.split(',').findIndex(item => item == '020') != -1 ? true : false;
|
||||
//审批单id
|
||||
const [processInstanceId, setProcessInstanceId] = useState<string>('');
|
||||
//weboffice
|
||||
const [contentWithStyle, setContentWithStyle] = useState('');
|
||||
|
||||
const [processName, setProcessName] = useState<any>(selectDefaultNameByBidMethodDict());
|
||||
|
||||
//列表展示信息
|
||||
const [listDisplayInfo, setListDisplayInfo] = useState<any>({
|
||||
annoTitle: '',
|
||||
docStartTime: '',
|
||||
docEndTime: '',
|
||||
replyEndTime: '',
|
||||
openingTime: '',
|
||||
openhallTitle: '',
|
||||
sectionNames: '',
|
||||
attDatasetId: '',
|
||||
medias: '',
|
||||
documentsList: [],
|
||||
id: '',
|
||||
approvalFileId: 'empty',
|
||||
});
|
||||
//是否可编辑状态
|
||||
const [editState, setEditState] = useState<boolean>(isEdit)
|
||||
useEffect(() => {
|
||||
selectAnnoById(annoId).then((res) => {
|
||||
if (res?.code === 200) {
|
||||
let data = res?.data;
|
||||
selectDocumentsById(annoId).then(response => {
|
||||
if (res?.code == 200) {
|
||||
//自定义编辑状态
|
||||
if (isEmpty(edit)) {
|
||||
getEditStatus().then(res => {
|
||||
if (res?.code == 200) {
|
||||
setEditState(res?.data)
|
||||
}
|
||||
})
|
||||
}
|
||||
setListDisplayInfo({
|
||||
annoTitle: data?.annoTitle,
|
||||
docStartTime: moment(data?.docStartTime).format('YYYY-MM-DD HH:mm'),
|
||||
docEndTime: moment(data?.docEndTime).format('YYYY-MM-DD HH:mm'),
|
||||
replyEndTime: moment(data?.replyEndTime).format('YYYY-MM-DD HH:mm'),
|
||||
openingTime: isEmpty(data?.openingTime) ? '' : moment(data?.openingTime).format('YYYY-MM-DD HH:mm'),
|
||||
openhallTitle: data?.openhallTitle,
|
||||
sectionNames: data?.sectionNames,
|
||||
attDatasetId: data?.attDatasetId,
|
||||
medias: data?.medias,
|
||||
documentsList: [...response?.data],
|
||||
id: data?.id,
|
||||
approvalFileId: data?.approvalFileId,
|
||||
});
|
||||
}
|
||||
})
|
||||
setContentWithStyle(data?.contentWithStyle);
|
||||
setProcessName(selectNameByBidMethodDict(data?.annoType));
|
||||
setProcessInstanceId(data?.approvalInstanceId);
|
||||
}
|
||||
});
|
||||
window.parent.postMessage("{'height':" + document.documentElement.scrollHeight + "}", '*');
|
||||
}, []);
|
||||
|
||||
//weboffice变更文件名称下载方法
|
||||
const getFileList = (bid: any, fileName: any) => {
|
||||
window.fetch(`/api/core-service-ebtp-updownload/v1/attachment/download/bid/${bid}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
// JwtToken: getSessionUserData() == null ? null : getSessionUserData().userId,
|
||||
Authorization: getUserToken(),
|
||||
currentRoleCode: getSessionRoleData()?.roleCode,
|
||||
},
|
||||
credentials: 'include',
|
||||
}).then((response) => {
|
||||
// 这里才是下载附件逻辑处理的地方
|
||||
response.blob().then(blob => {
|
||||
const blobUrl = window.URL.createObjectURL(blob);
|
||||
const aElement = document.createElement("a");
|
||||
aElement.href = blobUrl; // 设置a标签路径
|
||||
aElement.download = fileName;
|
||||
aElement.click();
|
||||
window.URL.revokeObjectURL(blobUrl);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<Card bordered={false} bodyStyle={{ padding: '0 200px', borderRadius: 6 }}>
|
||||
<h2 style={{ textAlign: 'center', marginTop: 10 }}>公告审批单</h2>
|
||||
<Collapse defaultActiveKey={['1', '2', '3', '4']} style={{ marginTop: 30 }}>
|
||||
<Panel header="基本信息" key="1">
|
||||
<BasicInformation processInstanceId={processInstanceId} />
|
||||
</Panel>
|
||||
<Panel header="公告信息" key="2">
|
||||
<Descriptions bordered column={1}>
|
||||
<Descriptions.Item
|
||||
label="公告名称"
|
||||
labelStyle={{ textAlign: 'center', width: '40%' }}
|
||||
>
|
||||
{listDisplayInfo.annoTitle}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
label={processName.name1 + '文件获取开始时间'}
|
||||
labelStyle={{ textAlign: 'center' }}
|
||||
>
|
||||
{listDisplayInfo.docStartTime}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
label={processName.name1 + '文件获取截止时间'}
|
||||
labelStyle={{ textAlign: 'center' }}
|
||||
>
|
||||
{listDisplayInfo.docEndTime}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
label={processName.name2 + '截止时间'}
|
||||
labelStyle={{ textAlign: 'center' }}
|
||||
>
|
||||
{listDisplayInfo.replyEndTime}
|
||||
</Descriptions.Item>
|
||||
{listDisplayInfo.openingTime == '' ? null : (
|
||||
<Descriptions.Item
|
||||
label={processName.name3 + '时间'}
|
||||
labelStyle={{ textAlign: 'center' }}
|
||||
>
|
||||
{listDisplayInfo.openingTime}
|
||||
</Descriptions.Item>
|
||||
)}
|
||||
{listDisplayInfo.openhallTitle == null ? null : (
|
||||
<Descriptions.Item
|
||||
label="开标大厅"
|
||||
labelStyle={{ textAlign: 'center' }}
|
||||
>
|
||||
{listDisplayInfo.openhallTitle}
|
||||
</Descriptions.Item>
|
||||
)}
|
||||
<Descriptions.Item
|
||||
label={'关联' + processName.name4}
|
||||
labelStyle={{ textAlign: 'center' }}
|
||||
>
|
||||
{listDisplayInfo.sectionNames}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
label="附件文件"
|
||||
labelStyle={{ textAlign: 'center' }}
|
||||
>
|
||||
<ExtendUpload
|
||||
bid={listDisplayInfo.attDatasetId}
|
||||
btnName="附件"
|
||||
uploadProps={{ disabled: true }}
|
||||
/>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
label="公告发布媒体"
|
||||
labelStyle={{ textAlign: 'center' }}
|
||||
>
|
||||
{changeMedias(listDisplayInfo.medias)}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
<h3 className="first-title">公告发布内容</h3>
|
||||
<p className="table-border" dangerouslySetInnerHTML={{ __html: contentWithStyle }}></p>
|
||||
</Panel>
|
||||
<Panel header="文件信息" key="3">
|
||||
{listDisplayInfo.documentsList.map((item: any, index: any) => {
|
||||
return <Descriptions bordered column={1} key={index} style={{ marginBottom: 8 }}>
|
||||
<Descriptions.Item
|
||||
label={processName.name1 + '文件名称'}
|
||||
labelStyle={{ textAlign: 'center', width: '40%' }}
|
||||
>
|
||||
{item?.documentName}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
label={'关联' + processName.name4}
|
||||
labelStyle={{ textAlign: 'center' }}
|
||||
>
|
||||
{item?.sections?.map((e: any) => e.bsName).join(",")}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
label="附件"
|
||||
labelStyle={{ textAlign: 'center' }}
|
||||
>
|
||||
<ExtendUpload
|
||||
bid={item?.documentSetId}
|
||||
btnName="附件"
|
||||
uploadProps={{ disabled: true }}
|
||||
/>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item
|
||||
label="正文"
|
||||
labelStyle={{ textAlign: 'center' }}
|
||||
>
|
||||
<a style={{ color: "#b30000" }} key="zhengwen" onClick={() => getFileList(item?.contentFileId, `${item?.documentName}(正文).doc`)}>{item?.documentName}(正文).doc</a>
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
})}
|
||||
</Panel>
|
||||
{!editState && (isEmpty(listDisplayInfo.approvalFileId) || listDisplayInfo.approvalFileId == "empty")
|
||||
? null
|
||||
: <Panel header="附件信息" key="4">
|
||||
<Descriptions bordered column={1}>
|
||||
<Descriptions.Item label="审批单附件" labelStyle={{ textAlign: 'center', width: '40%' }}>
|
||||
{
|
||||
listDisplayInfo.approvalFileId != "empty" ?
|
||||
<ApprovalAttachment
|
||||
primaryKey={listDisplayInfo.id}
|
||||
bid={listDisplayInfo.approvalFileId}
|
||||
uploadProps={{ disabled: !editState }}
|
||||
maxCount={1}
|
||||
/> : null
|
||||
}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
</Panel>}
|
||||
</Collapse>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
export default ProcurementRequirementsArePublicized;
|
36
src/pages/ExamineAndApprove/Announcement/service.ts
Normal file
36
src/pages/ExamineAndApprove/Announcement/service.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
|
||||
/*
|
||||
* @Author: liqiang
|
||||
* @Date: 2021-03-12 14:00:32
|
||||
* @LastEditTime: 2021-03-12 14:03:08
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @Description: In User Settings Edit
|
||||
* @FilePath: \ebtp-cloud-frontend\src\pages\ExamineAndApprove\service.ts
|
||||
*/
|
||||
/**
|
||||
* 根据公告id查询数据
|
||||
* @param id
|
||||
* @returns
|
||||
*/
|
||||
export function selectAnnoById (id:any) {
|
||||
return request('/api/biz-service-ebtp-bid/v1/anno/' + id);
|
||||
}
|
||||
/**
|
||||
* 根据公告id获取招标文件信息
|
||||
* @param id
|
||||
* @returns
|
||||
*/
|
||||
export function selectDocumentsById (id:any) {
|
||||
return request('/api/biz-service-ebtp-bid/v1/document/getDocumentByAnnoId/' + id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 临时获取编辑权限
|
||||
* @param id
|
||||
* @returns
|
||||
*/
|
||||
export function getEditStatus () {
|
||||
return request('/api/biz-service-ebtp-bid/v1/anno/config/approval_file');
|
||||
}
|
Reference in New Issue
Block a user