|
@@ -4,7 +4,7 @@ import type { DeviceInstance } from '@/pages/device/Instance/typings';
|
|
|
import moment from 'moment';
|
|
import moment from 'moment';
|
|
|
import { Badge, Button, Dropdown, Menu, message, Popconfirm, Tooltip } from 'antd';
|
|
import { Badge, Button, Dropdown, Menu, message, Popconfirm, Tooltip } from 'antd';
|
|
|
import { useRef, useState } from 'react';
|
|
import { useRef, useState } from 'react';
|
|
|
-import { Link } from 'umi';
|
|
|
|
|
|
|
+import { useHistory } from 'umi';
|
|
|
import {
|
|
import {
|
|
|
CheckCircleOutlined,
|
|
CheckCircleOutlined,
|
|
|
DeleteOutlined,
|
|
DeleteOutlined,
|
|
@@ -28,6 +28,7 @@ import { ProTableCard } from '@/components';
|
|
|
import SystemConst from '@/utils/const';
|
|
import SystemConst from '@/utils/const';
|
|
|
import Token from '@/utils/token';
|
|
import Token from '@/utils/token';
|
|
|
import DeviceCard from '@/components/ProTableCard/CardItems/device';
|
|
import DeviceCard from '@/components/ProTableCard/CardItems/device';
|
|
|
|
|
+import { getMenuPathByParams, MENUS_CODE } from '@/utils/menu';
|
|
|
|
|
|
|
|
export const statusMap = new Map();
|
|
export const statusMap = new Map();
|
|
|
statusMap.set('在线', 'success');
|
|
statusMap.set('在线', 'success');
|
|
@@ -63,26 +64,29 @@ const Instance = () => {
|
|
|
const [current, setCurrent] = useState<Partial<DeviceInstance>>({});
|
|
const [current, setCurrent] = useState<Partial<DeviceInstance>>({});
|
|
|
const [searchParams, setSearchParams] = useState<any>({});
|
|
const [searchParams, setSearchParams] = useState<any>({});
|
|
|
const [bindKeys, setBindKeys] = useState<any[]>([]);
|
|
const [bindKeys, setBindKeys] = useState<any[]>([]);
|
|
|
|
|
+ const history = useHistory<Record<string, string>>();
|
|
|
const intl = useIntl();
|
|
const intl = useIntl();
|
|
|
|
|
|
|
|
const tools = (record: DeviceInstance) => [
|
|
const tools = (record: DeviceInstance) => [
|
|
|
- <Link
|
|
|
|
|
- onClick={() => {
|
|
|
|
|
- InstanceModel.current = record;
|
|
|
|
|
- }}
|
|
|
|
|
- to={`/device/instance/detail/${record.id}`}
|
|
|
|
|
- key="link"
|
|
|
|
|
|
|
+ <Tooltip
|
|
|
|
|
+ title={intl.formatMessage({
|
|
|
|
|
+ id: 'pages.data.option.detail',
|
|
|
|
|
+ defaultMessage: '查看',
|
|
|
|
|
+ })}
|
|
|
|
|
+ key={'detail'}
|
|
|
>
|
|
>
|
|
|
- <Tooltip
|
|
|
|
|
- title={intl.formatMessage({
|
|
|
|
|
- id: 'pages.data.option.detail',
|
|
|
|
|
- defaultMessage: '查看',
|
|
|
|
|
- })}
|
|
|
|
|
- key={'detail'}
|
|
|
|
|
|
|
+ <Button
|
|
|
|
|
+ type={'link'}
|
|
|
|
|
+ style={{ padding: 0 }}
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ InstanceModel.current = record;
|
|
|
|
|
+ const url = getMenuPathByParams(MENUS_CODE['device/Instance/Detail'], record.id);
|
|
|
|
|
+ history.push(url);
|
|
|
|
|
+ }}
|
|
|
>
|
|
>
|
|
|
<EyeOutlined />
|
|
<EyeOutlined />
|
|
|
- </Tooltip>
|
|
|
|
|
- </Link>,
|
|
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </Tooltip>,
|
|
|
<Popconfirm
|
|
<Popconfirm
|
|
|
title={intl.formatMessage({
|
|
title={intl.formatMessage({
|
|
|
id: `pages.data.option.${record.state.value !== 'notActive' ? 'disabled' : 'enabled'}.tips`,
|
|
id: `pages.data.option.${record.state.value !== 'notActive' ? 'disabled' : 'enabled'}.tips`,
|
|
@@ -109,7 +113,7 @@ const Instance = () => {
|
|
|
defaultMessage: record.state.value !== 'notActive' ? '禁用' : '启用',
|
|
defaultMessage: record.state.value !== 'notActive' ? '禁用' : '启用',
|
|
|
})}
|
|
})}
|
|
|
>
|
|
>
|
|
|
- <Button type={'link'}>
|
|
|
|
|
|
|
+ <Button type={'link'} style={{ padding: 0 }}>
|
|
|
{record.state.value !== 'notActive' ? <StopOutlined /> : <CheckCircleOutlined />}
|
|
{record.state.value !== 'notActive' ? <StopOutlined /> : <CheckCircleOutlined />}
|
|
|
</Button>
|
|
</Button>
|
|
|
</Tooltip>
|
|
</Tooltip>
|
|
@@ -142,7 +146,7 @@ const Instance = () => {
|
|
|
defaultMessage: '删除',
|
|
defaultMessage: '删除',
|
|
|
})}
|
|
})}
|
|
|
>
|
|
>
|
|
|
- <Button type={'link'}>
|
|
|
|
|
|
|
+ <Button type={'link'} style={{ padding: 0 }}>
|
|
|
<DeleteOutlined />
|
|
<DeleteOutlined />
|
|
|
</Button>
|
|
</Button>
|
|
|
</Tooltip>
|
|
</Tooltip>
|
|
@@ -344,6 +348,7 @@ const Instance = () => {
|
|
|
field={columns}
|
|
field={columns}
|
|
|
target="device-instance"
|
|
target="device-instance"
|
|
|
onSearch={(data) => {
|
|
onSearch={(data) => {
|
|
|
|
|
+ console.log(data);
|
|
|
// 重置分页数据
|
|
// 重置分页数据
|
|
|
actionRef.current?.reset?.();
|
|
actionRef.current?.reset?.();
|
|
|
setSearchParams(data);
|
|
setSearchParams(data);
|