فهرست منبع

feat:一些问题

yf_elsa.cui 3 روز پیش
والد
کامیت
561bb25ff5

+ 59 - 33
App.vue

@@ -1,38 +1,64 @@
 <script>
+	// export default {
+	// 	onShow: function() {
+	// 		console.log('App Show app页面')
+	// 	},
+	// 	onHide: function() {
+	// 		console.log('App Hide')
+	// 	},
+	// 	  // 分享给朋友
+	// 	  onShareAppMessage() {
+	// 	    return {
+	// 	      title: '云飞智控', // 分享标题
+	// 	      path: 'pages/index/index', // 分享路径,通常包含页面参数
+	// 	      imageUrl: 'http://www.hnyfwlw.com:8006/data/home_logo/log1.jpg', // 分享图片,可选
+	// 	      success: (res) => {
+	// 	        // 分享成功回调
+	// 	        uni.showToast({
+	// 	          title: '分享成功',
+	// 	          icon: 'success'
+	// 	        })
+	// 	      },
+	// 	      fail: (err) => {
+	// 	        // 分享失败回调
+	// 	        console.log('分享失败', err)
+	// 	      }
+	// 	    }
+	// 	  },
+	// 	  // 分享到朋友圈(基础库2.11.3+)
+	// 	  onShareTimeline() {
+	// 	    return {
+	// 	      title:  '云飞智控', // 分享标题
+	// 	      query: 'id=123', // 页面参数,不同于分享给朋友的path,这里用query
+	// 	      imageUrl: 'http://www.hnyfwlw.com:8006/data/home_logo/log1.jpg' // 分享图片,可选
+	// 	    }
+	// 	  }
+	// }
+	// App.vue
 	export default {
-		onShow: function() {
-			console.log('App Show app页面')
-		},
-		onHide: function() {
-			console.log('App Hide')
-		},
-		  // 分享给朋友
-		  onShareAppMessage() {
-		    return {
-		      title: '云飞智控', // 分享标题
-		      path: 'pages/index/index', // 分享路径,通常包含页面参数
-		      imageUrl: 'http://www.hnyfwlw.com:8006/data/home_logo/log1.jpg', // 分享图片,可选
-		      success: (res) => {
-		        // 分享成功回调
-		        uni.showToast({
-		          title: '分享成功',
-		          icon: 'success'
-		        })
-		      },
-		      fail: (err) => {
-		        // 分享失败回调
-		        console.log('分享失败', err)
-		      }
-		    }
-		  },
-		  // 分享到朋友圈(基础库2.11.3+)
-		  onShareTimeline() {
-		    return {
-		      title:  '云飞智控', // 分享标题
-		      query: 'id=123', // 页面参数,不同于分享给朋友的path,这里用query
-		      imageUrl: 'http://www.hnyfwlw.com:8006/data/home_logo/log1.jpg' // 分享图片,可选
-		    }
-		  }
+		
+	  onLaunch() {
+	    // 监听分享到朋友圈
+		uni.showShareMenu({
+		  withShareTicket: true,
+		  menus: ['shareAppMessage', 'shareTimeline']
+		})
+	  },
+	  onShareTimeline() {
+	    return {
+	      title:  '云飞智控', // 分享标题
+	      query: 'id=123', // 页面参数,不同于分享给朋友的path,这里用query
+	      imageUrl: 'http://www.hnyfwlw.com:8006/data/home_logo/log1.jpg' // 分享图片,可选
+	    }
+	  },
+	  // 全局分享给朋友
+	  onShareAppMessage() {
+	    return {
+	      title: '分享标题',
+	      path: '/pages/index/index',
+	      imageUrl: '/static/logo.png'
+	    }
+	  }
 	}
 </script>
 <style lang="scss">

+ 29 - 0
main.js

@@ -83,8 +83,37 @@ Vue.mixin({
       $imageURL: Vue.prototype.$imageURL,
       $imageHost: Vue.prototype.$imageHost,
       // 其他需要混入的全局变量
+	  shareTitle: '',
+	        sharePath: '',
+	        shareImage: '',
+	        timelineTitle: '',
+	        timelineQuery: '',
+	        timelineImage: ''
     };
   },
+    onLoad() {
+      // 开启分享功能
+      uni.showShareMenu({
+        withShareTicket: true,
+        menus: ['shareAppMessage', 'shareTimeline']
+      })
+    },
+    
+    onShareAppMessage() {
+      return {
+        title: this.shareTitle || '云飞智控',
+        path: this.sharePath || '/pages/index/index',
+        imageUrl: this.shareImage || '/static/logo.png'
+      }
+    },
+    
+    onShareTimeline() {
+      return {
+        title: this.timelineTitle || '云飞智控',
+        query: this.timelineQuery || '',
+        imageUrl: this.timelineImage || '/static/logo.png'
+      }
+    },
   // 如果需要,也可以在created中赋值,但上面这样直接赋值也可以,因为mixin的data会在每个组件创建时合并
   // 但是注意,如果这些值在运行时改变,那么这种方式可能不会更新,因为data只初始化一次。如果需要在运行时响应变化,可以使用计算属性。
   // 另一种方式是用计算属性:

+ 2 - 2
manifest.json

