Browse Source

Merge branch 'master' of http://182.92.126.35:3000/msx/Vent-App

hongrunxia 1 week ago
parent
commit
76b901820d
3 changed files with 295 additions and 37 deletions
  1. 4 0
      api/api.js
  2. 56 22
      pages/history/history.vue
  3. 235 15
      pages/home/detail/autodoor/autodoor.vue

+ 4 - 0
api/api.js

@@ -146,6 +146,10 @@ const apiService = {
     const url = buildURL("/safety/ventanalyMonitorData/listdays", params);
     const url = buildURL("/safety/ventanalyMonitorData/listdays", params);
     return http.get(url);
     return http.get(url);
   },
   },
+  getDeviceHistory2(params) {
+    const url = buildURL("/monitor/history/getHistoryData", params);
+    return http.get(url);
+  },
   //获取操作历史
   //获取操作历史
   getOpreateHistory(params) {
   getOpreateHistory(params) {
     const url = buildURL(
     const url = buildURL(

+ 56 - 22
pages/history/history.vue

@@ -292,6 +292,7 @@ export default {
       loading: false, // 是否正在加载数据
       loading: false, // 是否正在加载数据
       hasMoreData: true, // 是否还有更多数据可以加载
       hasMoreData: true, // 是否还有更多数据可以加载
       pageNo: 1, // 当前页码(用于请求数据时分页)
       pageNo: 1, // 当前页码(用于请求数据时分页)
+      stationType: "plc1", // 站点类型(用于请求数据时的参数)
     };
     };
   },
   },
   components: {
   components: {
@@ -365,6 +366,7 @@ export default {
           id: element.deviceID,
           id: element.deviceID,
           strinstallpos: element.strinstallpos,
           strinstallpos: element.strinstallpos,
           type: element.deviceType,
           type: element.deviceType,
+          stationType: element.stationType,
         };
         };
         this.devices.push(deviceObj);
         this.devices.push(deviceObj);
       });
       });
