| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- import { PageContainer } from '@ant-design/pro-layout';
- import BaseService from '@/utils/BaseService';
- import type { ProColumns, ActionType } from '@jetlinks/pro-table';
- import { message, Popconfirm, Tooltip } from 'antd';
- import moment from 'moment';
- import { useRef } from 'react';
- import BaseCrud from '@/components/BaseCrud';
- import { useIntl } from '@@/plugin-locale/localeExports';
- import { EditOutlined, EyeOutlined, MinusOutlined } from '@ant-design/icons';
- import { CurdModel } from '@/components/BaseCrud/model';
- const service = new BaseService('firmware');
- const Firmware = () => {
- const actionRef = useRef<ActionType>();
- const intl = useIntl();
- const columns: ProColumns<FirmwareItem>[] = [
- {
- title: '固件名称',
- dataIndex: 'name',
- },
- {
- title: '固件版本',
- dataIndex: 'version',
- },
- {
- title: '所属产品',
- dataIndex: 'productName',
- },
- {
- title: '签名方式',
- dataIndex: 'signMethod',
- },
- {
- title: '创建时间',
- dataIndex: 'createTime',
- width: '200px',
- align: 'center',
- render: (text: any) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
- sorter: true,
- defaultSortOrder: 'descend',
- },
- {
- title: intl.formatMessage({
- id: 'pages.data.option',
- defaultMessage: '操作',
- }),
- valueType: 'option',
- align: 'center',
- width: 200,
- render: (text, record) => [
- <a
- onClick={() => {
- // router.push(`/device/firmware/save/${record.id}`);
- }}
- >
- <Tooltip
- title={intl.formatMessage({
- id: 'pages.data.option.detail',
- defaultMessage: '查看',
- })}
- key={'detail'}
- >
- <EyeOutlined />
- </Tooltip>
- </a>,
- <a key="editable" onClick={() => CurdModel.update(record)}>
- <Tooltip
- title={intl.formatMessage({
- id: 'pages.data.option.edit',
- defaultMessage: '编辑',
- })}
- >
- <EditOutlined />
- </Tooltip>
- </a>,
- <a>
- <Popconfirm
- title={intl.formatMessage({
- id: 'pages.data.option.remove.tips',
- defaultMessage: '确认删除?',
- })}
- onConfirm={async () => {
- await service.remove(record.id);
- message.success(
- intl.formatMessage({
- id: 'pages.data.option.success',
- defaultMessage: '操作成功!',
- }),
- );
- actionRef.current?.reload();
- }}
- >
- <Tooltip
- title={intl.formatMessage({
- id: 'pages.data.option.remove',
- defaultMessage: '删除',
- })}
- >
- <MinusOutlined />
- </Tooltip>
- </Popconfirm>
- </a>,
- ],
- },
- ];
- const schema = {};
- return (
- <PageContainer>
- <BaseCrud<FirmwareItem>
- columns={columns}
- service={service}
- title={'固件升级'}
- schema={schema}
- actionRef={actionRef}
- />
- </PageContainer>
- );
- };
- export default Firmware;
|