zhangyun 5 лет назад
Родитель
Сommit
2c43f1327b

+ 639 - 0
components/ksp-image-cutter/ksp-image-cutter.vue

@@ -0,0 +1,639 @@
+<template>
+<view v-show="url" class="ksp-image-cutter">
+	<canvas :style="{width: target.width + 'px', height: target.height + 'px'}" canvas-id="target"></canvas>
+	<view class="body">
+		<image v-if="url" class="image" @load="imageLoad" :style="{left: image.left + 'px', top: image.top + 'px', width: image.width + 'px', height: image.height + 'px'}" :src="url"></image>
+		<view v-if="mask.show" class="mask"></view>
+		<view @touchstart="touchStart($event, 'plank')" @touchmove="touchMove" @touchend="touchEnd" @touchcancel="touchCancel"  class="plank">
+			<view class="frame" @touchstart="touchStart($event, 'frame')" @touchstart.stop.prevent="touchHandle" :style="{left: frame.left + 'px', top: frame.top + 'px', width: frame.width + 'px', height: frame.height + 'px'}">
+				<canvas v-if="mask.show" class="canvas" :style="{width: frame.width + 'px', height: frame.height + 'px'}" canvas-id="canvas"></canvas>
+				<view class="rect"></view>
+				<view class="line-one"></view>
+				<view class="line-two"></view>
+				<view class="line-three"></view>
+				<view class="line-four"></view>
+				<view @touchstart="touchStart($event, 'left')" @touchstart.stop.prevent="touchHandle" class="frame-left"></view>
+				<view @touchstart="touchStart($event, 'right')" @touchstart.stop.prevent="touchHandle" class="frame-right"></view>
+				<view @touchstart="touchStart($event, 'top')" @touchstart.stop.prevent="touchHandle" class="frame-top"></view>
+				<view @touchstart="touchStart($event, 'bottom')" @touchstart.stop.prevent="touchHandle" class="frame-bottom"></view>
+				<view @touchstart="touchStart($event, 'left-top')" @touchstart.stop.prevent="touchHandle" class="frame-left-top"></view>
+				<view @touchstart="touchStart($event, 'left-bottom')" @touchstart.stop.prevent="touchHandle" class="frame-left-bottom"></view>
+				<view @touchstart="touchStart($event, 'right-top')" @touchstart.stop.prevent="touchHandle" class="frame-right-top"></view>
+				<view @touchstart="touchStart($event, 'right-bottom')" @touchstart.stop.prevent="touchHandle" class="frame-right-bottom"></view>
+			</view>
+		</view>
+	</view>
+	<view class="toolbar">
+		<button @tap="oncancle" class="btn-cancel">返回</button>
+		<button @tap="onok" class="btn-ok">确定</button>
+	</view>
+</view>
+</template>
+
+<script>
+export default {
+	props: {
+		url: {
+			type: String,
+			default: ""
+		},
+		fixed: {
+			type: Boolean,
+			default: false
+		},
+		width: {
+			type: Number,
+			default: 200
+		},
+		height: {
+			type: Number,
+			default: 200
+		},
+		maxWidth: {
+			type: Number,
+			default: 1024
+		},
+		maxHeight: {
+			type: Number,
+			default: 1024
+		},
+		blob: {
+			type: Boolean,
+			default: true
+		}
+	},
+	data() {
+		return {
+			mask: {
+				show: false
+			},
+			frame: {
+				left: 50,
+				top: 50,
+				width: this.width,
+				height: this.height
+			},
+			image: {
+				left: 20,
+				top: 20,
+				width: 300,
+				height: 400
+			},
+			real: {
+				width: 100,
+				height: 100
+			},
+			target: {
+				width: this.width,
+				height: this.height
+			},
+			touches: [],
+			type: "",
+			start: {
+				frame: {
+					left: 0,
+					top: 0,
+					width: 0,
+					height: 0
+				},
+				image: {
+					left: 0,
+					top: 0,
+					width: 0,
+					height: 0
+				},
+			},
+			timeoutId: -1,
+			context: null
+		};
+	},
+	mounted() {
+		//#ifdef H5
+		this.$el.addEventListener("touchmove", (ev) => {
+			ev.preventDefault();
+		});
+		// #endif
+		this.context = uni.createCanvasContext("canvas", this);
+		this.targetContext = uni.createCanvasContext("target", this);
+	},
+	methods: {
+		imageLoad(ev) {
+			this.mask.show = true;
+			this.real.width = ev.detail.width;
+			this.real.height = ev.detail.height;
+			this.image.width = ev.detail.width;
+			this.image.height = ev.detail.height;
+			this.frame.width = this.width;
+			this.frame.height = this.height;
+			if (!this.fixed) {
+				this.frame.width = this.image.width;
+				this.frame.height = this.image.height;
+			}
+			var query = uni.createSelectorQuery().in(this);
+			query.select(".body").boundingClientRect((data) => {
+				var bw = data.width;
+				var bh = data.height;
+				var fw = this.frame.width;
+				var fh = this.frame.height;
+				var tw = bw * 0.8;
+				var th = bh * 0.8;
+				var sx = tw / fw;
+				var sy = th / fh;
+				var scale = sx;
+				if (sx < sy) {
+					scale = sy;
+				}
+				tw = fw * scale;
+				th = fh * scale;
+				var tx = (bw - tw) / 2;
+				var ty = (bh - th) / 2;
+				this.frame.width = tw;
+				this.frame.height = th;
+				this.frame.left = tx;
+				this.frame.top = ty;
+				
+				var iw = this.image.width;
+				var ih = this.image.height;
+				sx = tw / iw;
+				sy = th / ih;
+				scale = sx;
+				if (sx < sy) {
+					scale = sy;
+				}
+				this.image.width = iw * scale;
+				this.image.height = ih * scale;
+				this.image.left = (bw - this.image.width) / 2;
+				this.image.top = (bh - this.image.height) / 2;
+				setTimeout(() => {
+					this.trimImage();
+				}, 100);
+			}).exec();
+		},
+		touchHandle() {},
+		touchStart(ev, type) {
+			this.stopTime();
+			this.mask.show = false;
+			if (this.touches.length == 0) {
+				this.type = type;
+				this.start.frame.left = this.frame.left;
+				this.start.frame.top = this.frame.top;
+				this.start.frame.width = this.frame.width;
+				this.start.frame.height = this.frame.height;
+				this.start.image.left = this.image.left;
+				this.start.image.top = this.image.top;
+				this.start.image.width = this.image.width;
+				this.start.image.height = this.image.height;
+			}
+			var touches = ev.changedTouches;
+			for(var i = 0; i < touches.length; i++) {
+				var touch = touches[i];
+				// this.touches[touch.identifier] = touch;
+				this.touches.push(touch);
+			}
+		},
+		touchMove(ev) {
+			this.stopTime();
+			ev.preventDefault();
+			var touches = ev.touches;
+			if (this.touches.length == 1) {
+				if (this.type == "plank" || this.type == "frame" || this.fixed) {
+					this.moveImage(this.touches[0], touches[0]);
+				} else {
+					this.scaleFrame(this.touches[0], touches[0], this.type);
+				}
+			} else if (this.touches.length == 2 && touches.length == 2) {
+				var ta = this.touches[0];
+				var tb = this.touches[1];
+				var tc = touches[0];
+				var td = touches[1];
+				if (ta.identifier != tc.identifier) {
+					var temp = tc;
+					tc = td;
+					td = temp;
+				}
+				this.scaleImage(ta, tb, tc, td);
+			}
+		},
+		touchEnd(ev) {
+			this.type = "";
+			this.touches = [];
+			this.startTime();
+		},
+		touchCancel(ev) {
+			this.type = "";
+			this.touches = [];
+			this.startTime();
+		},
+		startTime() {
+			this.stopTime();
+			this.timeoutId = setTimeout(() => {
+				this.trimImage();
+			}, 800);
+		},
+		stopTime() {
+			if (this.timeoutId >= 0) {
+				clearTimeout(this.timeoutId);
+				this.timeoutId = -1;
+			}
+		},
+		trimImage() {
+			this.mask.show = true;
+			var query = uni.createSelectorQuery().in(this);
+			query.select(".body").boundingClientRect((data) => {
+				var bw = data.width;
+				var bh = data.height;
+				var fw = this.frame.width;
+				var fh = this.frame.height;
+				var tw = bw * 0.8;
+				var th = bh * 0.8;
+				var sx = tw / fw;
+				var sy = th / fh;
+				var scale = sx;
+				if (sx > sy) {
+					scale = sy;
+				}
+				tw = fw * scale;
+				th = fh * scale;
+				var tx = (bw - tw) / 2;
+				var ty = (bh - th) / 2;
+				var ax = tx - this.frame.left + (this.frame.left - this.image.left) * (1 - scale);
+				var ay = ty - this.frame.top + (this.frame.top - this.image.top) * (1 - scale);
+				this.frame.width = tw;
+				this.frame.height = th;
+				this.frame.left = tx;
+				this.frame.top = ty;
+				this.image.width *= scale;
+				this.image.height *= scale;
+				this.image.left += ax;
+				this.image.top += ay;
+			}).exec();
+			setTimeout(() => {
+				var scale = this.image.width / this.real.width;
+				var x = (this.frame.left - this.image.left) / scale;
+				var y = (this.frame.top - this.image.top) / scale;
+				var width = this.frame.width / scale;
+				var height = this.frame.height / scale;
+				this.context.drawImage(this.url, x, y, width, height, 0, 0, this.frame.width, this.frame.height);
+				this.context.draw(false);
+			}, 100);
+		},
+		moveImage(ta, tb) {
+			var ax = tb.clientX - ta.clientX;
+			var ay = tb.clientY - ta.clientY;
+			this.image.left = this.start.image.left + ax;
+			this.image.top = this.start.image.top + ay;
+			if (this.image.left > this.frame.left) {
+				this.image.left = this.frame.left;
+			}
+			if (this.image.top > this.frame.top) {
+				this.image.top = this.frame.top;
+			}
+			if (this.image.left + this.image.width < this.frame.left + this.frame.width) {
+				this.image.left = this.frame.left + this.frame.width - this.image.width; 
+			}
+			if (this.image.top + this.image.height < this.frame.top + this.frame.height) {
+				this.image.top = this.frame.top + this.frame.height - this.image.height; 
+			}
+		},
+		scaleImage(ta, tb, tc, td) {
+			var x1 = ta.clientX;
+			var y1 = ta.clientY;
+			var x2 = tb.clientX;
+			var y2 = tb.clientY;
+			var x3 = tc.clientX;
+			var y3 = tc.clientY;
+			var x4 = td.clientX;
+			var y4 = td.clientY;
+			var ol = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
+			var el = Math.sqrt((x3 - x4) * (x3 - x4) + (y3 - y4) * (y3 - y4));
+			var ocx = (x1 + x2) / 2;
+			var ocy = (y1 + y2) / 2;
+			var ecx = (x3 + x4) / 2;
+			var ecy = (y3 + y4) / 2;
+			var ax = ecx - ocx;
+			var ay = ecy - ocy;
+			var scale = el / ol;
+			if (this.start.image.width * scale < this.frame.width) {
+				scale = this.frame.width / this.start.image.width;
+			}
+			if (this.start.image.height * scale < this.frame.height) {
+				scale = this.frame.height / this.start.image.height;
+			}
+			if (this.start.image.width * scale < this.frame.width) {
+				scale = this.frame.width / this.start.image.width;
+			}
+			this.image.left = this.start.image.left + ax - (ocx - this.start.image.left) * (scale - 1);
+			this.image.top = this.start.image.top + ay - (ocy - this.start.image.top) * (scale - 1);
+			this.image.width = this.start.image.width * scale;
+			this.image.height = this.start.image.height * scale;
+			if (this.image.left > this.frame.left) {
+				this.image.left = this.frame.left;
+			}
+			if (this.image.top > this.frame.top) {
+				this.image.top = this.frame.top;
+			}
+			if (this.image.left + this.image.width < this.frame.left + this.frame.width) {
+				this.image.left = this.frame.left + this.frame.width - this.image.width; 
+			}
+			if (this.image.top + this.image.height < this.frame.top + this.frame.height) {
+				this.image.top = this.frame.top + this.frame.height - this.image.height; 
+			}
+			
+		},
+		scaleFrame(ta, tb, type) {
+			var ax = tb.clientX - ta.clientX;
+			var ay = tb.clientY - ta.clientY;
+			var x1 = this.start.frame.left;
+			var y1 = this.start.frame.top;
+			var x2 = this.start.frame.left + this.start.frame.width;
+			var y2 = this.start.frame.top + this.start.frame.height;
+			if (type == "left") {
+				x1 += ax;
+			} else if (type == "right") {
+				x2 += ax;
+			} else if (type == "top") {
+				y1 += ay;
+			} else if (type == "bottom") {
+				y2 += ay;
+			} else if (type == "left-top") {
+				x1 += ax;
+				y1 += ay;
+			} else if (type == "left-bottom") {
+				x1 += ax;
+				y2 += ay;
+			} else if (type == "right-top") {
+				x2 += ax;
+				y1 += ay;
+			} else if (type == "right-bottom") {
+				x2 += ax;
+				y2 += ay;
+			}
+			if (x1 < this.image.left) {
+				x1 = this.image.left;
+			}
+			if (y1 < this.image.top) {
+				y1 = this.image.top;
+			}
+			if (x2 > this.image.left + this.image.width) {
+				x2 = this.image.left + this.image.width;
+			}
+			if (y2 > this.image.top + this.image.height) {
+				y2 = this.image.top + this.image.height;
+			}
+			this.frame.left = x1;
+			this.frame.top = y1;
+			this.frame.width = x2 - x1;
+			this.frame.height = y2 - y1;
+		},
+		parseBlob(base64) {
+			var arr = base64.split(',');
+			var mime = arr[0].match(/:(.*?);/)[1];
+			var bstr = atob(arr[1]);
+			var n = bstr.length;
+			var u8arr = new Uint8Array(n);
+			for(var i = 0; i < n; i++) {
+				u8arr[i] = bstr.charCodeAt(i);
+			}
+			var url = URL || webkitURL;
+			return url.createObjectURL(new Blob([u8arr], {type: mime}));
+		},
+		onok() {
+			var scale = this.image.width / this.real.width;
+			var x = (this.frame.left - this.image.left) / scale;
+			var y = (this.frame.top - this.image.top) / scale;
+			var width = this.frame.width / scale;
+			var height = this.frame.height / scale;
+			var tw = width;
+			var th = height;
+			if (this.fixed) {
+				tw = this.width / 2;
+				th = this.height / 2;
+			} else {
+				if (tw > this.maxWidth / 2) {
+					var sc = this.maxWidth / 2 / tw;
+					tw = tw * sc;
+					th = th * sc;
+				}
+				if (th > this.maxHeight / 2) {
+					var sc = this.maxHeight / 2 / th;
+					th = th * sc;
+					tw = tw * sc;
+				}
+			}
+			this.target.width = tw;
+			this.target.height = th;
+			uni.showLoading({
+				title: "正在裁剪"
+			});
+			setTimeout(() => {
+				this.targetContext.drawImage(this.url, x, y, width, height, 0, 0, tw, th);
+				this.targetContext.draw(false, () => {
+					uni.canvasToTempFilePath({
+						canvasId: "target",
+						success: (res) => {
+							var path = res.tempFilePath;
+							// #ifdef H5
+							if (this.blob) {
+								path = this.parseBlob(path);
+							}
+							// #endif
+							this.$emit("ok", {
+								path: path
+							});
+						},
+						fail: (ev) => {
+							console.log(ev);
+						},
+						complete: () => {
+							uni.hideLoading();
+						}
+					}, this);
+				});
+			}, 100);
+		},
+		oncancle() {
+			this.$emit("cancel");
+		}
+	}
+}
+</script>
+
+<style scoped>
+.ksp-image-cutter {
+	position: absolute;
+	width: 100%;
+	height: 100%;
+	top: 0;
+	bottom: 0;
+	z-index: 1000;
+}
+.toolbar {
+	position: absolute;
+	width: 100%;
+	height: 100upx;
+	left: 0upx;
+	bottom: 0upx;
+	box-sizing: border-box;
+	border-bottom: 1px solid #C0C0C0;
+	background: #F8F8F8;
+}
+.btn-cancel {
+	position: absolute;
+	left: 100upx;
+	top: 12upx;
+	font-size: 30upx;
+	line-height: 30upx;
+	padding: 20upx;
+	color: #333333;
+}
+.btn-ok {
+	position: absolute;
+	right: 100upx;
+	top: 12upx;
+	font-size: 30upx;
+	line-height: 30upx;
+	padding: 20upx;
+	color: #333333;
+}
+.body {
+	position: absolute;
+	left: 0upx;
+	right: 0upx;
+	top: 0upx;
+	bottom: 100upx;
+	background: black;
+	overflow: hidden;
+}
+.mask {
+	position: absolute;
+	left: 0upx;
+	right: 0upx;
+	top: 0upx;
+	bottom: 0upx;
+	background: black;
+	opacity: 0.4;
+}
+.plank {
+	position: absolute;
+	left: 0upx;
+	right: 0upx;
+	top: 0upx;
+	bottom: 0upx;
+}
+.image {
+	position: absolute;
+}
+.frame {
+	position: absolute;
+}
+.canvas {
+	position: absolute;
+	display: block;
+	left: 0px;
+	top: 0px;
+}
+.rect {
+	position: absolute;
+	left: -2px;
+	top: -2px;
+	width: 100%;
+	height: 100%;
+	border: 2px solid white;
+}
+.line-one {
+	position: absolute;
+	width: 100%;
+	height: 1px;
+	background: white;
+	left: 0;
+	top: 33.3%;
+}
+.line-two {
+	position: absolute;
+	width: 100%;
+	height: 1px;
+	background: white;
+	left: 0;
+	top: 66.7%;
+}
+.line-three {
+	position: absolute;
+	width: 1px;
+	height: 100%;
+	background: white;
+	top: 0;
+	left: 33.3%;
+}
+.line-four {
+	position: absolute;
+	width: 1px;
+	height: 100%;
+	background: white;
+	top: 0;
+	left: 66.7%;
+}
+.frame-left {
+	position: absolute;
+	height: 100%;
+	width: 8px;
+	left: -4px;
+	top: 0;
+}
+.frame-right {
+	position: absolute;
+	height: 100%;
+	width: 8px;
+	right: -4px;
+	top: 0;
+}
+.frame-top {
+	position: absolute;
+	width: 100%;
+	height: 8px;
+	top: -4px;
+	left: 0;
+}
+.frame-bottom {
+	position: absolute;
+	width: 100%;
+	height: 8px;
+	bottom: -4px;
+	left: 0;
+}
+.frame-left-top {
+	position: absolute;
+	width: 20px;
+	height: 20px;
+	left: -6px;
+	top: -6px;
+	border-left: 4px solid red;
+	border-top: 4px solid red;
+}
+.frame-left-bottom {
+	position: absolute;
+	width: 20px;
+	height: 20px;
+	left: -6px;
+	bottom: -6px;
+	border-left: 4px solid red;
+	border-bottom: 4px solid red;
+}
+.frame-right-top {
+	position: absolute;
+	width: 20px;
+	height: 20px;
+	right: -6px;
+	top: -6px;
+	border-right: 4px solid red;
+	border-top: 4px solid red;
+}
+.frame-right-bottom {
+	position: absolute;
+	width: 20px;
+	height: 20px;
+	right: -6px;
+	bottom: -6px;
+	border-right: 4px solid red;
+	border-bottom: 4px solid red;
+}
+</style>

