Prechádzať zdrojové kódy

fix:环境监测2.0bug

liu.haichuan 1 mesiac pred
rodič
commit
bbc5dab108

+ 3 - 1
pages/deviceDetails/weatherStation/devControl.vue

@@ -7,7 +7,9 @@
     </cu-custom>
     <view class="control-board">
       <view class="title">操作</view>
-      <u-button type="success" class="reload-btn" @click="handleControl('RESET')" style="margin-bottom: 48rpx;">重启</u-button>
+      <div style="margin-bottom: 48rpx;">
+        <u-button type="success" class="reload-btn" @click="handleControl('RESET')">重启</u-button>
+      </div>
       <u-button type="success" class="reload-btn" @click="handleControl('FWUPDATE')">升级</u-button>
       <view class="title date-title">本地存储间隔(min)</view>
       <view class="date-slider">

+ 56 - 17
pages/deviceDetails/weatherStation/eleDetail.vue

@@ -72,8 +72,11 @@
           canvas-id="temperatureChart"
           id="temperatureChart"
           class="chart"
+          @touchstart="touchLineA($event)"
+          @touchmove="moveLineA($event)"
+          @touchend="touchEndLineA($event)"
+          disable-scroll="true"
         ></canvas>
-        <!-- <baseCharts /> -->
       </view>
       <view class="no-data" v-else>
         <text>暂无数据</text>
@@ -108,7 +111,9 @@
         <scroll-view class="scroll-column" scroll-x="true">
           <view class="scroll-content">
             <view class="table-row">
-              <view class="table-cell header">{{ activeChartInfo.name + '(' + activeChartInfo.unit + ')' }}</view>
+              <view class="table-cell header">{{
+                activeChartInfo.name + "(" + activeChartInfo.unit + ")"
+              }}</view>
             </view>
             <view class="table-row" v-for="(item, idx) in tableList" :key="idx">
               <view class="table-cell">{{ item[activeChartInfo.title] }}</view>
@@ -118,13 +123,23 @@
       </view>
 
       <view class="pagination">
-        <view class="page-item prev" @click="prevPage" :class="{ disabled: currentPage === 1 }">上一页</view>
+        <view
+          class="page-item prev"
+          @click="prevPage"
+          :class="{ disabled: currentPage === 1 }"
+          >上一页</view
+        >
         <view class="page-info">
           <text class="curret-page">{{ currentPage }}</text>
           <text>/</text>
           <text>{{ totalPages }}</text>
         </view>
-        <view class="page-item next" @click="nextPage" :class="{ disabled: currentPage >= totalPages }">下一页</view>
+        <view
+          class="page-item next"
+          @click="nextPage"
+          :class="{ disabled: currentPage >= totalPages }"
+          >下一页</view
+        >
       </view>
     </view>
   </view>
@@ -138,6 +153,7 @@ export default {
   onLoad(options) {
     const deviceInfo = JSON.parse(decodeURIComponent(options.deviceInfo));
     console.log(deviceInfo, "deviceInfo");
+    this.eleKey = options.eleKey || "";
     this.initDateRange(deviceInfo.uptime);
     this.deviceInfo = deviceInfo;
     this.getChartData();
@@ -165,14 +181,15 @@ export default {
         series: [],
       },
       activeChartInfo: {},
+      eleKey: "",
     };
   },
