فهرست منبع

APP端问题修改

yf_zhb 2 سال پیش
والد
کامیت
d60cbc5d06

+ 478 - 447
pages/environment/gshistory.vue

@@ -1,481 +1,512 @@
 <template>
-  <view>
-    <view class="status_bar"></view>
-    <view class="" style="position: relative; top: 44px">
-      <view
-        style="
+	<view>
+		<view class="status_bar"></view>
+		<view class="" style="position: relative; top: 44px">
+			<view style="
           position: fixed;
           z-index: 10000000;
           width: 100%;
           background-color: #000000;
-        "
-      >
-        <uni-nav-bar
-          @clickLeft="clickLeft"
-          left-icon="back"
-          left-text="返回"
-          title="历史数据"
-        ></uni-nav-bar>
-      </view>
-    </view>
-    <view class="his_box">
-      <view class="selecttimes" @click="tiemshow = !tiemshow">
-        <view class="timesbox">
-          <image
-            :src="'http://www.hnyfwlw.com:8006/bigdata_app/image/prevention/1acfe2751c01d3786cdc49b83d7e505.png'"
-            mode=""
-          ></image>
-          <p>{{ timetab(begintime) }}</p>
-          <p class="or">~</p>
-          <p>{{ timetab(end) }}</p>
-          <u-icon name="rili" custom-prefix="custom-icon" class="icon"></u-icon>
-        </view>
-        <u-calendar
-          v-model="tiemshow"
-          mode="range"
-          @change="tiemchange"
-        ></u-calendar>
-      </view>
-      <view class="shuju_one">
-        <view class="canvastishi" v-if="!canvastishiTF && !dataloadingtf">
-          暂无数据
-        </view>
-        <view class="canvastishi" v-if="dataloadingtf">
-          <p class="dataloading">加载中</p>
-        </view>
-        <canvas
-          v-show="!tiemshow"
-          canvas-id="canvasColumnA"
-          id="canvasColumnA"
-          class="charts"
-          @touchstart="touchLineA($event)"
-          @touchmove="moveLineA($event)"
-          @touchend="touchEndLineA($event)"
-          disable-scroll="true"
-          :style="{
+        ">
+				<uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="历史数据"></uni-nav-bar>
+			</view>
+		</view>
+		<view class="his_box">
+			<view class="selecttimes" @click="tiemshow = !tiemshow">
+				<view class="timesbox">
+					<image
+						:src="'http://www.hnyfwlw.com:8006/bigdata_app/image/prevention/1acfe2751c01d3786cdc49b83d7e505.png'"
+						mode=""></image>
+					<p>{{ timetab(begintime) }}</p>
+					<p class="or">~</p>
+					<p>{{ timetab(end) }}</p>
+					<u-icon name="rili" custom-prefix="custom-icon" class="icon"></u-icon>
+				</view>
+				<u-calendar v-model="tiemshow" mode="range" @change="tiemchange"></u-calendar>
+			</view>
+			<view class="shuju_one">
+				<view class="canvastishi" v-if="!canvastishiTF && !dataloadingtf">
+					暂无数据
+				</view>
+				<view class="canvastishi" v-if="dataloadingtf">
+					<p class="dataloading">加载中</p>
+				</view>
+				<canvas v-show="!tiemshow" canvas-id="canvasColumnA" id="canvasColumnA" class="charts"
+					@touchstart="touchLineA($event)" @touchmove="moveLineA($event)" @touchend="touchEndLineA($event)"
+					disable-scroll="true" :style="{
             width: cWidth * pixelRatio + 'px',
             height: cHeight * pixelRatio + 'px',
             transform: 'scale(' + 1 / pixelRatio + ')',
             'margin-left': (-cWidth * (pixelRatio - 1)) / 2 + 'px',
             'margin-top': (-cHeight * (pixelRatio - 1)) / 2 + 'px',
-          }"
-        ></canvas>
-      </view>
-      <view class="condition">
-        <scroll-view scroll-top="0" scroll-x="true" class="scroll-X">
-          <table class="table">
-            <tr class="tr">
-              <th class="th" v-for="(item, index) in thdata" :key="'a' + index">
-                {{ item }}
-              </th>
-            </tr>
-            <tr
-              class="tr"
-              v-for="(items, indexs) in historylistdata"
-              :key="'b' + indexs"
-              v-if="!forbidden"
-            >
-              <td class="td">{{ items.uptime | timeFormat() }}</td>
-             <!-- <td class="td">{{ items.ats }}</td>
+          }"></canvas>
+			</view>
+			<view class="condition">
+				<scroll-view scroll-top="0" scroll-x="true" class="scroll-X">
+					<table class="table">
+						<tr class="tr">
+							<th class="th" v-for="(item, index) in thdata" :key="'a' + index">
+								{{ item }}
+							</th>
+						</tr>
+						<tr class="tr" v-for="(items, indexs) in historylistdata" :key="'b' + indexs" v-if="!forbidden">
+							<td class="td">{{ items.uptime | timeFormat() }}</td>
+							<!-- <td class="td">{{ items.ats }}</td>
               <td class="td">{{ items.at }}</td> -->