@@ -154,8 +154,8 @@
         "devServer" : {
             "port" : 8000,
             "disableHostCheck" : true,
-			"proxy" : {
-			    "/ksy" : {
+            "proxy" : {
+                "/ksy" : {
                     "target" : "http://dev.hnyfwlw.com",
                     "changeOrigin" : true,
                     "ws" : true,

+ 22 - 3
pages.json

@@ -6,9 +6,7 @@
 			"path": "pages/index/index",
 			"style": {
 				"navigationBarTitleText": "首页",
-				"navigationBarBackgroundColor": "#00B075",
-				"enableShareAppMessage": true,
-				        "enableShareTimeline": true
+				"navigationBarBackgroundColor": "#00B075"
 			}
 		},
 		{
@@ -301,6 +299,12 @@
 					}
 				},
 				{
+					"path": "equip-set/new-analyse",
+					"style": {
+						"navigationBarTitleText": "虫情分析"
+					}
+				},
+				{
 					"path": "equip-set/photo",
 					"style": {
 						"navigationBarTitleText": "图片列表",
@@ -832,6 +836,14 @@
 					}
 				},
 				{
+					"path": "equipment-new",
+					"style": {
+						"navigationBarTitleText": "环境监测设备1.0详情",
+						"enablePullDownRefresh": false,
+						"navigationStyle": "custom"
+					}
+				},
+				{
 					"path": "contros",
 					"style": {
 						"navigationBarTitleText": "环境监测控制页面",
@@ -854,6 +866,13 @@
 						"enablePullDownRefresh": false,
 						"navigationStyle": "custom"
 					}
+				},{
+					"path": "history-new",
+					"style": {
+						"navigationBarTitleText": "环境检测1.0历史数据",
+						"enablePullDownRefresh": false,
+						"navigationStyle": "custom"
+					}
 				},
 				{
 					"path": "sim",

+ 80 - 50
pages/cb/cbd/equip-set/new-analyse.vue

@@ -2,15 +2,15 @@
 	<view class="anabox">
 		<view class="timebox">
 			<view class="schedulebox">
-				<view class="schedule" @click="modelPicker=!modelPicker">
+		<!-- 		<view class="schedule" @click="modelPicker=!modelPicker">
 					<p class="schedule_value">{{modelList[identify_model].label}}</p>
-					<!-- {{titletext[indexone]}} -->
+					{{titletext[indexone]}}
 					<p class="schedule_icon">
 						<u-icon name="arrow-down"></u-icon>
 					</p>
-				</view>
-				<u-select v-model="modelPicker" mode="single-column" @confirm="confirmModel" :default-value="[identify_model]"
-					:list="modelList"></u-select>
+				</view> -->
+			<!-- 	<u-select v-model="modelPicker" mode="single-column" @confirm="confirmModel" :default-value="[identify_model]"
+					:list="modelList"></u-select> -->
 				<view class="schedule" @click="pickertfone=!pickertfone">
 					<p class="schedule_value">{{yservalue}}</p>
 					<!-- {{titletext[indexone]}} -->
@@ -66,23 +66,29 @@
 				<u-select v-model="timeshow" mode="mutil-column" :list="list" @confirm="Hourchange"
 					:default-value="defaultValue"></u-select>
 			</view>
+			<view >
 			<view class="tendency">
-				<canvas canvas-id="canvasColumnA" id="canvasColumnA" class="charts" @touchstart="touchLineA($event)"
+				<canvas  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="tendency">
-				<canvas canvas-id="canvasRing" id="canvasRing" class="charts" @touchstart="touchRing"
+			<view  class="tendency">
+				<canvas v-if="progresslist.length>0" canvas-id="canvasRing" id="canvasRing" class="charts" @touchstart="touchRing"
 					: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 class="" v-else style="margin-top: 20px;">
+					暂无虫情排名信息
+				</view>
 			</view>
 			<view class="tendency_pro">
 				<view class="" v-for="(item,index) in progresslist">
-					<span>{{index+1}}{{item.name}}</span>
+					<span>{{index+1}}.{{item.name}}</span>
 					<u-line-progress :active-color="colorlist[index%6]"
 						:percent="Number((item.data/pestsum*100).toFixed(2))" :show-percent="false"></u-line-progress>
-					<span>{{Number((item.data/pestsum*100).toFixed(2))}}%</span>
+					<span>{{item.data}}</span>
 				</view>
 			</view>
+			</view>
+
 			<view class="tablebox">
 				<view class="top_text">
 					<view :class="topindex==index?'title_text_color':'tltle_text'" v-for="(item,index) in toptext"
@@ -103,10 +109,10 @@
 							<td class="td" @click="wormdetails(items.pest_dict)">{{items.pestName}}</td>
 							<td class="td">{{items.addtime|timeFormat()}}</td>
 							<td class="td">{{items.location}}</td>
-							<td class="td" @click="examine(items.indentify_photo)">查看</td>
+						
 						</tr>
 						<tr class="tr" v-if="forbidden1">
-							<td class="td" v-for="item in 6">暂无数据</td>
+							<td class="td" v-for="item in thdata.length">暂无数据</td>
 						</tr>
 					</table>
 					<table class="table2" v-else>
@@ -119,7 +125,7 @@
 							<td class="td">{{items.addtime|timeFormat()}}</td>
 						</tr>
 						<tr class="tr" v-if="forbidden2">
-							<td class="td" v-for="item in 6">暂无数据</td>
+							<td class="td" v-for="item in thdata2.length">暂无数据</td>
 						</tr>
 					</table>
 				</scroll-view>
@@ -393,7 +399,7 @@
 				pagesum: 1,
 				eqlistdata: [],
 				thdata: [
-					"设备ID", "设备名称", "害虫名称", "上报时间", "设备位置", "图像"
+					"设备ID", "设备名称", "害虫名称", "上报时间", "设备位置"
 				],
 				thdata2: [
 					"害虫名称", "害虫数量", "上报时间"
@@ -433,7 +439,7 @@
 					url: '/api/api_gateway?method=forecast.worm_lamp.pest_raise_info',
 					data: {
 						d_ids: this.d_id,
-						device_type:34,
+						device_type:this.device_type,
 						year: this.yservalue,
 					}
 				})
@@ -444,6 +450,13 @@
 				this.wormindex = 0
 				if (this.wormvalue) {
 					this.timeobj = this.wormtimelist[this.wormvalue]
+				}else{
+					this.timeobj = {
+						endTime: "--",
+						highNum: "--",
+						highTime: "--",
+						startTime: "--",
+					}
 				}
 				this.$nextTick(() => {
 					this.getwormline()
@@ -457,9 +470,16 @@
 
 			},
 			confirmFun(e) {
-				console.log(e)
+				console.log(e,this.newtime,this.oldtime)
+				// this.newtime = e.endDate;
+				// this.oldtime = e.startDate;
 				this.yserindex = e[0]
 				this.yservalue = this.yearlist[e[0]]
+				
+				this.newtime = this.yservalue+this.newtime.substring(4);
+				this.oldtime = this.yservalue+this.oldtime.substring(4);
+				console.log(e,this.newtime,this.oldtime,this.yservalue)
+				// this.oldtime = e.startDate;
 				this.getwormtime()
 			},
 			confirmFun2(e) {
@@ -471,15 +491,15 @@
 			},
 			async getwormline() {
 				const res = await this.$myRequest({
-					url: '/api/api_gateway?method=forecast.worm_lamp.pest_statistics_char_new',
+					url: '/api/api_gateway?method=new_gateway.photo_info.pest_order_and_char',
 					data: {
-						d_ids: this.d_id,
-						identify_model: this.modelList[this.identify_model].value,
-						start_time: this.oldtime,
-						end_time: this.newtime,
-						sp_hour_st: this.sp_hour_st,
-						sp_hour_ed: this.sp_hour_ed,
-						amend:1
+						id: this.d_id,
+						device_type_id: this.device_type,
+						start: new Date(this.oldtime+' 00:00:00').getTime()/1000 ,
+						end: new Date(this.newtime+' 23:59:59').getTime()/1000 ,
+						hour_st: this.sp_hour_st,
+						hour_ed: this.sp_hour_ed
+						
 					}
 				})
 				// console.log(res)
@@ -517,8 +537,8 @@
 				var ringarr2 = ringarr.slice(ringarr.length - 5)
 				ringarr2.unshift(sumobj)
 				// console.log(ringarr2)
-				this.showRing(ringarr2)
-				console.log(ringarr)
+				this.showRing(ringarr)
+				console.log(ringarr,ringarr2)
 				this.progresslist = ringarr
 			},
 			// 根据起始日期获取中间时间列表
@@ -557,10 +577,20 @@
 					atLowarr[index] = item.low
 					aharr[index] = item.ah
 				})
-				res.char_data[this.wormvalue] && res.char_data[this.wormvalue].forEach(pest => {
-					let index = xtitle.indexOf(this.formatMonthDay(pest.addtime));
-					pestArr[index] = pest.sum
-				})
+				if(res.char_data[this.wormvalue]){
+					xtitle = []
+					pestArr = []
+					res.char_data[this.wormvalue].forEach(pest => {
+						let index = xtitle.indexOf(this.formatMonthDay(pest.addtime));
+						xtitle.push(this.formatTime(pest.addtime*1000,'MM-dd'))
+						pestArr.push( pest.sum)
+					})
+				}
+				// res.char_data[this.wormvalue] && res.char_data[this.wormvalue].forEach(pest => {
+				// 	let index = xtitle.indexOf(this.formatMonthDay(pest.addtime));
+				// 	xtitle.push(this.formatTime(pest.addtime,'MM-dd'))
+				// 	pestArr[index] = pest.sum
+				// })
 	
 				var atHighobj = {
 					name: '高温',
@@ -582,9 +612,9 @@
 					data: pestArr,
 					color: '#FA73F5'
 				}
-				obj.push(atHighobj)
-				obj.push(atlowobj)
-				obj.push(ahobj)
+				// obj.push(atHighobj)
+				// obj.push(atlowobj)
+				// obj.push(ahobj)
 				obj.push(pestObj)
 				console.log(xtitle, 'xtitle',obj)
 				this.showColumn("canvasColumnA", xtitle, obj)
@@ -597,8 +627,6 @@
 			},
 			tiemchange(e) {
 				console.log(e)
-				// this.oldtime = +new Date(e.startDate) / 1000 - 8 * 60 * 60
-				// this.newtime = +new Date(e.endDate) / 1000 + 16 * 60 * 60 - 1
 				this.newtime = e.endDate;
 				this.oldtime = e.startDate;
 				// newtime: "",
@@ -690,7 +718,7 @@
 					type: 'ring',
 					fontSize: 11,
 					legend: {
-						show: true,
+						show: false,
 					},
 					extra: {
 						ring: {
@@ -722,14 +750,14 @@
 			},
 			async gettabledata() {
 				const res = await this.$myRequest({
-					url: '/api/api_gateway?method=forecast.worm_lamp.pest_image_source',
+					url: '/api/api_gateway?method=new_gateway.analysis.pest_image_source',
 					data: {
-						d_ids: this.d_id,
-						identify_model: this.modelList[this.identify_model].value,
-						start_time: this.oldtime,
-						end_time: this.newtime,
-						sp_hour_st: this.sp_hour_st,
-						sp_hour_ed: this.sp_hour_ed,
+						id: this.d_id,
+						device_type_id:this.device_type,
+						start: new Date(this.oldtime+' 00:00:00').getTime()/1000 ,
+						end: new Date(this.newtime+' 23:59:59').getTime()/1000 ,
+						hour_st: this.sp_hour_st,
+						hour_ed: this.sp_hour_ed,
 						page: this.page
 					}
 				})
@@ -744,12 +772,14 @@
 			},
 			async gettabledata2() {
 				const res = await this.$myRequest({
-					url: '/api/api_gateway?method=forecast.worm_lamp.pest_base_data',
+					url: '/api/api_gateway?method=new_gateway.analysis.new_pest_base_data',
 					data: {
-						d_ids: this.d_id,
-						identify_model: this.modelList[this.identify_model].value,
-						start_time: this.oldtime,
-						end_time: this.newtime,
+						id: this.d_id,
+						device_type_id:this.device_type,
+						start: new Date(this.oldtime+' 00:00:00').getTime()/1000 ,
+						end: new Date(this.newtime+' 23:59:59').getTime()/1000 ,
+						hour_st: this.sp_hour_st,
+						hour_ed: this.sp_hour_ed,
 						page: this.page
 					}
 				})
@@ -914,13 +944,13 @@
 		padding: 10px 10px;
 		box-sizing: border-box;
 		width: 95%;
-		// justify-content: space-around;
+		justify-content: space-between;
 		margin: 0px auto;
 		background-color: #fff;
 
 		.schedule {
 			display: flex;
-			width: 240rpx;
+			width: 280rpx;
 			height: 50rpx;
 			// border: 2rpx solid #F0F0F0;
 			margin-right: 20rpx;

+ 1 - 1
pages/cb/cbd/equip-set/photo.vue

@@ -109,7 +109,7 @@
 						id: this.d_id,
 						device_type_id:this.device_type,
 						page: this.page,
-						page_number: 12,
+						page_size: 20,
 						start: +new Date(this.start_time+' 00:00:00') / 1000,
 						end: +new Date(this.end_time+' 23:59:59') / 1000, 
 						...this.searchObj

+ 6 - 6
pages/cb/equip-detail/equip-detail-new.vue

@@ -235,12 +235,12 @@ export default {
             tf: true,
           });
         } else if (item.purview_name == '分析') {
-          // this.cbd.unshift({
-          //   icon: '/image/cb/3.png',
-          //   tex: item.purview_name,
-          //   path: '/pages/cb/cbd/equip-set/new-analyse',
-          //   tf: true,
-          // });
+          this.cbd.unshift({
+            icon: '/image/cb/3.png',
+            tex: item.purview_name,
+            path: '/pages/cb/cbd/equip-set/new-analyse',
+            tf: true,
+          });
         }
       });
       return this.cbd;

+ 69 - 5
pages/environment/contros.vue

@@ -8,9 +8,14 @@
 			<view class="contros_box">
 				<view class="operation">
 					<p class="operation_title">操作</p>
-					<view class="operation_btn">
+					<view class="operation_btn" v-if="device_type_id==38">
+						<button @click="operate('RC_LOC')">定 位</button>
+						
+						<button @click="operate('RC_LOC')">长在线</button>
+					</view>
+					<view class="operation_btn" v-else>
 						<button @click="chongqi">重 启</button>
-						<!-- <button @click="shengji">升 级</button> -->
+						
 						<button @click="search">查询时间上传间隔</button>
 					</view>
 				</view>
@@ -53,12 +58,13 @@
 					interval: 1
 				},
 				id: '',