+ 42 - 2
pages.json

@@ -305,7 +305,7 @@
             "path" : "pages/distribution/index",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "",
+                "navigationBarTitleText": "设备分布",
                 "enablePullDownRefresh": false
             }
             
@@ -513,7 +513,47 @@
             "path" : "pages/cb/cbd/equip-set/note",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "",
+                "navigationBarTitleText": "短信预警",
+                "enablePullDownRefresh": false,
+				"navigationStyle":"custom"
+            }
+            
+        }
+        ,{
+            "path" : "pages/cb/cbd/equip-set/statistics",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "害虫统计",
+                "enablePullDownRefresh": false,
+				"navigationStyle":"custom"
+            }
+            
+        }
+        ,{
+            "path" : "pages/cb/bzy/equip-set/bzyhistoryile",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "孢子仪历史记录",
+                "enablePullDownRefresh": false,
+				"navigationStyle":"custom"
+            }
+            
+        }
+        ,{
+            "path" : "pages/cb/xy/equip-set/xyhistoryile",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "性诱设备历史记录",
+                "enablePullDownRefresh": false,
+				"navigationStyle":"custom"
+            }
+            
+        }
+        ,{
+            "path" : "pages/disandpests/index",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "病虫害识别",
                 "enablePullDownRefresh": false,
 				"navigationStyle":"custom"
             }