-              <td
-                class="td"
-                v-for="(item, index) in items.temp"
-                :key="'c' + index"
-              >
-                {{ item }}
-              </td>
-              <td
-                class="td"
-                v-for="(item, index) in items.swc"
-                :key="'d' + index"
-              >
-                {{ item }}
-              </td>
-              <!-- <td class="td">{{ items.atm }}</td> -->
-            </tr>
-            <tr class="tr" v-if="forbidden">
-              <td class="td" v-for="item in 13">暂无数据</td>
-            </tr>
-          </table>
-        </scroll-view>
-        <view class="pagenumber">
-          <button @click="prev">上一页</button>
-          <view class="pagenumber_page"> 第 {{ page }} 页 </view>
-          <view class="pagenumber_page"> 共 {{ pagesum }} 页 </view>
-          <button @click="next">下一页</button>
-        </view>
-      </view>
-    </view>
-  </view>
+							<td class="td" v-for="(item, index) in items.temp" :key="'c' + index">
+								{{ item }}
+							</td>
+							<td class="td" v-for="(item, index) in items.swc" :key="'d' + index">
+								{{ item }}
+							</td>
+							<!-- <td class="td">{{ items.atm }}</td> -->
+						</tr>
+						<tr class="tr" v-if="forbidden">
+							<td class="td" v-for="item in 13">暂无数据</td>
+						</tr>
+					</table>
+				</scroll-view>
+				<view class="pagenumber">
+					<button @click="prev">上一页</button>
+					<view class="pagenumber_page"> 第 {{ page }} 页 </view>
+					<view class="pagenumber_page"> 共 {{ pagesum }} 页 </view>
+					<button @click="next">下一页</button>
+				</view>
+			</view>
+		</view>
+	</view>
 </template>
 
 <script>