-				led:0
+				led:0,
+				device_type_id:0
 			}
 		},
 		methods: {
 			// forecast.send_control.device_control_info 设备配置查询
-			async controsdata(datas) { //提交数据
+			async controsdata() { //提交数据
 				const res = await this.$myRequest({
 					url: '/api/api_gateway?method=forecast.send_control.device_control_info',
 					data: {
@@ -70,6 +76,16 @@
 				this.config.interval = res.interval
 				this.led = Number(res.led)
 			},
+			async controsdataLow(){
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=greenhouse.env_first.control_device',
+					data: {
+						device_id: this.device_id
+					}
+				})
+				console.log(res)
+				this.config.interval = res.interval
+			},
 			//forecast.send_control.device_control  config: {"interval":10,"content":"content","timeout":"1"}
 			async timing(datas) { //提交数据
 				const res = await this.$myRequest({
@@ -150,6 +166,46 @@
 			chongqi() { //重启按钮
 				this.restart('reboot')
 			},
+			async operate(cmd){
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=forecast.send_control.get_device_config',
+					data: {
+						device_id: this.device_id,
+						order: cmd
+					}
+				})
+				console.log(res)
+				if (res == true) {
+					uni.showToast({
+						title: '指令下发成功!'
+					});
+				} else {
+					uni.showToast({
+						title: '指令下发失败!',
+						icon: "none"
+					});
+				}
+			},
+			async submit(){
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=forecast.send_control.get_device_config',
+					data: {
+						device_id: this.device_id,
+						interval: this.config.interval
+					}
+				})
+				console.log(res)
+				if (res == true) {
+					uni.showToast({
+						title: '指令下发成功!'
+					});
+				} else {
+					uni.showToast({
+						title: '指令下发失败!',
+						icon: "none"
+					});
+				}
+			},
 			// shengji() { //升级按钮
 			// 	this.restart('update')
 			// },
@@ -159,9 +215,17 @@
 		},
 		onLoad(option) {
 			this.id = option.id
+			this.device_type_id = option.device_type_id
+			if(option.device_id){
+				this.device_id = option.device_id
+			}
 		},
 		onShow() {
-			this.controsdata()
+			if(this.device_type_id==38){
+				this.controsdataLow()
+			}else{
+				this.controsdata()
+			}
 		}
 	}
 </script>

