63 lines
1.5 KiB
TypeScript
63 lines
1.5 KiB
TypeScript
import React from 'react';
|
|
import type { ParamsType, ProColumns, ProTableProps } from '@ant-design/pro-components';
|
|
import {
|
|
ProTable,
|
|
} from '@ant-design/pro-components';
|
|
import { InputNumber } from 'antd';
|
|
import { AnyObject } from 'antd/es/_util/type';
|
|
|
|
export interface TimeTemplateTableProps<DataSource, Params extends ParamsType = ParamsType, ValueType = "text"> extends ProTableProps<DataSource, Params, ValueType> {
|
|
onItemBlur?: (value?: number | string, id?: any, record?: any) => void,
|
|
}
|
|
|
|
const TimeTemplateTable = <DataSource extends AnyObject = AnyObject>(
|
|
props: TimeTemplateTableProps<DataSource, ParamsType, 'text'>
|
|
) => {
|
|
const {
|
|
onItemBlur,
|
|
} = props
|
|
|
|
|
|
const columns: ProColumns<DataSource>[] = [
|
|
{
|
|
title: '模板名称',
|
|
dataIndex: 'templateName',
|
|
},
|
|
{
|
|
title: '运行周期',
|
|
dataIndex: 'runCycle',
|
|
},
|
|
{
|
|
title: '布控星期',
|
|
dataIndex: 'arrangeDay',
|
|
},
|
|
{
|
|
title: '算力占用',
|
|
dataIndex: 'powerOccupy',
|
|
},
|
|
{
|
|
title: '配置路数',
|
|
key: 'option',
|
|
valueType: 'option',
|
|
render: (_, record) => <InputNumber value={record.lineNum} onBlur={e => onItemBlur?.(e.target.value, record.id, record)} min={0} />,
|
|
},
|
|
];
|
|
|
|
return (
|
|
<ProTable<DataSource>
|
|
columns={columns}
|
|
bordered
|
|
scroll={{ y: 95 }}
|
|
toolbar={undefined}
|
|
rowKey="id"
|
|
search={false}
|
|
options={false}
|
|
pagination={false}
|
|
dataSource={[]}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export default TimeTemplateTable
|