-import uCharts from "../../components/js_sdk/u-charts/u-charts/u-charts.js";
-var canvaColumnA = null;
-export default {
-  data() {
-    return {
-      tiemshow: false, //时间筛选弹框
-      begintime: "", //开始时间
-      end: "", //结束时间
-      dataloadingtf: true,
-      canvastishiTF: false,
-      device_id: "", //设备ID
-      thdata: [
-        "上传时间",
-        // "空气湿度(%RH)",
-        // "空气温度(℃)",
-        "10cm土壤温度(%RH)",
-        "20cm土壤温度(%RH)",
-        "30cm土壤温度(%RH)",
-        "10cm土壤湿度(%RH)",
-        "20cm土壤湿度(%RH)",
-        "30cm土壤湿度(%RH)",
-        // "大气压强(Pa)",
-      ], //表格抬头
-      forbidden: false,
-      historylistdata: [], //历史数据
-      pagesum: 1,
-      page: 1,
-      cWidth: "",
-      cHeight: "",
-      pixelRatio: 1,
-    };
-  },
-  methods: {
-    tiemchange(e) {
-      //切换时间
-      this.begintime = parseInt(+new Date(e.startDate) / 1000);
-      this.end = parseInt(+new Date(e.endDate) / 1000);
-      this.histprydatas();
-    },
-    timetab(e) {
-      //时间转换
-      e = new Date(e * 1000);
-      var year = e.getFullYear();
-      var month =
-        e.getMonth() + 1 < 10 ? "0" + (e.getMonth() + 1) : e.getMonth() + 1;
-      var day = e.getDate() < 10 ? "0" + e.getDate() : e.getDate();
-      var time = year + "/" + month + "/" + day;
-      return time;
-    },
-    async histprydatas() {
-      //历史数据
-      this.dataloadingtf = true;
-      const res = await this.$myRequest({
-        url: "/api/api_gateway?method=weather.weather.nd_data",
-        data: {
-          device_id: this.device_id,
-          page: this.page,
-          begin: this.begintime,
-          end: this.end,
-        },
-      });
-      this.dataloadingtf = false;
-      console.log(res.nums,res,'gs history');
-      this.pagesum = Math.ceil(res.nums / 10) || 1;
-      this.historylistdata = res.dat_list;
-      for (var i = 0; i < this.historylistdata.length; i++) {
-        this.historylistdata[i].temp = this.historylistdata[i].temp.split(",");
-        this.historylistdata[i].swc = this.historylistdata[i].swc.split(",");
-      }
-      var arr1 = [];
-      var arr2 = [];
-      var xtitle = [];
-      var obj = [
-        {
-          name: "空气温度",
-          data: [],
-          color: "#00E29D",
-        },
-        {
-          name: "空气湿度",
-          data: [],
-          color: "#6CBBFF",
-        },
-      ];
-      var arr3 = [];
-      var k = 0;
-      for (var i = 0; i < res.dat_char.length; i++) {
-        var times = new Date(res.dat_char[i].uptime * 1000);
-        xtitle.unshift(
-          times.getMonth() +
-            1 +
-            "/" +
-            times.getDate() +
-            "-" +
-            times.getHours() +
-            ":" +
-            times.getMinutes()
-        );
-        arr1.unshift(res.dat_char[i].at == "" ? "0" : res.dat_char[i].at); //空气温度
-        arr2.unshift(res.dat_char[i].ats == "" ? "0" : res.dat_char[i].ats); //空气湿度
-        res.dat_char[i].temp = res.dat_char[i].temp.split(",");
-        res.dat_char[i].swc = res.dat_char[i].swc.split(",");
-        for (var j = 0; j < res.dat_char[i].temp.length; j++) {
-          arr3.unshift(
-            res.dat_char[i].temp[j] == "" ? "0" : res.dat_char[i].temp[j]
-          ); //10cm土壤温度
-        }
-        res.dat_char[i].temp.forEach((items, indexs) => {
-          var tempdata = [];
-          var tempdatas = [];
-          tempdata.push(Number(items));
-          tempdatas.push(Number(res.dat_char[i].swc[indexs]));
-          var temparrs = {
-            name: 10 + indexs * res.topic + "cm土壤温度",
-            data: tempdata,
-          };
-          var temparr = {
-            name: 10 + indexs * res.topic + "cm土壤湿度",
-            data: tempdatas,
-          };
-          obj.push(temparr);
-          obj.push(temparrs);
-        });
-      }
-      obj[0].data = arr1;
-      obj[1].data = arr2;
-      var listArr = [];
-      obj.forEach(function (el, index) {
-        for (var i = 0; i < listArr.length; i++) {
-          // 对比相同的字段key,相同放入对应的数组中
-          if (listArr[i].name == el.name && el.data !== undefined) {
-            listArr[i].data.unshift(el.data[0]);
-            return;
-          }
-        }
-        // 第一次对比没有参照,放入参照
-        listArr.push({
-          name: el.name,
-          data: el.data,
-        });
-      });
-      console.log(listArr);
-      if (listArr.length == 0) {
-        this.canvastishiTF = false;
-      } else {
-        this.canvastishiTF = true;
-      }
-      this.showColumn("canvasColumnA", xtitle, listArr);
-      // console.log(this.historylistdata)
-    },
-    prev() {
-      //上一页
-      if (this.page > 1) {
-        this.page--;
-        this.histprydatas();
-      }
-    },
-    next() {
-      //下一页
-      if (this.page < this.pagesum) {
-        this.page++;
-        this.histprydatas();
-      }
-    },
-    clickLeft() {
-      uni.navigateBack({
-        delta: 1,
-      });
-    },
-    showColumn(id, xtitle, xinfo) {
-      var _self = this;
-      canvaColumnA = new uCharts({
-        canvasId: id,
-        type: "line",
-        legend: {
-          position: "top",
-        },
-        fontSize: 11,
-        background: "#FFFFFF",
-        pixelRatio: 1,
-        animation: true,
-        dataLabel: false,
-        categories: xtitle,
-        series: xinfo,
-        enableScroll: true, //开启图表拖拽功能
-        xAxis: {
-          disableGrid: true,
-          type: "grid",
-          gridType: "dash",
-          itemCount: 4, //x轴单屏显示数据的数量,默认为5个
-          scrollShow: true, //新增是否显示滚动条,默认false
-          // scrollAlign: 'left', //滚动条初始位置
-          scrollBackgroundColor: "#F7F7FF", //默认为 #EFEBEF
-          scrollColor: "#DEE7F7", //默认为 #A6A6A6
-        },
-        yAxis: {},
-        width: _self.cWidth * 1,
-        height: _self.cHeight * 1,
-        extra: {
-          line: {
-            type: "curve",
-          },
-        },
-      });
-    },
-    touchLineA(e) {
-      console.log(e);
-      canvaColumnA.scrollStart(e);
-    },
-    moveLineA(e) {
-      canvaColumnA.scroll(e);
-    },
-    touchEndLineA(e) {
-      canvaColumnA.scrollEnd(e);
-      //下面是toolTip事件,如果滚动后不需要显示,可不填写
-      canvaColumnA.showToolTip(e, {
-        format: function (item, category) {
-          return category + " " + item.name + ":" + item.data;
-        },
-      });
-    },
-  },
-  onLoad(option) {
-    this.cWidth = uni.upx2px(650);
-    this.cHeight = uni.upx2px(500);
-    this.device_id = option.id;
-    this.end = parseInt(+new Date() / 1000);
-    this.begintime = parseInt(this.end - 24 * 60 * 60);
-    this.histprydatas();
-  },
-};
+	import uCharts from "../../components/js_sdk/u-charts/u-charts/u-charts.js";
+	var canvaColumnA = null;
+	export default {
+		data() {
+			return {
+				tiemshow: false, //时间筛选弹框
+				begintime: "", //开始时间
+				end: "", //结束时间
+				dataloadingtf: true,
+				canvastishiTF: false,
+				device_id: "", //设备ID
+				thdata: [
+					"上传时间",
+					// "空气湿度(%RH)",
+					// "空气温度(℃)",
+					// "10cm土壤温度(%RH)",
+					// "20cm土壤温度(%RH)",
+					// "30cm土壤温度(%RH)",
+					// "10cm土壤湿度(%RH)",
+					// "20cm土壤湿度(%RH)",
+					// "30cm土壤湿度(%RH)",
+					// "大气压强(Pa)",
+				], //表格抬头
+				forbidden: false,
+				historylistdata: [], //历史数据
+				pagesum: 1,
+				page: 1,
+				cWidth: "",
+				cHeight: "",
+				pixelRatio: 1,
+				inidepth: "",
+			};
+		},
+		methods: {
+			tiemchange(e) {
+				//切换时间
+				this.begintime = parseInt(+new Date(e.startDate) / 1000);
+				this.end = parseInt(+new Date(e.endDate) / 1000);
+				this.histprydatas();
+			},
+			timetab(e) {
+				//时间转换
+				e = new Date(e * 1000);
+				var year = e.getFullYear();
+				var month =
+					e.getMonth() + 1 < 10 ? "0" + (e.getMonth() + 1) : e.getMonth() + 1;
+				var day = e.getDate() < 10 ? "0" + e.getDate() : e.getDate();
+				var time = year + "/" + month + "/" + day;
+				return time;
+			},
+			async histprydatas() {
+				//历史数据
+				this.dataloadingtf = true;
+				const res = await this.$myRequest({
+					url: "/api/api_gateway?method=weather.weather.nd_data",
+					data: {
+						device_id: this.device_id,
+						page: this.page,
+						begin: this.begintime,
+						end: this.end,
+					},
+				});
+				this.dataloadingtf = false;
+				console.log(res.nums, res, 'gs history');
+				this.pagesum = Math.ceil(res.nums / 10) || 1;
+				this.historylistdata = res.dat_list;
+				// ============ 摘抄自pc端 start
+				let titleList = ['上传时间'];
+				var reddata = [];
+				var reddata2 = [];
+				var reddata3 = [];
+				var ats = 0; //湿度
+				var at = 0; //温度
+				var atm = 0; //大气压强
+				this.inidepth = res.depth.split(",");
+				reddata.forEach((val) => {
+					if (!val[1]) {
+						ats++;
+					}
+				});
+				if (ats == reddata.length) {
+					this.skysd = false;
+				} else {
+					this.skysd = true;
+					titleList.push("空气湿度(%RH)");
+				}
+				// 温度
+				reddata2.forEach((val2) => {
+					if (!val2[1]) {
+						at++;
+					}
+				});
+				if (at == reddata2.length) {
+					this.skywd = false;
+				} else {
+					this.skywd = true;
+					titleList.push("空气温度(°C)");
+				}
+				// 大气压强
+				reddata3.forEach((val) => {
+					if (!val[1]) {
+						atm++;
+					}
+				});
+				if (atm == reddata3.length) {
+					this.skyyq = false;
+				} else {
+					this.skyyq = true;
+					titleList.push("大气压强(Pa)");
+				}
+				this.thdata = titleList;
+				
+				
+
+				// --------------------------------- 摘抄end
+				for (var i = 0; i < this.historylistdata.length; i++) {
+					this.historylistdata[i].temp = this.historylistdata[i].temp.split(",");
+					this.historylistdata[i].swc = this.historylistdata[i].swc.split(",");
+				}
+				var arr1 = [];
+				var arr2 = [];
+				var xtitle = [];
+				var obj = [{
+						name: "空气温度",
+						data: [],
+						color: "#00E29D",
+					},
+					{
+						name: "空气湿度",
+						data: [],
+						color: "#6CBBFF",
+					},
+				];
+				var arr3 = [];
+				var k = 0;
+				for (var i = 0; i < res.dat_char.length; i++) {
+					var times = new Date(res.dat_char[i].uptime * 1000);
+					xtitle.unshift(
+						times.getMonth() +
+						1 +
+						"/" +
+						times.getDate() +
+						"-" +
+						times.getHours() +
+						":" +
+						times.getMinutes()
+					);
+					arr1.unshift(res.dat_char[i].at == "" ? "0" : res.dat_char[i].at); //空气温度
+					arr2.unshift(res.dat_char[i].ats == "" ? "0" : res.dat_char[i].ats); //空气湿度
+					res.dat_char[i].temp = res.dat_char[i].temp.split(",");
+					res.dat_char[i].swc = res.dat_char[i].swc.split(",");
+					for (var j = 0; j < res.dat_char[i].temp.length; j++) {
+						arr3.unshift(
+							res.dat_char[i].temp[j] == "" ? "0" : res.dat_char[i].temp[j]
+						); //10cm土壤温度
+					}
+					res.dat_char[i].temp.forEach((items, indexs) => {
+						var tempdata = [];
+						var tempdatas = [];
+						tempdata.push(Number(items));
+						tempdatas.push(Number(res.dat_char[i].swc[indexs]));
+						var temparrs = {
+							name: 10 + indexs * res.topic + "cm土壤温度",
+							data: tempdata,
+						};
+						var temparr = {
+							name: 10 + indexs * res.topic + "cm土壤湿度",
+							data: tempdatas,
+						};
+						obj.push(temparr);
+						obj.push(temparrs);
+					});
+				}
+				obj[0].data = arr1;
+				obj[1].data = arr2;
+				var listArr = [];
+				obj.forEach(function(el, index) {
+					for (var i = 0; i < listArr.length; i++) {
+						// 对比相同的字段key,相同放入对应的数组中
+						if (listArr[i].name == el.name && el.data !== undefined) {
+							listArr[i].data.unshift(el.data[0]);
+							return;
+						}
+					}
+					// 第一次对比没有参照,放入参照
+					listArr.push({
+						name: el.name,
+						data: el.data,
+					});
+				});
+				console.log(listArr);
+				if (listArr.length == 0) {
+					this.canvastishiTF = false;
+				} else {
+					this.canvastishiTF = true;
+				}
+				// ------------ 摘抄自PC start
+				if (this.historylistdata[0]) {
+				  for (let i = 0; i < this.historylistdata[0].temp.length; i++) {
+					var num = this.inidepth[i];
+					this.thdata.push(num + "cm土壤温度(℃)");
+				  }
+				  for (let i = 0; i < this.historylistdata[0].temp.length; i++) {
+					var num = this.inidepth[i];
+					this.thdata.push(num + "cm土壤湿度(%RH)");
+				  }
+				}
+				// ----------------- 摘抄end
+				this.showColumn("canvasColumnA", xtitle, listArr);
+				// console.log(this.historylistdata)
+			},
+			prev() {
+				//上一页
+				if (this.page > 1) {
+					this.page--;
+					this.histprydatas();
+				}
+			},
+			next() {
+				//下一页
+				if (this.page < this.pagesum) {
+					this.page++;
+					this.histprydatas();
+				}
+			},
+			clickLeft() {
+				uni.navigateBack({
+					delta: 1,
+				});
+			},
+			showColumn(id, xtitle, xinfo) {
+				var _self = this;
+				canvaColumnA = new uCharts({
+					canvasId: id,
+					type: "line",
+					legend: {
+						position: "top",
+					},
+					fontSize: 11,
+					background: "#FFFFFF",
+					pixelRatio: 1,
+					animation: true,
+					dataLabel: false,
+					categories: xtitle,
+					series: xinfo,
+					enableScroll: true, //开启图表拖拽功能
+					xAxis: {
+						disableGrid: true,
+						type: "grid",
+						gridType: "dash",
+						itemCount: 4, //x轴单屏显示数据的数量,默认为5个
+						scrollShow: true, //新增是否显示滚动条,默认false
+						// scrollAlign: 'left', //滚动条初始位置
+						scrollBackgroundColor: "#F7F7FF", //默认为 #EFEBEF
+						scrollColor: "#DEE7F7", //默认为 #A6A6A6
+					},
+					yAxis: {},
+					width: _self.cWidth * 1,
+					height: _self.cHeight * 1,
+					extra: {
+						line: {
+							type: "curve",
+						},
+					},
+				});
+			},
+			touchLineA(e) {
+				console.log(e);
+				canvaColumnA.scrollStart(e);
+			},
+			moveLineA(e) {
+				canvaColumnA.scroll(e);
+			},
+			touchEndLineA(e) {
+				canvaColumnA.scrollEnd(e);
+				//下面是toolTip事件,如果滚动后不需要显示,可不填写
+				canvaColumnA.showToolTip(e, {
+					format: function(item, category) {
+						return category + " " + item.name + ":" + item.data;
+					},
+				});
+			},
+		},
+		onLoad(option) {
+			this.cWidth = uni.upx2px(650);
+			this.cHeight = uni.upx2px(500);
+			this.device_id = option.id;
+			this.end = parseInt(+new Date() / 1000);
+			this.begintime = parseInt(this.end - 24 * 60 * 60);
+			this.histprydatas();
+		},
+	};
 </script>
 
 <style lang="scss">
