物联设备页面和接口优化

This commit is contained in:
曹磊 2026-03-16 16:08:56 +08:00
parent ba002eba94
commit decc293cdf
10 changed files with 57 additions and 36 deletions

BIN
src/assets/iot/ap.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 KiB

BIN
src/assets/iot/lxj.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

BIN
src/assets/iot/router.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

BIN
src/assets/iot/switch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 KiB

View File

@ -8,7 +8,7 @@
<template #title>
<a-row style="font-weight: normal;">
<a-col :span="18" style="font-size: 14px;">
<div>SN<span style="font-weight: bold;">{{ item.sn }}</span></div>
<div>SN<span style="font-weight: bold;">{{ item.mac }}</span></div>
<div style="font-size: 12px;">名称{{ item.deviceName }}</div>
</a-col>
<a-col :span="6" style="display: flex; justify-content: flex-end;">
@ -25,9 +25,19 @@
{{item.nuName?item.nuName:'未配置'}}
</a-col> -->
<a-col :span="24" style="text-align: center;font-size: 44px;font-weight: bold;margin-top:10px;">
<img src="../../../../assets/iot/sxt.png" style="width:80px;" />
<img v-if="item.deviceType == 'NETWORKVIDEORECORDER'" src="../../../../assets/iot/lxj.png" style="width:80px;" />
<img v-if="item.deviceType == 'SURVEILLANCECAMERA'" src="../../../../assets/iot/sxt.png" style="width:80px;" />
<img v-if="item.deviceType == 'ROUTER'" src="../../../../assets/iot/router.png" style="width:80px;" />
<img v-if="item.deviceType == 'SWITCH'" src="../../../../assets/iot/switch.png" style="width:80px;" />
<img v-if="item.deviceType == 'AP'" src="../../../../assets/iot/ap.png" style="width:80px;" />
</a-col>
<a-col :span="12" style="margin-top: -1px;">
<a-tag v-if="item.deviceType == 'NETWORKVIDEORECORDER'" color="purple">录像机</a-tag>
<a-tag v-if="item.deviceType == 'SURVEILLANCECAMERA'" color="purple">摄像头</a-tag>
<a-tag v-if="item.deviceType == 'ROUTER'" color="purple">路由器</a-tag>
<a-tag v-if="item.deviceType == 'SWITCH'" color="purple">交换机</a-tag>
<a-tag v-if="item.deviceType == 'AP'" color="purple">无线AP</a-tag>
</a-col>
<a-col :span="12" style="margin-top: -1px;"><a-tag color="purple">摄像头</a-tag></a-col>
<a-col :span="12" style="margin-top: -11px;text-align:right;">
<span v-if="item.maintainStatus == 0" style="font-weight:700;font-size:16px;">正常</span>
<span v-if="item.maintainStatus == 1" style="font-weight:700;font-size:16px;color:red;">维修中</span>
@ -38,7 +48,7 @@
<a-divider style="margin: 10px 0 20px 0" />
<p style="text-align:center;margin-bottom:5px !important">
<span style="display:inline-block;cursor: pointer;" @click="handlePreview(item)">
<span style="display:inline-block;cursor: pointer;" @click="handlePreview(item)" v-if="item.deviceType == 'SURVEILLANCECAMERA'">
<span class="tbClass"><img src="../../../../assets/iot/a14.png" style="width:20px;" /></span><br />
<span class="antTitle">预览</span>
</span>
@ -279,7 +289,7 @@
<div style="margin: 30px auto;">
<a-empty />
</div>
<div style="margin-top: 10px;padding: 14px;background-color: white;">
<span style="font-size: 16px;color:red;font-weight: 700;">提示请联系平台运维组技术人员绑定物联设备</span>
</div>
@ -400,8 +410,7 @@ function getWsdj(record) {
//
async function handleRead(record) {
const params = {
'cid': record.cid,
'address': record.address,
'sn': record.sn,
};
await eleRead(params);
setTimeout(() => {
@ -422,9 +431,8 @@ async function handleControlLz(record) {
return;
}
const params = {
'cid': record.cid,
'address': record.address,
'type': '10',
'sn' : record.sn,
'type': '10'
};
await eleControl(params);
setTimeout(() => {
@ -445,8 +453,7 @@ async function handleControlHz(record) {
return;
}
const params = {
'cid': record.cid,
'address': record.address,
'sn' : record.sn,
'type': '11',
};
await eleControl(params);
@ -458,8 +465,7 @@ async function handleControlHz(record) {
//
async function handleReset(record) {
const params = {
'cid': record.cid,
'address': record.address,
'sn': record.sn,
};
await eleReset(params);
setTimeout(() => {
@ -597,6 +603,7 @@ function showWsdjApiLog(record) {
* 摄像头预览
*/
function handlePreview(record: Recordable) {
record.streamType = 1;
previewModal.value.disableSubmit = true;
previewModal.value.edit(record);
}

View File

@ -18,7 +18,7 @@ export const columns: BasicColumn[] = [
{
title: '设备标识',
align: "center",
dataIndex: 'deviceIndex'
dataIndex: 'sn'
},
{
title: '设备型号',

View File

@ -51,7 +51,7 @@
</BasicTable>
<!-- 表单区域 -->
<IotDevicesModal ref="registerModal" @success="handleSuccess"></IotDevicesModal>
<CameraPreviewModal ref="previewModal"></CameraPreviewModal>
</div>
</template>
@ -134,7 +134,7 @@ import CameraPreviewModal from '/@/views/iot/tplink/camera/components/CameraPrev
registerModal.value.disableSubmit = false;
registerModal.value.add();
}
/**
* 编辑事件
*/
@ -142,7 +142,7 @@ import CameraPreviewModal from '/@/views/iot/tplink/camera/components/CameraPrev
registerModal.value.disableSubmit = false;
registerModal.value.edit(record);
}
/**
* 详情
*/
@ -150,32 +150,33 @@ import CameraPreviewModal from '/@/views/iot/tplink/camera/components/CameraPrev
registerModal.value.disableSubmit = true;
registerModal.value.edit(record);
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 摄像头预览
*/
function handlePreview(record: Recordable) {
record.streamType = 1;
previewModal.value.disableSubmit = true;
previewModal.value.edit(record);
}
@ -193,7 +194,7 @@ function handlePreview(record: Recordable) {
},
];
}
/**
* 查询
@ -201,7 +202,7 @@ function handlePreview(record: Recordable) {
function searchQuery() {
reload();
}
/**
* 重置
*/
@ -211,7 +212,7 @@ function handlePreview(record: Recordable) {
//
reload();
}
function init() {
//
reload();

View File

@ -1,5 +1,5 @@
<template>
<a-spin :spinning="confirmLoading">
<!-- <a-spin :spinning="confirmLoading">-->
<a-row>
<a-col :span="24">
<div id="video-container-preview" style="min-height: 400px;"></div>
@ -156,7 +156,7 @@
</span>
</a-col> -->
</a-row>
</a-spin>
<!-- </a-spin>-->
</template>
<script lang="ts" setup>
@ -211,7 +211,7 @@ const formData = reactive<Record<string, any>>({
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const confirmLoading = ref<boolean>(false);
// const confirmLoading = ref<boolean>(false);
//
const validatorRules = reactive({
@ -235,7 +235,7 @@ const disabled = computed(() => {
*/
async function edit(record) {
await nextTick(() => {
confirmLoading.value = true;
// confirmLoading.value = true;
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
@ -246,8 +246,8 @@ async function edit(record) {
//
Object.assign(formData, tmpData);
});
createPreview();
getSwitch();
// createPreview();
// getSwitch();
}
/**
@ -259,7 +259,7 @@ async function createPreview() {
formData.backupUrl = res.backupUrl;
formData.wsUrl = res.wsUrl;
formData.wssUrl = res.wssUrl;
confirmLoading.value = false;
// confirmLoading.value = false;
});
if (player.value) {
player.value.destroy().then(() => {

View File

@ -137,6 +137,7 @@ const { resetFields, validate, validateInfos } = useForm(formData, validatorRule
*/
async function edit(record) {
console.log(record);
title.value = record.deviceName;
showCamera.value = true;
visible.value = true;
@ -178,7 +179,8 @@ function submitCallback() {
function handleCancel() {
visible.value = false;
nextTick(() => {
registerForm.value.destroy();
// registerForm.value.destroy();
destroy();
showCamera.value = false;
});
}
@ -212,6 +214,7 @@ function stopPhone() {
* 创建预览
*/
async function createPreview() {
console.log("🌊 ~ createPreview ~ a:", formData)
await getPreviewUrl({ "deviceIndex": formData.deviceIndex, "streamType": formData.streamType }).then(res => {
formData.url = res.url;
formData.backupUrl = res.backupUrl;
@ -224,7 +227,6 @@ async function createPreview() {
}); //
player.value = null;
}
console.log("🌊 ~ createPreview ~ a:", formData)
const TumsPlayer = window['tums-player'].default;
player.value = new TumsPlayer('video-container-preview', {
type: "rtsp", // rtsp
@ -361,6 +363,17 @@ function recordingEnd() {
});
}
/**
* 销毁
*/
function destroy() {
if (player) {
player.value.destroy().then(() => {
}); //
player.value = null;
}
}
defineExpose({
edit,
disableSubmit,

View File

@ -8,7 +8,7 @@ export const columns: BasicColumn[] = [
{
title: 'SN',
align: "center",
dataIndex: 'address'
dataIndex: 'cid'
},
// {
// title: '类型',
@ -58,7 +58,7 @@ export const columns2: BasicColumn[] = [
{
title: 'SN',
align: "center",
dataIndex: 'address'
dataIndex: 'cid'
},
{
title: '操作时间',