feat(iot): 优化设备详情和地图展示
- 移除了不必要的导入语句 - 优化了设备上报记录的展示逻辑,添加了详情弹窗 -修复了设备地图组件的样式问题 - 优化了产品 TSL 数据的请求逻辑,提高了数据加载效率 - 改进了设备列表中的在线状态展示,使用标签进行区分
This commit is contained in:
parent
c1c0be063d
commit
a045b8fc2d
@ -1,5 +1,4 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import dashboard from '@/router/routes/modules/dashboard';
|
|
||||||
|
|
||||||
export interface DeviceRecord {
|
export interface DeviceRecord {
|
||||||
size: number;
|
size: number;
|
||||||
|
@ -89,17 +89,27 @@
|
|||||||
<div>{{ dayjs(record.recordTime).format('YYYY-MM-DD HH:mm:ss') }}</div>
|
<div>{{ dayjs(record.recordTime).format('YYYY-MM-DD HH:mm:ss') }}</div>
|
||||||
</template>
|
</template>
|
||||||
<template #content="{ record }">
|
<template #content="{ record }">
|
||||||
<div v-for="(value, key) in record.content" :key="key">
|
<div v-if="record.content">
|
||||||
<strong>{{ key }}:</strong> {{ value }}
|
<span v-for="(value, key, index) in record.content" :key="key">
|
||||||
|
<template v-if="index === 0">
|
||||||
|
<strong>{{ key }}:</strong> {{ value }}
|
||||||
|
</template>
|
||||||
|
</span>
|
||||||
|
<span v-if="Object.keys(record.content).length > 1">. . . . . .</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<template #operations="{ record }">
|
||||||
|
<a-button type="text" @click="openDetailModal(record)">
|
||||||
|
<template #icon><icon-list /></template>
|
||||||
|
查看详情
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
</a-table>
|
</a-table>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane key="5" tab="设备地图" title="设备地图">
|
<a-tab-pane key="5" tab="设备地图" title="设备地图">
|
||||||
<DeviceMap :renderData=renderData />
|
<DeviceMap v-if="renderData.id" :renderData=renderData />
|
||||||
|
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
</a-card>
|
</a-card>
|
||||||
@ -120,13 +130,31 @@
|
|||||||
<a-button class="editor-button" type="primary" @click="handleSubmit">确定</a-button>
|
<a-button class="editor-button" type="primary" @click="handleSubmit">确定</a-button>
|
||||||
</template>
|
</template>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
|
|
||||||
|
<a-modal
|
||||||
|
:visible="detailVisible"
|
||||||
|
@cancel="closeDetailModal"
|
||||||
|
title="上报记录详情"
|
||||||
|
>
|
||||||
|
<template #footer>
|
||||||
|
<a-button @click="closeDetailModal">关闭</a-button>
|
||||||
|
</template>
|
||||||
|
<div v-if="selectedRecord">
|
||||||
|
<p><strong>上报时间:</strong> {{ dayjs(selectedRecord.recordTime).format('YYYY-MM-DD HH:mm:ss') }}</p>
|
||||||
|
<div v-if="selectedRecord.content">
|
||||||
|
<div v-for="(value, key) in selectedRecord.content" :key="key">
|
||||||
|
<strong>{{ key }}:</strong> {{ value }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a-modal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { onMounted, reactive, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
import { queryDeviceDetail, queryDeviceRecord, sendCommand } from '@/api/device';
|
import { queryDeviceDetail, queryDeviceRecord, sendCommand } from '@/api/device';
|
||||||
import { queryServeDetail, queryServeList } from '@/api/tsl';
|
import { queryServeDetail, queryServeList } from '@/api/tsl';
|
||||||
@ -170,6 +198,11 @@
|
|||||||
dataIndex: 'content',
|
dataIndex: 'content',
|
||||||
slotName: 'content',
|
slotName: 'content',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
dataIndex: 'operations',
|
||||||
|
slotName: 'operations',
|
||||||
|
}
|
||||||
];
|
];
|
||||||
const deviceServeColumns = [
|
const deviceServeColumns = [
|
||||||
{
|
{
|
||||||
@ -189,11 +222,26 @@
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
const activeKey = ref('1');
|
const activeKey = ref('1');
|
||||||
const renderData = ref({
|
|
||||||
deviceId: 0,
|
const detailVisible = ref(false);
|
||||||
clientId: 1,
|
const selectedRecord = ref<any>(null);
|
||||||
productId: 1
|
|
||||||
});
|
const openDetailModal = (record: any) => {
|
||||||
|
selectedRecord.value = record;
|
||||||
|
detailVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeDetailModal = () => {
|
||||||
|
detailVisible.value = false;
|
||||||
|
selectedRecord.value = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderData = ref(
|
||||||
|
{
|
||||||
|
clientId: 0,
|
||||||
|
productId: 0,
|
||||||
|
}
|
||||||
|
);
|
||||||
const deviceReportData = ref([]);
|
const deviceReportData = ref([]);
|
||||||
const deviceServerData = ref([]);
|
const deviceServerData = ref([]);
|
||||||
const fields = ref([]);
|
const fields = ref([]);
|
||||||
@ -217,7 +265,6 @@
|
|||||||
activeKey.value = e;
|
activeKey.value = e;
|
||||||
};
|
};
|
||||||
const dynamicFormData = ref();
|
const dynamicFormData = ref();
|
||||||
const formRef = ref();
|
|
||||||
// 关闭
|
// 关闭
|
||||||
const handleCancel = async () => {
|
const handleCancel = async () => {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-layout>
|
<a-layout>
|
||||||
<a-layout-content>
|
<a-layout-content>
|
||||||
<div id="container"></div>
|
<div id="container" style="height: 600px"></div>
|
||||||
</a-layout-content>
|
</a-layout-content>
|
||||||
</a-layout>
|
</a-layout>
|
||||||
</template>
|
</template>
|
||||||
|
@ -174,7 +174,8 @@
|
|||||||
{{ record.state == "UNACTIVATED" ? '未激活' : '激活'}}
|
{{ record.state == "UNACTIVATED" ? '未激活' : '激活'}}
|
||||||
</template>
|
</template>
|
||||||
<template #online="{ record }">
|
<template #online="{ record }">
|
||||||
{{ record.online == true ? '是' : '否' }}
|
<a-tag v-if="record.online == true" color="green">在线</a-tag>
|
||||||
|
<a-tag v-else color="red">离线</a-tag>
|
||||||
</template>
|
</template>
|
||||||
<template #operations="{ record }">
|
<template #operations="{ record }">
|
||||||
<a-button
|
<a-button
|
||||||
|
@ -616,13 +616,23 @@
|
|||||||
current: 1,
|
current: 1,
|
||||||
productId: Id,
|
productId: Id,
|
||||||
};
|
};
|
||||||
const res1 = await queryServeList(params);
|
|
||||||
serveData.value = res1.data.records;
|
try {
|
||||||
const res2 = await queryPropertyList(params);
|
const [res1, res2, res3] = await Promise.all([
|
||||||
propertyData.value = res2.data.records;
|
queryServeList(params),
|
||||||
const res3 = await queryEventList(params);
|
queryPropertyList(params),
|
||||||
eventData.value = res3.data.records;
|
queryEventList(params),
|
||||||
|
]);
|
||||||
|
|
||||||
|
serveData.value = res1.data.records;
|
||||||
|
propertyData.value = res2.data.records;
|
||||||
|
eventData.value = res3.data.records;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('请求失败:', error);
|
||||||
|
Message.error('获取数据失败,请稍后重试');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeKey = (e: any) => {
|
const changeKey = (e: any) => {
|
||||||
keyValue.value = e;
|
keyValue.value = e;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user