4.8 代理、采购经理首页增加公告审批结束提醒

This commit is contained in:
jl-zhoujl2
2022-04-08 15:43:43 +08:00
parent fd1cfa84f2
commit 24627a8507
4 changed files with 242 additions and 30 deletions

View File

@ -0,0 +1,179 @@
import { Button, Form, Input, Modal } from "antd"
import React, { useEffect, useState } from "react"
import { describeSiteMsgDetail, getProjectById, selectMsgRead } from '../service'
import '@/assets/ld_style.less'
import { history } from 'umi';
import { followUpAProjectManager, getDefId } from '@/utils/session';
const { TextArea } = Input;
interface ApprovalDetailProps {
modalVisible: boolean;
approvalId: string;
dateNum: Number;
trelist: any[];
onCancel: () => void;
}
const layout = {
labelCol: { span: 6 },
wrapperCol: { span: 15 },
};
const ApprovalDetail: React.FC<ApprovalDetailProps> = (props) => {
const { modalVisible, approvalId, onCancel, trelist, dateNum } = props;
const [form] = Form.useForm();
const [detailId, setDetailId] = useState<any>(approvalId); // 详情id
const [lastVisible, setLastVisible] = useState<boolean>(trelist?.indexOf(approvalId) == 0 ? true : false); // 上一条禁用
const [nextVisible, setNextVisible] = useState<boolean>(trelist?.indexOf(approvalId) == trelist?.length - 1 ? true : false); // 下一条禁用
const [knowVisible, setKnowVisible] = useState<any>(false); // 知道了禁用
const [projectId, setProjectId] = useState<any>(); // 项目id
const [roomType, setRoomType] = useState<any>(); // 判断资审候审
const [disFollowUp, setDisFollowUp] = useState<boolean>(false) //跟进按钮隐藏
useEffect(() => {
Int(approvalId);
setDetailId(approvalId)
}, [approvalId]);
const Int = (detailId: any) => {
describeSiteMsgDetail(detailId).then(res => {
// if(res.code == 200){
if (res?.servicecode) {
let detailMess = JSON.parse(res.servicecode)
setProjectId(detailMess.tpId)
setRoomType(detailMess.roomType)
} else {
// message.error('项目数据错误,无法获取流程,请联系管理员!')
setDisFollowUp(true)
}
res.authorizestate == '0' ? setKnowVisible(false) : setKnowVisible(true)
form.setFieldsValue({
"title": res.title,
"createtime": res.createtime,
"content": res.content
});
// }
});
};
const next = () => { // 下一条
setLastVisible(false)
let current = trelist.indexOf(detailId)
if (current < trelist.length - 2 && current != trelist.length - 2) {
setDetailId(trelist[current + 1])
Int(trelist[current + 1])
} else if (current == trelist.length - 2) {
setDetailId(trelist[current + 1])
Int(trelist[current + 1])
setNextVisible(true)
} else {
setNextVisible(true)
}
}
const last = () => { // 上一条
setNextVisible(false)
let current: any = trelist.indexOf(detailId)
if (current > 0 && current != 1) {
setDetailId(trelist[current - 1])
Int(trelist[current - 1])
} else if (current == 1) {
setDetailId(trelist[current - 1])
Int(trelist[current - 1])
setLastVisible(true)
} else {
setLastVisible(true)
}
}
const getRead = () => { // 知道了
selectMsgRead(detailId).then(res => {
setKnowVisible(true)
});
}
const getFollow = async () => { // 跟进
await getProjectById(projectId).then(async response => {
if (response?.code == 200 && response?.success == true) {
const resData = response?.data
await followUpAProjectManager(resData);
const defId = getDefId();
if (roomType == '1' && (defId == 'bid_prequalification' || defId == 'comparison_one_prequalification')) { //公开招标资格预审,公开比选一阶段资格预审
history.push('/ProjectLayout/ZYuShen/senior/Notice?roomType=1')
} else if (roomType == '2' && (defId == 'bid_prequalification' || defId == 'comparison_one_prequalification')) { //公开招标资格预审后审阶段,公开比选一阶段资格预审后审阶段
history.push('/ProjectLayout/biddingAnnouncement/BiddingInvitationList?roomType=2')
} else if (
defId == 'bid_qualification' ||
defId == 'comparison_one' ||
defId == 'comparison_multi' ||
defId == 'recruit' ||
defId == 'negotiation_competitive_public'
) { //公开招标后审,公开比选一阶段后审,公开比选多阶段,招募单轮,竞争性谈判发公告
history.push('/ProjectLayout/biddingAnnouncement/BiddingAnnouncementList')
} else if (
defId == 'bid_invitation' ||
defId == 'negotiation_competitive_invite' ||
defId == 'negotiation_single'
) { //邀请招标,竞争性谈判发邀请函,单一来源
history.push('/ProjectLayout/biddingAnnouncement/BiddingInvitationList')
} else if (
defId == 'recruit_multi'
) { //多轮招募
history.push('/ProjectLayout/ZZhaoMu/Bid/BiddingAnnouncement/BiddingAnnouncementList')
}
}
})
}
return (
<>
<Modal
destroyOnClose={true}
getContainer={false}
title='消息详情'
visible={modalVisible}
onCancel={() => onCancel()}
width={800}
centered
footer={[
<Button onClick={onCancel}></Button>,
<Button disabled={knowVisible} type="primary" onClick={() => getRead()}></Button>,
<Button disabled={disFollowUp} onClick={() => getFollow()} type="primary"></Button>]}
>
<p> <text className="tips">{dateNum}</text> <text className="tips">6</text> <a onClick={() => history.push('/SystemMessage/message')}> </a></p>
<Form
{...layout}
name="basic"
form={form}
>
<Form.Item
label="项目名称"
name="title"
>
<Input readOnly bordered={false} />
</Form.Item>
<Form.Item
label="内容"
name="content"
>
<TextArea readOnly bordered={false} autoSize />
</Form.Item>
<Form.Item
label="审批结束时间"
name="createtime"
>
<Input readOnly bordered={false} />
</Form.Item>
</Form>
<div className="btnBox">
<Button disabled={lastVisible} className="last" onClick={() => last()}></Button>
<Button disabled={nextVisible} onClick={() => next()}></Button>
</div>
</Modal>
</>
)
}
export default ApprovalDetail