From 9130536f57daccec183fa203fe2d666667fd42e1 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 13 三月 2024 17:32:32 +0800
Subject: [PATCH] 2024.3.13

---
 componet/chartutil.js |    8 ++++----
 dataprocesser.js      |    2 +-
 history.mode.js       |    6 +++++-
 underway.js           |    2 +-
 httpservice.js        |    4 ++--
 componet/checkbox.js  |   17 +++++++++++++++--
 6 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/componet/chartutil.js b/componet/chartutil.js
index 044cceb..c596b20 100644
--- a/componet/chartutil.js
+++ b/componet/chartutil.js
@@ -285,7 +285,7 @@
     const progress = i / (this._xAxis.length - this._size + 1);
 
     for (const iterator of this._series) {
-      if (iterator.name == factorName || (iterator.name == 'TVOC' || factorName == 'VOC')) {
+      // if (iterator.name == factorName || (iterator.name == 'TVOC' || factorName == 'VOC')) {
         iterator.markLine = {
           symbol: 'none',
           data: [
@@ -301,9 +301,9 @@
             },
           ],
         };
-      } else {
-        iterator.markLine = undefined;
-      }
+      // } else {
+      //   iterator.markLine = undefined;
+      // }
     }
     this.lineChartOnPage2({
       chart,
diff --git a/componet/checkbox.js b/componet/checkbox.js
index 625ae21..e7eeee8 100644
--- a/componet/checkbox.js
+++ b/componet/checkbox.js
@@ -16,7 +16,7 @@
       label.css('margin-left', '4px')
       // label.css('background-color', 'black')
       // checkbox.css('background-color', 'white')
-      checkbox.attr('checked', checked)
+      checkbox.prop('checked', checked)
       checkbox.on('click', onclickListener)
 
       var item = $('<div></div>')
@@ -27,6 +27,19 @@
       item.append(label)
 
       check.append(item)
+    }
+  },
+
+  /**
+   * 鍒锋柊澶嶉�夋缁勭殑閫夋嫨鐘舵��
+   * @param {*} elementId 
+   * @param {*} checkedList 
+   */
+  refreshCheckBox(elementId, checkedList){
+    var checkboxList = $(`#${elementId}`).find('input')
+    for (let i = 0; i < checkboxList.length; i++) {
+      const box = checkboxList[i];
+      $(box).prop('checked', checkedList.indexOf(i) != -1)
     }
   },
 
@@ -47,7 +60,7 @@
       label.css('margin-left', '4px')
       // label.css('background-color', 'black')
       // radiobox.css('background-color', 'white')
-      radiobox.attr('checked', checked)
+      radiobox.prop('checked', checked)
       radiobox.on('click', onclickListener)
       radioboxlist.push(radiobox)
 
diff --git a/dataprocesser.js b/dataprocesser.js
index 42a67aa..21ea2cf 100644
--- a/dataprocesser.js
+++ b/dataprocesser.js
@@ -18,7 +18,7 @@
     var range = _range == undefined ? DataUtil._hMap.get(type) : _range
     var min = range[0]
     var max = range[1]
-    var scale = (DataUtil._hRange[1] - DataUtil._hRange[0]) / (max - min)
+    var scale = (max - min == 0) ? 0 : (DataUtil._hRange[1] - DataUtil._hRange[0]) / (max - min)
     var offset = min
     // console.log("height:" + (data - offset) * scale * 10);
     if (data < range[0]) {
diff --git a/history.mode.js b/history.mode.js
index 2abbef0..0d2ead3 100644
--- a/history.mode.js
+++ b/history.mode.js
@@ -196,7 +196,7 @@
       this.drawMesh(false, this, this.factorDatas);
     }
     // 鎶樼嚎鍥鹃�変腑瀵瑰簲鍥犲瓙
-    this.choseOneFactorLineChart(factorType)
+    this.choseOneFactorLineChart(factorType);
     // 琛ㄦ牸閫変腑瀵瑰簲鍥犲瓙
   },
   setFactorMode: function (factorMode) {
@@ -335,6 +335,10 @@
     this.historyDatas.datas[index].show = true;
     this.historyDatas.physicalQuantity[index].show = true;
     this.lineChartFactorType = [index];
+    CheckBox.refreshCheckBox(
+      'history_chart_factorbox',
+      this.lineChartFactorType
+    );
     this.refreshLineChartData();
   },
   // 鍒涘缓鍒濆鎶樼嚎鍥�
diff --git a/httpservice.js b/httpservice.js
index 148a65a..8825fad 100644
--- a/httpservice.js
+++ b/httpservice.js
@@ -1,8 +1,8 @@
 var appConfig = {
-  baseUrl: "http://114.215.109.124:8805/",
+  // baseUrl: "http://114.215.109.124:8805/",
   // baseUrl: "http://47.100.191.150:9029/",
   // baseUrl: "http://localhost:8080/",
-  // baseUrl: 'http://192.168.0.138:8084/',
+  baseUrl: 'http://192.168.0.138:8084/',
 };
 
 var service = {
diff --git a/underway.js b/underway.js
index 212a7e9..8a13c2b 100644
--- a/underway.js
+++ b/underway.js
@@ -54,7 +54,7 @@
 
 function onCheckMap(obj) {
   var o = obj.value.split(',');
-  var factorType = parseInt(o[0]) - 1;
+  var factorType = parseInt(o[0]);
   mapController.setFactorType(factorType, this.factorMode, o[1]);
 }
 

--
Gitblit v1.9.3