-.his_box {
-  width: 100%;
-  top: 200rpx;
-  position: relative;
-}
-.selecttimes {
-  width: 90%;
-  box-shadow: 0 0 10rpx #bcb9ca;
-  padding: 10rpx 20rpx;
-  box-sizing: border-box;
-  margin: 0 auto;
-  font-size: 28rpx;
+	.his_box {
+		width: 100%;
+		top: 200rpx;
+		position: relative;
+	}
+
+	.selecttimes {
+		width: 90%;
+		box-shadow: 0 0 10rpx #bcb9ca;
+		padding: 10rpx 20rpx;
+		box-sizing: border-box;
+		margin: 0 auto;
+		font-size: 28rpx;
+
+		.timesbox {
+			display: flex;
+			justify-content: space-around;
+
+			image {
+				width: 30rpx;
+				height: 30rpx;
+				margin-top: 6rpx;
+			}
 
-  .timesbox {
-    display: flex;
-    justify-content: space-around;
+			.icon {
+				color: #949494;
+				text-align: right;
+				margin-left: 30rpx;
+			}
+		}
 
-    image {
-      width: 30rpx;
-      height: 30rpx;
-      margin-top: 6rpx;
-    }
+		/deep/.u-calendar__action {
+			display: flex;
+			justify-content: space-around;
 
-    .icon {
-      color: #949494;
-      text-align: right;
-      margin-left: 30rpx;
-    }
-  }
+			.u-calendar__action__text {
+				line-height: 25px;
+			}
+		}
+	}
 
-  /deep/.u-calendar__action {
-    display: flex;
-    justify-content: space-around;
+	.shuju_one {
+		width: 90%;
+		margin: 20px auto;
+		box-shadow: 0 0 10rpx #bcb9ca;
+		padding-top: 20rpx;
+		height: 550rpx;
 
-    .u-calendar__action__text {
-      line-height: 25px;
-    }
-  }
-}
+		.canvastishi {
+			font-size: 32rpx;
+			position: absolute;
+			top: 50%;
+			left: 50%;
+			margin-left: -64rpx;
+			margin-top: -21rpx;
 
-.shuju_one {
-  width: 90%;
-  margin: 20px auto;
-  box-shadow: 0 0 10rpx #bcb9ca;
-  padding-top: 20rpx;
-  height: 550rpx;
+			.dataloading:after {
+				overflow: hidden;
+				display: inline-block;
+				vertical-align: bottom;
+				animation: ellipsis 2s infinite;
+				content: "\2026";
+			}
 
-  .canvastishi {
-    font-size: 32rpx;
-    position: absolute;
-    top: 50%;
-    left: 50%;
-    margin-left: -64rpx;
-    margin-top: -21rpx;
+			@keyframes ellipsis {
+				from {
+					width: 2px;
+				}
 
-    .dataloading:after {
-      overflow: hidden;
-      display: inline-block;
-      vertical-align: bottom;
-      animation: ellipsis 2s infinite;
-      content: "\2026";
-    }
+				to {
+					width: 15px;
+				}
+			}
+		}
+	}
 
-    @keyframes ellipsis {
-      from {
-        width: 2px;
-      }
+	.condition {
+		display: flex;
+		flex-wrap: wrap;
+		width: 90%;
+		box-shadow: 0 0 10rpx #bcb9ca;
+		margin: 0 auto 30rpx;
 
-      to {
-        width: 15px;
-      }
-    }
-  }
-}
+		.scroll-X {
+			width: 95%;
+			margin: 20rpx auto;
 
-.condition {
-  display: flex;
-  flex-wrap: wrap;
-  width: 90%;
-  box-shadow: 0 0 10rpx #bcb9ca;
-  margin: 0 auto 30rpx;
-  .scroll-X {
-    width: 95%;
-    margin: 20rpx auto;
-    .tr {
-      display: flex;
-      overflow: hidden;
+			.tr {
+				display: flex;
+				overflow: hidden;
 
-      .th,
-      .td {
-        display: inline-block;
-        padding: 5rpx;
-        width: 300rpx;
-        text-align: center;
-        height: 52rpx;
-        line-height: 52rpx;
-        border: 2rpx solid #f1f1f1;
-      }
-    }
+				.th,
+				.td {
+					display: inline-block;
+					padding: 5rpx;
+					width: 300rpx;
+					text-align: center;
+					height: 52rpx;
+					line-height: 52rpx;
+					border: 2rpx solid #f1f1f1;
+				}
+			}
 
-    .tr:nth-child(2n-1) {
-      background-color: #f5fff8;
-    }
+			.tr:nth-child(2n-1) {
+				background-color: #f5fff8;
+			}
 
-    .tr:first-child {
-      background-color: #57c878;
-      color: #fff;
-    }
-  }
+			.tr:first-child {
+				background-color: #57c878;
+				color: #fff;
+			}
+		}
 
-  .pagenumber {
-    display: flex;
-    margin: 20rpx auto;
+		.pagenumber {
+			display: flex;
+			margin: 20rpx auto;
 
-    button {
-      width: 150rpx;
-      height: 50rpx;
-      line-height: 50rpx;
-      font-size: 26rpx;
-      text-align: center;
-      background-color: #57c878;
-      color: #ffffff;
-    }
+			button {
+				width: 150rpx;
+				height: 50rpx;
+				line-height: 50rpx;
+				font-size: 26rpx;
+				text-align: center;
+				background-color: #57c878;
+				color: #ffffff;
+			}
 
-    .pagenumber_page {
-      width: 100rpx;
-      height: 50rpx;
-      line-height: 50rpx;
-      font-size: 26rpx;
-      text-align: center;
-    }
-  }
-}
-</style>
+			.pagenumber_page {
+				width: 100rpx;
+				height: 50rpx;
+				line-height: 50rpx;
+				font-size: 26rpx;
+				text-align: center;
+			}
+		}
+	}
+</style>