+ 1 - 0
pages/afterSale/addafter.vue

@@ -188,6 +188,7 @@
 				obj.name=this.adddata.name
 				obj.phone=this.adddata.phone
 				obj.selfList=JSON.stringify(this.selfList)
+				console.log(obj.imageList)
 				if(this.deviceid && this.adddata.type_id!=''&&this.phoneTF){
 					this.getaddafter(obj)
 				}else{

+ 341 - 0
pages/cb/bzy/equip-set/bzyhistoryile.vue

@@ -0,0 +1,341 @@
+<template>
+	<view>
+		<view style="position: fixed;z-index: 100;">
+			<uni-nav-bar @clickLeft="clickLeft" left-icon="back" title="查看图片"></uni-nav-bar>
+		</view>
+		<view class="shuju_one">
+			<view class="shuju_one_title">
+				<view :class="titleidnex==index?'title_text_color':'tltle_text'" v-for="(item,index) in titletext" :key="index"
+				 @click="changeindex(index)">
+					{{item}}
+				</view>
+			</view>
+			<highcharts :chartOptions="options" :styles="styles" ref="simpleChart"></highcharts>
+		</view>
+		<view class="condition">
+			<scroll-view scroll-top="0" scroll-x="true" class="scroll-X">
+				<!-- @scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll" -->
+				<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.d_h_t.ds==0?"关":"开"}}</td>
+						<td class="td">{{items.d_h_t.at}}</td>
+						<td class="td">{{items.d_h_t.ah}}</td>
+						<td class="td">{{items.d_h_t.set_temp}}</td>
+						<td class="td">{{items.d_h_t.pre_temp}}</td>
+						<td class="td">{{items.d_h_t.bat_sta==0?"正常":"欠压"}}</td>
+						<td class="td">{{items.d_h_t.rps==0?"正常":"雨控"}}</td>
+						<td class="td">{{items.d_h_t.usb_sta==0?"正常":"异常"}}</td>
+						<td class="td">{{items.d_h_t.csq}}</td>
+						<td class="td">{{items.d_h_t.current}}</td>
+						<td class="td">{{items.d_h_t.vbat}}</td>
+						<td class="td">{{items.d_h_t.dver}}</td>
+						<td class="td">{{items.d_h_t.addtime|timeFormat()}}</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>
+				<button @click="next" :disabled="forbidden">下一页</button>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import highcharts from "@/components/highcharts/highcharts"
+	var newtime = +new Date()
+	var strrttime = newtime - 24*60*60*1000
+	export default {
+		data() {
+			return {
+				styles: {
+					// width: "650rpx",
+					height: "400rpx"
+				},
+				options: {
+					chart: {
+						type: 'spline', //指定图表的类型,默认是折线图(line)
+						zoomType: 'x',
+						panning: true,
+						panKey: 'shift'
+					},
+					title: {
+						text: '' // 标题
+					},
+					credits: {
+						enabled: false
+					},
+					xAxis: {
+						type: 'datetime',
+						crosshair: true, //十字基准线
+						dateTimeLabelFormats: {
+							//根据时间间距X轴自动显示哪种格式
+							millisecond: "%H:%M:%S.%L",
+							second: "%H:%M:%S",
+							minute: "%H:%M",
+							hour: "%H:%M",
+							day: "%m-%d",
+							week: "%m-%d",
+							month: "%Y-%m",
+							year: "%Y",
+						},
+					},
+					yAxis: {
+						title: false,
+					},
+					legend: {
+						// layout: 'vertical',
+						align: "center",
+						verticalAlign: "top",
+					},
+					tooltip: {
+						// crosshairs: true,
+						shared: true, //折线共享
+						headerFormat: "<b>{point.x:%Y-%m-%e %H:%M:%S}</b><br>",
+					},
+					plotOptions: {
+						spline: {
+							marker: {
+								enabled: false
+							},
+						}
+					},
+					series: [
+						{
+							name: "温度(°C)",
+							data: [],
+							color: "#00E29D"
+						},
+						{
+							name: "湿度(%)",
+							data: [],
+							color: "#6CBBFF"
+						},
+						{
+							name: "保温仓温度(°C)",
+							data: [],
+							color: "#f00000"
+						}
+					],
+				},
+				d_id:'',
+				start_time:strrttime,
+				end_time:newtime,
+				historydatas:[],
+				titletext: ["24小时", "近一个月", "近半年", "近一年"],
+				titleidnex: 0,
+				device_id:'',
+				page:1,
+				historylistdata:[],
+				thdata: ["设备开关","环境温度(°C)", "环境湿度(%)", "保温仓温度设定温度(°C)","保温仓温度当前温度(°C)","电池状态", "雨控状态", "摄像头状态", "信号强度", "电流(mA)", "电压(V)", "设备版本", "上报时间"],
+				forbidden:false
+			}
+		},
+		methods: {
+			//forecast.worm_lamp.device_polyline_data 历史数据折线图
+			 // device_type_id          必传(string)                  设备类型  3虫情测报灯 7孢子仪 4智能性诱 2杀虫灯  9糖醋测报灯  10测报灯rtu
+			 //    d_id                    必传                            设备id
+			 //    start_time              非必传(string 时间戳)           开始时间    (用于时间搜索)
+			 //    end_time
+			 async history() { //获取图片列表
+			 	const res = await this.$myRequest({
+			 		url: '/api/api_gateway?method=forecast.worm_lamp.device_polyline_data',
+			 		data: {
+			 			device_type_id:7,
+						d_id:this.d_id,
+						start_time :parseInt(this.start_time/1000),
+						end_time:parseInt(this.end_time/1000)
+			 		}
+			 	})
+			 	this.historydatas = res
+			 	console.log(this.historydatas)
+				this.options.series[0].data = []
+				this.options.series[1].data = []
+				this.options.series[2].data = []
+				for(var i=0;i<res.length;i++){
+					var arr1 = []
+					arr1.push(res[i].addtime * 1000 + 8 * 3600000, Number(res[i].temperature))
+					this.options.series[0].data.push(arr1)
+					var arr2 = []
+					arr2.push(res[i].addtime * 1000 + 8 * 3600000, Number(res[i].humidity))
+					this.options.series[1].data.push(arr2)
+					var arr3 = []
+					arr3.push(res[i].addtime * 1000 + 8 * 3600000, Number(res[i].others))
+					this.options.series[2].data.push(arr3)
+				}
+			 },
+			 //forecast.worm_lamp.device_history_data历史数据列表
+			 async historylist() { //获取图片列表
+			 	const res = await this.$myRequest({
+			 		url: '/api/api_gateway?method=forecast.worm_lamp.device_history_data',
+			 		data: {
+						device_type_id: 7,
+						device_id: this.device_id,
+						start_time: parseInt(this.start_time/1000),
+						end_time: parseInt(this.end_time/1000),
+						page: this.page
+			 		}
+			 	})
+				this.historylistdata = res.data
+				if(res.data.length == 0){
+					this.forbidden =true
+					console.log(res.data.length)
+				}else{
+					this.forbidden =false
+					console.log(res.data.length)
+				}
+				console.log(this.historylistdata)
+			},
+			 changeindex(index){
+				 this.titleidnex = index
+				 var now = new Date()
+				 this.$forceUpdate()
+				 if(index==0){
+					 this.start_time = strrttime
+					 this.history()
+					 this.historylist()
+				 }else if(index == 1){
+					 var oldtime = now.setMonth(now.getMonth() - 1)
+					 this.start_time = parseInt(oldtime)
+					 this.history()
+					 this.historylist()
+				 }else if(index == 2){
+					 var oldtime = now.setMonth(now.getMonth() - 6)
+					 this.start_time = parseInt(oldtime)
+					 this.history()
+					 this.historylist()
+				 }else if(index == 3){
+					 var oldtime = now.setFullYear(now.getFullYear() - 1)
+					 this.start_time = parseInt(oldtime)
+					 this.history()
+					 this.historylist()
+				 }
+			 },
+			 prev(){//上一页
+				 if(this.page > 1){
+					 this.page--
+					 this.historylist()
+				 }
+			 },
+			 next(){//下一页
+				 this.page++
+				 this.historylist()
+			 },
+			 clickLeft(){
+				 uni.navigateBack({
+				 	delta:1
+				 })
+			 }
+		},
+		onLoad(option){
+			this.d_id = option.d_id
+			this.device_id = option.device_id
+			this.history()
+			this.historylist()
+		}
+	}
+</script>
+
+<style lang="scss">
+	.shuju_one,
+	.shuju_two {
+		position: absolute;
+		top: 54px;
+		width: 90%;
+		left: 5%;
+		box-shadow: 0 0 10rpx #bcb9ca;
+		padding-top: 20rpx;
+
+		.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;
+			}
+		}
+	}
+	.condition {
+		position: absolute;
+		top: 600rpx;
+		display: flex;
+		flex-wrap: wrap;
+		width: 90%;
+		left: 5%;
+		box-shadow: 0 0 10rpx #bcb9ca;
+		margin-bottom: 30rpx;
+		
+		.scroll-X {
+			width: 95%;
+			margin: 20rpx auto;
+			.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{
+					height: 100rpx;
+				}
+			}
+		}
+	
+		.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;
+			}
+		}
+	}
+</style>
+

+ 21 - 2
pages/cb/cbd/equip-set/imgpage.vue

@@ -3,9 +3,11 @@
 		<view style="position: fixed;z-index: 100;">
 			<uni-nav-bar @clickLeft="clickLeft" left-icon="back" title="查看图片"></uni-nav-bar>
 		</view>
+		<p class="tishi" v-if="tishi">暂无数据</p>
 		<view class="imglist">
 			<view class="imglist_box" v-for="(item,index) in imglists" :key="index">
 				<view class="imglist_left">