+ 549 - 0
pages/environment/equipment-new.vue

@@ -0,0 +1,549 @@
+<template>
+	<view>
+		<view class="status_bar"></view>
+		<view class="" style="position: relative;top: 40px;">
+			<view style="position: fixed;z-index: 100;width: 100%;">
+				<uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="设备详情"></uni-nav-bar>
+			</view>
+			<view class="info">
+				<view class="info_item">
+					<image
+						:src="eqinfo.item.is_online==1?$imageURL+'/bigdata_app/image/cb/onBg.png':$imageURL+'/bigdata_app/image/cb/offBg.png'"
+						mode="" class="bgi"></image>
+					<p style="font-size: 32rpx;" @click="copy(eqinfo.item)">设备
+						ID:{{eqinfo.item.imei}}
+						<image :src="$imageURL+'/bigdata_app/image/environment/fuzhi.png'" mode=""
+							class="tishi"></image>
+					</p>
+					<p>设备名称:{{eqinfo.item.device_name?eqinfo.item.device_name:"无"}}</p>
+					<p>最近上报时间:<span v-if="eqinfo.item.uptime">{{eqinfo.item.uptime|timeFormat()}}</span><span
+							v-else>{{eqinfo.item.addtime|timeFormat()}}</span></p>
+					<p>地址:{{eqinfo.item.address||"--"}}</p>
+				</view>
+			</view>
+			<view class="control">
+				<view class="control_item" @click="control">
+					<image :src="$imageURL+'/bigdata_app'+'/image/environment/8.png'" mode=""></image>
+					<p>设备控制</p>
+				</view>
+				<view class="control_item" @click="repairs">
+					<image :src="$imageURL+'/bigdata_app'+'/image/environment/7.png'" mode=""></image>
+					<p>一键报修</p>
+				</view>
+				<view class="control_item" v-if="$QueryPermission(397)" @click="charts">
+					<image :src="$imageURL+'/bigdata_app'+'/image/environment/10.png'" mode=""></image>
+					<p>历史数据</p>
+				</view>
+				<view class="control_item" @click="siminfo(eqinfo.item.d_id)">
+					<image :src="$imageURL+'/bigdata_app'+'/image/cb/6.png'" mode=""></image>
+					<p>SIM卡信息</p>
+				</view>
+			</view>
+			<view class="realtime">
+				<p class="realtime_title"><span>实时数据</span></p>
+				<view class="realtime_text">
+					<view class="realtime_text_item">
+						<view class="realtime_text_item_info" v-for="(item,index) in olddata" :key="index"
+							@click="oneday(index,item)">
+							<view class="item_info_img" :style="{'background-color':olddatas[1]}">
+								<image
+									:src="$imageURL+'/bigdata_app'+'/image/environment/icon_'+item.num+'.png'"
+									mode=""></image>
+							</view>
+							<view class="item_info_text">
+								<p>{{item.name+item.unit}}</p>
+								<p style="margin-top: 20rpx;">
+									{{parseFloat(item.value) == -99.99 ?'N/A':parseFloat(item.value)}}
+								</p>
+							</view>
+						</view>
+					</view>
+				</view>
+				<view class="realtime_tishi" v-if="realtimeTF && !dataloadingtf">
+					暂无数据
+				</view>
+				<view class="realtime_tishi" v-if="dataloadingtf">
+					<p class="dataloading">加载中</p>
+				</view>
+			</view>
+		</view>
+		<u-modal v-model="show" :title-style="{color: 'red'}" :mask-close-able="true" title="24小时数据">
+			<p class="tishiTF" v-if="tishiTF">暂无24小时数据</p>
+			<view class="slot-content" v-else>
+				<canvas 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 class="maxdata">
+					<view class="maxdata_box">
+						<p class="dian"></p>
+						<p>当天最大值:{{onedatasMax}}&nbsp&nbsp{{onedatasMaxtime|timeFormat()}}</p>
+					</view>
+					<view class="maxdata_box">
+						<p class="dian diantwo"></p>
+						<p>当天最小值:{{onedatasMin}}&nbsp&nbsp{{onedatasMintime|timeFormat()}}</p>
+					</view>
+				</view>
+			</view>
+		</u-modal>
+
+	</view>
+</template>
+
+<script>
+	import uCharts from '../../components/js_sdk/u-charts/u-charts/u-charts.js';
+	var canvasColumnA = null;
+	export default {
+		data() {
+			return {
+				eqinfo: {
+					item: {
+
+					}
+				},
+				olddata: [],
+				olddatas: ["#fba825", "#53d67c", "#008cf2", "#fb504d", "#d87ffc", "#4ec5f0"],
+				city: "",
+				kongtf: false,
+				daydatatf: false,
+				shujutf: false,
+				onedatas: [],
+				canvastishiTF: true,
+				cWidth: '300',
+				cHeight: '200',
+				pixelRatio: 1,
+				show: false,
+				onedatasMax: 0,
+				onedatasMin: 0,
+				onedatasMaxtime: "",
+				onedatasMintime: "",
+				tishiTF: false,
+				realtimeTF: false, //暂无数据提示
+				dataloadingtf: true, //加载中提示
+			}
+		},
+		methods: {
+			clickLeft() {
+				uni.navigateBack({
+					delta: 1
+				})
+			},
+			async history() { //实时数据
+				this.dataloadingtf = true
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=greenhouse.env_first.recent_data',
+					data: {
+						device_id: this.eqinfo.item.imei || this.eqinfo.item.equip_id
+					}
+				})
+				this.dataloadingtf = false
+				this.olddata = res.recent
+
+				this.realtimeTF = false
+
+			},
+			// weather.weather.qxz_data_chart 一天的数据
+			async onehistory() { //设备列表
+				
+				var date = new Date()
+				var newtime = +date / 1000
+				// var oldtime = newtime - 24 * 60 * 60
+				var oldtime = Number(new Date(date.toLocaleDateString()).getTime()) / 1000;
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=weather.weather.qxz_data_chart',
+					data: {
+						device_id: this.eqinfo.item.imei || this.eqinfo.item.device_id,
+						begin: parseInt(oldtime - 24 * 60 * 60),
+						end: parseInt(newtime - 24 * 60 * 60)
+					}
+				})
+				this.onedatas = res.data
+				console.log(this.onedatas)
+			},
+			control() { //设备控制
+			console.log(this.eqinfo.item)
+				uni.navigateTo({
+					url: "./contros?id=" + this.eqinfo.item.d_id+'&device_type_id=38'+'&device_id='+this.eqinfo.item.imei
+				})
+			},
+			charts() { //历史数据
+				var device_id = this.eqinfo.item.imei || this.eqinfo.item.device_id
+				uni.navigateTo({
+					url: "./history-new?device_id=" + device_id+'&device_type_id=38'
+				})
+			},
+			reverseGeocode(lat, lng) {
+				uni.request({
+					type: "GET",
+					url: "https://restapi.amap.com/v3/geocode/regeo?output=JSON&location=" + lng + "," + lat +
+						"&key=27273b81090f78759e4057f94474516f&radius=1000&extensions=all",
+					dataType: "json",
+					complete: ress => {
+						console.log(ress)
+						this.city = ress.data.regeocode.formatted_address
+					}
+				});
+			},
+			copy(item) {
+				uni.setClipboardData({
+					data: item.imei || item.device_id,
+					success: function() {
+						console.log('success');
+					}
+				});
+			},
+			repairs() {
+				console.log(this.eqinfo.item)
+				var device_id = this.eqinfo.item.imei || this.eqinfo.item.device_id
+				uni.navigateTo({
+					url: "../afterSale/addafter?device_id=" + device_id + "&device_type=" + 38
+				})
+			},
+			oneday(key,item) {
+				// console.log(key)
+				var obj = {
+					name: item.lable=="PM255(ug/m3)"?"PM2.5(ug/m3)":item.lable,
+					data: [],
+				}
+				var xtitle = []
+				var linearr = []
+				var arr = []
+				var timearr = []
+				// console.log(key)
+				// console.log(this.olddata)
+				// console.log(this.onedatas)
+				// return
+				for (var i = 0; i < this.onedatas.length; i++) {
+					var times = new Date(this.onedatas[i].time * 1000)
+					// console.log(this.onedatas[i].dat[this.olddata[key].value[2]].split("#")[0])
+					arr.unshift(Number(this.onedatas[i].dat[this.olddata[key].value[2]].split("#")[0]))
+					if(times.getMinutes().toString().length>=2){
+						xtitle.unshift(times.getMonth() + 1 + "/" + times.getDate() + "-" + times.getHours() + ":" + times.getMinutes())
+					} else{
+						xtitle.unshift(times.getMonth() + 1 + "/" + times.getDate() + "-" + times.getHours() + ":0" + times.getMinutes())
+					}
+					
+					timearr.unshift(+new Date(times) / 1000)
+					obj.data.unshift(Number(this.onedatas[i].dat[this.olddata[key].value[2]].split("#")[0]))
+				}
+				arr.sort(function(a, b) {
+					return a - b
+				})
+				// console.log(arr)
+				this.onedatasMin = arr[0]
+				this.onedatasMax = arr[arr.length - 1]
+				for (var i = 0; i < obj.data.length; i++) {
+					if (this.onedatasMax == obj.data[i]) {
+						this.onedatasMaxtime = timearr[i]
+					}
+					if (this.onedatasMin == obj.data[i]) {
+						this.onedatasMintime = timearr[i]
+					}
+				}
+				console.log(obj)
+				linearr.push(obj)
+				if (obj.data.length == 0) {
+					this.tishiTF = true
+				} else {
+					this.tishiTF = false
+				}
+				console.log(xtitle)
+				// console.log(linearr)
+				// return
+				this.showColumn("canvasColumnA", xtitle, linearr)
+				this.show = true
+			},
+			showColumn(id, xtitle, xinfo) {
+				var _self = this
+				const ctx = uni.createCanvasContext(id, this);
+				canvasColumnA = new uCharts({
+					context: ctx,
+					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: {
+						format: (val) => {
+							return val.toFixed(2)
+						}
+					},
+					width: _self.cWidth * 1,
+					height: _self.cHeight * 1,
+					extra: {
+						line: {
+							type: 'curve'
+						},
+					},
+				});
+			},
+			touchLineA(e) {
+				canvasColumnA.scrollStart(e);
+			},
+			moveLineA(e) {
+				canvasColumnA.scroll(e);
+			},
+			touchEndLineA(e) {
+				canvasColumnA.scrollEnd(e);
+				//下面是toolTip事件,如果滚动后不需要显示,可不填写
+				canvasColumnA.showToolTip(e, {
+					format: function(item, category) {
+						return category + ' ' + item.name + ':' + item.data
+					}
+				});
+			},
+			siminfo(sim) {
+				uni.navigateTo({
+					url: "/pages/prevention/sim?id=" + sim
+				})
+			},
+			async getbaseinfo(id) {
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
+					data: {
+						device_type_id:38,
+						page: 1,
+						page_size: 10,
+						device_id: id,
+					}
+				})
+				// console.log(res.ids.id)
+				this.eqinfo.item = res.data[0] || {}
+			}
+		},
+		onLoad(option) {
+			this.$forceUpdate()
+			this.eqinfo.item = JSON.parse(option.shebei)
+			console.log(JSON.parse(option.shebei))
+			if (!this.eqinfo.item.iccid) {
+				this.getbaseinfo(this.eqinfo.item.equip_id)
+			}
+			this.history()
+			// this.onehistory()
+			// if (this.eqinfo.item.lat == '' || this.eqinfo.item.lng == "") {
+			// 	console.log(1)
+			// } else {
+			// 	this.reverseGeocode(this.eqinfo.item.lat, this.eqinfo.item.lng)
+			// }
+			// uni.getStorage({
+			// 	key: "jurisdiction",
+			// 	success: (res) => {
+			// 		console.log(JSON.parse(res.data))
+			// 		let items = JSON.parse(res.data).filter((item) => {
+			// 			return item.pur_id == 40
+			// 		})
+			// 		let items2 = items[0].children.filter((item) => {
+			// 			return item.pur_id == 41
+			// 		})
+			// 		var arr = items2[0].children
+			// 		console.log(arr)
+			// 		for (var i = 0; i < arr.length; i++) {
+			// 			switch (arr[i].pur_id) {
+			// 				case 144:
+			// 					this.kongtf = true
+			// 					break
+			// 				case 145:
+			// 					this.daydatatf = true
+			// 					break
+			// 				case 147:
+			// 					this.shujutf = true
+			// 					break
+			// 			}
+			// 		}
+			// 	},
+			// })
+		}
+	}
+</script>
+
+<style lang="scss">
+	.info {
+		width: 100%;
+		position: absolute;
+		top: 44px;
+
+		.info_item {
+			width: 90%;
+			margin: 0 auto;
+			height: 250rpx;
+			padding: 26rpx 50rpx;
+			position: relative;
+			box-sizing: border-box;
+
+			.bgi {
+				width: 100%;
+				height: 250rpx;
+				position: absolute;
+				top: 0;
+				left: 0;
+				z-index: -1;
+			}
+
+			p {
+				font-size: 24rpx;
+				color: #FFFFFF;
+				margin-bottom: 10rpx;
+
+				.tishi {
+					width: 30rpx;
+					height: 30rpx;
+					margin: 0rpx 0 0 20rpx;
+				}
+			}
+		}
+	}
+
+	.control {
+		width: 90%;
+		position: absolute;
+		top: 372rpx;
+		left: 5%;
+		display: flex;
+		text-align: center;
+		// padding: 0 30rpx;
+		box-sizing: border-box;
+
+		.control_item {
+			width: 128rpx;
+			height: 120rpx;
+			width: 33%;
+
+			image {
+				width: 70rpx;
+				height: 70rpx;
+			}
+
+			p {
+				font-size: 24rpx;
+			}
+		}
+	}
+
+	.realtime {
+		width: 100%;
+		position: absolute;
+		top: 500rpx;
+
+		.realtime_title {
+			font-weight: 700;
+			width: 90%;
+			margin: 0 auto;
+		}
+
+		.dataloading:after {
+			overflow: hidden;
+			display: inline-block;
+			vertical-align: bottom;
+			animation: ellipsis 2s infinite;
+			content: "\2026";
+		}
+
+		@keyframes ellipsis {
+			from {
+				width: 2px;
+			}
+
+			to {
+				width: 15px;
+			}
+		}
+
+		.realtime_tishi {
+			width: 90%;
+			margin: 0 auto;
+			text-align: center;
+			font-size: 32rpx;
+			padding-top: 40rpx;
+		}
+
+		.realtime_text {
+			width: 90%;
+			margin: 0 auto;
+
+			.realtime_text_item {
+				width: 100%;
+				display: flex;
+				justify-content: space-between;
+				flex-wrap: wrap;
+				margin-bottom: 50rpx;
+
+				.realtime_text_item_info {
+					width: 48%;
+					box-shadow: 0 0 10rpx #bcb9ca;
+					margin-top: 20rpx;
+					display: flex;
+					padding: 20rpx 0rpx 20rpx 20rpx;
+					box-sizing: border-box;
+
+					.item_info_img {
+						width: 90rpx;
+						text-align: center;
+						margin-right: 28rpx;
+						border-radius: 50%;
+						height: 90rpx;
+
+						image {
+							width: 64rpx;
+							height: 64rpx;
+							margin-top: 15rpx
+						}
+					}
+
+					.item_info_text {
+						font-size: 24rpx;
+					}
+				}
+			}
+		}
+
+	}
+
+	.charts {
+		// width: 650upx;
+		// height: 400upx;
+		background-color: #FFFFFF;
+	}
+
+	.tishiTF {
+		text-align: center;
+		margin-top: 20rpx;
+	}
+
+	.maxdata {
+		font-size: 26rpx;
+
+		.maxdata_box {
+			display: flex;
+			padding-left: 30rpx;
+			box-sizing: border-box;
+		}
+
+		.dian {
+			width: 20rpx;
+			height: 20rpx;
+			background-color: red;
+			margin: 8rpx 10rpx 0 0;
+			border-radius: 50%;
+		}
+
+		.diantwo {
+			background-color: #16c60d;
+		}
+	}
+</style>

