fix: 设备详情报错
This commit is contained in:
parent
48b6bbc0a7
commit
a094b9b093
|
@ -13,16 +13,16 @@
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
</template>
|
</template>
|
||||||
<j-descriptions-item label="设备ID">{{
|
<j-descriptions-item label="设备ID">{{
|
||||||
instanceStore.current.id
|
instanceStore.current?.id
|
||||||
}}</j-descriptions-item>
|
}}</j-descriptions-item>
|
||||||
<j-descriptions-item label="产品名称">{{
|
<j-descriptions-item label="产品名称">{{
|
||||||
instanceStore.current.productName
|
instanceStore.current?.productName
|
||||||
}}</j-descriptions-item>
|
}}</j-descriptions-item>
|
||||||
<j-descriptions-item label="产品分类">{{
|
<j-descriptions-item label="产品分类">{{
|
||||||
instanceStore.current.classifiedName
|
instanceStore.current?.classifiedName
|
||||||
}}</j-descriptions-item>
|
}}</j-descriptions-item>
|
||||||
<j-descriptions-item label="设备类型">{{
|
<j-descriptions-item label="设备类型">{{
|
||||||
instanceStore.current.deviceType?.text
|
instanceStore.current?.deviceType?.text
|
||||||
}}</j-descriptions-item>
|
}}</j-descriptions-item>
|
||||||
<j-descriptions-item label="固件版本">{{
|
<j-descriptions-item label="固件版本">{{
|
||||||
instanceStore.current?.firmwareInfo?.version
|
instanceStore.current?.firmwareInfo?.version
|
||||||
|
@ -31,25 +31,25 @@
|
||||||
instanceStore.current?.transport
|
instanceStore.current?.transport
|
||||||
}}</j-descriptions-item>
|
}}</j-descriptions-item>
|
||||||
<j-descriptions-item label="消息协议">{{
|
<j-descriptions-item label="消息协议">{{
|
||||||
instanceStore.current.protocolName
|
instanceStore.current?.protocolName
|
||||||
}}</j-descriptions-item>
|
}}</j-descriptions-item>
|
||||||
<j-descriptions-item label="创建时间">{{
|
<j-descriptions-item label="创建时间">{{
|
||||||
instanceStore.current.createTime
|
instanceStore.current?.createTime
|
||||||
? moment(instanceStore.current.createTime).format(
|
? moment(instanceStore.current?.createTime).format(
|
||||||
'YYYY-MM-DD HH:mm:ss',
|
'YYYY-MM-DD HH:mm:ss',
|
||||||
)
|
)
|
||||||
: ''
|
: ''
|
||||||
}}</j-descriptions-item>
|
}}</j-descriptions-item>
|
||||||
<j-descriptions-item label="注册时间">{{
|
<j-descriptions-item label="注册时间">{{
|
||||||
instanceStore.current.registerTime
|
instanceStore.current?.registerTime
|
||||||
? moment(instanceStore.current.registerTime).format(
|
? moment(instanceStore.current?.registerTime).format(
|
||||||
'YYYY-MM-DD HH:mm:ss',
|
'YYYY-MM-DD HH:mm:ss',
|
||||||
)
|
)
|
||||||
: ''
|
: ''
|
||||||
}}</j-descriptions-item>
|
}}</j-descriptions-item>
|
||||||
<j-descriptions-item label="最后上线时间">{{
|
<j-descriptions-item label="最后上线时间">{{
|
||||||
instanceStore.current.onlineTime
|
instanceStore.current?.onlineTime
|
||||||
? moment(instanceStore.current.onlineTime).format(
|
? moment(instanceStore.current?.onlineTime).format(
|
||||||
'YYYY-MM-DD HH:mm:ss',
|
'YYYY-MM-DD HH:mm:ss',
|
||||||
)
|
)
|
||||||
: ''
|
: ''
|
||||||
|
@ -57,12 +57,12 @@
|
||||||
<j-descriptions-item
|
<j-descriptions-item
|
||||||
label="父设备"
|
label="父设备"
|
||||||
v-if="
|
v-if="
|
||||||
instanceStore.current.deviceType?.value === 'childrenDevice'
|
instanceStore.current?.deviceType?.value === 'childrenDevice'
|
||||||
"
|
"
|
||||||
>{{ instanceStore.current.parentId }}</j-descriptions-item
|
>{{ instanceStore.current?.parentId }}</j-descriptions-item
|
||||||
>
|
>
|
||||||
<j-descriptions-item label="说明">{{
|
<j-descriptions-item label="说明">{{
|
||||||
instanceStore.current.description
|
instanceStore.current?.description
|
||||||
}}</j-descriptions-item>
|
}}</j-descriptions-item>
|
||||||
</j-descriptions>
|
</j-descriptions>
|
||||||
<Config />
|
<Config />
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<div style="display: flex; align-items: center">
|
<div style="display: flex; align-items: center">
|
||||||
<!-- <j-button @click="onBack" size="small">返回</j-button> -->
|
<!-- <j-button @click="onBack" size="small">返回</j-button> -->
|
||||||
<div style="font-size: 24px">
|
<div style="font-size: 24px">
|
||||||
{{ instanceStore.current.name }}
|
{{ instanceStore.current?.name }}
|
||||||
</div>
|
</div>
|
||||||
<j-divider type="vertical" />
|
<j-divider type="vertical" />
|
||||||
<j-space>
|
<j-space>
|
||||||
|
@ -20,15 +20,15 @@
|
||||||
<j-badge
|
<j-badge
|
||||||
:status="
|
:status="
|
||||||
statusMap.get(
|
statusMap.get(
|
||||||
instanceStore.current.state?.value,
|
instanceStore.current?.state?.value,
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
{{ instanceStore.current.state?.text }}
|
{{ instanceStore.current?.state?.text }}
|
||||||
</span>
|
</span>
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
v-if="
|
v-if="
|
||||||
instanceStore.current.state?.value ===
|
instanceStore.current?.state?.value ===
|
||||||
'notActive'
|
'notActive'
|
||||||
"
|
"
|
||||||
type="link"
|
type="link"
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
v-if="
|
v-if="
|
||||||
instanceStore.current.state?.value === 'online'
|
instanceStore.current?.state?.value === 'online'
|
||||||
"
|
"
|
||||||
type="link"
|
type="link"
|
||||||
style="margin-top: -5px; padding: 0 20px"
|
style="margin-top: -5px; padding: 0 20px"
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
"
|
"
|
||||||
:title="
|
:title="
|
||||||
instanceStore.current?.features?.find(
|
instanceStore.current?.features?.find(
|
||||||
(item) => item.id === 'selfManageState',
|
(item) => item?.id === 'selfManageState',
|
||||||
)
|
)
|
||||||
? '该设备的在线状态与父设备(网关设备)保持一致'
|
? '该设备的在线状态与父设备(网关设备)保持一致'
|
||||||
: '该设备在线状态由设备自身运行状态决定,不继承父设备(网关设备)的在线状态'
|
: '该设备在线状态由设备自身运行状态决定,不继承父设备(网关设备)的在线状态'
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
<div style="padding-top: 24px">
|
<div style="padding-top: 24px">
|
||||||
<j-descriptions size="small" :column="4">
|
<j-descriptions size="small" :column="4">
|
||||||
<j-descriptions-item label="ID">{{
|
<j-descriptions-item label="ID">{{
|
||||||
instanceStore.current.id
|
instanceStore.current?.id
|
||||||
}}</j-descriptions-item>
|
}}</j-descriptions-item>
|
||||||
<j-descriptions-item label="所属产品">
|
<j-descriptions-item label="所属产品">
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
|
@ -89,7 +89,7 @@
|
||||||
@click="jumpProduct"
|
@click="jumpProduct"
|
||||||
hasPermission="device/Product:view"
|
hasPermission="device/Product:view"
|
||||||
>
|
>
|
||||||
{{ instanceStore.current.productName }}
|
{{ instanceStore.current?.productName }}
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
</j-descriptions-item>
|
</j-descriptions-item>
|
||||||
</j-descriptions>
|
</j-descriptions>
|
||||||
|
@ -192,11 +192,12 @@ const getStatus = (id: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.params.id,
|
() => route.params?.id,
|
||||||
(newId) => {
|
(newId) => {
|
||||||
if (newId) {
|
if (newId) {
|
||||||
instanceStore.refresh(String(newId));
|
instanceStore.refresh(String(newId));
|
||||||
getStatus(String(newId));
|
getStatus(String(newId));
|
||||||
|
instanceStore.tabActiveKey = 'Info'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true, deep: true },
|
{ immediate: true, deep: true },
|
||||||
|
@ -215,43 +216,43 @@ const onTabChange = (e: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAction = async () => {
|
const handleAction = async () => {
|
||||||
if (instanceStore.current.id) {
|
if (instanceStore.current?.id) {
|
||||||
const resp = await _deploy(instanceStore.current.id);
|
const resp = await _deploy(instanceStore.current?.id);
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
message.success('操作成功!');
|
message.success('操作成功!');
|
||||||
instanceStore.refresh(instanceStore.current.id);
|
instanceStore.refresh(instanceStore.current?.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDisconnect = async () => {
|
const handleDisconnect = async () => {
|
||||||
if (instanceStore.current.id) {
|
if (instanceStore.current?.id) {
|
||||||
const resp = await _disconnect(instanceStore.current.id);
|
const resp = await _disconnect(instanceStore.current?.id);
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
message.success('操作成功!');
|
message.success('操作成功!');
|
||||||
instanceStore.refresh(instanceStore.current.id);
|
instanceStore.refresh(instanceStore.current?.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRefresh = async () => {
|
const handleRefresh = async () => {
|
||||||
if (instanceStore.current.id) {
|
if (instanceStore.current?.id) {
|
||||||
await instanceStore.refresh(instanceStore.current.id);
|
await instanceStore.refresh(instanceStore.current?.id);
|
||||||
message.success('操作成功');
|
message.success('操作成功');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const jumpProduct = () => {
|
const jumpProduct = () => {
|
||||||
menuStory.jumpPage('device/Product/Detail', {
|
menuStory.jumpPage('device/Product/Detail', {
|
||||||
id: instanceStore.current.productId,
|
id: instanceStore.current?.productId,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
const keys = list.value.map((i) => i.key);
|
const keys = list.value.map((i) => i.key);
|
||||||
if (
|
if (
|
||||||
instanceStore.current.protocol &&
|
instanceStore.current?.protocol &&
|
||||||
!['modbus-tcp', 'opc-ua'].includes(instanceStore.current.protocol) &&
|
!['modbus-tcp', 'opc-ua'].includes(instanceStore.current?.protocol) &&
|
||||||
!keys.includes('Diagnose')
|
!keys.includes('Diagnose')
|
||||||
) {
|
) {
|
||||||
list.value.push({
|
list.value.push({
|
||||||
|
@ -260,8 +261,8 @@ watchEffect(() => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
instanceStore.current.features?.find(
|
instanceStore.current?.features?.find(
|
||||||
(item: any) => item.id === 'transparentCodec',
|
(item: any) => item?.id === 'transparentCodec',
|
||||||
) &&
|
) &&
|
||||||
!keys.includes('Parsing')
|
!keys.includes('Parsing')
|
||||||
) {
|
) {
|
||||||
|
@ -271,7 +272,7 @@ watchEffect(() => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
instanceStore.current.protocol === 'modbus-tcp' &&
|
instanceStore.current?.protocol === 'modbus-tcp' &&
|
||||||
!keys.includes('Modbus')
|
!keys.includes('Modbus')
|
||||||
) {
|
) {
|
||||||
list.value.push({
|
list.value.push({
|
||||||
|
@ -280,7 +281,7 @@ watchEffect(() => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
instanceStore.current.protocol === 'opc-ua' &&
|
instanceStore.current?.protocol === 'opc-ua' &&
|
||||||
!keys.includes('OPCUA')
|
!keys.includes('OPCUA')
|
||||||
) {
|
) {
|
||||||
list.value.push({
|
list.value.push({
|
||||||
|
@ -289,7 +290,7 @@ watchEffect(() => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
instanceStore.current.deviceType?.value === 'gateway' &&
|
instanceStore.current?.deviceType?.value === 'gateway' &&
|
||||||
!keys.includes('ChildDevice')
|
!keys.includes('ChildDevice')
|
||||||
) {
|
) {
|
||||||
// 产品类型为网关的情况下才显示此模块
|
// 产品类型为网关的情况下才显示此模块
|
||||||
|
@ -299,8 +300,8 @@ watchEffect(() => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
instanceStore.current.accessProvider === 'edge-child-device' &&
|
instanceStore.current?.accessProvider === 'edge-child-device' &&
|
||||||
instanceStore.current.parentId &&
|
instanceStore.current?.parentId &&
|
||||||
!keys.includes('EdgeMap')
|
!keys.includes('EdgeMap')
|
||||||
) {
|
) {
|
||||||
list.value.push({
|
list.value.push({
|
||||||
|
|
Loading…
Reference in New Issue