Jelajahi Sumber

优化九宫格加载逻辑+实时数据历史数据对接

ming 1 Minggu lalu
induk
melakukan
1f61bf6fc9

+ 2 - 2
src/api/business/fireIot/deviceManage.js

@@ -30,7 +30,7 @@ export function dmpProductAttribute(param) {
 // 设备多属性历史数据请求
 export function historyMetrics(param) {
     return request({
-        url: "/usky-backend/dataQuery/historyMetrics",
+        url: "/data-tsdb-proxy/dataQuery/historyMetrics",
         method: "POST",
         data: param,
     });
@@ -39,7 +39,7 @@ export function historyMetrics(param) {
 // 设备实时数据请求
 export function last(param) {
     return request({
-        url: "/usky-backend/dataQuery/last",
+        url: "/data-tsdb-proxy/dataQuery/last",
         method: "POST",
         data: param,
     });

+ 15 - 9
src/pages/business/fireIot/deviceManage/components/deviceDetails.vue

@@ -68,9 +68,9 @@
             </u-row>
           </view> -->
         </view>
-        <!--  -->
         <view v-if="tabPosition == 0">
-          <view class="flex" style="flex-wrap: wrap; line-height: 36px">
+          <u-empty v-if="realTimeDataList.length <= 0" text="暂无数据" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png"> </u-empty>
+          <view v-else class="flex" style="flex-wrap: wrap; line-height: 36px">
             <view style="width: 50%" v-for="realTime in realTimeDataList" :key="realTime">
               {{ realTime.attributeName + ":" }}
               {{ realTime.value }}
@@ -83,8 +83,11 @@
           <br/>
           <u-row
             gutter="10"
+            style="justify-content:center"
           >
-              <u-col span="3" v-for="(item, index) in deviceCotrolList" :key="index">
+              <u-empty v-if="deviceCotrolList.length <= 0" text="暂无数据" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png"> </u-empty>
+
+              <u-col v-else span="3" v-for="(item, index) in deviceCotrolList" :key="index">
                   <view class="demo-layout" @click="goAction(item)">{{ item.commandName }}</view>
               </u-col>
               
@@ -169,6 +172,7 @@ const calendarStartTime = ref(""); //日历开始时间
 const calendarEndTime = ref(""); //日历结束时间
 const productId = ref(0); //产品id
 const deviceId = ref(0); //设备id
+const deviceUUID = ref("") //设备UUID
 const productCode = ref(""); //产品code
 const deviceCotrolList = ref([]) //设备调试数据存储
 function open() {
@@ -193,6 +197,7 @@ function dmpDeviceInfoApi() {
       dataList.value[3].value = requset.data.records[0].installAddress
       dataList.value[4].value = requset.data.records[0].createdTime ? requset.data.records[0].createdTime.replace("T", " ") : requset.data.records[0].createdTime;
       productCode.value = requset.data.records[0].productCode;
+      deviceUUID.value=requset.data.records[0].deviceUuid;
     }
   });
 }
@@ -218,7 +223,7 @@ function init() {
       });
 
       last({
-        deviceId: commonStore.deviceDetailsArray.deviceId,
+        deviceUUId: deviceUUID.value,
         metrics: array,
       }).then((requsets) => {
         if (requsets.status === "SUCCESS") {
@@ -284,10 +289,11 @@ function calendarConfirm(e) {
  */
 function historyMetricsApi() {
   historyMetrics({
-    startTime: calendarStartTime.value,
-    endTime: calendarEndTime.value,
-    deviceId: commonStore.deviceDetailsArray.deviceId,
-    deviceType: commonStore.deviceDetailsArray.deviceType,
+    startTime: calendarStartTime.value?calendarStartTime.value+' 00:00:00':calendarStartTime.value,
+    endTime: calendarEndTime.value?calendarEndTime.value+' 23:59:59':calendarEndTime.value,
+    deviceUUId: deviceUUID.value,
+    // deviceId: commonStore.deviceDetailsArray.deviceId,
+    // deviceType: commonStore.deviceDetailsArray.deviceType,
     metrics: checkboxValueList.value,
   }).then((requset) => {
     if (requset.status === "SUCCESS") {
@@ -356,7 +362,7 @@ watch(
 }
 .demo-layout{
   border:1px solid #e0e0e0;
-  padding:15px;
+  padding:15px 10px;
   box-shadow:0px 0px 12px rgba(0, 0, 0, 0.12);
 }
 </style>

+ 1 - 1
src/pages/business/fireIot/deviceManage/components/deviceDetailsList.vue

@@ -103,7 +103,7 @@ function init() {
  */
 
 function dmpDeviceInfoApi() {
-  dmpDeviceInfo({ current: current.value, size: pageSize.value ,deviceStatus:radioValue.value }).then((requset) => {
+  dmpDeviceInfo({productId: productId.value, deviceName: deviceName.value, current: current.value, size: pageSize.value, deviceStatus:radioValue.value }).then((requset) => {
     if (requset.status == "SUCCESS") {
       dataList.value = requset.data.records;
       total.value = requset.data.total;

+ 2 - 2
src/pages/business/fireIot/deviceManage/index.vue

@@ -5,7 +5,7 @@
     :total="total"
     :isSticky="false"
     :refresherLoad="true"
-    :refresherLoadTitle="false"
+    :refresherLoadTitle="true"
     :refresherEnabled="true"
     :refresherDefaultStyle="'none'"
     :refresherThreshold="44"
@@ -38,7 +38,7 @@ import { dmpProductInfo } from "@/api/business/fireIot/deviceManage.js";
 const { proxy } = getCurrentInstance();
 
 const dataList = ref([]);
-const pageSize = ref(20);
+const pageSize = ref(21);
 const current = ref(1);
 const total = ref(0);
 

+ 1 - 1
src/pages/index.vue

@@ -19,7 +19,7 @@
 
   <oa-scroll
     customClass="scroll-height"
-    :customStyle="{ height: `calc(100vh - (94px + ${proxy.$settingStore.StatusBarHeight} + ${proxy.$settingStore.tabBarHeight}))` }"
+    :customStyle="{ height: `calc(100vh - (104px + ${proxy.$settingStore.StatusBarHeight} + ${proxy.$settingStore.tabBarHeight}))` }"
     :refresherLoad="false"
     :refresherEnabled="true"
     :refresherEnabledTitle="false"