+ 490 - 0
pages/environment/history-new.vue

@@ -0,0 +1,490 @@
+<template>
+	<view>
+		<view class="status_bar"></view>
+		<view class="" style="position: relative;top: 40px;">
+			<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 class="graph">
+				<view class="canvasbox" v-if="false">
+					<view class="" style="display: flex;justify-content: flex-end;">
+						<view class="schedule" @click="pickertfone=!pickertfone">
+							<p class="schedule_value">{{titletext[indexone]}}</p>
+							<p class="schedule_icon">
+								<u-icon name="arrow-down"></u-icon>
+							</p>
+						</view>
+					</view>
+					<u-picker v-model="pickertfone" mode="selector" @confirm="confirmFun" :default-selector="[indexone]"
+						:range="titletext"></u-picker>
+					<view class="canvastishi" v-if="!canvastishiTF && !dataloadingtf">
+						暂无数据
+					</view>
+					<view class="canvastishi" v-if="dataloadingtf">
+						<p class="dataloading">加载中</p>
+					</view>
+					<canvas v-show="!tiemshow && !pickertfone" 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="selecttimes" @click="tiemshow=!tiemshow">
+					<view class="timesbox">
+						<image
+							:src="$imageURL+'/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="condition" v-if="scrollTF">
+					<scroll-view scroll-top="0" scroll-x="true" class="scroll-X">
+						<!-- @scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll" -->
+						<table class="table" :style="{width:300+240*datalength+'rpx'}">
+							<tr class="tr">
+								
+								<th class="th" v-for="(item,index) in thdata" :key="index">
+									{{item}}</th>
+							</tr>
+							<tr class="tr" v-for="(items,index) in tableData" :key="index" v-if="!forbidden">
+								<td class="td" v-for="(key,value) in items">{{key}}</td>
+							
+							</tr>
+							<tr class="tr" v-if="forbidden">
+								<td class="td" v-for="item in thdata.length">暂无数据</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" :disabled="page==pagesum">下一页</button>
+					</view>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import uCharts from '../../components/js_sdk/u-charts/u-charts/u-charts.js';
+	var canvasColumnA = null;
+	var presenttime = +new Date();
+	export default {
+		data() {
+			return {
+				cWidth: '400',
+				cHeight: '400',
+				pixelRatio: 1,
+				canvastishiTF: false, //暂无数据提示
+				dataloadingtf: true, //加载中提示
+				id: "",
+				begintime: '', //开始时间
+				end: '', //结束时间
+				titletext: [], //折线图数据切换列表数据
+				titleidnex: 0,
+				tiemshow: false, //选择时间
+				tishiTF: false, //提示
+				historydatas: [],
+				thdata:[],
+				tableData:[],
+				page: 1,
+				forbidden: false,
+				pagesum: 1,
+				datalength: 0,
+				scrollTF: true,
+				indexone: 0, //折线图数据切换列表下标
+				pickertfone: false, //折线图数据切换列表
+				chartdata: {}, //折线图数据
+				device_type_id:0
+			}
+		},
+		methods: { //weather.weather.qxz_detail
+			async listhistorydata(datas) { //上传时间 
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=greenhouse.env_first.history_data',
+					data: {
+						device_id: datas,
+						start: parseInt(this.begintime),
+						end: parseInt(this.end),
+						page: this.page
+					}
+				})
+				this.tableData = res.table
+				this.thdata = res.title
+				console.log(res)
+
+				if (this.thdata == 0) {
+					this.scrollTF = false
+				} else {
+					this.scrollTF = true
+				}
+				this.pagesum = Math.ceil(res.total / 10) || 1
+				if (res.table.length == 0) {
+					this.forbidden = true
+				} else {
+					this.forbidden = false
+				}
+			},
+			async historydata(datas) { //上传时间 //折线图
+				this.dataloadingtf = true
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=weather.weather.qxz_data_chart',
+					data: {
+						device_id: datas,
+						begin: parseInt(this.begintime),
+						end: parseInt(this.end)
+					}
+				})
+				this.dataloadingtf = false
+				console.log(res)
+				this.chartdata = res
+				if (res.data.length == 0) {
+					this.canvastishiTF = false
+				} else {
+					this.canvastishiTF = true
+					for (var key in res.conf) {
+						if (res.conf[key]) {
+							this.titletext.push(res.conf[key])
+						}
+					}
+					this.conflist(res, "e1")
+				}
+			},
+			conflist(res, eindex) {
+				var xtitle = []
+				var linearr = []
+				for (var i = 0; i < res.data.length; i++) {
+					var times = new Date(res.data[i].time * 1000)
+					xtitle.unshift(times.getMonth() + 1 + "/" + times.getDate() + "-" + times.getHours() + ":" + times
+						.getMinutes())
+				}
+				var obj = {}
+				obj.name = res.conf[eindex]
+				var arr = []
+				for (var i = 0; i < res.data.length; i++) {
+					if (parseFloat(((res.data[i].dat)[0][eindex].split('#'))[0]) != -99.99) {
+						arr.unshift(parseFloat(((res.data[i].dat)[0][eindex].split('#'))[0]))
+					}
+				}
+				obj.data = arr
+				if (obj.name) {
+					linearr.push(obj)
+				}
+				this.canvastishiTF = linearr.some((item) => {
+					return item.data.length != 0;
+				})
+				console.log(this.canvastishiTF)
+				this.showColumn("canvasColumnA", xtitle, linearr)
+			},
+			confirmFun(index) {
+				console.log(index)
+				this.indexone = index[0]
+				var str = 'e' + (index[0] + 1)
+				console.log(str)
+				this.conflist(this.chartdata, str)
+			},
+			tiemchange(e){
+				console.log(e)
+				this.page =1
+				this.begintime = +new Date(e.startDate)/1000
+				this.end = +new Date(e.endDate)/1000+16*60*60-1
+				// this.historydata(this.id)
+				this.listhistorydata(this.id)
+			},
+			prev() { //上一页
+				if (this.page > 1) {
+					this.page--
+					this.listhistorydata(this.id)
+				}
+			},
+			next() { //下一页
+				this.page++
+				this.listhistorydata(this.id)
+			},
+			clickLeft() {
+				uni.navigateBack({
+					delta: 1
+				})
+			},
+			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
+			},
+			showColumn(id, xtitle, xinfo) {
+				var _self = this
+				const ctx = uni.createCanvasContext(id, this);
+				canvasColumnA = new uCharts({
+					context: ctx,
+					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) {
+				canvasColumnA.scrollStart(e);
+			},
+			moveLineA(e) {
+				canvasColumnA.scroll(e);
+			},
+			touchEndLineA(e) {
+				canvasColumnA.scrollEnd(e);
+				//下面是toolTip事件,如果滚动后不需要显示,可不填写
+				canvasColumnA.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.id = option.device_id
+			this.device_type_id = option.device_type_id
+			this.end = presenttime / 1000
+			this.begintime = presenttime / 1000 - 24 * 60 * 60
+			// console.log(new Date(1616145097 * 1000), new Date(1616231497 * 1000))
+			console.log(option.device_id)
+			// this.historydata(option.device_id)
+			this.listhistorydata(option.device_id)
+		}
+	}
+</script>
+
+<style lang="scss">
+	.graph {
+		position: absolute;
+		top: 54px;
+		width: 90%;
+		left: 5%;
+
+		.canvasbox {
+			width: 100%;
+			height: 550rpx;
+			position: relative;
+			box-shadow: 0 0 10rpx #bcb9ca;
+			padding-top: 20px;
+
+			.charts {}
+
+			.canvastishi {
+				font-size: 32rpx;
+				position: absolute;
+				top: 50%;
+				left: 50%;
+				margin-left: -64rpx;
+				margin-top: -21rpx;
+
+				.dataloading:after {
+					overflow: hidden;
+					display: inline-block;
+					vertical-align: bottom;
+					animation: ellipsis 2s infinite;
+					content: "\2026";
+				}
+
+				@keyframes ellipsis {
+					from {
+						width: 2px;
+					}
+
+					to {
+						width: 15px;
+					}
+				}
+			}
+
+			.schedule {
+				display: flex;
+				width: 280rpx;
+				height: 50rpx;
+				border: 2rpx solid #F0F0F0;
+				margin-right: 40rpx;
+
+				.schedule_value {
+					width: 70%;
+					text-align: center;
+					line-height: 50rpx;
+					font-size: 24rpx;
+				}
+
+				.schedule_icon {
+					width: 30%;
+					background-color: #F2F2F2;
+					text-align: center;
+					line-height: 50rpx;
+				}
+			}
+		}
+
+		.none_hint {
+			font-size: 32rpx;
+			font-weight: 700;
+			position: absolute;
+			top: 0;
+			left: 50%;
+			margin-left: -64rpx;
+		}
+	}
+
+	.shuju_one_title {
+		width: 70%;
+		margin: 0 auto;
+		display: flex;
+
+		.tltle_text {
+			width: 25%;
+			border: 2rpx solid #B2B2B2;
+			color: #B2B2B2;
+			text-align: center;
+			font-size: 24rpx;
+			height: 50rpx;
+			line-height: 50rpx;
+		}
+
+		.title_text_color {
+			width: 25%;
+			border: 2rpx solid #28AE4F;
+			color: #28AE4F;
+			text-align: center;
+			font-size: 24rpx;
+			height: 50rpx;
+			line-height: 50rpx;
+		}
+	}
+
+	.selecttimes {
+		width: 100%;
+		box-shadow: 0 0 10rpx #bcb9ca;
+		margin-top: 20rpx;
+		padding: 10rpx 20rpx;
+		box-sizing: border-box;
+	
+		.timesbox {
+			display: flex;
+			justify-content: space-around;
+	
+			image {
+				width: 30rpx;
+				height: 30rpx;
+				margin-top: 6rpx;
+			}
+	
+			.icon {
+				color: #949494;
+				text-align: right;
+				margin-left: 30rpx;
+	
+			}
+		}
+	}
+
+	.condition {
+		display: flex;
+		flex-wrap: wrap;
+		width: 100%;
+		box-shadow: 0 0 10rpx #bcb9ca;
+		margin: 30rpx 0;
+
+		.scroll-X {
+			width: 95%;
+			margin: 20rpx auto;
+
+			.table {
+				// width: 10420px;
+			}
+
+			.tr {
+				display: flex;
+				overflow: hidden;
+
+				.th,
+				.td {
+					display: inline-block;
+					padding: 5rpx;
+					width: 240rpx;
+					text-align: center;
+					height: 52rpx;
+					line-height: 52rpx;
+					border: 2rpx solid #F1F1F1;
+				}
+
+				.th:first-child,
+				.td:first-child {
+					width: 300rpx;
+				}
+			}
+		}
+
+		.pagenumber {
+			display: flex;
+			margin: 20rpx auto;
+
+			button {
+				width: 150rpx;
+				height: 50rpx;
+				line-height: 50rpx;
+				font-size: 26rpx;
+				text-align: center;
+				background-color: #17BB89;
+				color: #FFFFFF;
+			}
+
+			.pagenumber_page {
+				width: 150rpx;
+				height: 50rpx;
+				line-height: 50rpx;
+				font-size: 26rpx;
+				text-align: center;
+			}
+		}
+	}
+	/deep/.u-calendar__action {
+		display: flex;
+		justify-content: space-around;
+	
+		.u-calendar__action__text {
+			line-height: 25px;
+		}
+	}
+</style>

+ 4 - 2
pages/environment/history.vue

@@ -6,7 +6,7 @@
 				<uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="历史数据"></uni-nav-bar>
 			</view>
 			<view class="graph">
-				<view class="canvasbox">
+				<view class="canvasbox" >
 					<view class="" style="display: flex;justify-content: flex-end;">
 						<view class="schedule" @click="pickertfone=!pickertfone">
 							<p class="schedule_value">{{titletext[indexone]}}</p>
@@ -103,7 +103,8 @@
 				scrollTF: true,
 				indexone: 0, //折线图数据切换列表下标
 				pickertfone: false, //折线图数据切换列表
-				chartdata: {} //折线图数据
+				chartdata: {}, //折线图数据
+				device_type_id:0
 			}
 		},
 		methods: { //weather.weather.qxz_detail
@@ -283,6 +284,7 @@
 			this.cWidth = uni.upx2px(650);
 			this.cHeight = uni.upx2px(500);
 			this.id = option.device_id
+			this.device_type_id = option.device_type_id
 			this.end = presenttime / 1000
 			this.begintime = presenttime / 1000 - 24 * 60 * 60
 			console.log(new Date(1616145097 * 1000), new Date(1616231497 * 1000))

+ 14 - 0
pages/equipList/index.vue

@@ -383,6 +383,20 @@ export default {
               '../prevention/equipmentdetails?shebei=' + JSON.stringify(item),
           });
           break;