+					<image src="../../../../static/image/cb/jiazai.ui.gif" mode=""></image>
 					<image :src="item.addr" mode=""></image>
 				</view>
 				<view class="imglist_right">
@@ -33,7 +35,8 @@
 		data() {
 			return {
 				page: 1,
-				imglists: []
+				imglists: [],
+				tishi:true
 			}
 		},
 		methods: {
@@ -49,6 +52,11 @@
 				})
 				this.imglists = this.imglists.concat(res.data) 
 				console.log(this.imglists)
+				if(this.imglists.length==0){
+					this.tishi = true
+				}else{
+					this.tishi = false
+				}
 			},
 			//forecast.forecast_system.equip_photo_del
 			async del(id) { //删除图片
@@ -124,6 +132,14 @@
 </script>
 
 <style lang="scss">
+	.tishi{
+		position: absolute;
+		top: 84px;
+		width: 95%;
+		left: 2.5%;
+		text-align: center;
+		font-size: 40rpx;
+	}
 	.imglist {
 		position: absolute;
 		top: 54px;
@@ -139,8 +155,11 @@
 
 		.imglist_left {
 			width: 50%;
-
+			position: relative;
 			image {
+				position: absolute;
+				top: 0;
+				left: 0;
 				width: 100%;
 				height: 280rpx;
 			}

+ 11 - 1
pages/cb/cbd/equip-set/note.vue

@@ -148,7 +148,12 @@
 				}else{
 					this.form.appointPest = "off"
 				}
-				console.log(this.form)
+				// console.log(this.form)
+				this.conf = JSON.stringify(this.form)
+				this.notealloc()
+				uni.navigateBack({
+					delta:1
+				})
 			},
 			phonereg(){
 				if(/^1[23456789]\d{9}$/.test(this.form.phone)){
@@ -159,6 +164,11 @@
 			},
 			confirmFun2(index){
 				this.form.appointPestName = index
+			},
+			clickLeft(){
+				uni.navigateBack({
+					delta:1
+				})
 			}
 		},
 		onLoad(option) {

+ 490 - 0
pages/cb/cbd/equip-set/statistics.vue

@@ -0,0 +1,490 @@
+<template>
+	<view>
+		<view style="position: fixed;z-index: 100;">
+			<uni-nav-bar @clickLeft="clickLeft" left-icon="back" title="害虫统计"></uni-nav-bar>
+		</view>
+		<view class="statistics">
+			<view class="top_text">
+				<view :class="topindex==index?'title_text_color':'tltle_text'" v-for="(item,index) in toptext" :key="index" @click="changeindex(index)">
+					{{item}}
+				</view>
+			</view>
+			<view class="shuju_one">
+				<view class="shuju_one_title">
+					<p>害虫趋势统计</p>
+					<view class="schedule_box">
+						<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>
+						<u-picker v-model="pickertfone" mode="selector" @confirm="confirmFun" :default-selector="[indexone]" :range="titletext"></u-picker>
+						<view class="schedule" @click="pickertftwo=!pickertftwo">
+							<p class="schedule_value">{{wormdata[indextwo]}}</p>
+							<p class="schedule_icon">
+								<u-icon name="arrow-down"></u-icon>
+							</p>
+							<u-picker v-model="pickertftwo" mode="selector" @confirm="confirmFun2" :default-selector="[indextwo]" :range="wormdata"></u-picker>
+						</view>
+					</view>
+				</view>
+				<highcharts :chartOptions="options" :styles="styles" ref="simpleChart"></highcharts>
+				<p class="tishi" v-if="!tishi">暂无数据</p>
+				<highcharts :chartOptions="optiontwos" :styles="styletwos" ref="simpleChart" v-if="tishitf"></highcharts>
+			</view>
+		</view>
+	</view>
+</template>
+<style lang="scss">
+	.top_text {
+		width: 90%;
+		position: absolute;
+		top: 54px;
+		display: flex;
+		left: 5%;
+
+		.tltle_text {
+			width: 50%;
+			border: 2rpx solid #F0F0F0;
+			text-align: center;
+		}
+
+		.title_text_color {
+			width: 50%;
+			border: 2rpx solid #64CC82;
+			text-align: center;
+		}
+	}
+
+	.tishi {
+		position: absolute;
+		top: 250rpx;
+		left: 40%;
+		font-size: 32rpx;
+		color: #7A7373;
+	}
+
+	.shuju_one_title {
+		width: 90%;
+		margin: 0 auto;
+		display: flex;
+		justify-content: space-between;
+
+
+		.schedule_box {
+			display: flex;
+		}
+
+		.schedule {
+			display: flex;
+			width: 180rpx;
+			height: 50rpx;
+			border: 2rpx solid #F0F0F0;
+			margin-left: 20rpx;
+
+			.schedule_value {
+				width: 70%;
+				text-align: center;
+				line-height: 50rpx;
+			}
+
+			.schedule_icon {
+				width: 30%;
+				background-color: #F2F2F2;
+				text-align: center;
+				line-height: 50rpx;
+			}
+		}
+	}
+</style>
+<script>
+	import highcharts from "@/components/highcharts/highcharts"
+	var newtime = +new Date()
+	var strrttime = newtime - 24 * 60 * 60 * 1000
+	export default {
+		data() {
+			return {
+				styles: {
+					// width: "650rpx",
+					height: "400rpx"
+				},
+				styletwos: {
+					width: "650rpx",
+					height: "600rpx"
+				},
+				options: {
+					chart: {
+						type: 'spline', //指定图表的类型,默认是折线图(line)
+						zoomType: 'x',
+						panning: true,
+						panKey: 'shift'
+					},
+					title: {
+						text: '' // 标题
+					},
+					credits: {
+						enabled: false
+					},
+					xAxis: {
+						type: 'datetime',
+						crosshair: true, //十字基准线
+						dateTimeLabelFormats: {
+							//根据时间间距X轴自动显示哪种格式
+							millisecond: "%H:%M:%S.%L",
+							second: "%H:%M:%S",
+							minute: "%H:%M",
+							hour: "%H:%M",
+							day: "%m-%d",
+							week: "%m-%d",
+							month: "%Y-%m",
+							year: "%Y",
+						},
+					},
+					yAxis: {
+						title: false,
+					},
+					legend: {
+						// layout: 'vertical',
+						align: "center",
+						verticalAlign: "top",
+					},
+					tooltip: {
+						// crosshairs: true,
+						shared: true, //折线共享
+						headerFormat: "<b>{point.x:%Y-%m-%e %H:%M:%S}</b><br>",
+					},
+					plotOptions: {
+						spline: {
+							marker: {
+								enabled: false
+							},
+						}
+					},
+					series: [],
+				},
+				d_id: '',
+				start_time: strrttime,
+				end_time: newtime,
+				titletext: ["24小时", "近一个月", "近半年", "近一年"],
+				device_id: '',
+				pest_name: '',
+				wormdata: [],
+				pickertfone: false,
+				pickertftwo: false,
+				indexone: 0,
+				indextwo: 0,
+				optiontwos: {
+					chart: {
+						spacing: [40, 0, 40, 0]
+					},
+					title: {
+						floating: true,
+						text: ''
+					},
+					credits: {
+						enabled: false
+					},
+					tooltip: {
+						pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
+					},
+
+					series: [{
+						type: 'pie',
+						innerSize: '60%',
+						name: '占比',
+						data: []
+					}]
+				},
+				tishitf: false,
+				tishi: false,
+				toptext: ["自动统计", "手动统计"],
+				topindex: 0
+			}
+		},
+		methods: {
+			async historys() { //获取统计虫子 自动统计
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=forecast.worm_lamp.pest_statistics',
+					data: {
+						d_id: this.d_id,
+						start_time: parseInt(this.start_time / 1000),
+						end_time: parseInt(this.end_time / 1000)
+					}
+				})
+				if (res.percentage.length == 0) {
+					this.tishitf = false
+				} else {
+					this.tishitf = true
+					this.wormdata = []
+					for (var i = 0; i < res.percentage.length; i++) {
+						this.wormdata.unshift(res.percentage[i].name_num)
+					}
+				}
+			},
+			async history() { //获取统计虫子 //自动统计
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=forecast.worm_lamp.pest_statistics',
+					data: {
+						pest_name: this.pest_name,
+						d_id: this.d_id,
+						start_time: parseInt(this.start_time / 1000),
+						end_time: parseInt(this.end_time / 1000)
+					}
+				})
+				this.historydatas = res
+				console.log(this.historydatas)
+				// console.log(this.optiontwos.series.data)
+				this.options.series = []
+				var obj1 = {
+					name: "温度(°C)",
+					data: [],
+					color: "#00E29D"
+				}
+				var obj2 = {
+					name: "湿度(%)",
+					data: [],
+					color: "#6CBBFF"
+				}
+				var obj3 = {
+					name: "害虫总数",
+					data: [],
+					color: "#f00000"
+				}
+				if (res.date.length == 0) {
+					this.tishi = false
+				} else {
+					this.tishi = true
+					this.optiontwos.series[0].data = []
+					for (var i = 0; i < res.percentage.length; i++) {
+						var arr = [res.percentage[i].name_num + ":" + res.percentage[i].sum + "头", res.percentage[i].sum]
+						this.optiontwos.series[0].data.push(arr) /*********************************/
+
+					}
+					for (var i = 0; i < res.date.length; i++) {
+						var arr1 = []
+						arr1.push(res.date[i].addtime * 1000 + 8 * 3600000, Number(res.date[i].temperature))
+						obj1.data.push(arr1)
+						var arr2 = []
+						arr2.push(res.date[i].addtime * 1000 + 8 * 3600000, Number(res.date[i].humidity))
+						obj2.data.push(arr2)
+						var arr3 = []
+						arr3.push(res.date[i].addtime * 1000 + 8 * 3600000, Number(res.date[i]._sums))
+						obj3.data.push(arr3)
+					}
+					this.options.series.push(obj1)
+					this.options.series.push(obj2)
+					this.options.series.push(obj3)
+				}
+				if (res.percentage.length == 0) {
+					this.tishitf = false
+					console.log(1)
+				} else {
+					console.log(2)
+					this.tishitf = true
+					this.wormdata = []
+					for (var i = 0; i < res.percentage.length; i++) {
+						this.wormdata.unshift(res.percentage[i].name_num)
+					}
+				}
+			},
+			//forecast.worm_lamp.pest_manual_statistics手动统计
+			async selfhistorys() { //获取统计虫子 自动统计
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=forecast.worm_lamp.pest_manual_statistics',
+					data: {
+						device_id: this.d_id,
+						start_time: parseInt(this.start_time / 1000),
+						end_time: parseInt(this.end_time / 1000)
+					}
+				})
+				if (res.dat.length == 0) {
+					this.tishitf = false
+				} else {
+					this.tishitf = true
+					this.wormdata = []
+					for (var i = 0; i < res.dat.length; i++) {
+						this.wormdata.unshift(res.dat[i].pest_name)
+					}
+				}
+			},
+			async selfhistory() { //获取统计虫子 //自动统计
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=forecast.worm_lamp.pest_manual_statistics',
+					data: {
+						pest_name: this.pest_name,
+						device_id: this.d_id,
+						start_time: parseInt(this.start_time / 1000),
+						end_time: parseInt(this.end_time / 1000)
+					}
+				})
+				this.historydatas = res
+				console.log(this.historydatas)
+				this.options.series = []
+				var obj = {
+					name: "害虫总数",
+					data: [],
+					color: "#f00000"
+				}
+				if (res.dat.length == 0) {
+					this.tishi = false
+				} else {
+					this.tishi = true
+					this.optiontwos.series[0].data = []
+					for (var i = 0; i < res.dat.length; i++) {
+						var arr = [res.dat[i].pest_name + ":" + res.dat[i].pest_num + "头", res.dat[i].pest_num]
+						this.optiontwos.series[0].data.push(arr) /*********************************/
+					}
+					for (var i = 0; i < res.date.length; i++) {
+						var arr1 = []
+						arr1.push(res.date[i].add_time * 1000 + 8 * 3600000, Number(res.date[i].pest_num))
+						obj.data.push(arr1)
+					}
+					this.options.series.push(obj)
+				}
+			},
+			clickLeft() {
+				uni.navigateBack({
+					delta: 1
+				})
+			},
+			confirmFun(index) {
+				this.indexone = index[0]
+				var now = new Date()
+				this.$forceUpdate()
+				if (index[0] == 0) {
+					this.start_time = strrttime
+					if (this.topindex == 0) {
+						this.history()
+						this.historys()
+					} else {
+						this.selfhistorys()
+						this.selfhistory()
+					}
+				} else if (index[0] == 1) {
+					var oldtime = now.setMonth(now.getMonth() - 1)
+					this.start_time = parseInt(oldtime)
+					if (this.topindex == 0) {
+						this.history()
+						this.historys()
+					} else {
+						this.selfhistorys()
+						this.selfhistory()
+					}
+				} else if (index[0] == 2) {
+					var oldtime = now.setMonth(now.getMonth() - 6)
+					this.start_time = parseInt(oldtime)
+					if (this.topindex == 0) {
+						this.history()
+						this.historys()
+					} else {
+						this.selfhistorys()
+						this.selfhistory()
+					}
+				} else if (index[0] == 3) {
+					var oldtime = now.setFullYear(now.getFullYear() - 1)
+					this.start_time = parseInt(oldtime)
+					if (this.topindex == 0) {
+						this.history()
+						this.historys()
+					} else {
+						this.selfhistorys()
+						this.selfhistory()
+					}
+				}
+			},
+			confirmFun2(index) {
+				this.indextwo = index[0]
+				this.pest_name = this.wormdata[this.indextwo]
+				this.history()
+			},
+			changeindex(index) {
+				this.topindex = index
+				if (this.topindex == 0) {
+					this.pest_name = ''
+					this.history()
+					this.historys()
+				} else {
+					this.pest_name = ''
+					this.selfhistorys()
+					this.selfhistory()
+				}
+			}
+		},
+		onLoad(option) {
+			this.d_id = option.d_id
+			this.device_id = option.device_id
+			this.history()
+			this.historys()
+
+		}
+	}
+</script>
+
+<style lang="scss">
+	.shuju_one,
+	.shuju_two {
+		position: absolute;
+		top: 84px;
+		width: 90%;
+		left: 5%;
+		box-shadow: 0 0 10rpx #bcb9ca;
+		padding-top: 20rpx;
+
+	}
+
+	.condition {
+		position: absolute;
+		top: 600rpx;
+		display: flex;
+		flex-wrap: wrap;
+		width: 90%;
+		left: 5%;
+		box-shadow: 0 0 10rpx #bcb9ca;
+		margin-bottom: 30rpx;
+
+		.scroll-X {
+			width: 95%;
+			margin: 20rpx auto;
+
+			.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;
+				}
+			}
+		}
+
+		.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;
+			}
+		}
+	}
+</style>

