This commit is contained in:
sunyu
2025-07-11 09:05:55 +08:00
parent f41dd0949d
commit 00e64e8d07
4 changed files with 794 additions and 0 deletions

View File

@ -0,0 +1,400 @@
import React, {useRef, useState} from 'react';
import ProTable, {ActionType, ProColumns} from '@ant-design/pro-table';
import { getPage,getDataById,deleteNotice,addNotice,updateNotice,sendNotice, getReceiptList } from './service';
import {Button, DatePicker, Form, Input, message, Modal, PageHeader, Checkbox, Spin, Table, Radio} from 'antd';
import TextArea from "antd/lib/input/TextArea";
import {getDicData} from "@/utils/session";
import moment, {Moment} from "moment";
import {RadioGroup} from "@material-ui/core";
const NoticeList: React.FC<{}> = () => {
const [title, setTitle] = useState<string>('');
const [open, setOpen] = useState<boolean>(false);
const [openView, setOpenView] = useState(false);
const [spin, spinSet] = useState<boolean>(false);
const [receiptData, setReceiptData] = useState<any[]>([]); // 回执数据
const [receiptLoading, setReceiptLoading] = useState<boolean>(false); // 回执加载状态
const [currentNoticeId, setCurrentNoticeId] = useState<number | null>(null); // 当前查看的通知ID
const actionRef = useRef<ActionType>();
const [form] = Form.useForm();
//获取字典
const getDict: any = getDicData();
//查询分页数据
const [pageData, pageDataSet] = useState<any>({
pageNo: 1,
pageSize: 10
});
const layout = {
labelCol: { span: 6 },
wrapperCol: { span: 13 },
};
const dictData = JSON.parse(getDict);
interface DictType {
value: string;
label: string;
}
const version_status: DictType[] = [
{ value: 1, label: '启用' },
{ value: 0, label: '停用' },
];
const { CheckboxGroup } = Checkbox;
const options = [
{ label: '服务器采购', value: 'server_purchase' },
{ label: '交换机采购', value: 'switch_purchase' }
];
//委托列表
const columns: ProColumns<any>[] = [
{ title: '序号', valueType: 'index', width: 50, },
{ title: '澄清标题', dataIndex: 'clarificationTitle' },//, ellipsis: true
{ title: '关联标段', dataIndex: 'relatedSection', width: '30%' ,
valueEnum: { '1': { text: '交换机采购', relatedSection: '1' }, },
render: (_, record) => {
if (record.relatedSection === '1') {
return (<></>)
} else {
return (<></>)
}
}
},
{ title: '起草时间', dataIndex: 'createDate', width: '10%', valueType: 'dateTime', search: false,
render: (value: Moment, record: any) => value?moment(value).format('yyyy-MM-DD'):null
},
{ title: '澄清状态', dataIndex: 'clarifyStatus', width: '10%',
valueEnum: { '1': { text: '已发送', clarifyStatus: '1' }, },
render: (_, record) => {
if (record.clarifyStatus === 1) {
return (<></>)
} else {
return (<></>)
}
}
},
{
title: '操作', width: '9%',
valueType: 'option',
render: (_, record) => [
<Button type='text' hidden={record.clarifyStatus === 0} onClick={() => { viewReceipt(record.id) }}></Button>,
<Button type='text' hidden={record.clarifyStatus === 1} onClick={() => { sendNoticeMes(record.id) }}></Button>,
<Button type='text' hidden={record.clarifyStatus === 1} onClick={() => { handleUpdate(record) }}></Button>,
<Button type='text' hidden={record.clarifyStatus === 1} onClick={() => { handleDelete(record.id) }}></Button>
]
},
];
// 回执表格列配置
const receiptColumns = [
{
title: '供应商名称',
dataIndex: 'supplierName',
key: 'supplierName',
},
{
title: '状态',
dataIndex: 'receiptStatus',
key: 'receiptStatus',
valueEnum: { '1': { text: '已回执', receiptStatus: '1' }, },
render: (_, record) => {
if (record.receiptStatus === '1') {
return (<></>)
} else {
return (<>-</>)
}
}
},
{
title: '回执时间',
dataIndex: 'createDate',
key: 'createDate',
},
{
title: '回执附件',
dataIndex: 'receiptAttachment',
key: 'receiptAttachment',
},
{
title: '回执内容',
dataIndex: 'receiptContent',
key: 'receiptContent',
},
];
const handleSubmit = async () => {
try {
const values = await form.validateFields();
values.openingTime = values.openingTime.format("yyyy-MM-DD HH:mm:ss")
values.bidDeadline = values.bidDeadline.format("yyyy-MM-DD HH:mm:ss")
values.relatedSection = values.relatedSection?.join(',') || ''
console.log(values)
if (values.id) {
await updateNotice(values).then((r: any) => {
if (r?.code == 200) {
message.success('修改成功');
} else {
message.error('修改失败');
}
});
} else {
await addNotice(values).then((r: any) => {
if (r?.code == 200) {
message.success('新增成功');
} else {
message.error('新增失败');
}
});
}
closeModal();
} catch (error) {
console.log("错误失败!")
console.error(error);
}
};
const checkSupModal = (
<Modal
title={title}
visible={open}
width="70%"
centered
destroyOnClose={true}
bodyStyle={{ maxHeight: window.innerHeight * 0.96 - 108, overflowY: 'auto', paddingTop: 0 }}
// footer={<Button onClick={() => setOpen(false)}>关闭</Button>}
onOk={handleSubmit}
onCancel={() => closeModal()}
>
<h3></h3>
<Form form={form} {...layout}>
<Form.Item label="主键id" name="id" hidden>
<Input />
</Form.Item>
<Form.Item label="选择标段" name="relatedSection" rules={[{ required: true, message: '请选择至少一个关联标段' }]}>
<Checkbox.Group style={{ width: '100%' }}>
<Checkbox value="0"></Checkbox>
<Checkbox value="1"></Checkbox>
</Checkbox.Group>
</Form.Item>
<h3></h3>
<Form.Item label="是否修改招标文件" name="modifyTenderDoc" rules={[{ required: true }]}>
<Radio.Group>
<Radio value={true}></Radio>
<Radio value={false}></Radio>
</Radio.Group>
</Form.Item>
<Form.Item label="是否修改开标时间" name="modifyOpeningTime" rules={[{ required: true }]}>
<Radio.Group>
<Radio value={true}></Radio>
<Radio value={false}></Radio>
</Radio.Group>
</Form.Item>
<Form.Item label="是否修改投标截止时间" name="modifyBidDeadline" rules={[{ required: true }]}>
<Radio.Group>
<Radio value={true}></Radio>
<Radio value={false}></Radio>
</Radio.Group>
</Form.Item>
<Form.Item label="是否修改投标格式" name="modifyBidFormat" rules={[{ required: true }]}>
<Radio.Group>
<Radio value={true}></Radio>
<Radio value={false}></Radio>
</Radio.Group>
</Form.Item>
<Form.Item label="开标时间" name="openingTime" rules={[{ required: true }]}>
<DatePicker
showNow={false}
format="yyyy-MM-DD"
showTime
style={{ width: '100%' }}
/>
</Form.Item>
<Form.Item label="投标截止时间" name="bidDeadline" rules={[{ required: true }]}>
<DatePicker
showNow={false}
format="yyyy-MM-DD"
showTime
style={{ width: '100%' }}
/>
</Form.Item>
<Form.Item label="澄清标题" name="clarificationTitle" rules={[{ required: true }]}>
<Input />
</Form.Item>
<Form.Item label="澄清文件说明" name="clarificationDescription" >
<TextArea />
</Form.Item>
<Form.Item label="澄清状态" name="status" hidden>
<Input />
</Form.Item>
<Form.Item label="澄清文件附件" name="clarificationAttachment">
<Input />
</Form.Item>
</Form>
</Modal>
);
// 回执查看模态框
const receiptModal = (
<Modal
title="查看回执"
visible={openView}
width="80%"
centered
onCancel={() => setOpenView(false)}
footer={[
<Button key="back" onClick={() => setOpenView(false)}>
</Button>
]}
>
<Spin spinning={receiptLoading}>
<Table
columns={receiptColumns}
dataSource={Array.isArray(receiptData) ? receiptData : []}
pagination={false}
rowKey="id"
/>
</Spin>
</Modal>
);
const handleUpdate = async (record: any) => {
form.resetFields();
const notice = await getDataById(record.id);
console.log(notice)
// 修复:过滤无效值并去重
const relatedSectionValues = notice.data.relatedSection
?.split(',')
.filter(value => options.some(option => option.value === value))
.filter((value, index, self) => self.indexOf(value) === index);
form.setFieldsValue({
...notice.data,
openingTime: moment(notice.openingTime),
bidDeadline: moment(notice.bidDeadline),
relatedSection: relatedSectionValues || []
});
setOpen(true);
setTitle('澄清');
};
// 查看回执功能
const viewReceipt = async (clarificationId: number) => {
setCurrentNoticeId(clarificationId);
setReceiptLoading(true);
try {
console.log(clarificationId)
console.log("clarificationId")
// 调用API获取回执数据
const response = await getReceiptList(clarificationId);
console.log(response)
if (response?.code === 200) {
// 确保数据是数组类型
const dataArray = Array.isArray(response?.data)
? response.data
: (response?.data ? [response.data] : []);
setReceiptData(dataArray);
setOpenView(true);
} else {
message.error('获取回执数据失败');
}
} catch (error) {
console.error('获取回执数据异常:', error);
message.error('获取回执数据异常');
} finally {
setReceiptLoading(false);
}
};
const sendNoticeMes = async (id: any) => {
await sendNotice(id).then((r: any) => {
if (r?.code == 200) {
message.success('发送成功');
} else {
message.error('发送失败');
}
});
actionRef.current?.reload();
};
// 删除操作
const handleDelete = (id: string) => {
Modal.confirm({
title: '确认删除?',
onOk: async () => {
await deleteNotice(id).then((r: any) => {
if (r?.code == 200) {
message.success('删除成功');
} else {
message.error('删除失败');
}
})
.finally(() => actionRef.current?.reload());
},
});
};
const handleAdd = async () => {
form.resetFields();
setOpen(true);
setTitle('澄清');
};
const closeModal = async () => {
actionRef.current?.reload();
form.resetFields();
// setCheckedKeys([]);
setOpen(false);
};
return (
<Spin spinning={spin}>
<PageHeader title="踏勘" />
<div style={{ maxHeight: innerHeight - 130, height: innerHeight - 130 }} className='xsy-entrust bgCWhite'>
<ProTable<any>
actionRef={actionRef}//action触发后更新表格
columns={columns}//表格
options={false}
bordered={false}
className='tableSearch'
size='small'
search={{ labelWidth: 'auto', span: 6 }}
request={(params) =>
getPage({
...params,
basePageRequest: { pageNo: pageData.pageNo, pageSize: pageData.pageSize },
}).then((res) => {
const result = {
data: res.data.records,
total: res.data.total,
success: res.success,
pageSize: res.data.size,
current: res.data.current
}
return result;
})
}
toolBarRender={() => [
<Button onClick={() => { handleAdd() }} type="primary">
</Button>,
]
}
pagination={{
defaultPageSize: 10,
showSizeChanger: false,
onChange: (page, pageSize) => pageDataSet({ pageNo: page, pageSize: pageSize }),
onShowSizeChange: (current, size) => pageDataSet({ pageNo: current, pageSize: size }),
}}
onReset={() => { pageDataSet({ pageNo: 1, pageSize: 10 }) }}
/>
{checkSupModal}
{receiptModal} {/* 显示回执模态框 */}
</div>
</Spin >
);
}
export default NoticeList;