+		case 38:
+			// console.log(item);
+			var obj = {};
+			obj.d_id = item.d_id;
+			obj.equip_id = item.imei;
+			obj.is_online = item.is_online;
+			obj.lat = item.lat;
+			obj.lng = item.lng;
+			obj.equip_name = item.device_name;
+			obj.uptime = item.uptime;
+			uni.navigateTo({
+			  url: '../environment/equipment-new?shebei=' + JSON.stringify(obj),
+			});
+			break;
         case 5:
           console.log(item);
           var obj = {};

+ 27 - 27
pages/index/index.vue

@@ -135,33 +135,33 @@
 
 <script>
 	export default {
-		// 分享给朋友
-		onShareAppMessage() {
-		  return {
-		    title: '云飞智控', // 分享标题
-		    path: 'pages/index/index', // 分享路径,通常包含页面参数
-		    imageUrl: 'http://www.hnyfwlw.com:8006/data/home_logo/log1.jpg', // 分享图片,可选
-		    success: (res) => {
-		      // 分享成功回调
-		      uni.showToast({
-		        title: '分享成功',
-		        icon: 'success'
-		      })
-		    },
-		    fail: (err) => {
-		      // 分享失败回调
-		      console.log('分享失败', err)
-		    }
-		  }
-		},
-		// 分享到朋友圈(基础库2.11.3+)
-		onShareTimeline() {
-		  return {
-		    title:  '云飞智控', // 分享标题
-		    query: 'id=123', // 页面参数,不同于分享给朋友的path,这里用query
-		    imageUrl: 'http://www.hnyfwlw.com:8006/data/home_logo/log1.jpg' // 分享图片,可选
-		  }
-		},
+		// // 分享给朋友
+		// onShareAppMessage() {
+		//   return {
+		//     title: '云飞智控', // 分享标题
+		//     path: 'pages/index/index', // 分享路径,通常包含页面参数
+		//     imageUrl: 'http://www.hnyfwlw.com:8006/data/home_logo/log1.jpg', // 分享图片,可选
+		//     success: (res) => {
+		//       // 分享成功回调
+		//       uni.showToast({
+		//         title: '分享成功',
+		//         icon: 'success'
+		//       })
+		//     },
+		//     fail: (err) => {
+		//       // 分享失败回调
+		//       console.log('分享失败', err)
+		//     }
+		//   }
+		// },
+		// // 分享到朋友圈(基础库2.11.3+)
+		// onShareTimeline() {
+		//   return {
+		//     title:  '云飞智控', // 分享标题
+		//     query: 'id=123', // 页面参数,不同于分享给朋友的path,这里用query
+		//     imageUrl: 'http://www.hnyfwlw.com:8006/data/home_logo/log1.jpg' // 分享图片,可选
+		//   }
+		// },
 		data() {
 			return {
 				weatherinfo: {

+ 37 - 0
util/shareMixin.js

@@ -0,0 +1,37 @@
+// 创建全局mixin
+export default {
+  onLoad() {
+    // 开启分享功能
+    uni.showShareMenu({
+      withShareTicket: true,
+      menus: ['shareAppMessage', 'shareTimeline']
+    })
+  },
+  
+  onShareAppMessage() {
+    return {
+      title: this.shareTitle || '默认分享标题',
+      path: this.sharePath || '/pages/index/index',
+      imageUrl: this.shareImage || '/static/share.png'
+    }
+  },
+  
+  onShareTimeline() {
+    return {
+      title: this.timelineTitle || '默认朋友圈标题',
+      query: this.timelineQuery || '',
+      imageUrl: this.timelineImage || '/static/share.png'
+    }
+  },
+  
+  data() {
+    return {
+      shareTitle: '',
+      sharePath: '',
+      shareImage: '',
+      timelineTitle: '',
+      timelineQuery: '',
+      timelineImage: ''
+    }
+  }
+}