+ 4 - 4
pages/cb/equip-detail/equip-detail.vue

@@ -102,7 +102,7 @@
 				}, {
 					icon: '/static/image/cb/3.png',
 					tex: '害虫统计',
-					path: '',
+					path: '/pages/cb/cbd/equip-set/statistics',
 				}, {
 					icon: '/static/image/cb/4.png',
 					tex: '设备控制',
@@ -123,11 +123,11 @@
 				}, {
 					icon: '/static/image/cb/1.png',
 					tex: '查看图片',
-					path: ''
+					path: '/pages/cb/cbd/equip-set/imgpage'
 				}, {
 					icon: '/static/image/cb/2.png',
 					tex: '历史数据',
-					path: ''
+					path: '/pages/cb/bzy/equip-set/bzyhistoryile'
 				}, {
 					icon: '/static/image/cb/6.png',
 					tex: 'sim卡详情',
@@ -144,7 +144,7 @@
 				}, {
 					icon: '/static/image/cb/2.png',
 					tex: '历史数据',
-					path: ''
+					path: '/pages/cb/xy/equip-set/xyhistoryile'
 				}],
 				newState: {}, //设备最新状态
 				setTimeShow: false,

+ 402 - 0
pages/cb/xy/equip-set/xyhistoryile.vue

