import React from 'react'; import { Tag, Typography } from 'antd'; import XinTable from '@/components/XinTable'; import type { XinTableColumn, XinTableProps } from '@/components/XinTable/typings.ts'; import type ISupplier from '@/domain/iSupplier.ts'; import { SUPPLIER_STATUS_MAP } from '@/domain/iSupplier.ts'; const { Title, Text } = Typography; /** * 供应商管理 */ const SupplierPage: React.FC = () => { const columns: XinTableColumn[] = [ { title: 'ID', dataIndex: 'id', hideInForm: true, hideInSearch: true, width: 70, align: 'center', }, { title: '供应商名称', dataIndex: 'name', valueType: 'text', required: true, rules: [{ required: true, message: '请输入供应商名称' }], }, { title: '联系人', dataIndex: 'contact', valueType: 'text', hideInSearch: true, }, { title: '联系电话', dataIndex: 'phone', valueType: 'text', hideInSearch: true, }, { title: '主营品类', dataIndex: 'main_products', valueType: 'text', hideInSearch: true, render: (_, record) => record.main_products ? record.main_products.split('/').map((item) => ( {item} )) : '-', }, { title: '状态', dataIndex: 'status', valueType: 'radioButton', initialValue: 1, fieldProps: { options: [ { value: 1, label: '正常' }, { value: 0, label: '停用' }, ], }, render: (_, record) => { const item = SUPPLIER_STATUS_MAP[record.status ?? 1]; return {item?.text}; }, }, { title: '地址', dataIndex: 'address', valueType: 'textarea', hideInSearch: true, hideInTable: true, fieldProps: { rows: 2 }, }, { title: '备注', dataIndex: 'remark', valueType: 'textarea', hideInSearch: true, hideInTable: true, fieldProps: { rows: 2 }, }, ]; const tableProps: XinTableProps = { api: '/customer/supplier', columns, rowKey: 'id', accessName: 'customer.supplier', formProps: { grid: true, colProps: { span: 12 }, layout: 'vertical', rowProps: {gutter: 24} }, modalProps: { width: 720 }, }; return ( <>
供应商管理 采购单接收方,供应商小程序端接收并确认采购单。
{...tableProps} /> ); }; export default SupplierPage;