feat(react-web-next): 新增.editorconfig和.prettierrc配置文件,添加public/.gitkeep占位文件
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
|
||||
import type { ActionType } from '@ant-design/pro-components';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import type { ProColumns } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
import { deviceApi } from '@/services/device';
|
||||
import { downloadByUrl } from '@/utils/download';
|
||||
|
||||
export interface WaylineTableRef {
|
||||
reload: () => void;
|
||||
}
|
||||
|
||||
interface WaylineTableProps {
|
||||
params?: Record<string, any>;
|
||||
onEdit?: (record: any) => void;
|
||||
onDelete?: (record: any) => void;
|
||||
}
|
||||
|
||||
const WaylineTable = forwardRef<WaylineTableRef, WaylineTableProps>(({ params, onEdit, onDelete }, ref) => {
|
||||
const actionRef = useRef<ActionType>();
|
||||
|
||||
useImperativeHandle(ref, () => ({ reload: () => actionRef.current?.reload() }));
|
||||
|
||||
const columns: ProColumns<any>[] = [
|
||||
{ dataIndex: 'index', valueType: 'indexBorder', width: 48 },
|
||||
{ title: '航线名称', dataIndex: 'name' },
|
||||
{ title: '航线ID', dataIndex: 'waylineId' },
|
||||
{ title: '空间ID', dataIndex: 'workspaceId' },
|
||||
{ title: '创建时间', dataIndex: 'createTime', valueType: 'dateTime', width: 180 },
|
||||
{
|
||||
title: '航线文件', dataIndex: 'fileUrl', search: false,
|
||||
render: (_, record) => record.fileUrl ? (
|
||||
<a
|
||||
href={record.fileUrl}
|
||||
onClick={(e) => { e.preventDefault(); downloadByUrl(record.fileUrl, record.name || 'wayline.kmz'); }}
|
||||
>下载文件</a>
|
||||
) : '-'
|
||||
},
|
||||
{ title: '文件签名', dataIndex: 'sign', ellipsis: true, copyable: true },
|
||||
{
|
||||
title: '操作', key: 'action', valueType: 'option',
|
||||
render: (_, record) => (
|
||||
<Space>
|
||||
<a onClick={() => onEdit?.(record)}>编辑</a>
|
||||
<a style={{ color: '#1677ff' }} onClick={() => onDelete?.(record)}>删除</a>
|
||||
</Space>
|
||||
)
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<ProTable<any>
|
||||
rowKey="id"
|
||||
headerTitle="航线列表"
|
||||
actionRef={actionRef}
|
||||
request={(p) => deviceApi.wayline({ ...p, ...params })}
|
||||
columns={columns}
|
||||
search={false}
|
||||
pagination={{ showSizeChanger: true, showQuickJumper: true }}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
export default WaylineTable;
|
||||
Reference in New Issue
Block a user