合并代码
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Modal, Table, Spin } from 'antd';
|
||||
import { getSupplierChangeDetail } from '../services';
|
||||
import { Modal, Table, Spin, Descriptions } from 'antd';
|
||||
import { supplierChangeApplyById } from '../services';
|
||||
|
||||
interface Qualification {
|
||||
type: string;
|
||||
@ -13,18 +13,24 @@ interface Qualification {
|
||||
file?: string;
|
||||
}
|
||||
interface InfoItem {
|
||||
label: string;
|
||||
value: string;
|
||||
fieldAnnotation?: string;
|
||||
newValue?: string;
|
||||
oldValue?: string;
|
||||
title?: string;
|
||||
changeDesc?: string;
|
||||
supplierName?: string;
|
||||
approveStatusText?: string;
|
||||
coscoSupplierChangeHistoryList?: [];
|
||||
}
|
||||
interface DetailData {
|
||||
baseInfo: InfoItem[];
|
||||
changeInfo: InfoItem[];
|
||||
coscoSupplierChangeApply: InfoItem;
|
||||
coscoSupplierChangeHistoryList: InfoItem[];
|
||||
qualifications: Qualification[];
|
||||
}
|
||||
interface DetailViewProps {
|
||||
visible: boolean;
|
||||
onClose: () => void;
|
||||
detailId?: string | number;
|
||||
detailId?: string;
|
||||
}
|
||||
|
||||
const DetailView: React.FC<DetailViewProps> = ({ visible, onClose, detailId }) => {
|
||||
@ -35,7 +41,7 @@ const DetailView: React.FC<DetailViewProps> = ({ visible, onClose, detailId }) =
|
||||
useEffect(() => {
|
||||
if (visible && detailId) {
|
||||
setLoading(true);
|
||||
getSupplierChangeDetail(detailId)
|
||||
supplierChangeApplyById(detailId)
|
||||
.then(res => {
|
||||
if (res.code === 200) {
|
||||
setDetailData(res.data);
|
||||
@ -46,55 +52,29 @@ const DetailView: React.FC<DetailViewProps> = ({ visible, onClose, detailId }) =
|
||||
if (!visible) setDetailData(null);
|
||||
}, [visible, detailId]);
|
||||
|
||||
const columns = [
|
||||
{ title: '资质证书类型', dataIndex: 'type', width: 120 },
|
||||
{ title: '资质名称', dataIndex: 'name', width: 120 },
|
||||
{ title: '资质类别和等级', dataIndex: 'level', width: 120 },
|
||||
{ title: '资质证书编号', dataIndex: 'number', width: 120 },
|
||||
{ title: '发证机构', dataIndex: 'org', width: 120 },
|
||||
{ title: '发证日期', dataIndex: 'issueDate', width: 120 },
|
||||
{ title: '资质有效期至', dataIndex: 'validDate', width: 120 },
|
||||
{
|
||||
title: '附件',
|
||||
dataIndex: 'file',
|
||||
width: 120,
|
||||
render: (file: string) =>
|
||||
file ? (
|
||||
<span>
|
||||
<img src={file} alt="附件" style={{ width: 30, verticalAlign: 'middle', marginRight: 8 }} />
|
||||
<a>更多</a>
|
||||
</span>
|
||||
) : (
|
||||
'-'
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
// 把info数组两两合并成一行显示
|
||||
function renderInfoTable(infoArr: InfoItem[]) {
|
||||
const rows = [];
|
||||
for (let i = 0; i < infoArr.length; i += 2) {
|
||||
const left = infoArr[i];
|
||||
const right = infoArr[i + 1] || { label: '', value: '' };
|
||||
rows.push(
|
||||
<tr key={i}>
|
||||
<td style={tdStyleTitle}>{left.label}</td>
|
||||
<td style={tdStyle}>{left.value}</td>
|
||||
<td style={tdStyleTitle}>{right.label}</td>
|
||||
<td style={tdStyle}>{right.value}</td>
|
||||
</tr>
|
||||
<>
|
||||
<Descriptions.Item label={`变更前-${infoArr[i].fieldAnnotation}` }>{infoArr[i].oldValue}</Descriptions.Item>
|
||||
<Descriptions.Item label={`变更后-${infoArr[i].fieldAnnotation}` }>{infoArr[i].newValue}</Descriptions.Item>
|
||||
</>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<table style={{ width: '100%', borderCollapse: 'collapse', background: '#fff', marginBottom: 8 }}>
|
||||
<tbody>{rows}</tbody>
|
||||
</table>
|
||||
<Descriptions bordered column={2}>
|
||||
{rows}
|
||||
</Descriptions>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title="供应商信息变更审批"
|
||||
title="供应商信息变更"
|
||||
visible={visible}
|
||||
onCancel={onClose}
|
||||
footer={null}
|
||||
@ -106,21 +86,16 @@ const DetailView: React.FC<DetailViewProps> = ({ visible, onClose, detailId }) =
|
||||
{detailData && (
|
||||
<div>
|
||||
{/* 基本信息 */}
|
||||
{renderInfoTable(detailData.baseInfo)}
|
||||
<Descriptions bordered column={1}>
|
||||
<Descriptions.Item label="变更标题" labelStyle={{width: '140px'}}>{detailData.coscoSupplierChangeApply?.title}</Descriptions.Item>
|
||||
<Descriptions.Item label="变更说明">{detailData.coscoSupplierChangeApply?.changeDesc}</Descriptions.Item>
|
||||
{detailData.coscoSupplierChangeApply?.coscoSupplierChangeHistoryList && (
|
||||
<Descriptions.Item label="附件">{detailData.coscoSupplierChangeApply?.changeDesc}</Descriptions.Item>
|
||||
) }
|
||||
</Descriptions>
|
||||
{/* 变更内容 */}
|
||||
<div style={{ padding: '16px 0 0 2px', fontWeight: 700 }}>变更内容:</div>
|
||||
{renderInfoTable(detailData.changeInfo)}
|
||||
{/* 新增资质 */}
|
||||
<div style={{ padding: '0 0 6px 2px', fontWeight: 700 }}>新增资质1</div>
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={detailData.qualifications}
|
||||
rowKey="number"
|
||||
size="small"
|
||||
pagination={false}
|
||||
bordered
|
||||
style={{ margin: '0 0 16px 0' }}
|
||||
/>
|
||||
<div style={{ padding: '16px 0 10px 2px', color: '#333', fontSize: '14px' }}>变更内容:</div>
|
||||
{renderInfoTable(detailData.coscoSupplierChangeHistoryList)}
|
||||
</div>
|
||||
)}
|
||||
</Spin>
|
||||
|
@ -3,9 +3,10 @@ import { useIntl } from 'umi';
|
||||
import { Form, Button, Table, Select, DatePicker, Input } from 'antd';
|
||||
import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
|
||||
import { SearchOutlined } from '@ant-design/icons';
|
||||
import { getPage } from './services';
|
||||
import { getSupplierChangePage } from './services';
|
||||
import moment from 'moment';
|
||||
import DetailView from './components/DetailView';
|
||||
import { getDictList } from '@/servers/api/dicts'
|
||||
|
||||
interface Data {
|
||||
deptName: string;
|
||||
@ -13,6 +14,12 @@ interface Data {
|
||||
createTime: string;
|
||||
exitTime: string;
|
||||
exitReason: string;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
interface Dict {
|
||||
dicName: string;
|
||||
code: string;
|
||||
}
|
||||
|
||||
const CooperateEnterprise: React.FC = () => {
|
||||
@ -22,6 +29,8 @@ const CooperateEnterprise: React.FC = () => {
|
||||
const [searchForm] = Form.useForm();
|
||||
//列表数据
|
||||
const [data, setData] = useState<Data[]>([]);
|
||||
//
|
||||
const [enterpriseType, setEnterpriseType] = useState<Dict[]>();
|
||||
//列表加载
|
||||
const [loading, setLoading] = useState(false);
|
||||
//列表分页
|
||||
@ -29,7 +38,7 @@ const CooperateEnterprise: React.FC = () => {
|
||||
//弹出组件开关状态
|
||||
const [detailVisible, setDetailVisible] = useState(false);
|
||||
//弹出组件参数
|
||||
const [currentDetail, setCurrentDetail] = useState<Data | null>(null);
|
||||
const [currentDetail, setCurrentDetail] = useState('');
|
||||
//列表头部
|
||||
const columns: ColumnsType<Data> = [
|
||||
{
|
||||
@ -38,32 +47,32 @@ const CooperateEnterprise: React.FC = () => {
|
||||
key: 'index',
|
||||
width: 80,
|
||||
align: 'center',
|
||||
render: (_: any, __: any, index: number) => index + 1,
|
||||
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
|
||||
},
|
||||
{
|
||||
title: '变更内容',
|
||||
dataIndex: 'deptName',
|
||||
key: 'deptName',
|
||||
dataIndex: 'changeDesc',
|
||||
key: 'changeDesc',
|
||||
},
|
||||
{
|
||||
title: '提交时间',
|
||||
dataIndex: 'categoryName',
|
||||
key: 'categoryName',
|
||||
dataIndex: 'updateTime',
|
||||
key: 'updateTime',
|
||||
},
|
||||
{
|
||||
title: '审批单位',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
dataIndex: 'deptNames',
|
||||
key: 'deptNames',
|
||||
},
|
||||
{
|
||||
title: '审批状态',
|
||||
dataIndex: 'exitTime',
|
||||
key: 'exitTime',
|
||||
dataIndex: 'enterpriseType',
|
||||
key: 'enterpriseType',
|
||||
},
|
||||
{
|
||||
title: '审批时间',
|
||||
dataIndex: 'exitReason',
|
||||
key: 'exitReason',
|
||||
dataIndex: 'updateTime',
|
||||
key: 'updateTime',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
@ -78,24 +87,18 @@ const CooperateEnterprise: React.FC = () => {
|
||||
//重置
|
||||
const handleReset = () => {
|
||||
searchForm.resetFields();
|
||||
getList({ page: 1, pageSize: pagination.pageSize ?? 10, parentCode: '', startTime: '', endTime: '' });
|
||||
getList({ pageNo: 1, pageSize: pagination.pageSize ?? 10 });
|
||||
};
|
||||
//搜索
|
||||
const handleSearch = (values: any) => {
|
||||
const { parentCode, createTime } = values;
|
||||
const startTime = createTime ? moment(createTime[0]).format('YYYY-MM-DD') : '';
|
||||
const endTime = createTime ? moment(createTime[1]).format('YYYY-MM-DD') : '';
|
||||
const handleSearch = () => {
|
||||
getList({
|
||||
page: 1,
|
||||
pageNo: 1,
|
||||
pageSize: pagination.pageSize ?? 10,
|
||||
parentCode: parentCode || '',
|
||||
startTime,
|
||||
endTime,
|
||||
});
|
||||
};
|
||||
//开启弹出
|
||||
const handleDetail = (record: Data) => {
|
||||
setCurrentDetail(record);
|
||||
setCurrentDetail(record.id || '');
|
||||
setDetailVisible(true);
|
||||
};
|
||||
//关闭演出
|
||||
@ -103,13 +106,17 @@ const CooperateEnterprise: React.FC = () => {
|
||||
setDetailVisible(false);
|
||||
};
|
||||
//列表数据请求
|
||||
const getList = async (params: { page: number; pageSize: number; parentCode: string; startTime: string; endTime: string }) => {
|
||||
const getList = async (params: { pageNo: number; pageSize: number; }) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { code , data, total } = await getPage(params);
|
||||
const values = searchForm.getFieldsValue();
|
||||
const { changeDesc, createTime, deptNames, enterpriseType } = values;
|
||||
const startTime = createTime ? moment(createTime[0]).format('YYYY-MM-DD') : '';
|
||||
const endTime = createTime ? moment(createTime[1]).format('YYYY-MM-DD') : '';
|
||||
const { code , data } = await getSupplierChangePage({...params, changeDesc, deptNames, enterpriseType,startTime,endTime});
|
||||
if (code === 200) {
|
||||
setData(data);
|
||||
setPagination({ current: params.page, pageSize: params.pageSize, total });
|
||||
setData(data.records);
|
||||
setPagination({ current: params.pageNo, pageSize: params.pageSize, total: data.total });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch data:', error);
|
||||
@ -119,7 +126,13 @@ const CooperateEnterprise: React.FC = () => {
|
||||
};
|
||||
//初始化
|
||||
useEffect(() => {
|
||||
getList({ page: 1, pageSize: 10, parentCode: '', startTime: '', endTime: '' });
|
||||
getDictList('approve_type').then((res) => {
|
||||
if(res.code == 200) {
|
||||
setEnterpriseType(res.data)
|
||||
}
|
||||
})
|
||||
|
||||
getList({ pageNo: 1, pageSize: 10 });
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@ -130,24 +143,24 @@ const CooperateEnterprise: React.FC = () => {
|
||||
onFinish={handleSearch}
|
||||
style={{ marginBottom: 16 }}
|
||||
>
|
||||
<Form.Item name="parentCode" label="变更内容">
|
||||
<Input placeholder="请输入变更内容" />
|
||||
<Form.Item name="changeDesc" label="变更内容">
|
||||
<Input style={{ width: 160 }} placeholder="请输入变更内容" allowClear maxLength={50} />
|
||||
</Form.Item>
|
||||
<Form.Item name="parentCode" label="审批单位">
|
||||
<Select placeholder="请选择审批单位">
|
||||
<Form.Item name="deptNames" label="审批单位">
|
||||
<Select style={{ width: 160 }} placeholder="请选择审批单位" allowClear>
|
||||
<Select.Option value="品类1">品类1</Select.Option>
|
||||
<Select.Option value="品类2">品类2</Select.Option>
|
||||
<Select.Option value="品类3">品类3</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item name="createTime" label="提交时间">
|
||||
<DatePicker.RangePicker placeholder={['开始时间', '结束时间']} />
|
||||
<DatePicker.RangePicker placeholder={['开始时间', '结束时间']} allowClear />
|
||||
</Form.Item>
|
||||
<Form.Item name="parentCode" label="审批状态">
|
||||
<Select placeholder="请选择审批状态">
|
||||
<Select.Option value="品类1">品类1</Select.Option>
|
||||
<Select.Option value="品类2">品类2</Select.Option>
|
||||
<Select.Option value="品类3">品类3</Select.Option>
|
||||
<Form.Item name="enterpriseType" label="审批状态">
|
||||
<Select style={{ width: 160 }} placeholder="请选择审批状态" allowClear>
|
||||
{enterpriseType?.map(item => (
|
||||
<Select.Option key={item.code} value={item.code}>{item.dicName}</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
@ -166,12 +179,12 @@ const CooperateEnterprise: React.FC = () => {
|
||||
dataSource={data}
|
||||
pagination={pagination}
|
||||
loading={loading}
|
||||
onChange={(pagination) => getList({ page: pagination.current!, pageSize: pagination.pageSize!, parentCode: '', startTime: '', endTime: '' })}
|
||||
onChange={(pagination) => getList({ pageNo: pagination.current!, pageSize: pagination.pageSize! })}
|
||||
/>
|
||||
<DetailView
|
||||
visible={detailVisible}
|
||||
onClose={handleDetailClose}
|
||||
detailId={10}
|
||||
detailId={currentDetail}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
@ -3,16 +3,26 @@ import request from '@/utils/request';
|
||||
|
||||
|
||||
|
||||
export async function getPage(params:any) {
|
||||
return request('/api/system/getPage', {
|
||||
method: 'GET',
|
||||
params
|
||||
});
|
||||
/**
|
||||
* 企业品类名录
|
||||
*/
|
||||
interface getSupplierChangePage {
|
||||
pageNo: number;
|
||||
pageSize: number;
|
||||
startTime?: string;
|
||||
endTime?: string;
|
||||
changeDesc?: string;
|
||||
deptNames?: string;
|
||||
enterpriseType?: string;
|
||||
}
|
||||
export const getSupplierChangePage = (data: getSupplierChangePage) => request.post('/coscoSupplierChangeApply/getSupplierChangePage', { data });
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 变更进度详情页
|
||||
*/
|
||||
export const supplierChangeApplyById = (id: string) => request.get(`/coscoSupplierChangeApply/supplierChangeApplyById/${id}`);
|
||||
|
||||
|
||||
export async function getSupplierChangeDetail(params:any) {
|
||||
return request('/api/system/getSupplierChangeDetail', {
|
||||
method: 'GET',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
@ -3,7 +3,11 @@ import { useIntl } from 'umi';
|
||||
import { Form, Button, Table, Select, DatePicker, TreeSelect } from 'antd';
|
||||
import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
|
||||
import { SearchOutlined } from '@ant-design/icons';
|
||||
import { category, categoryOption } from './services';
|
||||
import { getCategoryPage } from './services';
|
||||
import CategorySelector from '@/components/CategorySelector';
|
||||
|
||||
|
||||
|
||||
import moment from 'moment';
|
||||
|
||||
interface Data {
|
||||
@ -14,52 +18,6 @@ interface Data {
|
||||
exitReason: string;
|
||||
}
|
||||
|
||||
// 将 categoryTree 的字段从 categoryName 和 id 映射到 label 和 value
|
||||
const transformTreeData = (treeData: any[]): any[] => {
|
||||
return treeData.map((item) => ({
|
||||
value: item.id,
|
||||
label: item.categoryName,
|
||||
children: item.children ? transformTreeData(item.children) : undefined,
|
||||
}));
|
||||
};
|
||||
// 列表头
|
||||
const columns: ColumnsType<Data> = [
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'index',
|
||||
key: 'index',
|
||||
width: 80,
|
||||
align: 'center',
|
||||
render: (_: any, __: any, index: number) => index + 1,
|
||||
},
|
||||
{
|
||||
title: '准入部门',
|
||||
dataIndex: 'deptName',
|
||||
key: 'deptName',
|
||||
},
|
||||
{
|
||||
title: '准入品类',
|
||||
dataIndex: 'categoryName',
|
||||
key: 'categoryName',
|
||||
},
|
||||
{
|
||||
title: '准入时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
},
|
||||
{
|
||||
title: '退出时间',
|
||||
dataIndex: 'exitTime',
|
||||
key: 'exitTime',
|
||||
},
|
||||
{
|
||||
title: '退出原因',
|
||||
dataIndex: 'exitReason',
|
||||
key: 'exitReason',
|
||||
ellipsis: true,
|
||||
},
|
||||
];
|
||||
|
||||
const CooperateEnterprise: React.FC = () => {
|
||||
//双语
|
||||
const intl = useIntl();
|
||||
@ -71,16 +29,19 @@ const CooperateEnterprise: React.FC = () => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
//分页
|
||||
const [pagination, setPagination] = useState<TablePaginationConfig>({ current: 1, pageSize: 10, total: 0 });
|
||||
//搜索中树形下拉数据
|
||||
const [categoryTree, setCategoryTree] = useState<any[]>([]);
|
||||
//列表数据方法
|
||||
const getList = async (params: { page: number; pageSize: number; categoryName: string; startTime: string; endTime: string }) => {
|
||||
const getList = async (params: { pageNo: number; pageSize: number; }) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { code, data, total } = await category(params);
|
||||
const values = searchForm.getFieldsValue();
|
||||
const { categoryId, createTime, deptId } = values;
|
||||
const startTime = createTime ? moment(createTime[0]).format('YYYY-MM-DD') : '';
|
||||
const endTime = createTime ? moment(createTime[1]).format('YYYY-MM-DD') : '';
|
||||
|
||||
const { code, data } = await getCategoryPage({...params, categoryId, deptId, startTime, endTime });
|
||||
if (code === 200) {
|
||||
setData(data);
|
||||
setPagination({ current: params.page, pageSize: params.pageSize, total});
|
||||
setData(data.records);
|
||||
setPagination({ current: params.pageNo, pageSize: params.pageSize, total: data.total });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch data:', error);
|
||||
@ -91,31 +52,68 @@ const CooperateEnterprise: React.FC = () => {
|
||||
//搜索重置
|
||||
const handleReset = () => {
|
||||
searchForm.resetFields();
|
||||
getList({ page: 1, pageSize: pagination.pageSize ?? 10, categoryName: '', startTime: '', endTime: '' });
|
||||
getList({ pageNo: 1, pageSize: pagination.pageSize ?? 10 });
|
||||
};
|
||||
//搜索
|
||||
const handleSearch = (values: any) => {
|
||||
const { categoryName, createTime } = values;
|
||||
const startTime = createTime ? moment(createTime[0]).format('YYYY-MM-DD') : '';
|
||||
const endTime = createTime ? moment(createTime[1]).format('YYYY-MM-DD') : '';
|
||||
const handleSearch = () => {
|
||||
getList({
|
||||
page: 1,
|
||||
pageNo: 1,
|
||||
pageSize: pagination.pageSize ?? 10,
|
||||
categoryName: categoryName || '',
|
||||
startTime,
|
||||
endTime,
|
||||
});
|
||||
};
|
||||
//初始化
|
||||
useEffect(() => {
|
||||
categoryOption().then((res:any) => {
|
||||
const { code, data } = res;
|
||||
if(code == 200) {
|
||||
setCategoryTree(transformTreeData(data))
|
||||
}
|
||||
})
|
||||
getList({ page: 1, pageSize: 10, categoryName: '', startTime: '', endTime: '' });
|
||||
getList({ pageNo: 1, pageSize: 10 });
|
||||
}, []);
|
||||
// 列表头
|
||||
const columns: ColumnsType<Data> = [
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'index',
|
||||
key: 'index',
|
||||
width: 80,
|
||||
align: 'center',
|
||||
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
|
||||
},
|
||||
{
|
||||
title: '准入单位',
|
||||
dataIndex: 'deptId',
|
||||
key: 'deptId',
|
||||
},
|
||||
{
|
||||
title: '准入品类',
|
||||
dataIndex: 'categoryNames',
|
||||
key: 'categoryNames',
|
||||
render: (_: any, record: any) => {
|
||||
console.log(record.categoryNames);
|
||||
const arr = record.categoryNames ? record.categoryNames.split(',') : [];
|
||||
|
||||
return arr.length
|
||||
? arr.map((item: string, idx: number) => (
|
||||
<div key={idx} style={{ marginBottom: 4 }}>
|
||||
{item}
|
||||
</div>
|
||||
))
|
||||
: '';
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '准入时间',
|
||||
dataIndex: 'updateTime',
|
||||
key: 'updateTime',
|
||||
},
|
||||
{
|
||||
title: '退出时间',
|
||||
dataIndex: 'exitTime',
|
||||
key: 'exitTime',
|
||||
},
|
||||
{
|
||||
title: '退出原因',
|
||||
dataIndex: 'exitReason',
|
||||
key: 'exitReason',
|
||||
ellipsis: true,
|
||||
},
|
||||
];
|
||||
return (
|
||||
<>
|
||||
<Form
|
||||
@ -124,14 +122,11 @@ const CooperateEnterprise: React.FC = () => {
|
||||
onFinish={handleSearch}
|
||||
style={{ marginBottom: 16 }}
|
||||
>
|
||||
<Form.Item name="categoryName" label="准入品类">
|
||||
<TreeSelect
|
||||
style={{ width: '200px' }}
|
||||
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
||||
treeData={categoryTree}
|
||||
placeholder="请选择准入品类"
|
||||
treeDefaultExpandAll
|
||||
/>
|
||||
<Form.Item name="deptId" label="准入单位">
|
||||
{/* <CategorySelector multiple={false} style={{ width: 200 }} /> */}
|
||||
</Form.Item>
|
||||
<Form.Item name="categoryId" label="准入品类">
|
||||
<CategorySelector multiple={false} style={{ width: 200 }} />
|
||||
</Form.Item>
|
||||
<Form.Item name="createTime" label="准入时间">
|
||||
<DatePicker.RangePicker placeholder={['开始时间', '结束时间']} />
|
||||
@ -152,7 +147,7 @@ const CooperateEnterprise: React.FC = () => {
|
||||
dataSource={data}
|
||||
pagination={pagination}
|
||||
loading={loading}
|
||||
onChange={(pagination) => getList({ page: pagination.current!, pageSize: pagination.pageSize!, categoryName: '', startTime: '', endTime: '' })}
|
||||
onChange={(pagination) => getList({ pageNo: pagination.current!, pageSize: pagination.pageSize! })}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
@ -1,16 +1,17 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
|
||||
export async function category(params:any) {
|
||||
return request('/api/system/category', {
|
||||
method: 'GET',
|
||||
params
|
||||
});
|
||||
/**
|
||||
* 企业品类名录
|
||||
*/
|
||||
interface getCategoryPage {
|
||||
pageNo: number;
|
||||
pageSize: number;
|
||||
categoryId?: string;
|
||||
deptId?: string;
|
||||
startTime?: string;
|
||||
endTime?: string;
|
||||
}
|
||||
|
||||
export async function categoryOption() {
|
||||
return request('/api/system/categoryOption', {
|
||||
method: 'GET'
|
||||
});
|
||||
}
|
||||
|
||||
export const getCategoryPage = (data: getCategoryPage) => request.post('/coscoSupplierBase/getCategoryPage', { data });
|
||||
|
||||
export const categoryTree = () => request.get('/cosco/category/categoryTree');
|
@ -1,9 +1,10 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useIntl } from 'umi';
|
||||
import { useIntl } from 'umi';
|
||||
import { Form, Button, Table, Select, Input } from 'antd';
|
||||
import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
|
||||
import { SearchOutlined } from '@ant-design/icons';
|
||||
import { bank, categoryOption } from './services';
|
||||
import { page } from './services';
|
||||
import { getDictList } from '@/servers/api/dicts'
|
||||
|
||||
interface Data {
|
||||
deptName: string;
|
||||
@ -18,63 +19,27 @@ interface CategoryOption {
|
||||
label: string;
|
||||
}
|
||||
|
||||
const columns: ColumnsType<Data> = [
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'index',
|
||||
key: 'index',
|
||||
width: 80,
|
||||
align: 'center',
|
||||
render: (_: any, __: any, index: number) => index + 1,
|
||||
},
|
||||
{
|
||||
title: '消息内容',
|
||||
dataIndex: 'deptName',
|
||||
key: 'deptName',
|
||||
},
|
||||
{
|
||||
title: '业务类型',
|
||||
dataIndex: 'categoryName',
|
||||
key: 'categoryName',
|
||||
},
|
||||
{
|
||||
title: '发送时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
},
|
||||
{
|
||||
title: '审核单位',
|
||||
dataIndex: 'exitTime',
|
||||
key: 'exitTime',
|
||||
},
|
||||
{
|
||||
title: '审核状态',
|
||||
dataIndex: 'exitReason',
|
||||
key: 'exitReason',
|
||||
},
|
||||
];
|
||||
|
||||
const CooperateEnterprise: React.FC = () => {
|
||||
const supplierNews: React.FC = () => {
|
||||
//双语
|
||||
const intl = useIntl();
|
||||
//搜索
|
||||
const [searchForm] = Form.useForm();
|
||||
//列表数据
|
||||
const [data, setData] = useState<Data[]>([]);
|
||||
//列表加载
|
||||
//列表加载
|
||||
const [loading, setLoading] = useState(false);
|
||||
//分页
|
||||
const [pagination, setPagination] = useState<TablePaginationConfig>({ current: 1, pageSize: 10, total: 0 });
|
||||
//下拉数据
|
||||
const [categoryOptions, setCategoryOptions] = useState<CategoryOption[]>([]);
|
||||
//列表数据方法
|
||||
const getList = async (params: { page: number; pageSize: number; parentCode: string; }) => {
|
||||
const getList = async (params: { pageNo: number; pageSize: number; content: string; type: string; }) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const response = await bank(params);
|
||||
const response = await page(params);
|
||||
if (response.code === 200) {
|
||||
setData(response.data);
|
||||
setPagination({ current: params.page, pageSize: params.pageSize, total: response.total });
|
||||
setData(response.data.records);
|
||||
setPagination({ current: params.pageNo, pageSize: params.pageSize, total: response.data.total });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch data:', error);
|
||||
@ -85,26 +50,54 @@ const CooperateEnterprise: React.FC = () => {
|
||||
//搜索重置
|
||||
const handleReset = () => {
|
||||
searchForm.resetFields();
|
||||
getList({ page: 1, pageSize: pagination.pageSize ?? 10, parentCode: '' });
|
||||
getList({ pageNo: 1, pageSize: pagination.pageSize ?? 10, content: '', type: '' });
|
||||
};
|
||||
//搜索
|
||||
const handleSearch = (values: any) => {
|
||||
const { parentCode } = values;
|
||||
const { content, type } = values;
|
||||
getList({
|
||||
page: 1,
|
||||
pageNo: 1,
|
||||
pageSize: pagination.pageSize ?? 10,
|
||||
parentCode: parentCode || ''
|
||||
content,
|
||||
type,
|
||||
});
|
||||
};
|
||||
|
||||
const columns: ColumnsType<Data> = [
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'index',
|
||||
key: 'index',
|
||||
width: 80,
|
||||
align: 'center',
|
||||
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
|
||||
},
|
||||
{
|
||||
title: '消息内容',
|
||||
dataIndex: 'content',
|
||||
key: 'content',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '业务类型',
|
||||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
},
|
||||
{
|
||||
title: '发送时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
},
|
||||
];
|
||||
//初始化
|
||||
useEffect(() => {
|
||||
categoryOption().then((res:any) => {
|
||||
const { code, data } = res;
|
||||
if(code == 200) {
|
||||
setCategoryOptions(data)
|
||||
}
|
||||
})
|
||||
getList({ page: 1, pageSize: 10, parentCode: '', });
|
||||
// categoryOption().then((res:any) => {
|
||||
// const { code, data } = res;
|
||||
// if(code == 200) {
|
||||
// setCategoryOptions(data)
|
||||
// }
|
||||
// })
|
||||
getList({ pageNo: 1, pageSize: 10, content: '', type: '' });
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@ -115,11 +108,11 @@ const CooperateEnterprise: React.FC = () => {
|
||||
onFinish={handleSearch}
|
||||
style={{ marginBottom: 16 }}
|
||||
>
|
||||
<Form.Item name="parentCode" label="消息内容">
|
||||
<Input placeholder="请输入消息内容" />
|
||||
<Form.Item name="content" label="消息内容">
|
||||
<Input placeholder="请输入消息内容" allowClear maxLength={50}/>
|
||||
</Form.Item>
|
||||
<Form.Item name="parentCode" label="业务类型">
|
||||
<Select placeholder="请选择业务类型">
|
||||
<Form.Item name="type" label="业务类型">
|
||||
<Select placeholder="请选择业务类型" allowClear>
|
||||
{categoryOptions.map((option) => (
|
||||
<Select.Option key={option.value} value={option.value}>
|
||||
{option.label}
|
||||
@ -143,10 +136,10 @@ const CooperateEnterprise: React.FC = () => {
|
||||
dataSource={data}
|
||||
pagination={pagination}
|
||||
loading={loading}
|
||||
onChange={(pagination) => getList({ page: pagination.current!, pageSize: pagination.pageSize!, parentCode: '', })}
|
||||
onChange={(pagination) => getList({ pageNo: pagination.current!, pageSize: pagination.pageSize!, content: '', type: '' })}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default CooperateEnterprise;
|
||||
export default supplierNews;
|
@ -1,16 +1,13 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
|
||||
export async function bank(params:any) {
|
||||
return request('/api/system/bank', {
|
||||
method: 'GET',
|
||||
params
|
||||
});
|
||||
/**
|
||||
* 企业品类名录
|
||||
*/
|
||||
interface page {
|
||||
pageNo: number;
|
||||
pageSize: number;
|
||||
content?: string;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export async function categoryOption() {
|
||||
return request('/api/system/categoryOption', {
|
||||
method: 'GET'
|
||||
});
|
||||
}
|
||||
|
||||
export const page = (data: page) => request.post('/supplierMessage/page', { data });
|
Reference in New Issue
Block a user