@@ -0,0 +1,402 @@
+<template>
+	<view>
+		<view style="position: fixed;z-index: 100;">
+			<uni-nav-bar @clickLeft="clickLeft" left-icon="back" title="查看图片"></uni-nav-bar>
+		</view>
+		<view class="shuju_one">
+			<view class="shuju_one_title">
+				<view :class="titleidnex==index?'title_text_color':'tltle_text'" v-for="(item,index) in titletext" :key="index"
+				 @click="changeindex(index)">
+					{{item}}
+				</view>
+			</view>
+			<highcharts :chartOptions="options" :styles="styles" ref="simpleChart"></highcharts>
+		</view>
+		<view class="wind">
+			<p class="wind_titie">风速、风向</p>
+			<view class="wind_text">
+				<view class="wind_speed">
+					<image src="../../../../static/image/cb/xy/1c24243bb184e84ffd13540367569ba.png" mode=""></image>
+					<p>风速:{{wind_sped}}(m/s)</p>
+				</view>
+				<view class="wind_direction">
+					<image src="../../../../static/image/cb/xy/c44ae038324e1040a1eaa702e6d71a5.png" mode=""></image>
+					<p>风速:{{wind_drec}}</p>
+				</view>
+			</view>
+		</view>
+		<view class="condition">
+			<scroll-view scroll-top="0" scroll-x="true" class="scroll-X">
+				<!-- @scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll" -->
+				<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.d_h_t.proj}}</td>
+						<td class="td">{{items.d_h_t.ds==0?"关":"开"}}</td>
+						<td class="td">{{items.d_h_t.ws==0?"待机":"工作"}}</td>
+						<td class="td">{{items.d_h_t.at}}</td>
+						<td class="td">{{items.d_h_t.ah}}</td>
+						<td class="td">{{items.d_h_t.cv}}</td>
+						<td class="td">{{items.d_h_t.bv}}</td>
+						<td class="td">{{items.d_h_t.bs}}</td>
+						<td class="td">{{items.d_h_t.cs?"正常":"充电"}}</td>
+						<td class="td">{{items.d_h_t.infr_ct}}</td>
+						<td class="td">{{items.d_h_t.csq}}</td>
+						<td class="td">{{items.d_h_t.dver}}</td>
+						<td class="td">{{items.d_h_t.addtime|timeFormat()}}</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>
+				<button @click="next" :disabled="forbidden">下一页</button>
+			</view>
+		</view>
+	</view>
+</template>
+<style lang="scss">
+	
+</style>
+<script>
+	import highcharts from "@/components/highcharts/highcharts"
+	var newtime = +new Date()
+	var strrttime = newtime - 24*60*60*1000
+	export default {
+		data() {
+			return {
+				styles: {
+					// width: "650rpx",
+					height: "400rpx"
+				},
+				options: {
+					chart: {
+						type: 'spline', //指定图表的类型,默认是折线图(line)
+						zoomType: 'x',
+						panning: true,
+						panKey: 'shift'
+					},
+					title: {
+						text: '' // 标题
+					},
+					credits: {
+						enabled: false
+					},
+					xAxis: {
+						type: 'datetime',
+						crosshair: true, //十字基准线
+						dateTimeLabelFormats: {
+							//根据时间间距X轴自动显示哪种格式
+							millisecond: "%H:%M:%S.%L",
+							second: "%H:%M:%S",
+							minute: "%H:%M",
+							hour: "%H:%M",
+							day: "%m-%d",
+							week: "%m-%d",
+							month: "%Y-%m",
+							year: "%Y",
+						},
+					},
+					yAxis: {
+						title: false,
+					},
+					legend: {
+						// layout: 'vertical',
+						align: "center",
+						verticalAlign: "top",
+					},
+					tooltip: {
+						// crosshairs: true,
+						shared: true, //折线共享
+						headerFormat: "<b>{point.x:%Y-%m-%e %H:%M:%S}</b><br>",
+					},
+					plotOptions: {
+						spline: {
+							marker: {
+								enabled: false
+							},
+						}
+					},
+					series: [
+						{
+							name: "温度(°C)",
+							data: [],
+							color: "#00E29D"
+						},
+						{
+							name: "湿度(%)",
+							data: [],
+							color: "#6CBBFF"
+						}
+					],
+				},
+				d_id:'',
+				start_time:strrttime,
+				end_time:newtime,
+				historydatas:[],
+				titletext: ["24小时", "近一个月", "近半年", "近一年"],
+				titleidnex: 0,
+				device_id:'',
+				page:1,
+				historylistdata:[],
+				thdata: ["型号", "设备开关", "工作状态","环境温度(°C)", "环境湿度(%)", "充电电压(V)", "电池电压(V)", "电池状态","充电状态","红外计数值","信号强度",  "版本号", "上报时间"],
+				forbidden:false,
+				wind_sped:'',//风速
+				wind_drec:''
+			}
+		},
+		methods: {
+			//forecast.worm_lamp.device_polyline_data 历史数据折线图
+			 // device_type_id          必传(string)                  设备类型  3虫情测报灯 7孢子仪 4智能性诱 2杀虫灯  9糖醋测报灯  10测报灯rtu
+			 //    d_id                    必传                            设备id
+			 //    start_time              非必传(string 时间戳)           开始时间    (用于时间搜索)
+			 //    end_time
+			 async history() { //获取图片列表
+			 	const res = await this.$myRequest({
+			 		url: '/api/api_gateway?method=forecast.worm_lamp.device_polyline_data',
+			 		data: {
+			 			device_type_id:4,
+						d_id:this.d_id,
+						start_time :parseInt(this.start_time/1000),
+						end_time:parseInt(this.end_time/1000)
+			 		}
+			 	})
+			 	this.historydatas = res
+			 	console.log(this.historydatas)
+				this.options.series[0].data = []
+				this.options.series[1].data = []
+				if(res.length==0){
+					this.wind_sped = "--"
+					this.wind_drec = "--"
+				}else{
+					this.wind_sped = res[0].others.wind_sped
+					console.log(res[0].others.wind_drec)
+					if(22<res[0].others.wind_drec&&67<res[0].others.wind_drec){
+						this.wind_drec = "东北"
+					}else if(67<res[0].others.wind_drec&&112>res[0].others.wind_drec){
+						this.wind_drec = "东"
+					}else if(112<res[0].others.wind_drec&&157>res[0].others.wind_drec){
+						this.wind_drec = "东南"
+					}else if(157<res[0].others.wind_drec&&202>res[0].others.wind_drec){
+						this.wind_drec = "南"
+					}else if(202<res[0].others.wind_drec&&247>res[0].others.wind_drec){
+						this.wind_drec = "西南"
+					}else if(247<res[0].others.wind_drec&&292>res[0].others.wind_drec){
+						this.wind_drec = "西"
+					}else  if(292<res[0].others.wind_drec&&337>res[0].others.wind_drec){
+						this.wind_drec = "西北"
+					}else {
+						this.wind_drec = "北"
+					}
+				}
+				for(var i=0;i<res.length;i++){
+					var arr1 = []
+					arr1.push(res[i].addtime * 1000 + 8 * 3600000, Number(res[i].temperature))
+					this.options.series[0].data.push(arr1)
+					var arr2 = []
+					arr2.push(res[i].addtime * 1000 + 8 * 3600000, Number(res[i].humidity))
+					this.options.series[1].data.push(arr2)
+				}
+			 },
+			 //forecast.worm_lamp.device_history_data历史数据列表
+			 async historylist() { //获取图片列表
+			 	const res = await this.$myRequest({
+			 		url: '/api/api_gateway?method=forecast.worm_lamp.device_history_data',
+			 		data: {
+						device_type_id: 4,
+						device_id: this.device_id,
+						start_time: parseInt(this.start_time/1000),
+						end_time: parseInt(this.end_time/1000),
+						page: this.page
+			 		}
+			 	})
+				this.historylistdata = res.data
+				if(res.data.length == 0){
+					this.forbidden =true
+				}else{
+					this.forbidden =false
+				}
+				for(var i=0;i<this.historylistdata.length;i++){
+					if(res.data[i].d_h_t.bs==0){
+						this.historylistdata[i].d_h_t.bs = "正常"
+					}else if(res.data[i].d_h_t.bs==1){
+						this.historylistdata[i].d_h_t.bs = "欠压"
+					}else if(res.data[i].d_h_t.bs==2){
+						this.historylistdata[i].d_h_t.bs = "超压"
+					}
+				}
+				console.log(this.historylistdata)
+			},
+			 changeindex(index){
+				 this.titleidnex = index
+				 var now = new Date()
+				 this.$forceUpdate()
+				 if(index==0){
+					 this.start_time = strrttime
+					 this.history()
+					 this.historylist()
+				 }else if(index == 1){
+					 var oldtime = now.setMonth(now.getMonth() - 1)
+					 this.start_time = parseInt(oldtime)
+					 this.history()
+					 this.historylist()
+				 }else if(index == 2){
+					 var oldtime = now.setMonth(now.getMonth() - 6)
+					 this.start_time = parseInt(oldtime)
+					 this.history()
+					 this.historylist()
+				 }else if(index == 3){
+					 var oldtime = now.setFullYear(now.getFullYear() - 1)
+					 this.start_time = parseInt(oldtime)
+					 this.history()
+					 this.historylist()
+				 }
+			 },
+			 prev(){//上一页
+				 if(this.page > 1){
+					 this.page--
+					 this.historylist()
+				 }
+			 },
+			 next(){//下一页
+				 this.page++
+				 this.historylist()
+			 },
+			 clickLeft(){
+				 uni.navigateBack({
+				 	delta:1
+				 })
+			 }
+		},
+		onLoad(option){
+			this.d_id = option.d_id
+			this.device_id = option.device_id
+			this.history()
+			this.historylist()
+		}
+	}
+</script>
+
+<style lang="scss">
+	.shuju_one,
+	.shuju_two {
+		position: absolute;
+		top: 54px;
+		width: 90%;
+		left: 5%;
+		box-shadow: 0 0 10rpx #bcb9ca;
+		padding-top: 20rpx;
+
+		.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;
+			}
+		}
+	}
+	.wind{
+		position: absolute;
+		top: 600rpx;
+		width: 90%;
+		left: 5%;
+		box-shadow: 0 0 10rpx #bcb9ca;
+		padding: 20rpx;
+		.wind_titie{
+			border-left: 6rpx solid #26D696;
+			height: 34rpx;
+			padding-left: 20rpx;
+		}
+		.wind_text{
+			display: flex;
+			.wind_speed,.wind_direction{
+				width: 50%;
+				text-align: center;
+				margin-top: 30rpx;
+				image{
+					width: 160rpx;
+					height: 130rpx;
+				}
+			}
+		}
+	}
+	.condition {
+		position: absolute;
+		top: 900rpx;
+		display: flex;
+		flex-wrap: wrap;
+		width: 90%;
+		left: 5%;
+		box-shadow: 0 0 10rpx #bcb9ca;
+		margin-bottom: 30rpx;
+		
+		.scroll-X {
+			width: 95%;
+			margin: 20rpx auto;
+			.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;
+				}
+			}
+		}
+	
+		.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;
+			}
+		}
+	}
+</style>
+

+ 114 - 0
pages/disandpests/index.vue

@@ -0,0 +1,114 @@
+<template>
+	<view>
+		<view style="position: fixed;z-index: 100;">
+			<uni-nav-bar @clickLeft="clickLeft" left-icon="back" title="病虫害识别"></uni-nav-bar>
+		</view>
+		<image :src="path" mode="" class="image"></image>
+		<view class="recognition" v-if="datasTF">
+			<p class="recognition_title">{{name}}</p>
+			<view class="recognition_img">
+				<image :src="path2" mode=""></image>
+			</view>
+			<button class="recognition_details" v-if="tishi" @click="">查看详情</button>
+		</view>
+		<view class="datas" v-else>
+			<p>{{prevention}}</p>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				path: "",
+				path2:"",
+				tishi: true,
+				name:"",
+				prevention:"",
+				datasTF:true
+			}
+		},
+		methods: {
+			clickLeft() {
+				uni.switchTab({
+					url: "../index/index"
+				})
+			},
+			examine(){
+				this.datasTF = false
+			}
+		},
+		onLoad(option) {
+			this.path = option.path
+			console.log(JSON.parse(option.datas).img_urls, option.path)
+			if (JSON.parse(option.datas).img_urls== undefined ) {
+				this.name = "识别失败,请换张图片"
+				this.tishi = false
+			} else {
+				this.path2 = JSON.parse(option.datas).img_urls
+				this.name = JSON.parse(option.datas).name
+				this.tishi = true
+				this.prevention =  JSON.parse(option.datas).prevention
+			}
+
+		}
+	}
+</script>
+
+<style lang="scss">
+	.image {
+		position: absolute;
+		top: 44px;
+		width: 100%;
+		height: 400rpx;
+	}
+
+	.recognition {
+		position: absolute;
+		top: 244px;
+		width: 100%;
+		height: 800rpx;
+
+		.recognition_title {
+			width: 100%;
+			text-align: center;
+			font-size: 36rpx;
+			font-weight: 700;
+			margin: 60rpx 0;
+		}
+
+		.recognition_img {
+			border: 2rpx dashed #06B535;
+			width: 450rpx;
+			height: 450rpx;
+			border-radius: 50%;
+			margin: 0 auto;
+			text-align: center;
+			line-height: 450rpx;
+
+			image {
+				margin-top: 10rpx;
+				width: 430rpx;
+				height: 430rpx;
+			}
+		}
+
+		.recognition_details {
+			width: 400rpx;
+			height: 80rpx;
+			border-radius: 40rpx;
+			margin: 30rpx auto;
+			font-size: 30rpx;
+			background-color: #67B25F;
+			color: #FFFFFF;
+		}
+	}
+	.datas{
+		position: absolute;
+		top: 244px;
+		width: 90%;
+		left: 5%;
+		padding: 20rpx;
+	}
+</style>

+ 322 - 42
pages/distribution/index.vue

@@ -1,64 +1,344 @@
-<!-- 地图页面 -->
 <template>
 	<view>
