消息通知与公司信息tab调查问卷及反贿赂承诺书
This commit is contained in:
@ -1,14 +1,17 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useIntl } from 'umi';
|
||||
import { Form, Button, Table, Select, Input, Modal } from 'antd';
|
||||
import { Form, Button, Table, Select, Input, Modal, Descriptions } from 'antd';
|
||||
import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
|
||||
import { SearchOutlined, DeleteOutlined } from '@ant-design/icons';
|
||||
//字典与接口
|
||||
import { page, getExitMge } from './services';
|
||||
import { page, getExitMge, update } from './services';
|
||||
import { getDictList } from '@/servers/api/dicts'
|
||||
//统一列表分页
|
||||
import tableProps from '@/utils/tableProps'
|
||||
|
||||
const readTypeOptions = [
|
||||
{ dicName: '是', code: '1' },
|
||||
{ dicName: '否', code: '0' },
|
||||
];
|
||||
interface Data {
|
||||
deptName: string;
|
||||
categoryName: string;
|
||||
@ -35,11 +38,15 @@ const supplierNews: React.FC = () => {
|
||||
const [pagination, setPagination] = useState<TablePaginationConfig>({ current: 1, pageSize: 10, total: 0 });
|
||||
//下拉数据
|
||||
const [categoryOptions, setCategoryOptions] = useState<CategoryOption[]>([]);
|
||||
//查看信息与组件
|
||||
const [viewRecord, setViewRecord] = useState<any>(null); // 当前查看的消息
|
||||
const [viewVisible, setViewVisible] = useState(false); // 弹窗显隐
|
||||
//列表数据方法
|
||||
const getList = async (params: { pageNo: number; pageSize: number; content: string; type: string; }) => {
|
||||
const getList = async (params: { pageNo: number; pageSize: number;}) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const response = await page(params);
|
||||
const value = searchForm.getFieldsValue();
|
||||
const response = await page({...params, ...value});
|
||||
if (response.code === 200) {
|
||||
setData(response.data.records);
|
||||
setPagination({ current: params.pageNo, pageSize: params.pageSize, total: response.data.total });
|
||||
@ -53,16 +60,13 @@ const supplierNews: React.FC = () => {
|
||||
//搜索重置
|
||||
const handleReset = () => {
|
||||
searchForm.resetFields();
|
||||
getList({ pageNo: 1, pageSize: pagination.pageSize ?? 10, content: '', type: '' });
|
||||
getList({ pageNo: 1, pageSize: pagination.pageSize ?? 10});
|
||||
};
|
||||
//搜索
|
||||
const handleSearch = (values: any) => {
|
||||
const { content, type } = values;
|
||||
const handleSearch = () => {
|
||||
getList({
|
||||
pageNo: 1,
|
||||
pageSize: pagination.pageSize ?? 10,
|
||||
content,
|
||||
type,
|
||||
});
|
||||
};
|
||||
|
||||
@ -87,7 +91,7 @@ const supplierNews: React.FC = () => {
|
||||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
width: 160,
|
||||
render: (code: string) => typeMap[code] || code
|
||||
render: (code: string) => typeMap[code] || code
|
||||
},
|
||||
{
|
||||
title: '发送时间',
|
||||
@ -95,6 +99,28 @@ const supplierNews: React.FC = () => {
|
||||
key: 'createTime',
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
title: '是否已读',
|
||||
dataIndex: 'read',
|
||||
key: 'read',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
render: (_, record: any) => (<span>{record.read === '0' ? '否' : '是'}</span>)
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'option',
|
||||
align: 'center',
|
||||
width: 80,
|
||||
render: (_, record: any) => (
|
||||
<a onClick={() => {
|
||||
setViewRecord(record);
|
||||
setViewVisible(true);
|
||||
update({ id: record.id })
|
||||
handleSearch()
|
||||
}}>查看</a>
|
||||
),
|
||||
}
|
||||
];
|
||||
const [typeMap, setTypeMap] = useState<{ [code: string]: string }>({});
|
||||
//初始化
|
||||
@ -134,7 +160,7 @@ const supplierNews: React.FC = () => {
|
||||
}
|
||||
}
|
||||
})
|
||||
getList({ pageNo: 1, pageSize: 10, content: '', type: '' });
|
||||
getList({ pageNo: 1, pageSize: 10 });
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@ -151,7 +177,7 @@ const supplierNews: React.FC = () => {
|
||||
<Input placeholder="请输入消息内容" allowClear maxLength={50} />
|
||||
</Form.Item>
|
||||
<Form.Item name="type" label="业务类型">
|
||||
<Select placeholder="请选择业务类型" allowClear>
|
||||
<Select style={{ width: 140 }} placeholder="请选择业务类型" allowClear>
|
||||
{categoryOptions.map((option) => (
|
||||
<Select.Option key={option.code} value={option.code}>
|
||||
{option.dicName}
|
||||
@ -159,6 +185,13 @@ const supplierNews: React.FC = () => {
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item name="read" label="是否已读">
|
||||
<Select style={{ width: 140 }} placeholder="请选择是否已读" allowClear>
|
||||
{readTypeOptions.map(opt => (
|
||||
<Select.Option key={opt.code} value={opt.code}>{opt.dicName}</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button className="buttonSubmit" type="primary" htmlType="submit" icon={<SearchOutlined />}>
|
||||
搜索
|
||||
@ -176,11 +209,29 @@ const supplierNews: React.FC = () => {
|
||||
dataSource={data}
|
||||
pagination={{ ...tableProps.pagination, total: pagination.total }}
|
||||
loading={loading}
|
||||
onChange={(pagination) => getList({ pageNo: pagination.current!, pageSize: pagination.pageSize!, content: '', type: '' })}
|
||||
onChange={(pagination) => getList({ pageNo: pagination.current!, pageSize: pagination.pageSize! })}
|
||||
style={{ flex: 1, minHeight: 0 }}
|
||||
scroll={{ y: 'calc(100vh - 350px)' }}
|
||||
/>
|
||||
</div>
|
||||
<Modal
|
||||
title="消息详情"
|
||||
visible={viewVisible}
|
||||
onCancel={() => {
|
||||
setViewVisible(false)
|
||||
handleSearch()
|
||||
}}
|
||||
footer={null}
|
||||
destroyOnClose
|
||||
>
|
||||
{viewRecord && (
|
||||
<Descriptions bordered column={1} size="small">
|
||||
<Descriptions.Item labelStyle={{ width: '120px' }} label="消息内容">{viewRecord.content}</Descriptions.Item>
|
||||
<Descriptions.Item label="业务类型">{typeMap[viewRecord.type] || viewRecord.type}</Descriptions.Item>
|
||||
<Descriptions.Item label="发送时间">{viewRecord.createTime}</Descriptions.Item>
|
||||
</Descriptions>
|
||||
)}
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
@ -15,3 +15,11 @@ export const page = (data: page) => request.post('/supplierMessage/page', { data
|
||||
* 消息弹出
|
||||
*/
|
||||
export const getExitMge = () => request.get('/supplierMessage/getExitMge');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
interface update {
|
||||
id: string;
|
||||
}
|
||||
export const update = (data: update) => request.post('/supplierMessage/update', { data });
|
||||
|
@ -182,7 +182,10 @@ const SupplierMessage: React.FC = () => {
|
||||
<Modal
|
||||
title="消息详情"
|
||||
visible={viewVisible}
|
||||
onCancel={() => setViewVisible(false)}
|
||||
onCancel={() => {
|
||||
setViewVisible(false)
|
||||
handleSearch()
|
||||
}}
|
||||
footer={null}
|
||||
destroyOnClose
|
||||
>
|
||||
|
Reference in New Issue
Block a user