+ 2 - 1
pages/environment/history.vue

@@ -156,8 +156,9 @@
 					this.canvastishiTF = false
 				} else {
 					this.canvastishiTF = true
+					console.log(res.conf)
 					for (var key in res.conf) {
-						if (res.conf[key] != "") {
+						if (!!res.conf[key]) {
 							this.titletext.push(res.conf[key])
 						}
 					}

+ 1 - 0
pages/equipList/index.vue

@@ -448,6 +448,7 @@ export default {
     scroll() {},
   },
   onLoad() {
+	  console.log('onload equiplist --------------------------1')
     this.list = [];
     this.camera();
     this.current = 0;

+ 103 - 28
pages/equipList/modification.vue

@@ -4,7 +4,8 @@
 			<view class="mod">
 				<view class="mod_name">
 					<p><span style="color: #ff0000;" v-if="quanxian.namealter">*</span>设备名称</p>
-					<input type="text" v-model="moddata.device_name" :class="quanxian.namealter?'namebg':''" :disabled="!quanxian.namealter"/>
+					<input type="text" v-model="moddata.device_name" :class="quanxian.namealter?'namebg':''"
+						:disabled="!quanxian.namealter" />
 				</view>
 				<view class="mod_id">
 					<p>设备ID</p>
@@ -25,12 +26,16 @@
 					<p>设备添加时间</p>
 					<input type="text" :value="moddata.addtime|timeFormat()" disabled />
 				</view>
-				<p style="width: 90%;margin: 0 auto;text-align: right;color: #06B535;"><span style="color: #ff0000;">*</span>为可修改</p>
+				<p style="width: 90%;margin: 0 auto;text-align: right;color: #06B535;"><span
+						style="color: #ff0000;">*</span>为可修改</p>
 				<view class="sub" v-if="quanxian.infoalter" @click="btn">
 					提 交
 				</view>
 			</view>
 		</view>
+		<view class="loading" v-if="loading">
+			<image src="../../static/images/ajax-loader.gif" mode="" class="img"></image>
+		</view>
 	</view>
 </template>
 
@@ -38,13 +43,14 @@
 	export default {
 		data() {
 			return {
+				loading: false,
 				moddata: [],
 				city: "",
 				selectcityTF: false,
-				quanxian:{
-					namealter:false,
-					cityalter:false,
-					infoalter:false
+				quanxian: {
+					namealter: false,
+					cityalter: false,
+					infoalter: false
 				}
 			}
 		},
@@ -59,12 +65,12 @@
 					}
 				})
 				console.log(res)
-				if (res==false) {
+				if (res == false) {
 					uni.showToast({
 						title: "修改地址失败",
 						icon: "none"
 					})
-				}else{
+				} else {
 					uni.showToast({
 						title: "修改地址成功",
 						icon: "none"
@@ -80,12 +86,12 @@
 					}
 				})
 				console.log(res)
-				if (res==false) {
+				if (res == false) {
 					uni.showToast({
 						title: "修改名称失败",
 						icon: "none"
 					})
-				}else{
+				} else {
 					uni.showToast({
 						title: "修改名称成功",
 						icon: "none"
@@ -120,21 +126,70 @@
 				this.selectaddress(this.moddata.lng, this.moddata.lat)
 			},
 			btn() {
-				this.eqlistcity(this.moddata.lat, this.moddata.lng)
-				this.eqlistname()
+				this.equipmentSubmit()
+				// this.eqlistcity(this.moddata.lat, this.moddata.lng)
+				// this.eqlistname()
+			},
+			equipmentSubmit() {
+				if (!this.moddata.lat || !this.moddata.lng || !this.moddata.device_name) {
+
+					uni.showToast({
+						title: "请检查设备名称和设备位置是否填写完毕",
+						icon: "none"
+					})
+
+					return
+				}
+
+				if (!this.moddata.imei) {
+					uni.showToast({
+						title: "未查询到当前设备ID,请刷新后重试!",
+						icon: "none"
+					})
+					return
+				}
+				
+				const payload = {
+						device_id: this.moddata.imei,
+						device_name: this.moddata.device_name,
+						lat: this.moddata.lat,
+						lng: this.moddata.lng
+					}
+					
+				console.log(payload,'submit equipment info')
+
+				this.$myRequest({
+					url: '/api/api_gateway?method=forecast.worm_lamp.revise_device_name_lnglat',
+					data: payload
+				}).then(res=>{
+					console.log(res,'-------------------------------------')
+					if(res == false){
+						uni.showToast({
+							title: "修改失败,请稍后再试",
+							icon: "none"
+						})
+					}else{
+						uni.showToast({
+							title: "修改成功",
+							icon: "none"
+						})
+						
+						this.clickLeft()
+					}
+				})
 			},
 			clickLeft() {
 				uni.navigateBack({
-					delta:1
+					delta: 1
 				})
 			},
 			amendcity() { //修改设备地址
-				if(this.quanxian.cityalter){
+				if (this.quanxian.cityalter) {
 					this.selectcityTF = true
 					uni.navigateTo({
 						url: "../fourBase/city"
 					})
-				}else{
+				} else {
 					uni.showToast({
 						title: "您暂无权限进行此操作,如有需要,请联系管理员",
 						icon: "none"
@@ -160,34 +215,34 @@
 		},
 		onLoad(option) {
 			console.log(option)
-			if(option.id==10){
+			if (option.id == 10) {
 				this.xyeqlistuser(JSON.parse(option.data).device_id)
-			}else{
+			} else {
 				this.eqlistuser(option.id, JSON.parse(option.data).imei)
 			}
 			uni.getStorage({
-				key:"jurisdiction",
-				success:(res)=>{
+				key: "jurisdiction",
+				success: (res) => {
 					console.log(JSON.parse(res.data))
-					let items = JSON.parse(res.data).filter((item)=>{
+					let items = JSON.parse(res.data).filter((item) => {
 						return item.purview_name == "设备管理"
 					})
-					let items2 = items[0].children.filter((item)=>{
+					let items2 = items[0].children.filter((item) => {
 						return item.purview_name == "设备列表"
 					})
-					this.quanxian.namealter = items2[0].children.some((item)=>{
+					this.quanxian.namealter = items2[0].children.some((item) => {
 						return item.purview_name == "修改名称"
 					})
-					this.quanxian.cityalter = items2[0].children.some((item)=>{
+					this.quanxian.cityalter = items2[0].children.some((item) => {
 						return item.purview_name == "添加位置"
 					})
-					this.quanxian.infoalter = items2[0].children.some((item)=>{
+					this.quanxian.infoalter = items2[0].children.some((item) => {
 						return item.purview_name == "修改名称" || item.purview_name == "添加位置"
 					})
 				},
 			})
 		},
-		onShow(){
+		onShow() {
 			uni.getStorage({
 				key: "location",
 				success: (res) => {
@@ -200,13 +255,31 @@
 	}
 </script>
 
+<style lang="scss" scoped>
+	.loading {
+		position: fixed;
+		top: 0;
+		left: 0;
+		right: 0;
+		bottom: 0;
+		text-align: center;
+
+		.img {
+			width: 300rpx;
+			height: 40rpx;
+		}
+	}
+</style>
+
 <style lang="scss">
-	page{
+	page {
 		background-color: #FAFAFA;
 	}
+
 	.mod {
 		width: 100%;
 		padding-top: 30rpx;
+
 		.mod_name,
 		.mod_id,
 		.mod_user,
@@ -220,9 +293,11 @@
 			padding: 20rpx 10rpx;
 			color: #57C77A;
 			line-height: 50rpx;
-			.namebg{
+
+			.namebg {
 				background-color: #FAFAFA;
 			}
+
 			input {
 				text-align: right;
 				font-size: 28rpx;
@@ -241,4 +316,4 @@
 		border-radius: 35rpx;
 		color: #FFFFFF;
 	}
-</style>
+</style>

+ 26 - 3
pages/expertDiagnosis/postmessage.vue

@@ -5,10 +5,10 @@
 			<uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="发帖"></uni-nav-bar>
 			<view class="post">
 				<view class="post_title">
-					<input type="text" placeholder="请输入标题" v-model="title" />
+					<input type="text" placeholder="请输入标题" v-model="title" class="require" />
 				</view>
 				<view class="post_contert">
-					<textarea v-model="mainbody" placeholder="请输入正文" />
+					<textarea class="require" v-model="mainbody" placeholder="请输入正文" />
 					<p class="imgvideo_img_title">添加图片</p>
 					<view class="imgvideo_img">
 						<view @click="gainimg" class="imgbg">
@@ -70,18 +70,25 @@
 				}
 			},
 			post(){
-				if(this.title==''){
+				console.log(this.title,this.mainbody)
+				if(!this.title){
 					uni.showToast({
 						title: "请输入标题",
 						icon: "none"
 					})
+					
+					return 
 				}
+				
 				if(this.mainbody==''){
 					uni.showToast({
 						title: "请输入正文",
 						icon: "none"
 					})
+					
+					return 
 				}
+				
 				if(this.title!=''&&this.mainbody!=''){
 					let obj ={}
 					obj.title=this.title
@@ -144,6 +151,22 @@
 	}
 </script>
 
+<style lang="scss" scoped>
+	.require {
+		position: relative;
+		padding-left: 10rpx;
+		
+		&::before {
+			content: '*';
+			line-height: 1;
+			color: #f00;
+			position:absolute;
+			left: 0rpx;
+			top: 10rpx;
+		}
+	}
+</style>
+
 <style lang="scss">
 	page{
 		background-color: #F5F5F5;

+ 1 - 1
pages/login/login.vue

@@ -241,7 +241,7 @@
 				});
 			},
 			async formSubmit() {
-				console.log(11111)
+				console.log(11111,this.formdata)
 				const res = await this.$myRequest({
 					url: '/api/api_gateway?method=user.login.login_user',
 					data: {

+ 19 - 6
pages/waterandfer/elementdata.vue

@@ -69,7 +69,9 @@
 		data() {
 			return {
 				thdata: ["上报时间"],
-				eqlistdata: [[]],
+				eqlistdata: [
+					[]
+				],
 				cWidth: '400',
 				cHeight: '400',
 				pixelRatio: 1,
@@ -100,7 +102,7 @@
 			this.newtime = parseInt(presenttime / 1000)
 			setTimeout(() => {
 				this.getServerData(parseInt(presenttime / 1000), parseInt((presenttime - 30 * 24 * 60 * 60 *
-					1000) /
+						1000) /
 					1000))
 				this.historydata(parseInt(presenttime / 1000), parseInt((presenttime - 30 * 24 * 60 * 60 * 1000) /
 					1000))
@@ -132,6 +134,9 @@
 						begin: oldtimes,
 					}
 				})
+
+				console.log(res, '----------------- get server data', res.length == 0)
+
 				this.dataloadingtf = false
 				if (res.length == 0) {
 					this.canvastishiTF = false
@@ -140,6 +145,7 @@
 					var dataarr = res.conf.eleName.split("/")
 					var elearr = res.conf.eleNum.split("/")
 					var xtitle = []
+					var firstLoad = true;
 					var arr = []
 					var color = ['#F97000', '#00E29D', '#FF3F3F', '#6CBBFF', '#00E29D']
 					for (var i = 0; i < dataarr.length; i++) {
@@ -157,10 +163,16 @@
 								}
 								valuearr.unshift(numobj['e' + (i + 1)]) // + elelist[elearr[i]].unit
 								var times = new Date(res.dat[j].uptime * 1000)
-								xtitle.unshift(times.getMonth() + 1 + "/" + times.getDate() + "-" + times.getHours() +
-									":" +
-									times.getMinutes())
+								if (firstLoad) {
+									xtitle.unshift(times.getMonth() + 1 + "/" + times.getDate() + "-" + times
+										.getHours() +
+										":" +
+										times.getMinutes())
+								}
+								
 							}
+
+							firstLoad = false
 							var obj = {
 								name: dataarr[i],
 								data: valuearr,
@@ -256,6 +268,7 @@
 				})
 			},
 			showColumn(id, xtitle, xinfo) {
+				console.log(xtitle, 'show column')
 				var _self = this
 				canvaColumnA = new uCharts({
 					canvasId: id,
@@ -601,4 +614,4 @@
 			line-height: 25px;
 		}
 	}
-</style>
+</style>

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 53 - 32
unpackage/dist/dev/app-plus/app-service.js


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1483 - 1358
unpackage/dist/dev/app-plus/app-view.js


+ 6 - 2
util/api.js

@@ -2,13 +2,14 @@
 // let BASE_URL = 'http://192.168.1.112:8002'
 export const myRequest = (options) => {
 	let BASE_URL = uni.getStorageSync('http')
-	console.log(BASE_URL,'my request',process.env.NODE_ENV)
+	
 	if (BASE_URL == '') {
 		// BASE_URL = 'http://8.136.98.49:8002'//线上
 		BASE_URL = process.env.NODE_ENV === 'development' ? "http://114.115.147.140:8002" : "http://8.136.98.49:8002"
 		// BASE_URL = 'http://192.168.1.77:8002'
 	}
-	// BASE_URL = 'http://192.168.1.52:8003'
+	// BASE_URL = 'http://192.168.1.52:8002'
+	console.log(BASE_URL,'my request',process.env.NODE_ENV)
 	// console.log(BASE_URL)
 	var session_key = ""
 	session_key = uni.getStorageSync('session_key')
@@ -39,6 +40,8 @@ export const myRequest = (options) => {
 		url != 'after_sale.after_sale_manage.aftersale_apply') {
 		data.token = session_key
 	}
+	
+	console.log(data,'request data')
 
 	return new Promise((resolve, reject) => {
 		uni.request({
@@ -49,6 +52,7 @@ export const myRequest = (options) => {
 			},
 			data: data,
 			success: (res) => {
+				console.log(res.data,'http response')
 				if (res.data.message != "") {
 					if (res.data.message == "识别无结果" ||res.data.message == "该设备未绑定SIM") {
 						resolve(res.data.data)