feat: open device manegement page
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { NdmDeviceResultVO } from '@/apis/models';
|
import type { NdmDeviceResultVO } from '@/apis/models';
|
||||||
import { DeviceType, DeviceTypeName, getDeviceTypeVal } from '@/enums/device-type';
|
import { DeviceType, DeviceTypeName, getDeviceTypeVal, type DeviceTypeVal } from '@/enums/device-type';
|
||||||
import { NButton, NCard, NFlex, NTag } from 'naive-ui';
|
import { NButton, NCard, NFlex, NTag } from 'naive-ui';
|
||||||
import { computed, toRefs } from 'vue';
|
import { computed, toRefs } from 'vue';
|
||||||
|
|
||||||
@@ -18,9 +18,13 @@ const ipAddr = computed(() => device.value.ipAddress ?? '-');
|
|||||||
const gbCode = computed(() => Reflect.get(device.value, 'gbCode') as string | undefined);
|
const gbCode = computed(() => Reflect.get(device.value, 'gbCode') as string | undefined);
|
||||||
const status = computed(() => device.value.deviceStatus);
|
const status = computed(() => device.value.deviceStatus);
|
||||||
|
|
||||||
const isCamera = computed(() => getDeviceTypeVal(device.value.deviceType) === DeviceType['Camera']);
|
const canOpenMgmtPage = computed(() => {
|
||||||
|
const mgmtableDeviceTypes: DeviceTypeVal[] = [DeviceType['Camera'], DeviceType['Decoder'], DeviceType['Switch']];
|
||||||
|
return mgmtableDeviceTypes.includes(getDeviceTypeVal(device.value.deviceType));
|
||||||
|
});
|
||||||
|
|
||||||
const onClickCameraLogin = () => {
|
const onClickOpenMgmtPage = () => {
|
||||||
|
if (canOpenMgmtPage.value) {
|
||||||
const ipAddress = device.value.ipAddress;
|
const ipAddress = device.value.ipAddress;
|
||||||
if (ipAddress) {
|
if (ipAddress) {
|
||||||
const targetUrl = `http://${ipAddress}`;
|
const targetUrl = `http://${ipAddress}`;
|
||||||
@@ -28,6 +32,7 @@ const onClickCameraLogin = () => {
|
|||||||
} else {
|
} else {
|
||||||
window.$message.warning('未找到设备IP地址');
|
window.$message.warning('未找到设备IP地址');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -39,7 +44,7 @@ const onClickCameraLogin = () => {
|
|||||||
<NTag v-else-if="status === '20'" size="small" type="error">离线</NTag>
|
<NTag v-else-if="status === '20'" size="small" type="error">离线</NTag>
|
||||||
<NTag v-else size="small" type="warning">未知</NTag>
|
<NTag v-else size="small" type="warning">未知</NTag>
|
||||||
<div>{{ name }}</div>
|
<div>{{ name }}</div>
|
||||||
<NButton v-if="isCamera" ghost size="tiny" type="default" :focusable="false" @click="onClickCameraLogin">登录</NButton>
|
<NButton v-if="canOpenMgmtPage" ghost size="tiny" type="default" :focusable="false" @click="onClickOpenMgmtPage">管理</NButton>
|
||||||
</NFlex>
|
</NFlex>
|
||||||
<div style="font-size: small; color: #666">
|
<div style="font-size: small; color: #666">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in New Issue
Block a user