-		<highcharts :chartOptions="options" :styles="styles" ref="simpleChart"></highcharts>
+		<view class="page-body">
+			<view class="utabs">
+				<view style="width: 95%;margin: 0 auto;">
+					<u-tabs :list="list" :is-scroll="true" :current="current" @change="change" item-width="140" font-size="24" gutter="20"
+					 bar-width="60" active-color="#42b983"></u-tabs>
+				</view>
+			</view>
+			<view class="page-section page-section-gap">
+				<map style="width: 100%; height: 88vh;" scale="3" :latitude="latitude" :longitude="longitude" :markers="covers"
+				 :enable-zoom="true" @markertap="markertap">
+				</map>
+			</view>
+		</view>
+		<view class="particulars">
+			<view class="particulars_par" @click="eqinfo">
+				查看详情
+			</view>
+			<view class="particulars_ser" @click="serTF=!serTF">
+				搜索
+			</view>
+		</view>
+		<view class="distri_ser" v-if="serTF">
+			<view class="distri_ser_input">
+				<input type="number" v-model="device_id" placeholder="请输入设备ID" @confirm="doSearch" />
+				<u-icon name="search" size="38rpx" @click="search"></u-icon>
+			</view>
+			<p class="distri_ser_title">请选择设备类型(点击选择)</p>
+			<view class="distri_ser_type">
+				<view :class="typeindex==index?'type_items_bor':'type_items'" v-for="item,index in 6" :key="index" @click="typeselect(index)">
+					<image :src="icon[item].url" mode="" class="type_items_img"></image>
+					<p class="type_items_p">{{list[item].name}}</p>
+				</view>
+			</view>
+			<view class="search_btn">
+				<view class="btn_f" @click="btnF">
+					取 消
+				</view>
+				<view class="btn_t" @click="btnT">
+					确 定
+				</view>
+			</view>
+		</view>
 	</view>
 </template>
 <script>
-	import highcharts from "@/components/highcharts/highcharts"
 	export default {
 		data() {
 			return {
-				options: {
-					chart: {
-						type: 'spline' //指定图表的类型,默认是折线图(line)
+				id: 0, // 使用 marker点击事件 需要填写id
+				title: 'map',
+				latitude: 39.909,
+				longitude: 116.39742,
+				covers: [],
+				list: [{
+					name: "全部"
+				}, {
+					name: "杀虫灯"
+				}, {
+					name: "测报灯"
+				}, {
+					name: "性诱测报"
+				}, {
+					name: "环境检测"
+				}, {
+					name: "监控设备"
+				}, {
+					name: "孢子仪"
+				}],
+				current: 0,
+				icon: [{
+						id: '', //全部
+						url: "../../static/image/distribution/f38c3024bf12cd5777348593e7e5daf.png"
 					},
-					title: {
-						text: '我的第一个图表' // 标题
+					{
+						id: 2, //杀虫灯
+						url: "../../static/image/distribution/70f9fc043155ddaca85c847df2c670c.png"
 					},
-					xAxis: {
-						type: 'datetime',
-						crosshair: true, //十字基准线
-						dateTimeLabelFormats: {
-							//根据时间间距X轴自动显示哪种格式
-							millisecond: "%H:%M:%S.%L",
-							second: "%H:%M:%S",
-							minute: "%H:%M",
-							hour: "%H:%M",
-							day: "%m-%d",
-							week: "%m-%d",
-							month: "%Y-%m",
-							year: "%Y",
-						},
+					{
+						id: 3, //测报灯
+						url: "../../static/image/distribution/621d60f8f64bbe1462e47b4a26635eb.png"
 					},
-					yAxis: {
-						title: {
-							text: '吃水果个数' // y 轴标题
-						}
+					{
+						id: 4, //性诱测报
+						url: "../../static/image/distribution/b7f317cb75082eac43ee4dd84e5156e.png"
 					},
-					series:[{
-						data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
-						// pointStart: Date.UTC(2010, 0, 1),
-						pointInterval: 1000*60*60 // one day
-					}],
-				},
-				styles: {
-					width: "600rpx",
-					height: "600rpx"
-				}
+					{
+						id: 5, //环境检测
+						url: "../../static/image/distribution/3a4b76ff573ebed04f29b408986cb56.png"
+					},
+					{
+						id: 6, //监控设备
+						url: "../../static/image/distribution/c792f8b4befeaa06824f988ac8c9ddc.png"
+					},
+					{
+						id: 7, //孢子仪
+						url: "../../static/image/distribution/14b9bc2ef553b53872389c22a537baf.png"
+					},
+				],
+				type: '', //设备类型
+				typeindex: null, //设备选择
+				device_id: '', //设备号
+				serTF: false, //设备搜索显示隐藏
+				punctuationTF: false, //判断是否以点击标点
+				punctuation_id: "", //点击标点的id
+				punctuation_did: '',
+				punctuation_type: ''
 			}
 		},
-		methods: {},
-
 		onLoad() {
-
+			this.history()
 		},
-		components: {
-			highcharts
+		methods: {
+			async history() { //获取分布位置
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=home.homes.equip_map_location',
+					data: {
+						equip_type: this.type,
+						device_id: this.device_id
+					}
+				})
+				this.covers = []
+				for (var i = 0; i < res.length; i++) {
+					var obj = {}
+					obj.latitude = res[i].lat
+					obj.longitude = res[i].lng
+					obj.id = [res[i].device_id, res[i].d_id, res[i].device_type_id]
+					obj.title = res[i].device_name
+					for (var j = 0; j < this.icon.length; j++) {
+						if (res[i].device_type_id == this.icon[j].id) {
+							obj.iconPath = this.icon[j].url
+						}
+					}
+					this.covers.push(obj)
+				}
+				console.log(res)
+			},
+			change(index) {
+				this.current = index
+				if (index == 0) {
+					this.type = ''
+				} else {
+					this.type = index + 1
+				}
+				this.history()
+			},
+			markertap(e) {
+				this.punctuation_id = e.detail.markerId[0]
+				this.punctuation_did = e.detail.markerId[1]
+				this.punctuation_type = e.detail.markerId[2]
+			},
+			typeselect(index) { //选择设备类型
+				this.typeindex = index
+				this.type = this.icon[index + 1].id
+				console.log(this.type)
+			},
+			doSearch() { //按下回车键
+				this.search()
+			},
+			search() { //点击搜索
+				// this.history()
+				if (this.type == '') {
+					uni.showToast({
+						title: '请选择设备类型',
+						duration: 2000,
+						icon: "none"
+					});
+				} else {
+					this.history()
+					this.serTF = !this.serTF
+				}
+			},
+			btnF() { //确定
+				this.serTF = !this.serTF
+			},
+			btnT() { //取消
+				this.search()
+			},
+			eqinfo() { //设备信息
+				if (this.punctuation_id == '') {
+					uni.showToast({
+						title: '请点击需查看的设备',
+						duration: 2000,
+						icon: "none"
+					});
+				} else {
+					switch (this.punctuation_type) {
+						case 2:
+							uni.navigateTo({
+								url: "../prevention/ucharts?d_id=" + this.punctuation_did + "&device_id=" + this.punctuation_id
+							})
+							break;
+						case 3:
+							uni.navigateTo({
+								url: "../cb/cbd/equip-set/historyfile?d_id=" + this.punctuation_did + "&device_id=" + this.punctuation_id
+							})
+							break;
+						case 4:
+							uni.navigateTo({
+								url: "../cb/xy/equip-set/xyhistoryile?d_id=" + this.punctuation_did + "&device_id=" + this.punctuation_id
+							})
+							break;
+						case 5:
+							uni.navigateTo({
+								url: "../environment/history?d_id=" + this.punctuation_did + "&device_id=" + this.punctuation_id
+							})
+							break;
+						case 6:
+							// uni.navigateTo({
+							// 	url: "../prevention/ucharts?d_id=" + this.punctuation_did + "&device_id=" + this.punctuation_id
+							// })
+							break;
+						case 7:
+							uni.navigateTo({
+								url: "../cb/bzy/equip-set/bzyhistoryile?d_id=" + this.punctuation_did + "&device_id=" + this.punctuation_id
+							})
+							break;
+					}
+
+				}
+			}
 		}
 	}
 </script>
 
-<style>
+<style lang="scss">
+	.utabs {
+		width: 100%;
+		position: fixed;
+		top: 44px;
+		z-index: 100;
+		background-color: #FFFFFF;
+	}
+
+	.particulars {
+		position: absolute;
+		bottom: 0rpx;
+		right: 0rpx;
+		width: 160rpx;
+		text-align: center;
+		color: #FFFFFF;
+
+		.particulars_par {
+			background-color: #35A478;
+			height: 60rpx;
+			padding: 10rpx 20rpx;
+			width: 100%;
+		}
+
+		.particulars_ser {
+			margin-top: 10rpx;
+			background-color: #35A478;
+			height: 60rpx;
+			padding: 10rpx 20rpx;
+			width: 100%;
+		}
+	}
+
+	.distri_ser {
+		position: absolute;
+		bottom: 0px;
+		right: 0px;
+		width: 100%;
+		height: 400rpx;
+		background-color: #FFFFFF;
+
+		.distri_ser_input {
+			width: 90%;
+			margin: 20rpx auto;
+			display: flex;
+			background-color: #F1F1F1;
+			height: 60rpx;
+			border-radius: 30rpx;
+			padding: 10rpx 20rpx;
 
+			input {
+				width: 90%;
+				font-size: 28rpx;
+				margin-right: 20rpx;
+			}
+		}
+
+		.distri_ser_title {
+			width: 90%;
+			margin: 0 auto;
+			padding-left: 20rpx;
+			border-left: 4rpx solid #57C87B;
+		}
+
+		.distri_ser_type {
+			width: 90%;
+			margin: 20rpx auto;
+			display: flex;
+			justify-content: space-around;
+
+			.type_items {
+				height: 150rpx;
+				width: 120rpx;
+				padding: 20rpx 0;
+			}
+
+			.type_items_bor {
+				height: 150rpx;
+				width: 120rpx;
+				border: 2rpx solid #57C87B;
+				padding: 20rpx 0;
+			}
+
+			.type_items_img {
+				width: 70rpx;
+				height: 70rpx;
+				margin-left: 20rpx;
+			}
+
+			.type_items_p {
+				font-size: 24rpx;
+				text-align: center;
+			}
+		}
+	}
+
+	.search_btn {
+		width: 100%;
+		display: flex;
+
+		.btn_f,
+		.btn_t {
+			width: 50%;
+			text-align: center;
+			height: 80rpx;
+			line-height: 80rpx;
+		}
+
+		.btn_f {
+			background-color: #F1F1F1;
+		}
+
+		.btn_t {
+			background-color: #57C87B;
+			color: #FFFFFF;
+		}
+	}
 </style>

+ 1 - 1
pages/environment/equipment.vue

@@ -88,7 +88,7 @@
 			},
 			charts(){//历史数据
 				uni.navigateTo({
-					url:"./history?id="+this.eqinfo.item.equip_id
+					url:"./history?device_id="+this.eqinfo.item.equip_id
 				})
 			}
 		},

+ 4 - 7
pages/environment/history.vue

@@ -178,7 +178,7 @@
 				for (var Key in res.conf) {
 					let obj = {}
 					if (res.conf[Key] != '') {
-						obj.name = Key + res.conf[Key].replace("#", "(") + ")"
+						obj.name = res.conf[Key].replace("#", "(") + ")"
 						obj.data = []
 						obj.color = "rgb(" + parseInt(Math.random() * 256) + "," + parseInt(Math.random() * 256) + "," + parseInt(Math.random() *
 							256) + ")"
@@ -202,9 +202,6 @@
 						}
 					}
 				}