View File

@ -0,0 +1,75 @@
import request from "@/utils/request";
/**
* 查询数据并分页
* @param params
*/
export async function getPage(params: any) {
return request('/api/sys-manager-ebtp-project/v1/coscotenderclarification/getPage', {
method: 'post',
data: params,
});
}
/**
* 新增澄清通知
* @param params
*/
export async function addNotice(params: any) {
return request('/api/sys-manager-ebtp-project/v1/coscotenderclarification', {
method: 'post',
data: params,
});
}
/**
* 修改澄清通知
* @param params
*/
export async function updateNotice(params: any) {
return request('/api/sys-manager-ebtp-project/v1/coscotenderclarification/update', {
method: 'post',
data: params,
});
}
/**
* 根据id查询澄清通知详情
* @param params
*/
export async function getDataById(id: any) {
return request(`/api/sys-manager-ebtp-project/v1/coscotenderclarification/${id}`, {
method: 'get',
});
}
/**
* 根据id删除澄清通知
* @param params
*/
export async function deleteNotice(id: any) {
return request(`/api/sys-manager-ebtp-project/v1/coscotenderclarification/delete/${id}`, {
method: 'get',
});
}
/**
* 发送澄清通知
* @param params
*/
export async function sendNotice(id: any) {
return request(`/api/sys-manager-ebtp-project/v1/coscotenderclarification/sendNotice/${id}`, {
method: 'get',
});
}
/**
* 根据通知id查询回执列表
* @param params
*/
export async function getReceiptList(clarificationId: any) {
return request(`/api/sys-manager-ebtp-project/v1/coscotenderclarificationreceipt/getReceiptList/${clarificationId}`, {
method: 'get',
});
}