-    computed: {
-      totalPages() {
-        return Math.ceil(this.total / this.pageSize);
-      }
+  computed: {
+    totalPages() {
+      return Math.ceil(this.total / this.pageSize);
     },
-    methods: {
+  },
+  methods: {
     initDateRange(timestamp) {
       if (!timestamp) {
         const today = new Date();
@@ -197,12 +214,12 @@ export default {
     initChart() {
       const ctx = uni.createCanvasContext("temperatureChart", this);
       const currentEle = this.eleTabs[this.eleActive];
-      console.log(currentEle, 'currentEle')
-      currentEle.data.forEach(item => {
-        if (item.value === '/') {
-          item.value = '0'
+      console.log(currentEle, "currentEle");
+      currentEle.data.forEach((item) => {
+        if (item.value === "/") {
+          item.value = "0";
         }
-      })
+      });
       const series = [
         {
           name: currentEle.name,
@@ -245,8 +262,9 @@ export default {
           axisLineColor: "#E4E7ED",
           disableGrid: true,
           fontColor: "#656565",
-          tickCount: 5,
           fontSize: 10,
+          itemCount: 5,
+          scrollShow: true,
         },
         yAxis: {
           splitNumber: 4,
@@ -258,6 +276,8 @@ export default {
           fontSize: 10,
         },
         dataLabel: false,
+        enableScroll: true,
+        background: "#FFFFFF",
         extra: {
           line: {
             type: "curve",
@@ -267,6 +287,22 @@ export default {
         },
       });
     },
+    touchLineA(e) {
+      this.temperatureChart.scrollStart(e);
+    },
+    moveLineA(e) {
+      this.temperatureChart.scroll(e);
+    },
+    touchEndLineA(e) {
+      this.temperatureChart.scrollEnd(e);
+      //下面是toolTip事件,如果滚动后不需要显示,可不填写
+      // this.temperatureChart.showToolTip(e, {
+      //   format: function(item, category) {
+      //     console.log(item, 'iyee', e)
+      //     return category + ' ' + item.name + ':' + item.data
+      //   }
+      // });
+    },
 
     // 打开日期选择器
     openDatePicker() {
@@ -384,8 +420,11 @@ export default {
         if (res && Array.isArray(res) && res.length > 0) {
           this.eleTabs = res;
           this.hasData = true;
-          this.activeChartInfo = this.eleTabs[this.eleActive];
-          console.log(this.activeChartInfo, 'activeChartInfo')
+          this.activeChartInfo =
+            this.eleTabs.find((item) => item.title === this.eleKey) ||
+            this.eleTabs[0];
+          this.eleActive = this.eleTabs.indexOf(this.activeChartInfo);
+          console.log(this.activeChartInfo, "activeChartInfo");
           this.$nextTick(() => {
             this.initChart();
           });

+ 10 - 16
pages/deviceDetails/weatherStation/index.vue

@@ -70,7 +70,7 @@
           class="data-card"
           v-for="(item, index) in monitorList"
           :key="index"
-          @click="goPage('eleDetail')"
+          @click="goPage('eleDetail', item)"
         >
           <view class="card-title">{{ item.factorName }}</view>
           <view class="data-value-row">
@@ -236,20 +236,8 @@ export default {
     return {
       deviceInfo: {},
       activeTab: "monitoring",
-      monitorList: [
-        // {
-        //   label: "大气温度",
-        //   val: "42.0",
-        //   unit: "℃",
-        //   key: "1",
-        //   key: "WDIRA",
-        //   type: "default",
-        // }
-      ],
+      monitorList: [],
       statusList: [],
-      tableList: [
-        { reportTime: "2025-06-10 15:00:00", batteryVolt: 35, signal: 30 },
-      ],
       show: false,
       mode: "range",
       startDate: "",
@@ -311,9 +299,15 @@ export default {
         },
       });
     },
-    goPage(type) {
+    goPage(type, eleItem) {
+      let url = ''
+      if (eleItem && eleItem.key) {
+        url = `/pages/deviceDetails/weatherStation/${type}?deviceInfo=${encodeURIComponent(JSON.stringify(this.deviceInfo))}&eleKey=${eleItem.key}`
+      } else {
+        url = `/pages/deviceDetails/weatherStation/${type}?deviceInfo=${encodeURIComponent(JSON.stringify(this.deviceInfo))}`
+      }
       uni.navigateTo({
-        url: `/pages/deviceDetails/weatherStation/${type}?deviceInfo=${encodeURIComponent(JSON.stringify(this.deviceInfo))}`,
+        url
       });
     },
     openDatePicker() {

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 3 - 0
static/images/device/SM01A-default.svg


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 3 - 0
static/images/device/STEMC-default.svg


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 18 - 0
static/images/device/冻土.svg