import React, { useMemo, useState } from 'react'; import { Form, Input, Select, Space, Button, Switch, message } from 'antd'; import { PlusOutlined, SearchOutlined, ReloadOutlined, ExportOutlined } from '@ant-design/icons'; import StandardTable from '@/components/StandardTable'; import styles from './BasicInfo.less'; import BtBg1 from '@/assets/business_basic/Bt_bg1.png'; import BtBg2 from '@/assets/business_basic/Bt_bg2.png'; const BasicInfo = () => { const [form] = Form.useForm(); // 列表筛选与数据(演示数据,可替换为接口) const [filters, setFilters] = useState({ listCategory: undefined, listStatus: undefined, }); const columns = useMemo(() => { return [ { title: '油品信息', dataIndex: 'name', key: 'name', width: 180 }, { title: '油品分类', dataIndex: 'category', key: 'category', width: 100 }, { title: '密度(P15)', dataIndex: 'density', key: 'density', width: 120 }, { title: '闪点(℃)', dataIndex: 'flashPoint', key: 'flashPoint', width: 100 }, { title: '粘度(MM²/S)', dataIndex: 'viscosity', key: 'viscosity', width: 120 }, { title: '硫含量(MG/KG)', dataIndex: 'sulfur', key: 'sulfur', width: 140 }, { title: '状态', dataIndex: 'enabled', key: 'enabled', width: 90, render: (val, record) => ( { record.enabled = checked; message.success(`已${checked ? '启用' : '停用'}`); }} /> ), }, { title: '最后更新', dataIndex: 'updatedAt', key: 'updatedAt', width: 180 }, { title: '操作', key: 'action', fixed: 'right', width: 180, render: () => ( ), }, ]; }, []); const tableData = [ { key: '1', name: '92#汽油P001', category: '汽油', density: '0.852 kg/L', flashPoint: '-43', viscosity: '0.55', sulfur: '10', enabled: true, updatedAt: '2025-10-25 22:30:16', }, { key: '2', name: '95#汽油P001', category: '汽油', density: '0.725 kg/L', flashPoint: '-43', viscosity: '0.55', sulfur: '10', enabled: false, updatedAt: '2025-10-25 10:28:14', }, { key: '3', name: '0#柴油油P003', category: '柴油', density: '0.832 kg/L', flashPoint: '65', viscosity: '3.0', sulfur: '10', enabled: true, updatedAt: '2025-10-23 20:58:24', }, { key: '4', name: '航空煤油P004', category: '航空煤油', density: '0.852 kg/L', flashPoint: '48', viscosity: '1.25', sulfur: '8', enabled: false, updatedAt: '2025-10-23 04:59:13', }, { key: '5', name: '测流油P005', category: '测流油', density: '0.876 kg/L', flashPoint: '32', viscosity: '2.00', sulfur: '300', enabled: false, updatedAt: '2025-10-22 03:03:13', }, ]; const onSubmit = () => { form.validateFields().then((values) => { // 提交时可对接接口 // eslint-disable-next-line no-console console.log('基本信息提交: ', values); message.success('已保存基本信息'); }); }; const onReset = () => { form.resetFields(); message.info('已重置基本信息'); }; return (
基本信息
油品列表
油品分类: setFilters({ ...filters, listStatus: v })} placeholder="全部" options={[ { label: '全部', value: undefined }, { label: '启用', value: '启用' }, { label: '停用', value: '停用' }, ]} allowClear />
`共 ${total} 条`, }, }} selectionType="checkbox" />
); }; export default BasicInfo;