View File

@ -0,0 +1,265 @@
import React, { useRef, useState } from'react';
import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
import { getPage, updateClarificationReceipt, addClarificationReceipt, getDataById,getReceiptInfo } from './service';
import {Button, Form, Input, message, Modal, PageHeader, Spin, Radio, DatePicker} from 'antd';
import { getDicData } from "@/utils/session";
import moment, { Moment } from "moment";
const receipt: React.FC<{}> = () => {
const [openReceiptModal, setOpenReceiptModal] = useState(false); // 新增控制踏勘回执Modal显示状态的变量
const [spin, spinSet] = useState<boolean>(false);
const [receiptLoading, setReceiptLoading] = useState<boolean>(false); // 回执加载状态
const [clarificationId, setClarificationId] = useState<number | null>(null); // 当前查看的通知ID
const actionRef = useRef<ActionType>();
const [form] = Form.useForm();
const [receiptForm] = Form.useForm(); // 用于踏勘回执表单
//获取字典
const getDict: any = getDicData();
//查询分页数据
const [pageData, pageDataSet] = useState<any>({
pageNo: 1,
pageSize: 10
});
const layout = {
labelCol: { span: 6 },
wrapperCol: { span: 13 },
};
const dictData = JSON.parse(getDict);
interface DictType {
value: string;
label: string;
}
//踏勘回执列表
const columns: ProColumns<any>[] = [
{ title: '序号', valueType: 'index', width: 50, },
{ title: '澄清标题', dataIndex: 'clarificationTitle' },//, ellipsis: true
{ title: '关联标段', dataIndex: 'relatedSection', width: '30%' ,
valueEnum: { '1': { text: '交换机采购', relatedSection: '1' }, },
render: (_, record) => {
if (record.relatedSection === '1') {
return (<></>)
} else {
return (<></>)
}
}
},
{ title: '发布时间', dataIndex: 'createDate', width: '10%', valueType: 'dateTime', search: false,
render: (value: Moment, record: any) => value?moment(value).format('yyyy-MM-DD'):null
},
{ title: '回执时间', dataIndex:'receiptDate', width: '10%', valueType: 'dateTime', search: false,
// render: (value: Moment, record: any) => value? moment(value).format('yyyy-MM-DD') : null
},
{
title: '操作', width: '9%',
valueType: 'option',
render: (_, record) => [
<Button type='text' onClick={() => { clarificationReceipt(record.id) }}></Button>,
]
},
];
// 澄清回执方法
const clarificationReceipt = async (id: number) => {
setReceiptLoading(true);
try {
setClarificationId(id);
// 调用API获取通知消息数据用于踏勘信息 上边信息回显
const notice = await getDataById(id);
const receiptInfo = await getReceiptInfo(id);
//todo 根据ClarificationId和供应商唯一标识去查询供应商 填写的踏勘回执信息
//todo 调接口
if (notice?.code === 200 && receiptInfo?.code === 200) {
//踏勘信息会先赋值
form.setFieldsValue({
...notice.data,
openingTime: moment(notice.openingTime),
bidDeadline: moment(notice.bidDeadline),
});
receiptForm.setFieldsValue({
...receiptInfo.data,
// reconnaissanceTime: moment(notice.reconnaissanceTime),
});
setOpenReceiptModal(true); // 打开踏勘回执Modal
} else {
message.error('获取回执数据失败');
}
} catch (error) {
console.error('获取回执数据异常:', error);
message.error('获取回执数据异常');
} finally {
setReceiptLoading(false);
}
};
const closeModal = async () => {
actionRef.current?.reload();
receiptForm.resetFields();
setOpenReceiptModal(false);
};
const handleReceiptSubmit = async () => {
try {
const values = await receiptForm.validateFields();
values.clarificationId = clarificationId
values.receiptStatus = 1
if (values.id) {
await updateClarificationReceipt(values).then((r: any) => {
if (r?.code == 200) {
message.success('回执修改成功');
} else {
message.error('回执修改失败');
}
});
} else {
await addClarificationReceipt(values).then((r: any) => {
if (r?.code == 200) {
message.success('回执成功');
} else {
message.error('回执失败');
}
});
}
closeModal();
} catch (error) {
console.log("错误失败!")
console.error(error);
}
};
const receiptModal = (
<Modal
title="澄清回执"
visible={openReceiptModal}
centered
width="50%"
onOk={handleReceiptSubmit}
onCancel={() => closeModal()}
>
{/* 踏勘信息展示部分 */}
<div>
<h3></h3>
<Form form={form} {...layout}>
{/* 这里按照需求依次添加其他踏勘信息字段展示,如关联标段、踏勘时间等,以下仅为示例 */}
<Form.Item label="选择标段" name="relatedSection">
<Input disabled />
</Form.Item>
<h3></h3>
<Form.Item label="是否修改招标文件" name="modifyTenderDoc">
<Radio.Group disabled={true}>
<Radio value={true}></Radio>
<Radio value={false}></Radio>
</Radio.Group>
</Form.Item>
<Form.Item label="是否修改开标时间" name="modifyOpeningTime">
<Radio.Group disabled={true}>
<Radio value={true}></Radio>
<Radio value={false}></Radio>
</Radio.Group>
</Form.Item>
<Form.Item label="是否修改投标截止时间" name="modifyBidDeadline">
<Radio.Group disabled={true}>
<Radio value={true}></Radio>
<Radio value={false}></Radio>
</Radio.Group>
</Form.Item>
<Form.Item label="是否修改投标格式" name="modifyBidFormat">
<Radio.Group disabled={true}>
<Radio value={true}></Radio>
<Radio value={false}></Radio>
</Radio.Group>
</Form.Item>
<Form.Item label="开标时间" name="openingTime">
<DatePicker
showNow={false}
format="yyyy-MM-DD"
showTime
disabled
style={{ width: '100%' }}
/>
</Form.Item>
<Form.Item label="投标截止时间" name="bidDeadline">
<DatePicker
showNow={false}
format="yyyy-MM-DD"
showTime
disabled
style={{ width: '100%' }}
/>
</Form.Item>
<Form.Item label="澄清标题" name="clarificationTitle">
<Input disabled />
</Form.Item>
<Form.Item label="澄清文件说明" name="clarificationDescription">
<Input disabled />
</Form.Item>
{/*<Form.Item label="澄清状态" name="status">*/}
{/* <Input hidden={true} />*/}
{/*</Form.Item>*/}
<Form.Item label="澄清文件附件" name="clarificationAttachment">
<Input disabled />
</Form.Item>
</Form>
</div>
{/* 澄清回执表单部分 */}
<h3></h3>
<Form form={receiptForm} {...layout}>
<Form.Item label="id" name="id" hidden={true}>
<Input />
</Form.Item>
<Form.Item label="回执内容" name="receiptContent" rules={[{ required: true }]}>
<Input />
</Form.Item>
<Form.Item label="回执状态" name="receiptStatus" hidden>
<Input />
</Form.Item>
<Form.Item label="回执附件" name="receiptAttachment" rules={[{ required: true }]}>
<Input />
</Form.Item>
</Form>
</Modal>
);
return (
<Spin spinning={spin}>
<PageHeader title="踏勘" />
<div style={{ maxHeight: innerHeight - 130, height: innerHeight - 130 }} className='xsy-entrust bgCWhite'>
<ProTable<any>
actionRef={actionRef}//action触发后更新表格
columns={columns}//表格
options={false}
bordered={false}
className='tableSearch'
size='small'
search={{ labelWidth: 'auto', span: 6 }}
request={(params) =>
getPage({
...params,
basePageRequest: { pageNo: pageData.pageNo, pageSize: pageData.pageSize },
}).then((res) => {
const result = {
data: res.data.records,
total: res.data.total,
success: res.success,
pageSize: res.data.size,
current: res.data.current
}
return result;
})
}
pagination={{
defaultPageSize: 10,
showSizeChanger: false,
onChange: (page, pageSize) => pageDataSet({ pageNo: page, pageSize: pageSize }),
onShowSizeChange: (current, size) => pageDataSet({ pageNo: current, pageSize: size }),
}}
onReset={() => { pageDataSet({ pageNo: 1, pageSize: 10 }) }}
/>
{receiptModal}
</div>
</Spin>
);
}
export default receipt;

