bobo04052021@163.com преди 2 дни
родител
ревизия
c482f0c8e9
променени са 1 файла, в които са добавени 26 реда и са изтрити 7 реда
  1. 26 7
      pages/history/history.vue

+ 26 - 7
pages/history/history.vue

@@ -365,7 +365,11 @@ export default {
       this.devices = [];
       data.forEach((element) => {
         const deviceObj = {
-          id: element.deviceId ? element.deviceId : element.deviceID,
+          id: element.deviceId
+            ? element.deviceId
+            : element.deviceID
+            ? element.deviceID
+            : "",
           strinstallpos: element.strinstallpos,
           type: element.deviceType,
           stationtype: element.stationtype,
@@ -411,12 +415,11 @@ export default {
     },
     //查询历史数据 getDeviceHistory
     checkHistory() {
-      // if (this.stationType !== "redis") {
-      //   this.getHistoryData();
-      // } else {
-      //   this.getHistoryData2();
-      // }
-      this.getHistoryData2();
+      if (this.stationType !== "redis") {
+        this.getHistoryData();
+      } else {
+        this.getHistoryData2();
+      }
     },
     // 查询历史数据
     getHistoryData() {
@@ -429,6 +432,7 @@ export default {
         pageSize: 10,
         strtype: this.TabCur,
       };
+      console.log(params, "params");
       new Promise((resolve, reject) => {
         api
           .getDeviceHistory(params)
@@ -472,8 +476,23 @@ export default {
                   response.data.result.records) ||
                 [];
               // this.pageNo = response.data.result.datalist.current;
+              uni.showModal({
+                title: "数据提示",
+                content: this.historyData.length
+                  ? `共${
+                      this.historyData.length
+                    }条数据:\n${this.historyData.join("\n\n")}`
+                  : "暂无历史数据",
+                showCancel: false,
+                confirmText: "知道了",
+              });
             } else {
               resolve(response);
+              uni.showToast({
+                title: "请求失败",
+                icon: "none",
+                duration: 2000,
+              });
             }
           })
           .catch((error) => {