|
|
@ -17,7 +17,7 @@ import { useParams } from 'react-router-dom'; |
|
|
|
import { advList } from '../services/matrix/admin'; |
|
|
|
// import { RequestOptionsType, ProFieldRequestData } from "@ant-design/pro-utils";
|
|
|
|
|
|
|
|
import { deviceList, incomeDaily1, incomeOverview1, offline } from '@/services/matrix/device'; |
|
|
|
import { deviceList, incomeDaily1, incomeOverview1, offline, online } from '@/services/matrix/device'; |
|
|
|
import { Column } from '@ant-design/charts'; |
|
|
|
import type { ActionType } from '@ant-design/pro-components'; |
|
|
|
import moment from 'moment'; |
|
|
@ -62,6 +62,16 @@ const DeviceOwnerApp: React.FC = () => { |
|
|
|
deviceRef.current?.reload(); |
|
|
|
}; |
|
|
|
|
|
|
|
const handleSetOnline = async (deviceId: string | undefined) => { |
|
|
|
if (!deviceId) { |
|
|
|
return; |
|
|
|
} |
|
|
|
try { |
|
|
|
await online({ deviceId: deviceId }); |
|
|
|
deviceRef.current?.reload(); |
|
|
|
} catch {} |
|
|
|
}; |
|
|
|
|
|
|
|
const [columnsState, setColumnsState] = useState<Record<string, ColumnsState>>({ |
|
|
|
deviceId: { show: !isMobile() }, |
|
|
|
appName: { show: !isMobile() }, |
|
|
@ -210,6 +220,9 @@ const DeviceOwnerApp: React.FC = () => { |
|
|
|
if (record.status === 0) { |
|
|
|
return <a onClick={() => handleSetOffline(record.deviceId)}>下线</a>; |
|
|
|
} |
|
|
|
if (record.status === -1) { |
|
|
|
return <a onClick={() => handleSetOnline(record.deviceId)}>上线</a>; |
|
|
|
} |
|
|
|
return null; |
|
|
|
}, |
|
|
|
}, |
|
|
|