View File

@ -0,0 +1,54 @@
import request from "@/utils/request";
/**
* 查询数据并分页
* @param params
*/
export async function getPage(params: any) {
return request('/api/sys-manager-ebtp-project/v1/coscotenderclarification/getPage', {
method: 'post',
data: params,
});
}
/**
* 根据id查询澄清通知详情
* @param params
*/
export async function getDataById(id: any) {
return request(`/api/sys-manager-ebtp-project/v1/coscotenderclarification/${id}`, {
method: 'get',
});
}
/**
* 踏勘回执 确定
* @param params
*/
export async function addClarificationReceipt(params: any) {
return request('/api/sys-manager-ebtp-project/v1/coscotenderclarificationreceipt', {
method: 'post',
data: params,
});
}
/**
* 踏勘回执 修改
* @param params
*/
export async function updateClarificationReceipt(params: any) {
return request('/api/sys-manager-ebtp-project/v1/coscotenderclarificationreceipt/update', {
method: 'post',
data: params,
});
}
/**
* 根据供应商名称和澄清表主键id(clarificationId)查询澄清回执回显信息
* @param clarificationId
*/
export async function getReceiptInfo(clarificationId: any) {
return request(`/api/sys-manager-ebtp-project/v1/coscotenderclarificationreceipt/getReceiptInfo/${clarificationId}`, {
method: 'get',
});
}