|
@@ -1,21 +1,36 @@
|
|
|
import { PageContainer } from '@ant-design/pro-layout';
|
|
import { PageContainer } from '@ant-design/pro-layout';
|
|
|
import SearchComponent from '@/components/SearchComponent';
|
|
import SearchComponent from '@/components/SearchComponent';
|
|
|
-import { useRef, useState } from 'react';
|
|
|
|
|
|
|
+import { useRef, useState, useEffect } from 'react';
|
|
|
import type { ActionType } from '@jetlinks/pro-table';
|
|
import type { ActionType } from '@jetlinks/pro-table';
|
|
|
-import { PermissionButton, ProTableCard } from '@/components';
|
|
|
|
|
|
|
+import { PermissionButton } from '@/components';
|
|
|
import { useIntl } from '@@/plugin-locale/localeExports';
|
|
import { useIntl } from '@@/plugin-locale/localeExports';
|
|
|
import type { ProColumns } from '@jetlinks/pro-table';
|
|
import type { ProColumns } from '@jetlinks/pro-table';
|
|
|
import type { CardManagement } from './typing';
|
|
import type { CardManagement } from './typing';
|
|
|
-import { Button, Dropdown, Menu } from 'antd';
|
|
|
|
|
|
|
+import { Button, Dropdown, Menu, message, Popconfirm } from 'antd';
|
|
|
import {
|
|
import {
|
|
|
ExportOutlined,
|
|
ExportOutlined,
|
|
|
PlusOutlined,
|
|
PlusOutlined,
|
|
|
ImportOutlined,
|
|
ImportOutlined,
|
|
|
CheckCircleOutlined,
|
|
CheckCircleOutlined,
|
|
|
|
|
+ StopOutlined,
|
|
|
|
|
+ PoweroffOutlined,
|
|
|
|
|
+ SwapOutlined,
|
|
|
|
|
+ DeleteOutlined,
|
|
|
|
|
+ EditOutlined,
|
|
|
|
|
+ LinkOutlined,
|
|
|
|
|
+ EyeOutlined,
|
|
|
} from '@ant-design/icons';
|
|
} from '@ant-design/icons';
|
|
|
|
|
+import ProTable from '@jetlinks/pro-table';
|
|
|
|
|
+import Service from './service';
|
|
|
import SaveModal from './SaveModal';
|
|
import SaveModal from './SaveModal';
|
|
|
import ExportModal from '@/pages/iot-card/CardManagement/ExportModal';
|
|
import ExportModal from '@/pages/iot-card/CardManagement/ExportModal';
|
|
|
-import Service from './service';
|
|
|
|
|
|
|
+import ImportModal from '@/pages/iot-card/CardManagement/ImportModal';
|
|
|
|
|
+import BindDeviceModal from '@/pages/iot-card/CardManagement/BindDevice';
|
|
|
|
|
+import moment from 'moment';
|
|
|
|
|
+import { useDomFullHeight } from '@/hooks';
|
|
|
|
|
+import { onlyMessage } from '@/utils/util';
|
|
|
|
|
+import { useHistory, useLocation } from 'umi';
|
|
|
|
|
+import { getMenuPathByParams } from '@/utils/menu';
|
|
|
|
|
|
|
|
export const service = new Service('network/card');
|
|
export const service = new Service('network/card');
|
|
|
|
|
|
|
@@ -25,10 +40,22 @@ const CardManagementNode = () => {
|
|
|
const [visible, setVisible] = useState<boolean>(false);
|
|
const [visible, setVisible] = useState<boolean>(false);
|
|
|
const [exportVisible, setExportVisible] = useState<boolean>(false); // 导出
|
|
const [exportVisible, setExportVisible] = useState<boolean>(false); // 导出
|
|
|
const [importVisible, setImportVisible] = useState<boolean>(false); // 导入
|
|
const [importVisible, setImportVisible] = useState<boolean>(false); // 导入
|
|
|
|
|
+ const [bindDeviceVisible, setBindDeviceVisible] = useState<boolean>(false); // 绑定设备
|
|
|
const [current, setCurrent] = useState<Partial<CardManagement>>({});
|
|
const [current, setCurrent] = useState<Partial<CardManagement>>({});
|
|
|
const [bindKeys, setBindKeys] = useState<any[]>([]);
|
|
const [bindKeys, setBindKeys] = useState<any[]>([]);
|
|
|
|
|
+ const { minHeight } = useDomFullHeight(`.iot-card-management`, 24);
|
|
|
const { permission } = PermissionButton.usePermission('device/Instance');
|
|
const { permission } = PermissionButton.usePermission('device/Instance');
|
|
|
const intl = useIntl();
|
|
const intl = useIntl();
|
|
|
|
|
+ const history = useHistory();
|
|
|
|
|
+ const location = useLocation();
|
|
|
|
|
+
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ const { state } = location;
|
|
|
|
|
+ if (state && state.save) {
|
|
|
|
|
+ setVisible(true);
|
|
|
|
|
+ setCurrent({});
|
|
|
|
|
+ }
|
|
|
|
|
+ }, [location]);
|
|
|
|
|
|
|
|
const columns: ProColumns<CardManagement>[] = [
|
|
const columns: ProColumns<CardManagement>[] = [
|
|
|
{
|
|
{
|
|
@@ -48,71 +75,239 @@ const CardManagementNode = () => {
|
|
|
title: '绑定设备',
|
|
title: '绑定设备',
|
|
|
dataIndex: 'deviceId',
|
|
dataIndex: 'deviceId',
|
|
|
ellipsis: true,
|
|
ellipsis: true,
|
|
|
|
|
+ width: 200,
|
|
|
|
|
+ hideInSearch: true,
|
|
|
|
|
+ render: (_, record) => record.deviceName,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '平台对接',
|
|
title: '平台对接',
|
|
|
dataIndex: 'platformConfigId',
|
|
dataIndex: 'platformConfigId',
|
|
|
|
|
+ width: 200,
|
|
|
|
|
+ valueType: 'select',
|
|
|
|
|
+ request: () =>
|
|
|
|
|
+ service
|
|
|
|
|
+ .queryPlatformNoPage({
|
|
|
|
|
+ sorts: [{ name: 'createTime', order: 'desc' }],
|
|
|
|
|
+ terms: [{ column: 'state', value: 'enabled' }],
|
|
|
|
|
+ })
|
|
|
|
|
+ .then((resp) => resp.result.map((item: any) => ({ label: item.name, value: item.id }))),
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '运营商',
|
|
title: '运营商',
|
|
|
dataIndex: 'operatorName',
|
|
dataIndex: 'operatorName',
|
|
|
|
|
+ width: 120,
|
|
|
|
|
+ valueType: 'select',
|
|
|
|
|
+ request: async () => {
|
|
|
|
|
+ return [
|
|
|
|
|
+ { label: '移动', value: '移动' },
|
|
|
|
|
+ { label: '电信', value: '电信' },
|
|
|
|
|
+ { label: '联通', value: '联通' },
|
|
|
|
|
+ ];
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '类型',
|
|
title: '类型',
|
|
|
dataIndex: 'cardType',
|
|
dataIndex: 'cardType',
|
|
|
|
|
+ width: 120,
|
|
|
|
|
+ valueType: 'select',
|
|
|
|
|
+ render(_, record) {
|
|
|
|
|
+ return record.cardType.text;
|
|
|
|
|
+ },
|
|
|
|
|
+ request: async () => {
|
|
|
|
|
+ return [
|
|
|
|
|
+ { label: '年卡', value: 'year' },
|
|
|
|
|
+ { label: '季卡', value: 'season' },
|
|
|
|
|
+ { label: '月卡', value: 'month' },
|
|
|
|
|
+ { label: '其他', value: 'other' },
|
|
|
|
|
+ ];
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '总流量',
|
|
title: '总流量',
|
|
|
dataIndex: 'totalFlow',
|
|
dataIndex: 'totalFlow',
|
|
|
|
|
+ width: 120,
|
|
|
|
|
+ render: (_, record) => (record.totalFlow ? record.totalFlow.toFixed(2) + ' M' : ''),
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '使用流量',
|
|
title: '使用流量',
|
|
|
dataIndex: 'usedFlow',
|
|
dataIndex: 'usedFlow',
|
|
|
|
|
+ width: 120,
|
|
|
|
|
+ render: (_, record) => (record.usedFlow ? record.usedFlow.toFixed(2) + ' M' : ''),
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '剩余流量',
|
|
title: '剩余流量',
|
|
|
dataIndex: 'residualFlow',
|
|
dataIndex: 'residualFlow',
|
|
|
|
|
+ width: 120,
|
|
|
|
|
+ render: (_, record) => (record.residualFlow ? record.residualFlow.toFixed(2) + ' M' : ''),
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '激活日期',
|
|
title: '激活日期',
|
|
|
dataIndex: 'activationDate',
|
|
dataIndex: 'activationDate',
|
|
|
|
|
+ width: 200,
|
|
|
|
|
+ render: (_, record) =>
|
|
|
|
|
+ record.activationDate ? moment(record.activationDate).format('YYYY-MM-DD HH:mm:ss') : '',
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '更新时间',
|
|
title: '更新时间',
|
|
|
dataIndex: 'updateTime',
|
|
dataIndex: 'updateTime',
|
|
|
|
|
+ width: 200,
|
|
|
|
|
+ render: (_, record) =>
|
|
|
|
|
+ record.updateTime ? moment(record.updateTime).format('YYYY-MM-DD HH:mm:ss') : '',
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '状态',
|
|
title: '状态',
|
|
|
dataIndex: 'cardStateType',
|
|
dataIndex: 'cardStateType',
|
|
|
- valueEnum: {
|
|
|
|
|
- using: {
|
|
|
|
|
- text: '正常',
|
|
|
|
|
- status: 'using',
|
|
|
|
|
- },
|
|
|
|
|
- toBeActivated: {
|
|
|
|
|
- text: '未激活',
|
|
|
|
|
- status: 'using',
|
|
|
|
|
- },
|
|
|
|
|
- deactivate: {
|
|
|
|
|
- text: '停机',
|
|
|
|
|
- status: 'using',
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ width: 180,
|
|
|
|
|
+ valueType: 'select',
|
|
|
|
|
+ render(_, record) {
|
|
|
|
|
+ return record.cardStateType?.text;
|
|
|
|
|
+ },
|
|
|
|
|
+ request: async () => {
|
|
|
|
|
+ return [
|
|
|
|
|
+ { label: '正常', value: 'using' },
|
|
|
|
|
+ { label: '未激活', value: 'toBeActivated' },
|
|
|
|
|
+ { label: '停机', value: 'deactivate' },
|
|
|
|
|
+ ];
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '操作',
|
|
title: '操作',
|
|
|
valueType: 'option',
|
|
valueType: 'option',
|
|
|
- width: 120,
|
|
|
|
|
|
|
+ width: 200,
|
|
|
fixed: 'right',
|
|
fixed: 'right',
|
|
|
render: (_, record) => {
|
|
render: (_, record) => {
|
|
|
- console.log(_, record);
|
|
|
|
|
- return [];
|
|
|
|
|
|
|
+ return [
|
|
|
|
|
+ <PermissionButton
|
|
|
|
|
+ style={{ padding: 0 }}
|
|
|
|
|
+ type="link"
|
|
|
|
|
+ isPermission={permission.update}
|
|
|
|
|
+ key="editable"
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ setCurrent(record);
|
|
|
|
|
+ setVisible(true);
|
|
|
|
|
+ }}
|
|
|
|
|
+ tooltip={{
|
|
|
|
|
+ title: intl.formatMessage({
|
|
|
|
|
+ id: 'pages.data.option.edit',
|
|
|
|
|
+ defaultMessage: '编辑',
|
|
|
|
|
+ }),
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <EditOutlined />
|
|
|
|
|
+ </PermissionButton>,
|
|
|
|
|
+ <PermissionButton
|
|
|
|
|
+ style={{ padding: 0 }}
|
|
|
|
|
+ type="link"
|
|
|
|
|
+ isPermission={true}
|
|
|
|
|
+ key="view"
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ const url = getMenuPathByParams('iot-card/CardManagement/Detail', record.id);
|
|
|
|
|
+ history.push(url);
|
|
|
|
|
+ }}
|
|
|
|
|
+ tooltip={{
|
|
|
|
|
+ title: '查看',
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <EyeOutlined />
|
|
|
|
|
+ </PermissionButton>,
|
|
|
|
|
+ <PermissionButton
|
|
|
|
|
+ type="link"
|
|
|
|
|
+ key="bindDevice"
|
|
|
|
|
+ style={{ padding: 0 }}
|
|
|
|
|
+ isPermission={permission.delete}
|
|
|
|
|
+ tooltip={{ title: '绑定设备' }}
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ setBindDeviceVisible(true);
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <LinkOutlined />
|
|
|
|
|
+ </PermissionButton>,
|
|
|
|
|
+ record.cardStateType.value === 'toBeActivated' ? (
|
|
|
|
|
+ <PermissionButton
|
|
|
|
|
+ type="link"
|
|
|
|
|
+ key="activation"
|
|
|
|
|
+ style={{ padding: 0 }}
|
|
|
|
|
+ isPermission={permission.active}
|
|
|
|
|
+ tooltip={{ title: '激活' }}
|
|
|
|
|
+ popConfirm={{
|
|
|
|
|
+ title: '确认激活?',
|
|
|
|
|
+ onConfirm: async () => {
|
|
|
|
|
+ service.changeDeploy(record.id).then((resp) => {
|
|
|
|
|
+ if (resp.status === 200) {
|
|
|
|
|
+ message.success('操作成功');
|
|
|
|
|
+ actionRef.current?.reload();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <CheckCircleOutlined />
|
|
|
|
|
+ </PermissionButton>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <PermissionButton
|
|
|
|
|
+ type="link"
|
|
|
|
|
+ key="activation"
|
|
|
|
|
+ style={{ padding: 0 }}
|
|
|
|
|
+ isPermission={permission.action}
|
|
|
|
|
+ tooltip={{ title: record.cardStateType.value === 'deactivate' ? '复机' : '停用' }}
|
|
|
|
|
+ popConfirm={{
|
|
|
|
|
+ title: record.cardStateType.value === 'deactivate' ? '确认复机?' : '确认停用?',
|
|
|
|
|
+ onConfirm: async () => {
|
|
|
|
|
+ if (record.cardStateType.value === 'deactivate') {
|
|
|
|
|
+ service.resumption(record.id).then((resp) => {
|
|
|
|
|
+ if (resp.status === 200) {
|
|
|
|
|
+ message.success('操作成功');
|
|
|
|
|
+ actionRef.current?.reload();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ service.unDeploy(record.id).then((resp) => {
|
|
|
|
|
+ if (resp.status === 200) {
|
|
|
|
|
+ message.success('操作成功');
|
|
|
|
|
+ actionRef.current?.reload();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ {record.cardStateType.value === 'deactivate' ? (
|
|
|
|
|
+ <PoweroffOutlined />
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <StopOutlined />
|
|
|
|
|
+ )}
|
|
|
|
|
+ </PermissionButton>
|
|
|
|
|
+ ),
|
|
|
|
|
+ <PermissionButton
|
|
|
|
|
+ type="link"
|
|
|
|
|
+ key="delete"
|
|
|
|
|
+ style={{ padding: 0 }}
|
|
|
|
|
+ isPermission={permission.delete}
|
|
|
|
|
+ tooltip={{ title: '删除' }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Popconfirm
|
|
|
|
|
+ onConfirm={async () => {
|
|
|
|
|
+ const resp: any = await service.remove(record.id);
|
|
|
|
|
+ if (resp.status === 200) {
|
|
|
|
|
+ onlyMessage(
|
|
|
|
|
+ intl.formatMessage({
|
|
|
|
|
+ id: 'pages.data.option.success',
|
|
|
|
|
+ defaultMessage: '操作成功!',
|
|
|
|
|
+ }),
|
|
|
|
|
+ );
|
|
|
|
|
+ actionRef.current?.reload();
|
|
|
|
|
+ }
|
|
|
|
|
+ }}
|
|
|
|
|
+ title="确认删除?"
|
|
|
|
|
+ >
|
|
|
|
|
+ <DeleteOutlined />
|
|
|
|
|
+ </Popconfirm>
|
|
|
|
|
+ </PermissionButton>,
|
|
|
|
|
+ ];
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
- console.log(exportVisible, importVisible);
|
|
|
|
|
-
|
|
|
|
|
const menu = (
|
|
const menu = (
|
|
|
<Menu>
|
|
<Menu>
|
|
|
<Menu.Item key="1">
|
|
<Menu.Item key="1">
|
|
@@ -125,7 +320,7 @@ const CardManagementNode = () => {
|
|
|
}}
|
|
}}
|
|
|
style={{ width: '100%' }}
|
|
style={{ width: '100%' }}
|
|
|
>
|
|
>
|
|
|
- 导出
|
|
|
|
|
|
|
+ 批量导出
|
|
|
</PermissionButton>
|
|
</PermissionButton>
|
|
|
</Menu.Item>
|
|
</Menu.Item>
|
|
|
<Menu.Item key="2">
|
|
<Menu.Item key="2">
|
|
@@ -138,87 +333,126 @@ const CardManagementNode = () => {
|
|
|
}}
|
|
}}
|
|
|
style={{ width: '100%' }}
|
|
style={{ width: '100%' }}
|
|
|
>
|
|
>
|
|
|
- 导入
|
|
|
|
|
|
|
+ 批量导入
|
|
|
</PermissionButton>
|
|
</PermissionButton>
|
|
|
</Menu.Item>
|
|
</Menu.Item>
|
|
|
- {bindKeys.length > 0 && (
|
|
|
|
|
- <Menu.Item key="3">
|
|
|
|
|
- <PermissionButton
|
|
|
|
|
- isPermission={permission.action}
|
|
|
|
|
- icon={<CheckCircleOutlined />}
|
|
|
|
|
- type="primary"
|
|
|
|
|
- ghost
|
|
|
|
|
- popConfirm={{
|
|
|
|
|
- title: '确认激活吗?',
|
|
|
|
|
- onConfirm: async () => {},
|
|
|
|
|
- }}
|
|
|
|
|
- style={{ width: '100%' }}
|
|
|
|
|
- >
|
|
|
|
|
- 激活
|
|
|
|
|
- </PermissionButton>
|
|
|
|
|
- </Menu.Item>
|
|
|
|
|
- )}
|
|
|
|
|
- {bindKeys.length > 0 && (
|
|
|
|
|
- <Menu.Item key="4">
|
|
|
|
|
- <PermissionButton
|
|
|
|
|
- isPermission={permission.stop}
|
|
|
|
|
- icon={<CheckCircleOutlined />}
|
|
|
|
|
- type="primary"
|
|
|
|
|
- ghost
|
|
|
|
|
- popConfirm={{
|
|
|
|
|
- title: '确认停用吗?',
|
|
|
|
|
- onConfirm: async () => {},
|
|
|
|
|
- }}
|
|
|
|
|
- style={{ width: '100%' }}
|
|
|
|
|
- >
|
|
|
|
|
- 停用
|
|
|
|
|
- </PermissionButton>
|
|
|
|
|
- </Menu.Item>
|
|
|
|
|
- )}
|
|
|
|
|
- {bindKeys.length > 0 && (
|
|
|
|
|
- <Menu.Item key="5">
|
|
|
|
|
- <PermissionButton
|
|
|
|
|
- isPermission={permission.restart}
|
|
|
|
|
- icon={<CheckCircleOutlined />}
|
|
|
|
|
- type="primary"
|
|
|
|
|
- ghost
|
|
|
|
|
- popConfirm={{
|
|
|
|
|
- title: '确认复机吗?',
|
|
|
|
|
- onConfirm: async () => {},
|
|
|
|
|
- }}
|
|
|
|
|
- style={{ width: '100%' }}
|
|
|
|
|
- >
|
|
|
|
|
- 复机
|
|
|
|
|
- </PermissionButton>
|
|
|
|
|
- </Menu.Item>
|
|
|
|
|
- )}
|
|
|
|
|
- <Menu.Item key="6">
|
|
|
|
|
|
|
+ <Menu.Item key="3">
|
|
|
<PermissionButton
|
|
<PermissionButton
|
|
|
- isPermission={permission.sync}
|
|
|
|
|
|
|
+ isPermission={permission.active}
|
|
|
icon={<CheckCircleOutlined />}
|
|
icon={<CheckCircleOutlined />}
|
|
|
|
|
+ type="default"
|
|
|
|
|
+ popConfirm={{
|
|
|
|
|
+ title: '确认激活吗?',
|
|
|
|
|
+ onConfirm: async () => {
|
|
|
|
|
+ if (bindKeys.length >= 10 && bindKeys.length <= 100) {
|
|
|
|
|
+ service.changeDeployBatch(bindKeys).then((res) => {
|
|
|
|
|
+ if (res.status === 200) {
|
|
|
|
|
+ message.success('操作成功');
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ message.warn('仅支持同一个运营商下且最少10条数据,最多100条数据');
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ }}
|
|
|
|
|
+ style={{ width: '100%' }}
|
|
|
|
|
+ >
|
|
|
|
|
+ 批量激活
|
|
|
|
|
+ </PermissionButton>
|
|
|
|
|
+ </Menu.Item>
|
|
|
|
|
+ <Menu.Item key="4">
|
|
|
|
|
+ <PermissionButton
|
|
|
|
|
+ isPermission={permission.action}
|
|
|
|
|
+ icon={<StopOutlined />}
|
|
|
type="primary"
|
|
type="primary"
|
|
|
ghost
|
|
ghost
|
|
|
popConfirm={{
|
|
popConfirm={{
|
|
|
- title: '确认同步物联卡状态?',
|
|
|
|
|
- onConfirm: async () => {},
|
|
|
|
|
|
|
+ title: '确认停用吗?',
|
|
|
|
|
+ onConfirm: async () => {
|
|
|
|
|
+ if (bindKeys.length >= 10 && bindKeys.length <= 100) {
|
|
|
|
|
+ service.unDeployBatch(bindKeys).then((res) => {
|
|
|
|
|
+ if (res.status === 200) {
|
|
|
|
|
+ message.success('操作成功');
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ message.warn('仅支持同一个运营商下且最少10条数据,最多100条数据');
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
}}
|
|
}}
|
|
|
|
|
+ style={{ width: '100%' }}
|
|
|
>
|
|
>
|
|
|
- 同步状态
|
|
|
|
|
|
|
+ 批量停用
|
|
|
</PermissionButton>
|
|
</PermissionButton>
|
|
|
</Menu.Item>
|
|
</Menu.Item>
|
|
|
- {bindKeys.length > 0 && (
|
|
|
|
|
|
|
+ <Menu.Item key="5">
|
|
|
<PermissionButton
|
|
<PermissionButton
|
|
|
- isPermission={permission.delete}
|
|
|
|
|
- icon={<CheckCircleOutlined />}
|
|
|
|
|
|
|
+ isPermission={permission.action}
|
|
|
|
|
+ icon={<PoweroffOutlined />}
|
|
|
type="primary"
|
|
type="primary"
|
|
|
ghost
|
|
ghost
|
|
|
popConfirm={{
|
|
popConfirm={{
|
|
|
- title: '确认删除吗?',
|
|
|
|
|
- onConfirm: async () => {},
|
|
|
|
|
|
|
+ title: '确认复机吗?',
|
|
|
|
|
+ onConfirm: async () => {
|
|
|
|
|
+ if (bindKeys.length >= 10 && bindKeys.length <= 100) {
|
|
|
|
|
+ service.resumptionBatch(bindKeys).then((res) => {
|
|
|
|
|
+ if (res.status === 200) {
|
|
|
|
|
+ message.success('操作成功');
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ message.warn('仅支持同一个运营商下且最少10条数据,最多100条数据');
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
}}
|
|
}}
|
|
|
|
|
+ style={{ width: '100%' }}
|
|
|
>
|
|
>
|
|
|
- 批量删除
|
|
|
|
|
|
|
+ 批量复机
|
|
|
</PermissionButton>
|
|
</PermissionButton>
|
|
|
|
|
+ </Menu.Item>
|
|
|
|
|
+ <Menu.Item key="6">
|
|
|
|
|
+ <PermissionButton
|
|
|
|
|
+ isPermission={permission.sync}
|
|
|
|
|
+ icon={<SwapOutlined />}
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ ghost
|
|
|
|
|
+ popConfirm={{
|
|
|
|
|
+ title: '确认同步物联卡状态?',
|
|
|
|
|
+ onConfirm: async () => {
|
|
|
|
|
+ service.sync().then((res) => {
|
|
|
|
|
+ if (res.status === 200) {
|
|
|
|
|
+ actionRef?.current?.reload();
|
|
|
|
|
+ message.success('同步状态成功');
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ 同步状态
|
|
|
|
|
+ </PermissionButton>
|
|
|
|
|
+ </Menu.Item>
|
|
|
|
|
+ {bindKeys.length > 0 && (
|
|
|
|
|
+ <Menu.Item>
|
|
|
|
|
+ <PermissionButton
|
|
|
|
|
+ isPermission={permission.delete}
|
|
|
|
|
+ icon={<DeleteOutlined />}
|
|
|
|
|
+ type="default"
|
|
|
|
|
+ popConfirm={{
|
|
|
|
|
+ title: '确认删除吗?',
|
|
|
|
|
+ onConfirm: async () => {
|
|
|
|
|
+ service.removeCards(bindKeys).then((res) => {
|
|
|
|
|
+ if (res.status === 200) {
|
|
|
|
|
+ setBindKeys([]);
|
|
|
|
|
+ message.success('操作成功');
|
|
|
|
|
+ actionRef?.current?.reload();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ 批量删除
|
|
|
|
|
+ </PermissionButton>
|
|
|
|
|
+ </Menu.Item>
|
|
|
)}
|
|
)}
|
|
|
</Menu>
|
|
</Menu>
|
|
|
);
|
|
);
|
|
@@ -227,12 +461,13 @@ const CardManagementNode = () => {
|
|
|
<PageContainer>
|
|
<PageContainer>
|
|
|
{visible && (
|
|
{visible && (
|
|
|
<SaveModal
|
|
<SaveModal
|
|
|
- type={'add'}
|
|
|
|
|
|
|
+ type={current.id ? 'edit' : 'add'}
|
|
|
onCancel={() => {
|
|
onCancel={() => {
|
|
|
setVisible(false);
|
|
setVisible(false);
|
|
|
}}
|
|
}}
|
|
|
data={current}
|
|
data={current}
|
|
|
onOk={() => {
|
|
onOk={() => {
|
|
|
|
|
+ setCurrent({});
|
|
|
setVisible(false);
|
|
setVisible(false);
|
|
|
actionRef.current?.reload();
|
|
actionRef.current?.reload();
|
|
|
}}
|
|
}}
|
|
@@ -246,6 +481,28 @@ const CardManagementNode = () => {
|
|
|
}}
|
|
}}
|
|
|
/>
|
|
/>
|
|
|
)}
|
|
)}
|
|
|
|
|
+ {importVisible && (
|
|
|
|
|
+ <ImportModal
|
|
|
|
|
+ onCancel={() => {
|
|
|
|
|
+ setImportVisible(false);
|
|
|
|
|
+ }}
|
|
|
|
|
+ onOk={() => {
|
|
|
|
|
+ actionRef.current?.reload();
|
|
|
|
|
+ }}
|
|
|
|
|
+ />
|
|
|
|
|
+ )}
|
|
|
|
|
+ {bindDeviceVisible && (
|
|
|
|
|
+ <BindDeviceModal
|
|
|
|
|
+ cardId={current.id!}
|
|
|
|
|
+ onCancel={() => {
|
|
|
|
|
+ setBindDeviceVisible(false);
|
|
|
|
|
+ }}
|
|
|
|
|
+ onOk={() => {
|
|
|
|
|
+ setBindDeviceVisible(false);
|
|
|
|
|
+ actionRef.current?.reload();
|
|
|
|
|
+ }}
|
|
|
|
|
+ />
|
|
|
|
|
+ )}
|
|
|
<SearchComponent<CardManagement>
|
|
<SearchComponent<CardManagement>
|
|
|
field={columns}
|
|
field={columns}
|
|
|
target="iot-card-management"
|
|
target="iot-card-management"
|
|
@@ -254,12 +511,14 @@ const CardManagementNode = () => {
|
|
|
setSearchParams(data);
|
|
setSearchParams(data);
|
|
|
}}
|
|
}}
|
|
|
/>
|
|
/>
|
|
|
- <ProTableCard<CardManagement>
|
|
|
|
|
|
|
+ <ProTable<CardManagement>
|
|
|
columns={columns}
|
|
columns={columns}
|
|
|
scroll={{ x: 1366 }}
|
|
scroll={{ x: 1366 }}
|
|
|
|
|
+ tableStyle={{ minHeight }}
|
|
|
actionRef={actionRef}
|
|
actionRef={actionRef}
|
|
|
params={searchParams}
|
|
params={searchParams}
|
|
|
options={{ fullScreen: true }}
|
|
options={{ fullScreen: true }}
|
|
|
|
|
+ tableClassName={'iot-card-management'}
|
|
|
columnEmptyText={''}
|
|
columnEmptyText={''}
|
|
|
request={(params) =>
|
|
request={(params) =>
|
|
|
service.query({
|
|
service.query({
|