|
|
@@ -28,10 +28,10 @@
|
|
|
<div class="right-title">实时监测:</div>
|
|
|
<a-table
|
|
|
size="small"
|
|
|
- :scroll="{ y: 680 }"
|
|
|
+ :scroll="{ y: 650 }"
|
|
|
:columns="outerColumns"
|
|
|
- :data-source="deviceList"
|
|
|
- :pagination="pagination"
|
|
|
+ :data-source="paginatedData2"
|
|
|
+ :pagination="paginationConfig2"
|
|
|
:row-key="(record) => record.id"
|
|
|
:expand-row-by-click="true"
|
|
|
:expanded-row-keys="expandedRowKeys"
|
|
|
@@ -59,11 +59,11 @@
|
|
|
<a-table
|
|
|
size="small"
|
|
|
:columns="innerColumns"
|
|
|
- :data-source="monitorList"
|
|
|
- :pagination="pagination"
|
|
|
+ :data-source="paginatedData"
|
|
|
+ :pagination="paginationConfig"
|
|
|
:loading="loadingMap[record.id]"
|
|
|
bordered
|
|
|
- overflow-y="auto"
|
|
|
+ :scroll="{ y: 410 }"
|
|
|
>
|
|
|
<template #bodyCell="{ column, record: innerRecord }">
|
|
|
<template v-if="column.dataIndex === 'value'">
|
|
|
@@ -87,7 +87,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { ref, nextTick, reactive, onMounted, onUnmounted, inject, shallowRef, computed } from 'vue';
|
|
|
+import { ref, nextTick, reactive, onMounted, onUnmounted, watch, shallowRef, computed } from 'vue';
|
|
|
import { usePermission } from '/@/hooks/web/usePermission';
|
|
|
import customHeader from '/@/components/vent/customHeader.vue';
|
|
|
import { AesEncryption } from '/@/utils/cipher';
|
|
|
@@ -119,22 +119,69 @@ const expandedRowKeys = ref([]);
|
|
|
|
|
|
// 加载状态映射
|
|
|
const loadingMap = reactive({});
|
|
|
-
|
|
|
-// 分页配置
|
|
|
-const pagination = reactive({
|
|
|
+// 分页参数
|
|
|
+const paginationState = ref({
|
|
|
current: 1,
|
|
|
pageSize: 10,
|
|
|
- total: computed(() => deviceList.value.length),
|
|
|
- showSizeChanger: true,
|
|
|
- pageSizeOptions: ['10', '20', '50'],
|
|
|
- onChange: (page, size) => {
|
|
|
- pagination.current = page;
|
|
|
- pagination.pageSize = size;
|
|
|
- },
|
|
|
- onShowSizeChange: (current, size) => {
|
|
|
- pagination.current = 1;
|
|
|
- pagination.pageSize = size;
|
|
|
- },
|
|
|
+ total: 0,
|
|
|
+});
|
|
|
+const paginationState2 = ref({
|
|
|
+ current: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ total: 0,
|
|
|
+});
|
|
|
+// 计算分页后的数据
|
|
|
+const paginatedData = computed(() => {
|
|
|
+ const start = (paginationState.value.current - 1) * paginationState.value.pageSize;
|
|
|
+ const end = start + paginationState.value.pageSize;
|
|
|
+ return monitorList.value.slice(start, end);
|
|
|
+});
|
|
|
+// 计算分页后的数据
|
|
|
+const paginatedData2 = computed(() => {
|
|
|
+ const start = (paginationState2.value.current - 1) * paginationState2.value.pageSize;
|
|
|
+ const end = start + paginationState2.value.pageSize;
|
|
|
+ return deviceList.value.slice(start, end);
|
|
|
+});
|
|
|
+// 分页器配置 - 修复响应式问题
|
|
|
+const paginationConfig = computed(() => {
|
|
|
+ return {
|
|
|
+ current: paginationState.value.current,
|
|
|
+ pageSize: paginationState.value.pageSize,
|
|
|
+ total: monitorList.value.length,
|
|
|
+ showSizeChanger: true,
|
|
|
+ showQuickJumper: true,
|
|
|
+ showTotal: (total) => `共 ${total} 条`,
|
|
|
+ pageSizeOptions: ['10', '20', '50', '100'],
|
|
|
+ size: 'small',
|
|
|
+ onChange: (page, pageSize) => {
|
|
|
+ paginationState.value.current = page;
|
|
|
+ paginationState.value.pageSize = pageSize;
|
|
|
+ },
|
|
|
+ onShowSizeChange: (current, size) => {
|
|
|
+ paginationState.value.current = 1;
|
|
|
+ paginationState.value.pageSize = size;
|
|
|
+ },
|
|
|
+ };
|
|
|
+});
|
|
|
+const paginationConfig2 = computed(() => {
|
|
|
+ return {
|
|
|
+ current: paginationState2.value.current,
|
|
|
+ pageSize: paginationState2.value.pageSize,
|
|
|
+ total: deviceList.value.length,
|
|
|
+ showSizeChanger: true,
|
|
|
+ showQuickJumper: true,
|
|
|
+ showTotal: (total) => `共 ${total} 条`,
|
|
|
+ pageSizeOptions: ['10', '20', '50', '100'],
|
|
|
+ size: 'small',
|
|
|
+ onChange: (page, pageSize) => {
|
|
|
+ paginationState2.value.current = page;
|
|
|
+ paginationState2.value.pageSize = pageSize;
|
|
|
+ },
|
|
|
+ onShowSizeChange: (current, size) => {
|
|
|
+ paginationState2.value.current = 1;
|
|
|
+ paginationState2.value.pageSize = size;
|
|
|
+ },
|
|
|
+ };
|
|
|
});
|
|
|
// 切换tab页面
|
|
|
async function onChangeTab(tab) {
|
|
|
@@ -371,7 +418,7 @@ const loadMonitoringData = async (deviceId) => {
|
|
|
|
|
|
loadingMap[deviceId] = true;
|
|
|
try {
|
|
|
- const result = await getDevMonitorListById({ devId: deviceId });
|
|
|
+ const result = await getDevMonitorListById({ devId: deviceId.toString() });
|
|
|
monitorList.value = Object.values(result.readData);
|
|
|
} catch (error) {
|
|
|
console.error(`加载设备 ${deviceId} 数据失败:`, error);
|
|
|
@@ -384,6 +431,11 @@ onMounted(async () => {
|
|
|
await getDeviceType();
|
|
|
});
|
|
|
onUnmounted(() => {});
|
|
|
+// 监听分页变化
|
|
|
+watch(
|
|
|
+ () => [paginationState.value.current, paginationState.value.pageSize],
|
|
|
+ () => {}
|
|
|
+);
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
@@ -479,172 +531,6 @@ onUnmounted(() => {});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- .detail-content {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- }
|
|
|
-
|
|
|
- .history-content {
|
|
|
- position: relative;
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- align-items: center;
|
|
|
- background: url('/@/assets/images/fire/bj1.png') no-repeat center;
|
|
|
- background-size: 100% 100%;
|
|
|
- color: #fff;
|
|
|
-
|
|
|
- .left-box {
|
|
|
- width: 40%;
|
|
|
- height: 100%;
|
|
|
- margin-right: 15px;
|
|
|
- padding: 10px;
|
|
|
- box-sizing: border-box;
|
|
|
- background: url('/@/assets/images/fire/bj1.png') no-repeat center;
|
|
|
- background-size: 100% 100%;
|
|
|
-
|
|
|
- .left-title {
|
|
|
- display: flex;
|
|
|
- height: 30px;
|
|
|
- align-items: center;
|
|
|
- font-size: 14px;
|
|
|
- margin-bottom: 10px;
|
|
|
-
|
|
|
- span {
|
|
|
- color: #fff;
|
|
|
- }
|
|
|
-
|
|
|
- .zd-open {
|
|
|
- color: rgb(0, 242, 255);
|
|
|
- }
|
|
|
-
|
|
|
- .zd-close {
|
|
|
- color: #ff0000;
|
|
|
- }
|
|
|
-
|
|
|
- .title-fz {
|
|
|
- margin-right: 25px;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .left-content {
|
|
|
- display: flex;
|
|
|
- justify-content: flex-start;
|
|
|
- align-items: flex-start;
|
|
|
- flex-wrap: wrap;
|
|
|
- height: calc(100% - 40px);
|
|
|
- overflow-y: auto;
|
|
|
-
|
|
|
- .card-box {
|
|
|
- position: relative;
|
|
|
- // width: 242px;
|
|
|
- width: 182px;
|
|
|
- height: 120px;
|
|
|
- margin-bottom: 15px;
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
-
|
|
|
- .card-itemN {
|
|
|
- position: relative;
|
|
|
- width: 85px;
|
|
|
- height: 120px;
|
|
|
- background: url('/@/assets/images/zd-2.png') no-repeat center;
|
|
|
- background-size: 100% 100%;
|
|
|
- cursor: pointer;
|
|
|
-
|
|
|
- .card-item-label {
|
|
|
- width: 100%;
|
|
|
- position: absolute;
|
|
|
- bottom: 5px;
|
|
|
- font-size: 12px;
|
|
|
- color: #fff;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .card-itemL {
|
|
|
- position: relative;
|
|
|
- width: 85px;
|
|
|
- height: 120px;
|
|
|
- background: url('/@/assets/images/zd-3.png') no-repeat center;
|
|
|
- background-size: 100% 100%;
|
|
|
- cursor: pointer;
|
|
|
-
|
|
|
- .card-item-label {
|
|
|
- width: 100%;
|
|
|
- position: absolute;
|
|
|
- bottom: 5px;
|
|
|
- font-size: 12px;
|
|
|
- color: #fff;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .card-itemD {
|
|
|
- position: relative;
|
|
|
- width: 85px;
|
|
|
- height: 120px;
|
|
|
- background: url('/@/assets/images/zd-1.png') no-repeat center;
|
|
|
- background-size: 100% 100%;
|
|
|
- cursor: pointer;
|
|
|
-
|
|
|
- .card-item-label {
|
|
|
- width: 100%;
|
|
|
- position: absolute;
|
|
|
- bottom: 5px;
|
|
|
- font-size: 12px;
|
|
|
- color: #fff;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .card-modal {
|
|
|
- width: 86px;
|
|
|
- position: absolute;
|
|
|
- left: 140px;
|
|
|
- color: #fff;
|
|
|
- top: 50%;
|
|
|
- transform: translate(0, -50%);
|
|
|
- font-size: 12px;
|
|
|
- }
|
|
|
-
|
|
|
- .card-modal1 {
|
|
|
- width: 86px;
|
|
|
- position: absolute;
|
|
|
- left: -42px;
|
|
|
- color: #fff;
|
|
|
- top: 50%;
|
|
|
- transform: translate(0, -50%);
|
|
|
- font-size: 12px;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .right-box {
|
|
|
- width: calc(60% - 15px);
|
|
|
- height: 100%;
|
|
|
- padding: 10px;
|
|
|
- box-sizing: border-box;
|
|
|
- background: url('/@/assets/images/fire/bj1.png') no-repeat center;
|
|
|
- background-size: 100% 100%;
|
|
|
-
|
|
|
- .historytable {
|
|
|
- height: 100%;
|
|
|
- }
|
|
|
-
|
|
|
- .right-title {
|
|
|
- display: flex;
|
|
|
- height: 30px;
|
|
|
- align-items: center;
|
|
|
- font-size: 14px;
|
|
|
- color: #fff;
|
|
|
- margin-bottom: 10px;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|