|
@@ -3,16 +3,21 @@ import type { ActionType, ProColumns } from '@jetlinks/pro-table';
|
|
|
import ProTable from '@jetlinks/pro-table';
|
|
import ProTable from '@jetlinks/pro-table';
|
|
|
import { Button, Popconfirm, Tooltip } from 'antd';
|
|
import { Button, Popconfirm, Tooltip } from 'antd';
|
|
|
import moment from 'moment';
|
|
import moment from 'moment';
|
|
|
-import { useRef } from 'react';
|
|
|
|
|
|
|
+import { useRef, useState } from 'react';
|
|
|
import { useIntl } from '@@/plugin-locale/localeExports';
|
|
import { useIntl } from '@@/plugin-locale/localeExports';
|
|
|
import { EditOutlined, EyeOutlined, MinusOutlined, PlusOutlined } from '@ant-design/icons';
|
|
import { EditOutlined, EyeOutlined, MinusOutlined, PlusOutlined } from '@ant-design/icons';
|
|
|
-import { Link } from 'umi';
|
|
|
|
|
|
|
+import { Link, useHistory } from 'umi';
|
|
|
import { model } from '@formily/reactive';
|
|
import { model } from '@formily/reactive';
|
|
|
import { observer } from '@formily/react';
|
|
import { observer } from '@formily/react';
|
|
|
import type { FirmwareItem, TaskItem } from '@/pages/device/Firmware/typings';
|
|
import type { FirmwareItem, TaskItem } from '@/pages/device/Firmware/typings';
|
|
|
import Service from '@/pages/device/Firmware/service';
|
|
import Service from '@/pages/device/Firmware/service';
|
|
|
import Save from '@/pages/device/Firmware/Save';
|
|
import Save from '@/pages/device/Firmware/Save';
|
|
|
import { onlyMessage } from '@/utils/util';
|
|
import { onlyMessage } from '@/utils/util';
|
|
|
|
|
+import { PermissionButton } from '@/components';
|
|
|
|
|
+import useDomFullHeight from '@/hooks/document/useDomFullHeight';
|
|
|
|
|
+import usePermissions from '@/hooks/permission';
|
|
|
|
|
+import SearchComponent from '@/components/SearchComponent';
|
|
|
|
|
+import { getMenuPathByParams, MENUS_CODE } from '@/utils/menu';
|
|
|
|
|
|
|
|
export const service = new Service('firmware');
|
|
export const service = new Service('firmware');
|
|
|
|
|
|
|
@@ -35,18 +40,18 @@ export const state = model<{
|
|
|
const Firmware = observer(() => {
|
|
const Firmware = observer(() => {
|
|
|
const actionRef = useRef<ActionType>();
|
|
const actionRef = useRef<ActionType>();
|
|
|
const intl = useIntl();
|
|
const intl = useIntl();
|
|
|
|
|
+ const { minHeight } = useDomFullHeight(`.firmware`, 24);
|
|
|
|
|
+ const { permission } = usePermissions('device/Firmware');
|
|
|
|
|
+ const [param, setParam] = useState({});
|
|
|
|
|
+ const history = useHistory<Record<string, string>>();
|
|
|
|
|
|
|
|
const columns: ProColumns<FirmwareItem>[] = [
|
|
const columns: ProColumns<FirmwareItem>[] = [
|
|
|
{
|
|
{
|
|
|
- dataIndex: 'index',
|
|
|
|
|
- valueType: 'indexBorder',
|
|
|
|
|
- width: 48,
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
title: intl.formatMessage({
|
|
title: intl.formatMessage({
|
|
|
id: 'pages.device.firmware.name',
|
|
id: 'pages.device.firmware.name',
|
|
|
defaultMessage: '固件名称',
|
|
defaultMessage: '固件名称',
|
|
|
}),
|
|
}),
|
|
|
|
|
+ ellipsis: true,
|
|
|
dataIndex: 'name',
|
|
dataIndex: 'name',
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -54,6 +59,7 @@ const Firmware = observer(() => {
|
|
|
id: 'pages.device.firmware.version',
|
|
id: 'pages.device.firmware.version',
|
|
|
defaultMessage: '固件版本',
|
|
defaultMessage: '固件版本',
|
|
|
}),
|
|
}),
|
|
|
|
|
+ ellipsis: true,
|
|
|
dataIndex: 'version',
|
|
dataIndex: 'version',
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -61,6 +67,7 @@ const Firmware = observer(() => {
|
|
|
id: 'pages.device.firmware.productName',
|
|
id: 'pages.device.firmware.productName',
|
|
|
defaultMessage: '所属产品',
|
|
defaultMessage: '所属产品',
|
|
|
}),
|
|
}),
|
|
|
|
|
+ ellipsis: true,
|
|
|
dataIndex: 'productName',
|
|
dataIndex: 'productName',
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -68,6 +75,7 @@ const Firmware = observer(() => {
|
|
|
id: 'pages.device.firmware.signMethod',
|
|
id: 'pages.device.firmware.signMethod',
|
|
|
defaultMessage: '签名方式',
|
|
defaultMessage: '签名方式',
|
|
|
}),
|
|
}),
|
|
|
|
|
+ ellipsis: true,
|
|
|
dataIndex: 'signMethod',
|
|
dataIndex: 'signMethod',
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -78,9 +86,20 @@ const Firmware = observer(() => {
|
|
|
dataIndex: 'createTime',
|
|
dataIndex: 'createTime',
|
|
|
width: '200px',
|
|
width: '200px',
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
|
|
+ ellipsis: true,
|
|
|
|
|
+ valueType: 'dateTime',
|
|
|
render: (text: any) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
|
|
render: (text: any) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
- sorter: true,
|
|
|
|
|
- defaultSortOrder: 'descend',
|
|
|
|
|
|
|
+ // sorter: true,
|
|
|
|
|
+ // defaultSortOrder: 'descend',
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ title: intl.formatMessage({
|
|
|
|
|
+ id: 'pages.table.description',
|
|
|
|
|
+ defaultMessage: '说明',
|
|
|
|
|
+ }),
|
|
|
|
|
+ ellipsis: true,
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ dataIndex: 'description',
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: intl.formatMessage({
|
|
title: intl.formatMessage({
|
|
@@ -157,20 +176,50 @@ const Firmware = observer(() => {
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<PageContainer>
|
|
<PageContainer>
|
|
|
|
|
+ <SearchComponent<FirmwareItem>
|
|
|
|
|
+ field={columns}
|
|
|
|
|
+ target="firmware"
|
|
|
|
|
+ onSearch={(data) => {
|
|
|
|
|
+ // 重置分页数据
|
|
|
|
|
+ actionRef.current?.reset?.();
|
|
|
|
|
+ setParam(data);
|
|
|
|
|
+ }}
|
|
|
|
|
+ />
|
|
|
<ProTable<FirmwareItem>
|
|
<ProTable<FirmwareItem>
|
|
|
- toolBarRender={() => [
|
|
|
|
|
- <Button
|
|
|
|
|
- onClick={() => {
|
|
|
|
|
- state.visible = true;
|
|
|
|
|
- }}
|
|
|
|
|
- key="button"
|
|
|
|
|
- icon={<PlusOutlined />}
|
|
|
|
|
- type="primary"
|
|
|
|
|
- >
|
|
|
|
|
- 新增
|
|
|
|
|
- </Button>,
|
|
|
|
|
- ]}
|
|
|
|
|
- request={async (params) => service.query(params)}
|
|
|
|
|
|
|
+ scroll={{ x: 1366 }}
|
|
|
|
|
+ tableClassName={'firmware'}
|
|
|
|
|
+ tableStyle={{ minHeight }}
|
|
|
|
|
+ search={false}
|
|
|
|
|
+ params={param}
|
|
|
|
|
+ headerTitle={
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <PermissionButton
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ state.visible = true;
|
|
|
|
|
+ }}
|
|
|
|
|
+ isPermission={permission.add}
|
|
|
|
|
+ key="button"
|
|
|
|
|
+ icon={<PlusOutlined />}
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ >
|
|
|
|
|
+ {intl.formatMessage({
|
|
|
|
|
+ id: 'pages.data.option.add',
|
|
|
|
|
+ defaultMessage: '新增',
|
|
|
|
|
+ })}
|
|
|
|
|
+ </PermissionButton>
|
|
|
|
|
+ <Button
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ const url = getMenuPathByParams(MENUS_CODE['device/Firmware/Task'], '123');
|
|
|
|
|
+ history.push(url);
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ 升级任务
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ }
|
|
|
|
|
+ request={async (params) =>
|
|
|
|
|
+ service.query({ ...params, sorts: [{ name: 'createTime', order: 'desc' }] })
|
|
|
|
|
+ }
|
|
|
columns={columns}
|
|
columns={columns}
|
|
|
actionRef={actionRef}
|
|
actionRef={actionRef}
|
|
|
/>
|
|
/>
|