-				if (this.options.series[0].data.length == 0) {
-					console.log(1)
-				}
 				this.$forceUpdate()
 			},
 			pickone(e) {//开始时间
@@ -246,11 +243,11 @@
 			}
 		},
 		onLoad(option) {
-			this.id = option.id
+			this.id = option.device_id
 			this.end = presenttime / 1000
 			this.begintime = presenttime / 1000 - 24 * 60 * 60
-			this.historydata(option.id)
-			this.listhistorydata(option.id)
+			this.historydata(option.device_id)
+			this.listhistorydata(option.device_id)
 		}
 	}
 </script>

+ 164 - 74
pages/index/index.vue

@@ -15,66 +15,19 @@
 				</view>
 			</view>
 		</view>
+		<kps-image-cutter @ok="onok" @cancel="oncancle" :url="url" :fixed="false" :blob="false" :maxWidth="500" :maxHeight="500"></kps-image-cutter>
 	</view>
 </template>
-<style lang="scss">
-	.index_uswiper {
-		width: 95%;
-		margin: 0 auto;
-		border-radius: 20rpx !important;
-	}
-
-	.function {
-		width: 95%;
-		margin: 20rpx auto;
-		display: flex;
-		justify-content: space-around;
-
-		.function_item {
-			width: 18%;
-			text-align: center;
-
-			image {
-				width: 90rpx;
-				height: 90rpx;
-			}
-
-			p {
-				font-size: 24rpx;
-			}
-		}
-	}
 
-	.equipment {
-		width: 95%;
-		margin: 20rpx auto;
-
-		.equipment_p {
-			width: 90%;
-			border-left: 8rpx solid #4BB85F;
-			font-weight: 700;
-			padding-left: 20rpx;
-		}
-		.equipment_item{
-			display: flex;
-			flex-wrap:wrap ;
-			justify-content: space-between;
-			.equipment_item_img{
-				width: 49%;
-				margin-top: 20rpx;
-				image{
-					width: 100%;
-					height: 170rpx;
-				}
-			}
-		}
-	}
-</style>
 <script>
+	import kpsImageCutter from "@/components/ksp-image-cutter/ksp-image-cutter.vue";
 	export default {
+		components: {
+			kpsImageCutter
+		},
 		data() {
 			return {
-				currentPage:'tabBar1',
+				currentPage: 'tabBar1',
 				list: [{
 					image: '../../static/image/index/11.png'
 				}, ],
@@ -113,53 +66,190 @@
 					{
 						src: "../../static/image/index/10.png"
 					}
-				]
+				],
+				url: '',
+				res:{},
+				path:'',
+				flag:1
 			}
 		},
 		onLoad() {
 
 		},
 		methods: {
-			tabfunction(index){
-				if(index==0){
+			// pest.pests.insect_discern 虫害
+			async worm(data) {
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=pest.pests.insect_discern',
+					data: {
+						img_file: data
+					}
+				})
+				this.res = res.data
+			},
+			//pest.pests.insect_discern病害识别
+			async disease(data) {
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=pest.pests.plant_discern',
+					data: {
+						img_file: data
+					}
+				})
+				this.res = res.data
+			},
+			tabfunction(index) {
+				if (index == 0) {
 					uni.navigateTo({
-						url:"../fourBase/index"
+						url: "../fourBase/index"
 					})
-				}else if(index==1){
-					console.log(1)
-				}else if(index==2){
+				} else if (index == 1) {
+					var that = this
+					uni.showModal({
+						content: '拍照识别病虫害',
+						confirmText: "拍病害",
+						cancelText: "拍虫害",
+						success: function(res) {
+							if (res.confirm) {
+								that.flag = 1
+								uni.chooseImage({
+									count: 1, //默认9
+									// sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+									sourceType: ['camera'], //从相册选择
+									success: (res) => {
+										that.url = res.tempFilePaths[0]
+									}
+								});
+							} else if (res.cancel) {
+								that.flag = 2
+								uni.chooseImage({
+									count: 1, //默认9
+									// sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+									sourceType: ['camera'], //从相册选择
+									success: (res) => {
+										console.log(1)
+										that.url = res.tempFilePaths[0]
+									}
+								});
+							}
+						}
+					});
+				} else if (index == 2) {
 					uni.navigateTo({
-						url:"../expertDiagnosis/index"
+						url: "../expertDiagnosis/index"
 					})
-				}else if(index==3){
+				} else if (index == 3) {
 					uni.navigateTo({
-						url:"../afterSale/index"
+						url: "../afterSale/index"
 					})
 				}
 			},
-			tabequipment(index){
-				if(index==0){
+			tabequipment(index) {
+				if (index == 0) {
 					uni.navigateTo({
-						url:"../cb/index/index"
+						url: "../cb/index/index"
 					})
-				}else if(index==1){
+				} else if (index == 1) {
 					uni.navigateTo({
-						url:"../prevention/index"
+						url: "../prevention/index"
 					})
-				}else if(index==2){
+				} else if (index == 2) {
 					console.log(2)
-				}else if(index==3){
+				} else if (index == 3) {
 					uni.navigateTo({
-						url:"../environment/index"
+						url: "../environment/index"
 					})
-				}else if(index==4){
+				} else if (index == 4) {
 					uni.navigateTo({
-						url:"../equipMange/index/index"
+						url: "../equipMange/index/index"
 					})
-				}else if(index==5){
+				} else if (index == 5) {
 					console.log(5)
 				}
+			},
+			onok(ev) {
+				uni.uploadFile({
+					url: 'http://182.92.193.64:8002/api/api_gateway?method=base.bases.base_photo', //仅为示例,非真实的接口地址
+					filePath: ev.path,
+					name: 'img_file',
+					formData: {
+						'user': 'test'
+					},
+					success: (uploadFileRes) => {
+						console.log(this.flag)
+						if(this.flag == 1){
+						}else if(this.flag == 2){
+							this.worm(JSON.parse(uploadFileRes.data).data.src)
+						}
+						uni.navigateTo({
+							url:"../disandpests/index?datas="+JSON.stringify(this.res)+"&path="+JSON.parse(uploadFileRes.data).data.src
+						}) 
+						
+					}
+				});
+				this.url = "";
+				
+			},
+			oncancle() {
+				// url设置为空,隐藏控件
+				this.url = ''
 			}
 		}
 	}
 </script>
+<style lang="scss">
+	.index_uswiper {
+		width: 95%;
+		margin: 0 auto;
+		border-radius: 20rpx !important;
+	}
+
+	.function {
+		width: 95%;
+		margin: 20rpx auto;
+		display: flex;
+		justify-content: space-around;
+
+		.function_item {
+			width: 18%;
+			text-align: center;
+
+			image {
+				width: 90rpx;
+				height: 90rpx;
+			}
+
+			p {
+				font-size: 24rpx;
+			}
+		}
+	}
+
+	.equipment {
+		width: 95%;
+		margin: 30rpx auto 0;
+
+		.equipment_p {
+			width: 90%;
+			border-left: 8rpx solid #4BB85F;
+			font-weight: 700;
+			padding-left: 20rpx;
+			margin-bottom: 20rpx;
+		}
+
+		.equipment_item {
+			display: flex;
+			flex-wrap: wrap;
+			justify-content: space-between;
+
+			.equipment_item_img {
+				width: 49%;
+				margin-top: 20rpx;
+
+				image {
+					width: 100%;
+					height: 170rpx;
+				}
+			}
+		}
+	}
+</style>

+ 1 - 1
pages/prevention/equipmentdetails.vue

@@ -155,7 +155,7 @@
 			},
 			charts(){//历史数据
 				uni.navigateTo({
-					url:"./ucharts?id="+this.eqinfo.item.d_id+"&device_id="+this.eqinfo.item.device_id
+					url:"./ucharts?d_id="+this.eqinfo.item.d_id+"&device_id="+this.eqinfo.item.device_id
 				})
 			}
 		},

+ 1 - 1
pages/prevention/ucharts.vue

@@ -261,7 +261,7 @@
 		},
 		// 页面加载执行的函数
 		onLoad(option) {
-			this.times.d_id = option.id
+			this.times.d_id = option.d_id
 			this.times.device_id = option.device_id
 			this.getServerData(parseInt(presenttime / 1000), parseInt((presenttime - 24 * 60 * 60 * 1000) / 1000))
 			this.historydata(parseInt(presenttime / 1000), parseInt((presenttime - 24 * 60 * 60 * 1000) / 1000))

BIN
static/image/cb/jiazai.ui.gif


BIN
static/image/cb/xy/1c24243bb184e84ffd13540367569ba.png


BIN
static/image/cb/xy/c44ae038324e1040a1eaa702e6d71a5.png


BIN
static/image/distribution/14b9bc2ef553b53872389c22a537baf.png


BIN
static/image/distribution/3a4b76ff573ebed04f29b408986cb56.png


BIN
static/image/distribution/621d60f8f64bbe1462e47b4a26635eb.png


BIN
static/image/distribution/70f9fc043155ddaca85c847df2c670c.png


BIN
static/image/distribution/b7f317cb75082eac43ee4dd84e5156e.png


BIN
static/image/distribution/c792f8b4befeaa06824f988ac8c9ddc.png


BIN
static/image/distribution/f38c3024bf12cd5777348593e7e5daf.png


BIN
static/logo.png