|
|
@@ -20,18 +20,20 @@ import { useState } from 'react';
|
|
|
import { useEffect } from 'react';
|
|
|
import { InstanceModel, service } from '@/pages/device/Instance';
|
|
|
import _ from 'lodash';
|
|
|
-import { onlyMessage, randomString } from '@/utils/util';
|
|
|
+import { onlyMessage } from '@/utils/util';
|
|
|
import { getMenuPathByCode, getMenuPathByParams, MENUS_CODE } from '@/utils/menu';
|
|
|
// import PermissionButton from '@/components/PermissionButton';
|
|
|
import ManualInspection from './ManualInspection';
|
|
|
import useHistory from '@/hooks/route/useHistory';
|
|
|
+import DiagnosticAdvice from './DiagnosticAdvice';
|
|
|
+import BindParentDevice from '@/components/BindParentDevice';
|
|
|
interface Props {
|
|
|
- providerType: 'network' | 'child-device' | 'media' | 'cloud' | 'channel';
|
|
|
+ providerType: 'network' | 'child-device' | 'media' | 'cloud' | 'channel' | undefined;
|
|
|
}
|
|
|
|
|
|
const Status = observer((props: Props) => {
|
|
|
const { providerType } = props;
|
|
|
- const time = 1000;
|
|
|
+ const time = 500;
|
|
|
const device = { ...InstanceModel.detail };
|
|
|
const history = useHistory();
|
|
|
|
|
|
@@ -42,6 +44,11 @@ const Status = observer((props: Props) => {
|
|
|
|
|
|
const [artificialVisible, setArtificialVisible] = useState<boolean>(false);
|
|
|
const [artificiaData, setArtificiaData] = useState<any>({});
|
|
|
+ const [diagnoseVisible, setDiagnoseVisible] = useState<boolean>(false);
|
|
|
+ const [diagnoseData, setDiagnoseData] = useState<any>({});
|
|
|
+
|
|
|
+ // 绑定父设备
|
|
|
+ const [bindParentVisible, setBindParentVisible] = useState<boolean>(false);
|
|
|
|
|
|
// 跳转到产品设备接入配置
|
|
|
const jumpAccessConfig = () => {
|
|
|
@@ -368,7 +375,7 @@ const Status = observer((props: Props) => {
|
|
|
|
|
|
// 网关父设备
|
|
|
const diagnoseParentDevice = () =>
|
|
|
- new Promise((resolve) => {
|
|
|
+ new Promise(async (resolve) => {
|
|
|
DiagnoseStatusModel.count++;
|
|
|
if (device.state?.value === 'online') {
|
|
|
setTimeout(() => {
|
|
|
@@ -399,7 +406,15 @@ const Status = observer((props: Props) => {
|
|
|
status="default"
|
|
|
text={
|
|
|
<span>
|
|
|
- 未绑定父设备,请先<a>绑定</a>父设备后重试
|
|
|
+ 未绑定父设备,请先
|
|
|
+ <a
|
|
|
+ onClick={() => {
|
|
|
+ setBindParentVisible(true);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 绑定
|
|
|
+ </a>
|
|
|
+ 父设备后重试
|
|
|
</span>
|
|
|
}
|
|
|
/>
|
|
|
@@ -411,6 +426,67 @@ const Status = observer((props: Props) => {
|
|
|
resolve({});
|
|
|
}, time);
|
|
|
} else {
|
|
|
+ let item: ListProps | undefined = undefined;
|
|
|
+ const response = await service.detail(device?.parentId);
|
|
|
+ if (response.status === 200) {
|
|
|
+ if (response?.state?.value === 'notActive') {
|
|
|
+ item = {
|
|
|
+ key: 'parent-device',
|
|
|
+ name: '网关父设备',
|
|
|
+ desc: '诊断网关父设备状态是否正常,禁用或离线将导致连接失败',
|
|
|
+ status: 'error',
|
|
|
+ text: '异常',
|
|
|
+ info: (
|
|
|
+ <div>
|
|
|
+ <div className={styles.infoItem}>
|
|
|
+ <Badge
|
|
|
+ status="default"
|
|
|
+ text={
|
|
|
+ <span>
|
|
|
+ 网关父设备已禁用,请先<a>启用</a>
|
|
|
+ </span>
|
|
|
+ }
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ ),
|
|
|
+ };
|
|
|
+ } else if (response?.state?.value === 'online') {
|
|
|
+ item = {
|
|
|
+ key: 'parent-device',
|
|
|
+ name: '网关父设备',
|
|
|
+ desc: '诊断网关父设备状态是否正常,禁用或离线将导致连接失败',
|
|
|
+ status: 'success',
|
|
|
+ text: '正常',
|
|
|
+ info: null,
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ item = {
|
|
|
+ key: 'parent-device',
|
|
|
+ name: '网关父设备',
|
|
|
+ desc: '诊断网关父设备状态是否正常,禁用或离线将导致连接失败',
|
|
|
+ status: 'error',
|
|
|
+ text: '异常',
|
|
|
+ info: (
|
|
|
+ <div>
|
|
|
+ <div className={styles.infoItem}>
|
|
|
+ <Badge
|
|
|
+ status="default"
|
|
|
+ text={<span>网关父设备已离线,请先排查网关设备故障</span>}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ ),
|
|
|
+ };
|
|
|
+ }
|
|
|
+ setTimeout(() => {
|
|
|
+ if (item) {
|
|
|
+ DiagnoseStatusModel.list = modifyArrayList(DiagnoseStatusModel.list, item);
|
|
|
+ DiagnoseStatusModel.count++;
|
|
|
+ }
|
|
|
+ resolve({});
|
|
|
+ }, time);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
setTimeout(() => {
|
|
|
@@ -546,6 +622,7 @@ const Status = observer((props: Props) => {
|
|
|
onConfirm={async () => {
|
|
|
const resp = await service.deployDevice(device?.id || '');
|
|
|
if (resp.status === 200) {
|
|
|
+ InstanceModel.detail.state = { value: 'offline', text: '离线' };
|
|
|
onlyMessage('操作成功!');
|
|
|
DiagnoseStatusModel.list = modifyArrayList(DiagnoseStatusModel.list, {
|
|
|
key: 'device',
|
|
|
@@ -1024,155 +1101,318 @@ const Status = observer((props: Props) => {
|
|
|
});
|
|
|
|
|
|
// // opc
|
|
|
- // const diagnoseOpcua = () => new Promise(() => {
|
|
|
+ const diagnoseOpcua = () =>
|
|
|
+ new Promise(async (resolve) => {
|
|
|
+ if (device.accessProvider === 'opc-ua') {
|
|
|
+ let item: ListProps | undefined = undefined;
|
|
|
+ const response = await service.noPagingOpcua({
|
|
|
+ paging: false,
|
|
|
+ terms: [
|
|
|
+ {
|
|
|
+ column: 'id$bind-opc',
|
|
|
+ value: device.id,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ });
|
|
|
+ if (response.status === 200) {
|
|
|
+ if (response.result.length > 0) {
|
|
|
+ item = {
|
|
|
+ key: `opc-ua-config`,
|
|
|
+ name: `OPC UA通道配置`,
|
|
|
+ desc: '诊断设备是否已绑定通道,未绑定通道将导致设备连接失败',
|
|
|
+ status: 'success',
|
|
|
+ text: '正常',
|
|
|
+ info: null,
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ item = {
|
|
|
+ key: `opc-ua-config`,
|
|
|
+ name: `OPC UA通道配置`,
|
|
|
+ desc: '诊断设备是否已绑定通道,未绑定通道将导致设备连接失败',
|
|
|
+ status: 'error',
|
|
|
+ text: '异常',
|
|
|
+ info: (
|
|
|
+ <div>
|
|
|
+ <div className={styles.infoItem}>
|
|
|
+ <Badge
|
|
|
+ status="default"
|
|
|
+ text={
|
|
|
+ <span>
|
|
|
+ 设备未绑定通道,请先<a>配置</a>
|
|
|
+ </span>
|
|
|
+ }
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ ),
|
|
|
+ };
|
|
|
+ }
|
|
|
+ setTimeout(() => {
|
|
|
+ if (item) {
|
|
|
+ DiagnoseStatusModel.list = modifyArrayList(
|
|
|
+ DiagnoseStatusModel.list,
|
|
|
+ item,
|
|
|
+ DiagnoseStatusModel.list.length,
|
|
|
+ );
|
|
|
+ }
|
|
|
+ DiagnoseStatusModel.count++;
|
|
|
+ resolve({});
|
|
|
+ }, time);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ resolve({});
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
+ // opc ua 连接状态
|
|
|
+ // const diagnoseOpcuaState = () => new Promise(async (resolve) => {
|
|
|
+ // if (device.accessProvider === 'opc-ua') {
|
|
|
+ // let item: ListProps | undefined = undefined;
|
|
|
+ // const response = await service.noPagingOpcua({
|
|
|
+ // paging: false,
|
|
|
+ // terms: [
|
|
|
+ // {
|
|
|
+ // column: 'id$bind-opc',
|
|
|
+ // value: device.id,
|
|
|
+ // },
|
|
|
+ // ],
|
|
|
+ // })
|
|
|
+ // if (response.status === 200) {
|
|
|
+ // if (response.result.length > 0) {
|
|
|
+ // item = {
|
|
|
+ // key: `opc-ua-state`,
|
|
|
+ // name: `OPC UA通道连接状态`,
|
|
|
+ // desc: '诊断通道连接状态是否已连接,未连接状态将导致设备连接失败',
|
|
|
+ // status: 'success',
|
|
|
+ // text: '正常',
|
|
|
+ // info: null,
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // item = {
|
|
|
+ // key: `opc-ua-state`,
|
|
|
+ // name: `OPC UA通道连接状态`,
|
|
|
+ // desc: '诊断通道连接状态是否已连接,未连接状态将导致设备连接失败',
|
|
|
+ // status: 'error',
|
|
|
+ // text: '异常',
|
|
|
+ // info: (
|
|
|
+ // <div>
|
|
|
+ // <div className={styles.infoItem}>
|
|
|
+ // <Badge
|
|
|
+ // status="default"
|
|
|
+ // text={<span>通道未连接成功,请联系管理员处理</span>}
|
|
|
+ // />
|
|
|
+ // </div>
|
|
|
+ // </div>
|
|
|
+ // ),
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // setTimeout(() => {
|
|
|
+ // if (item) {
|
|
|
+ // DiagnoseStatusModel.list = modifyArrayList(DiagnoseStatusModel.list, item, DiagnoseStatusModel.list.length);
|
|
|
+ // }
|
|
|
+ // DiagnoseStatusModel.count++;
|
|
|
+ // resolve({});
|
|
|
+ // }, time);
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // resolve({})
|
|
|
+ // }
|
|
|
// })
|
|
|
// //modbus
|
|
|
- // const diagnoseModbus = () => new Promise(() => {
|
|
|
+ const diagnoseModbus = () =>
|
|
|
+ new Promise((resolve) => {
|
|
|
+ if (device.accessProvider === 'modbus-tcp') {
|
|
|
+ } else {
|
|
|
+ resolve({});
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- // })
|
|
|
+ // 数据点绑定
|
|
|
+ const diagnoseDataPointBind = () =>
|
|
|
+ new Promise((resolve) => {
|
|
|
+ if (device.accessProvider === 'modbus-tcp' || device.accessProvider === 'opc-ua') {
|
|
|
+ } else {
|
|
|
+ resolve({});
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // onenet
|
|
|
+ const diagnoseOnenet = () =>
|
|
|
+ new Promise((resolve) => {
|
|
|
+ if (device.accessProvider === 'OneNet') {
|
|
|
+ } else {
|
|
|
+ resolve({});
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // ctwing
|
|
|
+ const diagnoseCTWing = () =>
|
|
|
+ new Promise((resolve) => {
|
|
|
+ if (device.accessProvider === 'Ctwing') {
|
|
|
+ } else {
|
|
|
+ resolve({});
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
// 设备离线且全部诊断项都是正确的情况后
|
|
|
- const diagnoseNetworkOtherConfig = () =>
|
|
|
- new Promise(async (resolve) => {
|
|
|
- if (device.state?.value != 'online') {
|
|
|
- const item: ReactNode[] = [];
|
|
|
- if (providerType === 'network') {
|
|
|
- DiagnoseStatusModel.configuration.product.map((it) => {
|
|
|
- item.push(
|
|
|
- <Badge
|
|
|
- status="default"
|
|
|
- text={
|
|
|
- <span>
|
|
|
- 产品-{it.name}规则可能有加密处理,请认真查看
|
|
|
- <a
|
|
|
- onClick={() => {
|
|
|
- jumpAccessConfig();
|
|
|
- }}
|
|
|
- >
|
|
|
- 设备接入配置
|
|
|
- </a>
|
|
|
- 中【消息协议】说明
|
|
|
- </span>
|
|
|
- }
|
|
|
- />,
|
|
|
- );
|
|
|
- });
|
|
|
- DiagnoseStatusModel.configuration.device.map((it) => {
|
|
|
- item.push(
|
|
|
- <Badge
|
|
|
- status="default"
|
|
|
- text={
|
|
|
- <span>
|
|
|
- 设备-{it.name}规则可能有加密处理,请认真查看
|
|
|
- <a
|
|
|
- onClick={() => {
|
|
|
- jumpAccessConfig();
|
|
|
- }}
|
|
|
- >
|
|
|
- 设备接入配置
|
|
|
- </a>
|
|
|
- 中【消息协议】说明
|
|
|
- </span>
|
|
|
- }
|
|
|
- />,
|
|
|
- );
|
|
|
- });
|
|
|
- if (
|
|
|
- device?.protocol &&
|
|
|
- device?.accessProvider &&
|
|
|
- gatewayList.includes(device?.accessProvider)
|
|
|
- ) {
|
|
|
- const response = await service.queryProcotolDetail(device.protocol, 'MQTT');
|
|
|
- if (response.status === 200) {
|
|
|
- if ((response.result?.routes || []).length > 0) {
|
|
|
- item.push(
|
|
|
- <Badge
|
|
|
- status="default"
|
|
|
- text={
|
|
|
- // accessPermission.view ? (
|
|
|
- <span>
|
|
|
- 请根据
|
|
|
- <a
|
|
|
- onClick={() => {
|
|
|
- jumpAccessConfig();
|
|
|
- }}
|
|
|
- >
|
|
|
- 设备接入配置
|
|
|
- </a>
|
|
|
- 中${urlMap.get(device?.accessProvider) || ''}信息,任意上报一条数据
|
|
|
- </span>
|
|
|
- // ) : (
|
|
|
- // `请联系管理员提供${
|
|
|
- // urlMap.get(device?.accessProvider) || ''
|
|
|
- // }信息,并根据URL信息任意上报一条数据)`
|
|
|
- // )
|
|
|
- }
|
|
|
- />,
|
|
|
- );
|
|
|
- } else {
|
|
|
- item.push(
|
|
|
- <Badge
|
|
|
- status="default"
|
|
|
- text={
|
|
|
- <span>
|
|
|
- 请联系管理员提供${urlMap.get(device?.accessProvider) || ''}
|
|
|
- 信息,并根据URL信息任意上报一条数据
|
|
|
+ const diagnoseNetworkOtherConfig = async () => {
|
|
|
+ if (device.state?.value != 'online') {
|
|
|
+ const item: ReactNode[] = [];
|
|
|
+ let info: any = {
|
|
|
+ id: device.id,
|
|
|
+ };
|
|
|
+ item.push(<Badge status="default" text="请检查设备运行状态是否正常" />);
|
|
|
+ if (providerType === 'network') {
|
|
|
+ item.push(
|
|
|
+ <Badge
|
|
|
+ status="default"
|
|
|
+ text={
|
|
|
+ (DiagnoseStatusModel.gateway?.channelInfo?.addresses || []).length > 1 ? (
|
|
|
+ <>
|
|
|
+ 请检查设备网络是否畅通,并确保设备已连接到以下地址之一:
|
|
|
+ <div className="serverItem">
|
|
|
+ {(DiagnoseStatusModel.gateway?.channelInfo?.addresses || []).map((i: any) => (
|
|
|
+ <span style={{ marginLeft: 15 }} key={i.address}>
|
|
|
+ <Badge color={i.health === -1 ? 'red' : 'green'} />
|
|
|
+ {i.address}
|
|
|
</span>
|
|
|
- }
|
|
|
- />,
|
|
|
- );
|
|
|
- }
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+ </>
|
|
|
+ ) : (
|
|
|
+ <>
|
|
|
+ 请检查设备网络是否畅通,并确保设备已连接到:
|
|
|
+ {(DiagnoseStatusModel.gateway?.channelInfo?.addresses || []).map((i: any) => (
|
|
|
+ <span style={{ marginLeft: 15 }} key={i.address}>
|
|
|
+ <Badge color={i.health === -1 ? 'red' : 'green'} />
|
|
|
+ {i.address}
|
|
|
+ </span>
|
|
|
+ ))}
|
|
|
+ </>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ />,
|
|
|
+ );
|
|
|
+ // DiagnoseStatusModel.configuration.product.map((it) => {
|
|
|
+ // item.push(
|
|
|
+ // <Badge
|
|
|
+ // status="default"
|
|
|
+ // text={
|
|
|
+ // <span>
|
|
|
+ // 产品-{it.name}规则可能有加密处理,请认真查看
|
|
|
+ // <a
|
|
|
+ // onClick={() => {
|
|
|
+ // jumpAccessConfig();
|
|
|
+ // }}
|
|
|
+ // >
|
|
|
+ // 设备接入配置
|
|
|
+ // </a>
|
|
|
+ // 中【消息协议】说明
|
|
|
+ // </span>
|
|
|
+ // }
|
|
|
+ // />,
|
|
|
+ // );
|
|
|
+ // });
|
|
|
+ // DiagnoseStatusModel.configuration.device.map((it) => {
|
|
|
+ // item.push(
|
|
|
+ // <Badge
|
|
|
+ // status="default"
|
|
|
+ // text={
|
|
|
+ // <span>
|
|
|
+ // 设备-{it.name}规则可能有加密处理,请认真查看
|
|
|
+ // <a
|
|
|
+ // onClick={() => {
|
|
|
+ // jumpAccessConfig();
|
|
|
+ // }}
|
|
|
+ // >
|
|
|
+ // 设备接入配置
|
|
|
+ // </a>
|
|
|
+ // 中【消息协议】说明
|
|
|
+ // </span>
|
|
|
+ // }
|
|
|
+ // />,
|
|
|
+ // );
|
|
|
+ // });
|
|
|
+ if (
|
|
|
+ device?.protocol &&
|
|
|
+ device?.accessProvider &&
|
|
|
+ gatewayList.includes(device?.accessProvider)
|
|
|
+ ) {
|
|
|
+ const response = await service.queryProcotolDetail(device.protocol, 'MQTT');
|
|
|
+ if (response.status === 200) {
|
|
|
+ if ((response.result?.routes || []).length > 0) {
|
|
|
+ item.push(
|
|
|
+ <Badge
|
|
|
+ status="default"
|
|
|
+ text={
|
|
|
+ // accessPermission.view ? (
|
|
|
+ <span>
|
|
|
+ 请根据
|
|
|
+ <a
|
|
|
+ onClick={() => {
|
|
|
+ jumpAccessConfig();
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 设备接入配置
|
|
|
+ </a>
|
|
|
+ 中${urlMap.get(device?.accessProvider) || ''}信息,任意上报一条数据
|
|
|
+ </span>
|
|
|
+ // ) : (
|
|
|
+ // `请联系管理员提供${
|
|
|
+ // urlMap.get(device?.accessProvider) || ''
|
|
|
+ // }信息,并根据URL信息任意上报一条数据)`
|
|
|
+ // )
|
|
|
+ }
|
|
|
+ />,
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ item.push(
|
|
|
+ <Badge
|
|
|
+ status="default"
|
|
|
+ text={
|
|
|
+ <span>
|
|
|
+ 请联系管理员提供${urlMap.get(device?.accessProvider) || ''}
|
|
|
+ 信息,并根据URL信息任意上报一条数据
|
|
|
+ </span>
|
|
|
+ }
|
|
|
+ />,
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
- } else if (providerType === 'child-device') {
|
|
|
- } else if (providerType === 'media') {
|
|
|
- } else if (providerType === 'cloud') {
|
|
|
- } else if (providerType === 'channel') {
|
|
|
}
|
|
|
- item.push(<Badge status="default" text="请检查设备是否已开机" />);
|
|
|
- setTimeout(() => {
|
|
|
- DiagnoseStatusModel.list = modifyArrayList(
|
|
|
- DiagnoseStatusModel.list,
|
|
|
- {
|
|
|
- key: 'other',
|
|
|
- name: '其他可能异常',
|
|
|
- desc: '当以上诊断均无异常时,请检查以下内容',
|
|
|
- status: 'error',
|
|
|
- text: '可能存在异常',
|
|
|
- info: (
|
|
|
- <div>
|
|
|
- {item.map((i) => (
|
|
|
- <div key={randomString()} className={styles.infoItem}>
|
|
|
- {i}
|
|
|
- </div>
|
|
|
- ))}
|
|
|
- </div>
|
|
|
- ),
|
|
|
- },
|
|
|
- DiagnoseStatusModel.list.length,
|
|
|
- );
|
|
|
- DiagnoseStatusModel.count++;
|
|
|
- DiagnoseStatusModel.percent = 100;
|
|
|
- resolve({});
|
|
|
- }, time);
|
|
|
- } else {
|
|
|
- DiagnoseStatusModel.state = 'success';
|
|
|
+ info = {
|
|
|
+ ...info,
|
|
|
+ address: DiagnoseStatusModel.gateway?.channelInfo?.addresses || [],
|
|
|
+ config: DiagnoseStatusModel.configuration.device || [],
|
|
|
+ };
|
|
|
+ } else if (providerType === 'child-device') {
|
|
|
+ } else if (providerType === 'media') {
|
|
|
+ } else if (providerType === 'cloud') {
|
|
|
+ } else if (providerType === 'channel') {
|
|
|
}
|
|
|
- });
|
|
|
+ info = {
|
|
|
+ ...info,
|
|
|
+ configValue: device?.configuration || {},
|
|
|
+ };
|
|
|
+ setDiagnoseData({
|
|
|
+ list: [...item],
|
|
|
+ info,
|
|
|
+ });
|
|
|
+ setDiagnoseVisible(true);
|
|
|
+ } else {
|
|
|
+ DiagnoseStatusModel.state = 'success';
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
useEffect(() => {
|
|
|
if (DiagnoseStatusModel.status === 'finish') {
|
|
|
const list = _.uniq(_.map(DiagnoseStatusModel.list, 'status'));
|
|
|
if (device.state?.value !== 'online') {
|
|
|
+ DiagnoseStatusModel.state = 'error';
|
|
|
if (list[0] === 'success' && list.length === 1) {
|
|
|
diagnoseNetworkOtherConfig();
|
|
|
- } else if (list.includes('error')) {
|
|
|
- DiagnoseStatusModel.percent = 100;
|
|
|
- DiagnoseStatusModel.state = 'error';
|
|
|
}
|
|
|
} else {
|
|
|
- DiagnoseStatusModel.percent = 100;
|
|
|
DiagnoseStatusModel.state = 'success';
|
|
|
}
|
|
|
}
|
|
|
@@ -1207,6 +1447,13 @@ const Status = observer((props: Props) => {
|
|
|
await diagnoseParentDevice();
|
|
|
await diagnoseProduct();
|
|
|
await diagnoseDevice();
|
|
|
+ DiagnoseStatusModel.percent = 60;
|
|
|
+ await diagnoseProductAuthConfig();
|
|
|
+ await diagnoseDeviceAuthConfig();
|
|
|
+ DiagnoseStatusModel.percent = 80;
|
|
|
+ await diagnoseModbus();
|
|
|
+ await diagnoseOpcua();
|
|
|
+ await diagnoseDataPointBind();
|
|
|
} else if (providerType === 'media') {
|
|
|
DiagnoseStatusModel.list = [...mediaInitList];
|
|
|
await diagnoseGateway();
|
|
|
@@ -1219,22 +1466,31 @@ const Status = observer((props: Props) => {
|
|
|
DiagnoseStatusModel.percent = 40;
|
|
|
await diagnoseProduct();
|
|
|
await diagnoseDevice();
|
|
|
+ DiagnoseStatusModel.percent = 80;
|
|
|
+ await diagnoseCTWing();
|
|
|
+ await diagnoseOnenet();
|
|
|
} else if (providerType === 'channel') {
|
|
|
DiagnoseStatusModel.list = [...channelInitList];
|
|
|
await diagnoseGateway();
|
|
|
- DiagnoseStatusModel.percent = 40;
|
|
|
+ DiagnoseStatusModel.percent = 20;
|
|
|
await diagnoseProduct();
|
|
|
await diagnoseDevice();
|
|
|
+ DiagnoseStatusModel.percent = 40;
|
|
|
+ await diagnoseModbus();
|
|
|
+ await diagnoseOpcua();
|
|
|
+ // await diagnoseOpcuaState();
|
|
|
+ await diagnoseDataPointBind();
|
|
|
+ DiagnoseStatusModel.percent = 80;
|
|
|
}
|
|
|
- DiagnoseStatusModel.percent = 90;
|
|
|
+ DiagnoseStatusModel.percent = 100;
|
|
|
DiagnoseStatusModel.status = 'finish';
|
|
|
};
|
|
|
|
|
|
useEffect(() => {
|
|
|
- if (DiagnoseStatusModel.state === 'loading') {
|
|
|
+ if (DiagnoseStatusModel.state === 'loading' && providerType) {
|
|
|
handleSearch();
|
|
|
}
|
|
|
- }, [DiagnoseStatusModel.state]);
|
|
|
+ }, [DiagnoseStatusModel.state, providerType]);
|
|
|
|
|
|
return (
|
|
|
<div className={styles.statusBox}>
|
|
|
@@ -1274,6 +1530,14 @@ const Status = observer((props: Props) => {
|
|
|
</div>
|
|
|
))}
|
|
|
</div>
|
|
|
+ {diagnoseVisible && (
|
|
|
+ <DiagnosticAdvice
|
|
|
+ data={diagnoseData}
|
|
|
+ close={() => {
|
|
|
+ setDiagnoseVisible(false);
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ )}
|
|
|
{artificialVisible && (
|
|
|
<ManualInspection
|
|
|
data={artificiaData}
|
|
|
@@ -1293,6 +1557,7 @@ const Status = observer((props: Props) => {
|
|
|
}}
|
|
|
/>
|
|
|
)}
|
|
|
+ {bindParentVisible && <BindParentDevice data={device} onCancel={() => {}} onOk={() => {}} />}
|
|
|
</div>
|
|
|
);
|
|
|
});
|