@@ -372,7 +374,7 @@ export default {
     //选择设备  点击确定按钮  保存id
     //选择设备  点击确定按钮  保存id
     selectDevice(e) {
     selectDevice(e) {
       this.deviceID = e.value[0].id;
       this.deviceID = e.value[0].id;
-      // this.TabCur = e.value[0].type;
+      this.stationType = e.value[0].stationType;
       // console.log(this.TabCur, "设备类型");
       // console.log(this.TabCur, "设备类型");
       this.deviceName = e.value[0].strinstallpos;
       this.deviceName = e.value[0].strinstallpos;
       this.deviceShow = false;
       this.deviceShow = false;
@@ -404,6 +406,14 @@ export default {
     },
     },
     //查询历史数据 getDeviceHistory
     //查询历史数据 getDeviceHistory
     checkHistory() {
     checkHistory() {
+      if (this.stationType !== "redis") {
+        this.getHistoryData();
+      } else {
+        this.getHistoryData2();
+      }
+    },
+    // 查询历史数据
+    async getHistoryData() {
       const params = {
       const params = {
         ttime_begin: this.StartTime,
         ttime_begin: this.StartTime,
         ttime_end: this.EndTime,
         ttime_end: this.EndTime,
@@ -413,7 +423,6 @@ export default {
         pageSize: 10,
         pageSize: 10,
         strtype: this.TabCur,
         strtype: this.TabCur,
       };
       };
-
       new Promise((resolve, reject) => {
       new Promise((resolve, reject) => {
         api
         api
           .getDeviceHistory(params)
           .getDeviceHistory(params)
@@ -421,6 +430,51 @@ export default {
             debugger;
             debugger;
             if (response.data.code == 200) {
             if (response.data.code == 200) {
               const infolist = response.data.result;
               const infolist = response.data.result;
+              this.historyData = infolist.datalist.records;
+              this.historyData.forEach((item) => {
+                if (item.readData.frontGateOpen == 1) {
+                  item.readData.frontGateOpen = "打开";
+                } else {
+                  item.readData.frontGateOpen = "关闭";
+                }
+                if (item.readData.rearGateOpen == 1) {
+                  item.readData.rearGateOpen = "打开";
+                } else {
+                  item.readData.rearGateOpen = "关闭";
+                }
+                if (item.readData.midGateOpen == 1) {
+                  item.readData.midGateOpen = "打开";
+                } else {
+                  item.readData.midGateOpen = "关闭";
+                }
+              });
+              this.pageNo = response.data.result.datalist.current;
+            } else {
+              resolve(response);
+            }
+          })
+          .catch((error) => {
+            reject(error);
+          });
+      });
+    },
+    async getHistoryData2() {
+      const params = {
+        startTime: this.StartTime,
+        endTIme: this.EndTime,
+        deviceId: this.deviceID,
+        interval: this.skip,
+        isEmployee: true,
+        pageSize: 10,
+        strtype: this.TabCur,
+      };
+      new Promise((resolve, reject) => {
+        api
+          .getDeviceHistory2(params)
+          .then((response) => {
+            debugger;
+            if (response.data.code == 200) {
+              const infolist = response.data.result;
               this.historyData = infolist.records;
               this.historyData = infolist.records;
               this.historyData.forEach((item) => {
               this.historyData.forEach((item) => {
                 if (item.readData.frontGateOpen == 1) {
                 if (item.readData.frontGateOpen == 1) {
@@ -440,26 +494,6 @@ export default {
                 }
                 }
               });
               });
               this.pageNo = response.data.result.datalist.current;
               this.pageNo = response.data.result.datalist.current;
-              // if (infolist.length == 0 && this.pageNo == 1) {
-              //   // console.log('首次加载没数据');
-              //   this.noData = false;
-              //   this.historyData = [];
-              // } else if (infolist.length < 3 && this.pageNo == 1) {
-              //   // console.log('首次加载有数据,但少于4条');
-              //   this.noData = true;
-              //   this.historyData = infolist;
-              // } else if (infolist.length !== 0 && this.pageNo == 1) {
-              //   // console.log('首次加载有数据');
-              //   this.noData = false;
-              //   this.historyData = infolist;
-              // } else if (infolist.length !== 0 && this.pageNo > 1) {
-              //   // console.log('上拉加载更多数据');
-              //   this.noData = false;
-              //   this.historyData = this.historyData.concat(infolist);
-              // } else if (infolist.length == 0 && this.pageNo > 1) {
-              //   // console.log('上拉加载没有更多数据了');
-              //   this.noData = true;
-              // }
             } else {
             } else {
               resolve(response);
               resolve(response);
             }
             }

+ 235 - 15
pages/home/detail/autodoor/autodoor.vue

@@ -256,7 +256,7 @@
             </div>
             </div>
           </div>
           </div>
           <div class="flex-container" v-else-if="TabCur == 'fanmain'">
           <div class="flex-container" v-else-if="TabCur == 'fanmain'">
-            <!-- <div>主机</div> -->
+            <div>主机</div>
             <div
             <div
               class="itemback"
               class="itemback"
               v-for="(item, index) in showColum[TabCur + '_monitor_left']"
               v-for="(item, index) in showColum[TabCur + '_monitor_left']"
@@ -289,9 +289,21 @@
                     style="margin-top: 60rpx; color: #3787fe"
                     style="margin-top: 60rpx; color: #3787fe"
                   >
                   >
                     {{
                     {{
-                      tableData[item.monitorcode] !== undefined &&
-                      tableData[item.monitorcode] !== null
-                        ? tableData[item.monitorcode]
+                      tableData[
+                        item.monitorcode.startsWith("Fan")
+                          ? item.monitorcode.replace(/^Fan/, "Fan1")
+                          : item.monitorcode
+                      ] !== undefined &&
+                      tableData[
+                        item.monitorcode.startsWith("Fan")
+                          ? item.monitorcode.replace(/^Fan/, "Fan1")
+                          : item.monitorcode
+                      ] !== null
+                        ? tableData[
+                            item.monitorcode.startsWith("Fan")
+                              ? item.monitorcode.replace(/^Fan/, "Fan1")
+                              : item.monitorcode
+                          ]
                         : "-"
                         : "-"
                     }}
                     }}
                   </view>
                   </view>
@@ -301,9 +313,107 @@
                     style="margin-top: 60rpx; color: #3787fe"
                     style="margin-top: 60rpx; color: #3787fe"
                   >
                   >
                     {{
                     {{
-                      tableData.readData[item.monitorcode] !== undefined &&
-                      tableData.readData[item.monitorcode] !== null
-                        ? tableData.readData[item.monitorcode]
+                      tableData.readData[
+                        item.monitorcode.startsWith("Fan")
+                          ? item.monitorcode.replace(/^Fan/, "Fan1")
+                          : item.monitorcode
+                      ] !== undefined &&
+                      tableData.readData[
+                        item.monitorcode.startsWith("Fan")
+                          ? item.monitorcode.replace(/^Fan/, "Fan1")
+                          : item.monitorcode
+                      ] !== null
+                        ? tableData.readData[
+                            item.monitorcode.startsWith("Fan")
+                              ? item.monitorcode.replace(/^Fan/, "Fan1")
+                              : item.monitorcode
+                          ]
+                        : "-"
+                    }}
+                  </view>
+                  <div class="spacer"></div>
+                  <!-- 间距 -->
+                  <view
+                    class="demo-layout bg-purple-light"
+                    style="color: #677799"
+                  >
+                    {{ item.des }}
+                  </view>
+                </div>
+              </div>
+            </div>
+            <div>备机</div>
+            <div
+              class="itemback"
+              v-for="(item, index) in showColum[TabCur + '_monitor_left']"
+              :key="index"
+              v-show="item.appShow == 1"
+            >
+              <div
+                class="datacardtime"
+                v-if="item.monitorcode == 'readTime' && item.datatype == 1"
+              >
+                <view
+                  class="demo-layout bg-purple-light"
+                  style="padding: 20rpx; color: #3787fe"
+                >
+                  {{ readTime }}
+                </view>
+              </div>
+              <div class="datacard" v-if="item.monitorcode !== 'readTime'">
+                <div class="left-content">
+                  <view
+                    v-if="item.monitorcode == 'netStatus' && item.datatype == 1"
+                    class="demo-layout bg-purple-light"
+                    style="margin-top: 60rpx; color: #3787fe"
+                  >
+                    {{ doorNetStatus == "1" ? "正常" : "异常" }}
+                  </view>
+                  <view
+                    v-else-if="item.datatype == 1"
+                    class="demo-layout bg-purple-light"
+                    style="margin-top: 60rpx; color: #3787fe"
+                  >
+                    {{
+                      tableData[
+                        item.monitorcode.startsWith("Fan")
+                          ? item.monitorcode.replace(/^Fan/, "Fan2")
+                          : item.monitorcode
+                      ] !== undefined &&
+                      tableData[
+                        item.monitorcode.startsWith("Fan")
+                          ? item.monitorcode.replace(/^Fan/, "Fan2")
+                          : item.monitorcode
+                      ] !== null
+                        ? tableData[
+                            item.monitorcode.startsWith("Fan")
+                              ? item.monitorcode.replace(/^Fan/, "Fan2")
+                              : item.monitorcode
+                          ]
+                        : "-"
+                    }}
+                  </view>
+                  <view
+                    v-else-if="item.datatype == 2"
+                    class="demo-layout bg-purple-light"
+                    style="margin-top: 60rpx; color: #3787fe"
+                  >
+                    {{
+                      tableData.readData[
+                        item.monitorcode.startsWith("Fan")
+                          ? item.monitorcode.replace(/^Fan/, "Fan2")
+                          : item.monitorcode
+                      ] !== undefined &&
+                      tableData.readData[
+                        item.monitorcode.startsWith("Fan")
+                          ? item.monitorcode.replace(/^Fan/, "Fan2")
+                          : item.monitorcode
+                      ] !== null
+                        ? tableData.readData[
+                            item.monitorcode.startsWith("Fan")
+                              ? item.monitorcode.replace(/^Fan/, "Fan2")
+                              : item.monitorcode
+                          ]
                         : "-"
                         : "-"
                     }}
                     }}
                   </view>
                   </view>
@@ -320,10 +430,96 @@
             </div>
             </div>
           </div>
           </div>
           <div class="flex-container" v-else-if="TabCur == 'fanlocal'">
           <div class="flex-container" v-else-if="TabCur == 'fanlocal'">
-            <!-- <div>主机</div> -->
+            <div>主机</div>
             <div
             <div
               class="itemback"
               class="itemback"
-              v-for="(item, index) in showColum[TabCur + '_monitor_right']"
+              v-for="(item, index) in showColum[TabCur + '_monitor_left']"
+              :key="index"
+              v-show="item.appShow == 1"
+            >
+              <div
+                class="datacardtime"
+                v-if="item.monitorcode == 'readTime' && item.datatype == 1"
+              >
+                <view
+                  class="demo-layout bg-purple-light"
+                  style="padding: 20rpx; color: #3787fe"
+                >
+                  {{ readTime }}
+                </view>
+              </div>
+              <div class="datacard" v-if="item.monitorcode !== 'readTime'">
+                <div class="left-content">
+                  <view
+                    v-if="item.monitorcode == 'netStatus' && item.datatype == 1"
+                    class="demo-layout bg-purple-light"
+                    style="margin-top: 60rpx; color: #3787fe"
+                  >
+                    {{ doorNetStatus == "1" ? "正常" : "异常" }}
+                  </view>
+                  <view
+                    v-else-if="item.datatype == 1"
+                    class="demo-layout bg-purple-light"
+                    style="margin-top: 60rpx; color: #3787fe"
+                  >
+                    {{
+                      tableData[
+                        item.monitorcode.startsWith("Fan")
+                          ? item.monitorcode.replace(/^Fan/, "Fan1")
+                          : item.monitorcode
+                      ] !== undefined &&
+                      tableData[
+                        item.monitorcode.startsWith("Fan")
+                          ? item.monitorcode.replace(/^Fan/, "Fan1")
+                          : item.monitorcode
+                      ] !== null
+                        ? tableData[
+                            item.monitorcode.startsWith("Fan")
+                              ? item.monitorcode.replace(/^Fan/, "Fan1")
+                              : item.monitorcode
+                          ]
+                        : "-"
+                    }}
+                  </view>
+                  <view
+                    v-else-if="item.datatype == 2"
+                    class="demo-layout bg-purple-light"
+                    style="margin-top: 60rpx; color: #3787fe"
+                  >
+                    {{
+                      tableData.readData[
+                        item.monitorcode.startsWith("Fan")
+                          ? item.monitorcode.replace(/^Fan/, "Fan1")
+                          : item.monitorcode
+                      ] !== undefined &&
+                      tableData.readData[
+                        item.monitorcode.startsWith("Fan")
+                          ? item.monitorcode.replace(/^Fan/, "Fan1")
+                          : item.monitorcode
+                      ] !== null
+                        ? tableData.readData[
+                            item.monitorcode.startsWith("Fan")
+                              ? item.monitorcode.replace(/^Fan/, "Fan1")
+                              : item.monitorcode
+                          ]
+                        : "-"
+                    }}
+                  </view>
+                  <div class="spacer"></div>
+                  <!-- 间距 -->
+                  <view
+                    class="demo-layout bg-purple-light"
+                    style="color: #677799"
+                  >
+                    {{ item.des }}
+                  </view>
+                </div>
+              </div>
+            </div>
+            <div>备机</div>
+            <div
+              class="itemback"
+              v-for="(item, index) in showColum[TabCur + '_monitor_left']"
               :key="index"
               :key="index"
               v-show="item.appShow == 1"
               v-show="item.appShow == 1"
             >
             >
@@ -353,9 +549,21 @@
                     style="margin-top: 60rpx; color: #3787fe"
                     style="margin-top: 60rpx; color: #3787fe"
                   >
                   >
                     {{
                     {{
-                      tableData[item.monitorcode] !== undefined &&
-                      tableData[item.monitorcode] !== null
-                        ? tableData[item.monitorcode]
+                      tableData[
+                        item.monitorcode.startsWith("Fan")
+                          ? item.monitorcode.replace(/^Fan/, "Fan2")
+                          : item.monitorcode
+                      ] !== undefined &&
+                      tableData[
+                        item.monitorcode.startsWith("Fan")
+                          ? item.monitorcode.replace(/^Fan/, "Fan2")
+                          : item.monitorcode
+                      ] !== null
+                        ? tableData[
+                            item.monitorcode.startsWith("Fan")
+                              ? item.monitorcode.replace(/^Fan/, "Fan2")
+                              : item.monitorcode
+                          ]
                         : "-"
                         : "-"
                     }}
                     }}
                   </view>
                   </view>
@@ -365,9 +573,21 @@
                     style="margin-top: 60rpx; color: #3787fe"
                     style="margin-top: 60rpx; color: #3787fe"
                   >
                   >
                     {{
                     {{
-                      tableData.readData[item.monitorcode] !== undefined &&
-                      tableData.readData[item.monitorcode] !== null
-                        ? tableData.readData[item.monitorcode]
+                      tableData.readData[
+                        item.monitorcode.startsWith("Fan")
+                          ? item.monitorcode.replace(/^Fan/, "Fan2")
+                          : item.monitorcode
+                      ] !== undefined &&
+                      tableData.readData[
+                        item.monitorcode.startsWith("Fan")
+                          ? item.monitorcode.replace(/^Fan/, "Fan2")
+                          : item.monitorcode
+                      ] !== null
+                        ? tableData.readData[
+                            item.monitorcode.startsWith("Fan")
+                              ? item.monitorcode.replace(/^Fan/, "Fan2")
+                              : item.monitorcode
+                          ]
                         : "-"
                         : "-"
                     }}
                     }}
                   </view>
                   </view>