first version
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
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<ISupplier>[] = [
|
||||
{
|
||||
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) => (
|
||||
<Tag key={item} color="green">
|
||||
{item}
|
||||
</Tag>
|
||||
))
|
||||
: '-',
|
||||
},
|
||||
{
|
||||
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 <Tag color={item?.color}>{item?.text}</Tag>;
|
||||
},
|
||||
},
|
||||
{
|
||||
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<ISupplier> = {
|
||||
api: '/customer/supplier',
|
||||
columns,
|
||||
rowKey: 'id',
|
||||
accessName: 'customer.supplier',
|
||||
formProps: {
|
||||
grid: true,
|
||||
colProps: { span: 12 },
|
||||
layout: 'vertical',
|
||||
},
|
||||
modalProps: { width: 720 },
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="mb-5">
|
||||
<Title level={3}>供应商管理</Title>
|
||||
<Text type="secondary">采购单接收方,供应商小程序端接收并确认采购单。</Text>
|
||||
</div>
|
||||
<XinTable<ISupplier> {...tableProps} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default SupplierPage;
|
||||
Reference in New Issue
Block a user