|
@@ -6,8 +6,8 @@ import { useInfiniteScroll } from '@vueuse/core';
|
|
|
import SvgIcon from '@/components/SvgIcon.vue';
|
|
|
import { useRequest } from '@/hooks/request';
|
|
|
import { getDevWorkRealTimeData, getDevWorkTypeCount, queryDevicesList } from '@/api';
|
|
|
-import { getFixedNum } from '@/utils';
|
|
|
-import { DeviceRunningStatus, DeviceStatusQuery } from '@/constants';
|
|
|
+import { getFixedNum, timeSorter } from '@/utils';
|
|
|
+import { DeviceStatusQuery } from '@/constants';
|
|
|
import { DevParamChillerUnit, DevParamCtrlCabinet } from '@/constants/device-params';
|
|
|
|
|
|
import { deviceCardData, DeviceType } from './device-card';
|
|
@@ -124,19 +124,19 @@ useInfiniteScroll(
|
|
|
|
|
|
const getDeviceList = () => {
|
|
|
handleRequest(async () => {
|
|
|
- let runningStatusList = null;
|
|
|
+ let status = null;
|
|
|
|
|
|
if (activeDeviceStatus.value === DeviceStatusQuery.Offline) {
|
|
|
- runningStatusList = [DeviceRunningStatus.Offline];
|
|
|
+ status = 0;
|
|
|
} else if (activeDeviceStatus.value === DeviceStatusQuery.Online) {
|
|
|
- runningStatusList = [DeviceRunningStatus.Stop, DeviceRunningStatus.Run];
|
|
|
+ status = 1;
|
|
|
}
|
|
|
|
|
|
const { records, total } = await queryDevicesList({
|
|
|
...pageParams.value,
|
|
|
deviceType: activeDeviceType.value,
|
|
|
groupId: props.deviceGroupId,
|
|
|
- runningStatusList,
|
|
|
+ status,
|
|
|
});
|
|
|
|
|
|
const deviceIds = records.map((item) => item.id);
|
|
@@ -152,9 +152,19 @@ const getDeviceList = () => {
|
|
|
deviceRealTimeData.value[deviceId] = {};
|
|
|
}
|
|
|
|
|
|
- deviceParamMapList.forEach((paramItem) => {
|
|
|
- Object.assign(deviceRealTimeData.value[item.deviceId], paramItem);
|
|
|
- });
|
|
|
+ const times = deviceParamMapList
|
|
|
+ .filter((item) => item.time)
|
|
|
+ .map((item) => item.time)
|
|
|
+ .sort(timeSorter);
|
|
|
+ const mostRecentTime = times[times.length - 1];
|
|
|
+
|
|
|
+ if (mostRecentTime) {
|
|
|
+ deviceParamMapList.forEach((paramItem) => {
|
|
|
+ if (paramItem.time === mostRecentTime) {
|
|
|
+ Object.assign(deviceRealTimeData.value[item.deviceId], paramItem);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
if (isDeviceChillerUnit) {
|
|
|
Object.assign(deviceRealTimeData.value[item.deviceId], chillerUnitExtraParams);
|
|
@@ -238,6 +248,7 @@ const handleDevCardClick = (devId: number, e: Event) => {
|
|
|
</ATabs>
|
|
|
</div>
|
|
|
<div ref="deviceListEl" class="device-card-list">
|
|
|
+ <AEmpty class="device-card-empty" v-show="!deviceList.length" />
|
|
|
<ARow :gutter="[22, 24]">
|
|
|
<ACol v-for="item in deviceList" :key="item.id" :xs="24" :sm="24" :md="24" :lg="24" :xl="12" :xxl="8">
|
|
|
<div class="device-card-container" @click="handleDevCardClick(item.id, $event)">
|
|
@@ -246,7 +257,7 @@ const handleDevCardClick = (devId: number, e: Event) => {
|
|
|
:class="[
|
|
|
'status-dot',
|
|
|
{
|
|
|
- 'device-status-offline': item.runningStatus === DeviceRunningStatus.Offline,
|
|
|
+ 'status-dot-green': item.status === 1,
|
|
|
},
|
|
|
]"
|
|
|
></span>
|
|
@@ -284,6 +295,7 @@ const handleDevCardClick = (devId: number, e: Event) => {
|
|
|
</div>
|
|
|
</ACol>
|
|
|
</ARow>
|
|
|
+ <ASpin v-if="isLoading" class="center-loading" :spinning="true" />
|
|
|
</div>
|
|
|
<DeviceWorkParams ref="deviceWorkParams" :dev-id="currentDevId" @view-history-data="viewHistoryData" />
|
|
|
<DevWorkParamData ref="devWorkParamData" :dev-id="currentDevId" :param-codes="currentDevParamCodes" />
|
|
@@ -332,6 +344,10 @@ const handleDevCardClick = (devId: number, e: Event) => {
|
|
|
overflow: hidden auto;
|
|
|
}
|
|
|
|
|
|
+.device-card-empty {
|
|
|
+ margin-top: 200px;
|
|
|
+}
|
|
|
+
|
|
|
.device-card-container {
|
|
|
position: relative;
|
|
|
height: 328px;
|
|
@@ -346,10 +362,6 @@ const handleDevCardClick = (devId: number, e: Event) => {
|
|
|
margin-bottom: 24px;
|
|
|
}
|
|
|
|
|
|
-.device-status-offline {
|
|
|
- --status-dot-rgb: 191, 191, 191; // RGB 颜色分量 (灰色)
|
|
|
-}
|
|
|
-
|
|
|
.device-card-header-title {
|
|
|
max-width: 150px;
|
|
|
margin-right: 16px;
|