Browse Source

feat: 小程序新增天牛设备

yf_elsa.cui 5 months ago
parent
commit
a7588af6c1

+ 2 - 1
manifest.json

@@ -1,10 +1,11 @@
 {
     "name" : "云飞智控",
-    "appid" : "__UNI__DBA6730",
+    "appid" : "__UNI__9B16977",
     "description" : "",
     "versionName" : "1.0.4",
     "versionCode" : 104,
     "transformPx" : false,
+    "sassImplementationName" : "node-sass",
     /* 5+App特有相关 */
     "app-plus" : {
         "softinput" : {

+ 42 - 3
pages.json

@@ -207,7 +207,7 @@
 					"enablePullDownRefresh": false
 				}
 
-			}, {
+			},{
 				"path": "equip-set/bzyhistoryile",
 				"style": {
 					"navigationBarTitleText": "孢子仪历史记录",
@@ -233,10 +233,25 @@
 						"navigationStyle": "custom"
 					}
 
+				},{
+					"path": "equip-set/equip-set-new",
+					"style": {
+						"navigationBarTitleText": "设备控制",
+						"enablePullDownRefresh": false
+					}
+
 				}, {
-					"path": "equip-set/addimg",
+					"path": "equip-set/photo",
 					"style": {
-						"navigationBarTitleText": "手动添加",
+						"navigationBarTitleText": "图片列表",
+						"enablePullDownRefresh": false,
+						"navigationStyle": "custom"
+					}
+
+				}, {
+					"path": "equip-set/photoResults",
+					"style": {
+						"navigationBarTitleText": "识别结果",
 						"enablePullDownRefresh": false,
 						"navigationStyle": "custom"
 					}
@@ -250,6 +265,22 @@
 					}
 
 				}, {
+					"path": "equip-set/addimg",
+					"style": {
+						"navigationBarTitleText": "手动添加",
+						"enablePullDownRefresh": false,
+						"navigationStyle": "custom"
+					}
+
+				}, {
+					"path": "equip-set/newhistoryfile",
+					"style": {
+						"navigationBarTitleText": "历史记录",
+						"enablePullDownRefresh": true,
+						"navigationStyle": "custom"
+					}
+
+				}, {
 					"path": "equip-set/note",
 					"style": {
 						"navigationBarTitleText": "短信预警",
@@ -454,6 +485,14 @@
 					"enablePullDownRefresh": false
 				}
 
+			},{
+				"path": "equip-detail-new",
+				"style": {
+					"navigationBarTitleText": "设备详情",
+					"enablePullDownRefresh": false,
+					"navigationBarBackgroundColor": "#f7f7f7"
+				}
+
 			}]
 		},
 		{

+ 3 - 0
pages/afterSale/addafter.vue

@@ -134,6 +134,9 @@
 					{
 						text: '性诱2.0',
 						id:10
+					},{
+						text: '天牛监测设备',
+						id:32
 					},
 				],
 				show:false,//选择器的显示

+ 564 - 0
pages/cb/cbd/equip-set/equip-set-new.vue

@@ -0,0 +1,564 @@
+<template>
+	<view style="padding: 0 24rpx;">
+		<view class="" v-if="myuser_type">
+			<view class="tit adminTit">
+				联网模块
+			</view>
+			<view class="btns">
+				<button v-for="(item,index) in controlInfo.netControl" type="warn" @click="equipBtnControl(item.cmd)" size="mini">{{item.name}}</button>
+			</view>
+			<view class="tit adminTit">
+				强制操作
+			</view>
+			<view class="btns">
+				<button v-for="(item,index) in controlInfo.forceControl" type="warn" @click="equipBtnControl(item.cmd)" size="mini">{{item.name}}</button>
+		
+			</view>
+			<view class="tit adminTit">
+				设备操作
+			</view>
+			<view class="btns">
+				<button v-for="(item,index) in controlInfo.equipControl" type="warn" @click="equipBtnControl(item.cmd)" size="mini">{{item.name}}</button>
+
+			</view>
+		</view>
+		<view style="margin:40rpx 0 20rpx 0;">
+			<u-line color="#E5EBE9" />
+		</view>
+
+		<view class="uni-list-cell" @click="modeShow = true">
+			<span class="tit">定时模式</span>
+			<view class="right-data" style="float: right;">
+				<span>{{tsArrLabel}}</span>
+				<u-icon class="arrow" name="arrow-right"></u-icon>
+			</view>
+		</view>
+		<view >
+			<u-select v-model="modeShow" :list="tsArr" @confirm="tsArrConfirm"></u-select>
+			<u-select v-model="shikongshow" mode="mutil-column" :list="shikonglist" @confirm="shikongconfirm"></u-select>
+		</view>
+		<view class="uni-list-cell" @click="shikongshow = true">
+			<span class="tit">
+				开始结束时间
+			</span>
+			<view class="right-data" style="float: right;">
+				<span>{{shikongLabel}}</span>
+				<u-icon class="arrow" name="arrow-right"></u-icon>
+			</view>
+			
+		</view>
+
+		<u-select v-model="dataSelectShow"  :list="singleSelectList" @confirm="dataconfirm"></u-select>
+		<view class="uni-list-cell" @click="selectOperate('dataList','DATT')">
+			<span class="tit">
+				数据上传频率(min)
+			</span>
+			<view class="right-data" style="float: right;">
+				<span>{{equipContrlForm.DATT}}</span>
+				<u-icon class="arrow" name="arrow-right"></u-icon>
+			</view>
+			
+		</view>
+		<view class="uni-list-cell" @click="selectOperate('photoList','PHO_T')">
+			<span class="tit">
+				照片上传频率(min)
+			</span>
+			<view class="right-data" style="float: right;">
+				<span>{{equipContrlForm.PHO_T}}</span>
+				<u-icon class="arrow" name="arrow-right"></u-icon>
+			</view>
+			
+		</view>
+		<view class="submit-box">
+			<u-button :custom-style="customStyle" @click="submit" :disabled="submitBtnDisabled" >确定</u-button>
+		</view>
+		<u-toast ref="toast" />
+		<u-popup v-model="mqttShow">
+			<view class="mqtt-popup">
+				<u-field required v-model="mqttConfig.muid" label="MQTT用户名" label-width="180">
+				</u-field>
+				<u-field required v-model="mqttConfig.mpwd" label="MQTT密码" label-width="180">
+				</u-field>
+				<u-field required v-model="mqttConfig.mpi" label="MQTT地址" label-width="180">
+				</u-field>
+				<u-field required v-model="mqttConfig.mport" label="MQTT端口" label-width="180">
+				</u-field>
+				<u-field required v-model="mqttConfig.mpub" label="上传地址" label-width="180">
+				</u-field>
+				<u-field required v-model="mqttConfig.msub" label="下发地址" label-width="180">
+				</u-field>
+				<u-field v-model="mqttConfig.fuid" label="FTP用户名" label-width="180">
+				</u-field>
+				<u-field v-model="mqttConfig.fpwd" label="FTP密码" label-width="180">
+				</u-field>
+				<u-field required v-model="mqttConfig.fip" label="图片上传地址" label-width="180">
+				</u-field>
+				<u-field required v-model="mqttConfig.fport" label="图片上传接口" label-width="180">
+				</u-field>
+			</view>
+			<view class="mqtt-btn-box">
+				<u-button @click="" size="medium" type="success">确定</u-button>
+			</view>
+		</u-popup>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				d_id: '',
+				device_id:'',
+				device_type:'',
+				dsArr: ['关机', '开机'],
+				dsIndex: 0,
+				wsArr: ['待机', '工作'],
+				wsIndex: 0,
+				tsArr: [ { value: '1', label: '时控触发' },
+        { value: '0', label: '时控模式' }],
+				tsIndex: 0,
+				imgresArr: ['高', '中', '低'],
+				imgresIndex: "",
+				wsModelShow: false,
+				equipContrlForm: {
+					END_TIME: '',
+					CONTROL: '0',
+					DATT: 5,
+					START_TIME: '',
+					PHO_T: 5
+				},
+
+				shikongLabel:'00:00-00:00',
+				list: [{
+						value: '00:00',
+						label: '00:00'
+					},
+					{
+						value: '01:00',
+						label: '01:00'
+					},
+					{
+						value: '02:00',
+						label: '02:00'
+					},
+					{
+						value: '03:00',
+						label: '03:00'
+					},
+					{
+						value: '04:00',
+						label: '04:00'
+					},
+					{
+						value: '05:00',
+						label: '05:00'
+					},
+					{
+						value: '06:00',
+						label: '06:00'
+					},
+					{
+						value: '07:00',
+						label: '07:00'
+					}, {
+						value: '08:00',
+						label: '08:00'
+					},
+					{
+						value: '09:00',
+						label: '09:00'
+					},
+					{
+						value: '10:00',
+						label: '10:00'
+					},
+					{
+						value: '11:00',
+						label: '11:00'
+					},
+					{
+						value:'12:00',
+						label: '12:00'
+					},
+					{
+						value: '13:00',
+						label: '13:00'
+					},
+					{
+						value: '14:00',
+						label: '14:00'
+					}, {
+						value: '15:00',
+						label: '15:00'
+					},
+					{
+						value: '16:00',
+						label: '16:00'
+					},
+					{
+						value: '17:00',
+						label: '17:00'
+					},
+					{
+						value: '18:00',
+						label: '18:00'
+					},
+					{
+						value: '19:00',
+						label: '19:00'
+					},
+					{
+						value: '20:00',
+						label: '20:00'
+					},
+					{
+						value: '21:00',
+						label: '21:00'
+					}, {
+						value: '22:00',
+						label: '22:00'
+					},
+					{
+						value: '23:00',
+						label: '23:00'
+					},
+				],
+				mqttShow: false,
+				shikongshow:false,
+				mqttConfig: {
+					muid: '',
+					mpwd: '',
+					mip: '',
+					mport: '',
+					mpub: '',
+					msub: '',
+					fuid: '',
+					fpwd: '',
+					fip: '',
+					fport: ''
+				},
+				myuser_type: false,
+				singleSelectList:[],
+				dataSelectShow:false,
+				currentFormKey:'',
+				tsArrLabel:'时控模式',
+				modeShow:false,
+				submitBtnDisabled:false
+			}
+		},
+		
+		computed:{
+			customStyle(){
+				return {
+					background: '#14A478',
+					borderRadius:'90rpx',
+					border:'none',
+					color:'#fff'
+				}
+			},
+			shikonglist(){
+				return[
+					[...this.list],
+					[...this.list]
+				] 
+			},
+
+			controlInfo(){
+				const netControl = [{
+					name: '数据单元重启',
+					cmd: 'dtu_reboot'
+				  },
+				  {
+					name: '数据单元升级',
+					cmd: 'dtu_update'
+				  }]
+				const forceControl = [
+				  {
+					name: '控制单元重启',
+					cmd: 'reboot'
+				  },
+				  {
+					name: '控制单元升级',
+					cmd: 'update'
+				  }
+				]
+				const equipControl = [
+				  {
+					name: '开启补光灯',
+					cmd: 'led_on'
+				  },
+				  {
+					name: '关闭补光灯',
+					cmd: 'led_off'
+				  },
+				  {
+					name: '测试拍照',
+					cmd: 'takephoto'
+				  },
+				  {
+					name: '翻版测试',
+					cmd: 'FB_Test'
+				  }
+				]
+			
+				switch (this.device_type){
+					case 32://天牛
+						break;
+					case 33:
+						break;
+					case 34:
+						break;
+					case 35:
+					break;
+					default:
+						break;
+				}
+				return {
+					netControl,forceControl,equipControl
+					
+				}
+			}
+		},
+		onLoad(option) {
+			this.d_id = option.d_id
+			this.device_id = option.device_id
+			this.device_type = option.device_type
+			this.getInfo()
+			uni.getStorage({
+				key: "myuser_type",
+				success: (res) => {
+					if (Number(res.data) == 1) {
+						this.myuser_type = true
+					}
+				}
+			})
+		},
+		methods: {
+			selectOperate(selectList,formKey){
+				this.dataSelectShow = true
+				let length = 0
+				if(selectList=='photoList'){
+					length = 60
+				}
+				if(selectList=='dataList'){
+					length = 180
+				}
+				this.singleSelectList = []
+				for (let i = 5; i < length; i++) {
+					this.singleSelectList.push({
+						value:i,
+						label:i.toString()
+					})
+				}
+				console.log(this.singleSelectList,'--')
+				this.currentFormKey = formKey
+			},
+			tsArrConfirm(e){
+				this.tsArrLabel = e[0].label
+				this.equipContrlForm.CONTROL = e[0].value
+			},
+			dataconfirm(e){
+				this.equipContrlForm[this.currentFormKey] = e[0].value
+			},
+			shikongconfirm(e){
+				console.log(e)
+				this.shikongLabel = e[0].label+'-'+e[1].label
+				this.equipContrlForm.START_TIME = e[0].value
+				this.equipContrlForm.END_TIME = e[1].value
+			},
+			
+			turnChange(e, a) {
+				this.equipContrlForm.ts = e.target.value
+
+			},	
+			async getInfo() {
+				let res = await this.$myRequest({
+					url: '/api/api_gateway?method=new_gateway.device_info.get_device_config',
+					data: {
+						device_type_id:this.device_type,
+						d_id: this.d_id
+					}
+				})
+				if(res.code==4000){
+					this.submitBtnDisabled = true
+					this.$refs.toast.show({
+						title: res.msg,
+						type: 'warning'
+					})
+					return 
+				}
+	
+				console.log(this.equipContrlForm)
+			},
+			async submit() {
+				console.log(this.equipContrlForm)
+				let res = await this.$myRequest({
+					url: '/api/api_gateway?method=new_gateway.device_info.update_device_config',
+					data: {
+						device_type_id: this.device_type,
+						id: this.d_id,
+						...this.equipContrlForm
+						
+					}
+				})
+				if(res.code==4000){
+					this.$refs.toast.show({
+						title: res.msg+'无法修改',
+						type: 'warning'
+					})
+					
+				}
+			},
+			async equipBtnControl(cmd) {
+				let res = await this.$myRequest({
+					url: '/api/api_gateway?method=forecast.send_control.admin_device_control',
+					data: {
+						cmd,
+						device_type_id: this.device_type,
+						d_id: this.d_id
+					}
+				})
+				if (res) {
+					this.$refs.toast.show({
+						title: '指令下发成功!',
+						type: 'success',
+					})
+				}
+			},
+			async mqttInfo() {
+				let res = await this.$myRequest({
+					url: '/api/api_gateway?method=forecast.send_control.device_control_info',
+					data: {
+						cmd: 'netconf',
+						d_id: this.d_id
+					}
+				})
+				if (res) {
+					let {
+						ftp,
+						mqtt
+					} = res
+					this.mqttConfig = {
+						muid: mqtt.uid,
+						mpwd: mqtt.pwd,
+						mip: mqtt.ip,
+						mport: mqtt.port,
+						mpub: mqtt.pub,
+						msub: mqtt.sub,
+						fuid: ftp.uid,
+						fpwd: ftp.pwd,
+						fip: ftp.ip,
+						fport: ftp.port
+					}
+				}
+				this.mqttShow = true
+			},
+			async mqttSubm() {
+				let obj = {
+					mqtt: {
+						uid: this.mqttConfig.muid,
+						pwd: this.mqttConfig.mpwd,
+						ip: this.mqttConfig.mip,
+						port: this.mqttConfig.mport,
+						pub: this.mqttConfig.mpub,
+						sub: this.mqttConfig.msub,
+						keepalive: 60,
+						lastwill: '/yfkj/cbd/offline/'
+					},
+					ftp: {
+						uid: this.mqttConfig.fuid,
+						pwd: this.mqttConfig.fpwd,
+						ip: this.mqttConfig.fip,
+						port: this.mqttConfig.fport
+					}
+				}
+				let res = await this.$myRequest({
+					url: '/api/api_gateway?method=forecast.send_control.device_control',
+					data: {
+						device_type_id: 3,
+						d_id: this.d_id,
+						cmd: 'setnet',
+						config: JSON.stringify(obj)
+					}
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	page {
+		padding: 20rpx;
+		box-sizing: border-box;
+
+		.tit {
+			line-height: 30rpx;
+			font-size: 28rpx;
+			margin: 30rpx 0;
+			color: #666666;
+		}
+
+		.adminTit {
+			border-left-color: #e64340;
+		}
+
+		.btns {
+			display: flex;
+			justify-content: flex-start;
+			flex-wrap: wrap;
+			gap: 16rpx;
+			button {
+				margin: 0;
+				margin-right: 10rpx;
+				padding: 0 25rpx;
+			}
+		}
+
+		.uni-list-cell {
+			// background: #F7F8FA;
+			// padding: 10rpx 40rpx;
+			height: 80rpx;
+			line-height: 80rpx;
+			font-size: 28rpx;
+			box-sizing: border-box;
+			.arrow{
+				margin-left: 30rpx;
+			}
+			.right-data{
+				color: #CCCCCC;
+			}
+		}
+
+		.selectTime {
+			display: flex;
+			float: right;
+			width: 30%;
+			color: #CCCCCC;
+			justify-content: space-between;
+			.time {
+				// width: 350rpx;
+				// display: flex;
+				// justify-content: space-between;
+			}
+
+			.line {
+				width: 50rpx;
+				text-align: center;
+			}
+		}
+
+		.submit-box {
+			margin-top: 60rpx
+		}
+
+		.mqtt-popup {
+			width: 580rpx;
+
+		}
+
+		.mqtt-btn-box {
+			margin-top: 50rpx;
+			text-align: center;
+		}
+	}
+</style>

+ 486 - 0
pages/cb/cbd/equip-set/newhistoryfile.vue

@@ -0,0 +1,486 @@
+<template>
+	<view style="background-color: #f7f7f7; height: 100vh;padding-top: 88rpx;">
+			<!-- <view class="status_bar"></view> -->
+			<view>
+				<uni-nav-bar @clickLeft="clickLeft" left-icon="back" title="历史数据" backgroundColor="#f7f7f7"></uni-nav-bar>
+			</view>
+			<view style="padding: 0 48rpx; background-color: #f7f7f7;">
+			<view class="date" @click="dataShow = true">
+				<u-calendar v-model="dataShow" :mode="mode" @change="tiemchange" :maxDate="maxDate"></u-calendar>
+				<span>选择日期 </span>
+				<span style="color: #cccccc;">
+					{{start_time}} <span style="margin: 0 10rpx;"> /</span> {{end_time}} 
+					<u-icon style="margin-left: 20rpx;" name="arrow-right" size="28"></u-icon>
+				</span>
+			</view>
+			<view class="title">温湿度数据</view>
+			<view class="shuju_one">
+				
+				<view class="canvastishi" v-if="!canvastishiTF && !dataloadingtf">
+					暂无数据
+				</view>
+				<view class="canvastishi" v-if="dataloadingtf">
+					<p class="dataloading">加载中</p>
+				</view>
+				<canvas v-if="canvastishiTF" 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="title">监测数据 
+			
+				<u-button size="mini" :loading='refreshLoading' class="refresh" throttle-time="500" @click="refresh" :customStyle="customStyle">刷 新</u-button>
+			</view>
+			
+			<view class="condition">
+				<scroll-view scroll-top="0" scroll-x="true" class="scroll-X">					
+					<table class="table" :style="tableStyle">
+						<tr class="tr">
+							<th style="background-color: #E6E8EB;" class="th" v-for="(value,key) in thdata" :key="key">{{value}}</th>
+						</tr>
+						<tr class="tr" v-for="(items,indexs) in historylistdata" :key="'b'+indexs" v-if="!forbidden">
+							<td class="td" v-for="(value,key) in thdata">{{items[key]}}</td>
+						</tr>
+						<tr class="tr" v-if="forbidden">
+							<td class="td" v-for="item in Object.keys(thdata)">暂无数据</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="forbidden">下一页</button>
+				</view>
+			</view>
+		</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import uCharts from '../../../../components/js_sdk/u-charts/u-charts/u-charts.js';
+	var canvaColumnA = null;
+	export default {
+		data() {
+			return {
+				maxDate:'2050-12-31',
+				styles: {
+					// width: "650rpx",
+					height: "400rpx"
+				},
+				d_id: '',
+				start_time: "",
+				end_time: "",
+				historydatas: [],
+				titletext: ["24小时", "近一个月", "近半年", "近一年"],
+				titleidnex: 0,
+				device_id: '',
+				page: 1,
+				historylistdata: [],
+				thdata: {},
+				
+				forbidden: false,
+				cWidth: '400',
+				cHeight: '400',
+				pixelRatio: 1,
+				canvastishiTF: false,//暂无数据提示
+				dataloadingtf:true,//加载中提示
+				pagesum: 1,
+				device_type:"",
+				dataShow: false,
+				mode: 'range',
+				refreshLoading:false
+			}
+		},
+		computed:{
+			customStyle(){
+				return {
+					background: '#018B3F',
+					fontSize:'12px',
+					border:'none',
+					color:'#fff'
+				}
+			},
+			tableStyle(){
+				return{
+					width: Object.keys(this.thdata).length*150 + 'px'
+				}
+			}
+		},
+		methods: {
+			tiemchange(e) {
+				console.log(e)
+
+				this.start_time = e.startDate
+				this.end_time = e.endDate 
+
+				this.history()
+				this.historylist() 
+		
+			},
+			async history() { //历史数据列表折线图
+				this.dataloadingtf = true
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=new_gateway.data_info.temp_hum',
+					data: {
+						device_type_id: this.device_type,
+						id: this.d_id,
+						start: +new Date(this.start_time+' 00:00:00') / 1000,
+						end: +new Date(this.end_time+' 23:59:59') / 1000  
+					}
+				})
+				this.dataloadingtf = false
+				this.historydatas = res || []
+				if (this.historydatas.length == 0) {
+					this.canvastishiTF = false
+				} else {
+					this.canvastishiTF = true
+
+					var arr1 = []
+					var arr2 = []
+				
+					var xtitle = []
+					for (var i = 0; i < res.length; i++) {
+						// var times = new Date(res[i].addtime * 1000)
+						xtitle.push(res[i].addtime.split(' ')[0])
+						arr1.push(res[i].tem)
+						arr2.push(res[i].hum)
+					
+					}
+					// console.log(arr1)
+					var obj = [{
+						name: '温度',
+						data: arr1,
+						color: '#00E29D'
+					}, {
+						name: '湿度',
+						data: arr2,
+						color: '#6CBBFF'
+					}]
+					this.showColumn("canvasColumnA", xtitle, obj)
+				}
+			},
+			//历史数据列表
+			async historylist() { 
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=new_gateway.data_info.history_data',
+					data: {
+						device_type_id: this.device_type,
+						id: this.d_id,
+						start: +new Date(this.start_time +' 00:00:00') / 1000,
+						end: +new Date(this.end_time +' 23:59:59') / 1000,
+						page: this.page
+					}
+				})
+				this.refreshLoading = false
+				// this.thdata = Object.values(res.title) 
+				Object.keys(res.title).forEach(item=>{
+					this.$set(this.thdata,item,res.title[item])
+				})
+			
+				this.historylistdata = res.data
+				
+				this.pagesum = Math.ceil(res.total / 10) || 1
+				if (res.data.length == 0) {
+					this.forbidden = true
+					
+				} else {
+					this.forbidden = false
+					
+				}
+
+				console.log(this.historylistdata,'historylistdata')
+			},
+			// forecast.send_control.get_device_config 获取当前时间的数据
+			async newdata() {
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=forecast.send_control.get_device_config',
+					data: {
+						device_type_id: 3,
+						d_id: this.d_id,
+						control_type: "data"
+					}
+				})
+				if(res){
+					uni.showToast({
+						title: '刷新成功',
+						duration: 2000,
+						icon: "none"
+					});
+					
+					this.historylist()
+				}else{
+					uni.showToast({
+						title: '刷新失败',
+						duration: 2000,
+						icon: "none"
+					});
+				}
+			},
+			refresh() { //获取当前时间的数据
+				this.refreshLoading = true
+				this.historylist()
+			},
+	
+			prev() { //上一页
+				if (this.page > 1) {
+					this.page--
+					this.historylist()
+				}
+			},
+			next() { //下一页
+				if(this.page<this.pagesum){
+					this.page++
+					this.historylist()
+				}
+			},
+			clickLeft() {
+				uni.navigateBack({
+					delta: 1
+				})
+			},
+			showColumn(id, xtitle, xinfo) {
+				var _self = this
+				canvaColumnA = new uCharts({
+					canvasId: id,
+					type: 'line',
+					legend: {
+						position: "top"
+					},
+					fontSize: 11,
+					background: '#FFFFFF',
+					pixelRatio: 1,
+					animation: true,
+					dataLabel: false,
+					categories: xtitle,
+					series: xinfo,
+					enableScroll: true, //开启图表拖拽功能
+					xAxis: {
+						disableGrid: true,
+						type: 'grid',
+						gridType: 'dash',
+						itemCount: 4, //x轴单屏显示数据的数量,默认为5个
+						scrollShow: true, //新增是否显示滚动条,默认false
+						// scrollAlign: 'left', //滚动条初始位置
+						scrollBackgroundColor: '#F7F7FF', //默认为 #EFEBEF
+						scrollColor: '#DEE7F7', //默认为 #A6A6A6
+					},
+					yAxis: {},
+					width: _self.cWidth * 1,
+					height: _self.cHeight * 1,
+					extra: {
+						line: {
+							type: 'curve'
+						}
+					}
+				});
+			},
+			touchLineA(e) {
+				console.log(e)
+				canvaColumnA.scrollStart(e);
+			},
+			moveLineA(e) {
+				canvaColumnA.scroll(e);
+			},
+			touchEndLineA(e) {
+				canvaColumnA.scrollEnd(e);
+				//下面是toolTip事件,如果滚动后不需要显示,可不填写
+				canvaColumnA.showToolTip(e, {
+					format: function(item, category) {
+						return category + ' ' + item.name + ':' + item.data
+					}
+				});
+			},
+		},
+		onLoad(option) {
+			this.d_id = option.d_id
+			this.device_id = option.device_id
+			this.device_type = option.device_type
+			this.cWidth = uni.upx2px(650);
+			this.cHeight = uni.upx2px(500);
+			let endTime = +new Date()/1000
+			let startTime = endTime - 60 * 60 * 24
+			
+			this.end_time = this.formatTime(endTime*1000,'yyyy-MM-dd')
+			console.log(this.end_time)
+			this.start_time = this.formatTime(startTime*1000,'yyyy-MM-dd')
+			setTimeout(()=>{
+				this.history()
+				this.historylist()
+			},1000)
+		},
+		onShow(){
+			// this.end_time = +new  Date()/1000
+			// this.start_time = this.end_time - 24 * 60 * 60
+			// // this.formatTime(date, 'yyyy-MM-dd')
+			// setTimeout(()=>{
+			// 	this.history()
+			// 	this.historylist()
+			// },1000)
+		},
+		onPullDownRefresh() {
+			this.history()
+			this.historylist()
+			setTimeout(() => {
+				uni.stopPullDownRefresh()
+			}, 1000)
+		},
+	}
+</script>
+
+<style lang="scss" scoped>
+	page{
+		background: #f7f7f7;
+	}
+	.title{
+		color: #999999;
+		margin: 32rpx 0;
+	}
+	.date{
+		height: 92rpx;
+		line-height: 92rpx;
+		border-radius: 92rpx;
+		background: #fff;
+		display: flex;
+		justify-content: space-between;
+		margin-top: 16rpx;
+		padding: 0 48rpx;
+		position: relative;
+		/deep/.u-calendar__action {
+			display: flex;
+			justify-content: space-around;
+		
+			.u-calendar__action__text {
+				line-height: 25px;
+			}
+		}
+	}
+	
+	.shuju_one,
+	.shuju_two {
+		// position: absolute;
+		// top: 54px;
+		width: 100%;
+		// left: 5%;
+		// box-shadow: 0 0 10rpx #bcb9ca;
+		padding-top: 20rpx;
+		height: 550rpx;
+		background-color: #fff;
+		border-radius: 24rpx;
+		.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;
+				}
+			}
+		}
+
+		
+	}
+
+	.refresh {
+		// position: absolute;
+		// top: 700rpx;
+		// left: 5%;
+		font-size: 12px;
+		float: right;
+		// padding: 0 10rpx;
+		// height: 40rpx;
+		// border-radius: 8rpx;
+		// background-color: #018B3F;
+		// color: #FFFFFF;
+		// line-height: 40rpx;
+		// text-align: center;
+	}
+
+	.condition {
+		// position: absolute;
+		// top: 770rpx;
+		display: flex;
+		flex-wrap: wrap;
+		width: 100%;
+		// left: 5%;
+		// box-shadow: 0 0 10rpx #bcb9ca;
+		margin-bottom: 30rpx;
+
+		.scroll-X {
+			width: 100%;
+			margin: 20rpx auto;
+			.table{
+				width: 1620px;
+			}
+			.tr {
+				display: flex;
+				overflow: hidden;
+
+				.th,
+				.td {
+					display: inline-block;
+					padding: 4rpx;
+					width: 286rpx;
+					text-align: center;
+					height: 52rpx;
+					line-height: 52rpx;
+					border: 2rpx solid #F1F1F1;
+				}
+
+				.th:first-child,
+				.td:first-child {
+					width: 300rpx;
+				}
+			}
+			.tr:nth-child(2n-1){
+				// background-color: #f5fff8;
+			}
+			.tr:first-child{
+				// background-color: #E6E8EB;
+				color: #31373D;
+			}
+		}
+
+		.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: 100rpx;
+				height: 50rpx;
+				line-height: 50rpx;
+				font-size: 26rpx;
+				text-align: center;
+			}
+		}
+	}
+</style>

+ 338 - 0
pages/cb/cbd/equip-set/photo.vue

@@ -0,0 +1,338 @@
+<template>
+	<view style="background-color: #f7f7f7;padding-top: 88rpx;height: calc(100vh - 88rpx);">
+		<uni-nav-bar @clickLeft="clickLeft" left-icon="back" title="查看图片" backgroundColor="#F7F7F7"></uni-nav-bar>
+		<view class="search-item">
+			<u-dropdown >
+				<u-dropdown-item @change="dropDownChange" v-model="searchObj.is_pest" title="害虫筛选" :options="pestOptions"></u-dropdown-item>
+			</u-dropdown>
+			<span v-if="!delShow" class="right" @click="imgOperate">
+				管理
+			</span>
+			<span v-else class="right"  @click="delShow = false">
+				完成
+			</span>
+			
+		</view>
+		<view style="padding: 0 48rpx;" v-if="searchObj.is_pest!='2'">
+			<u-search bg-color="#fff" height="92" shape="square"  placeholder="请输入害虫名称" v-model="searchObj.pest_name" @search="dropDownChange" :show-action='false'></u-search>
+		</view>
+		<u-calendar v-model="calendarShow" mode="range" @maxDate="maxDate" @change="change"></u-calendar>
+		<view class="tile-item">
+			
+			<view @click="calendarShow = true" class="calendar">{{start_time}} <span style="margin: 0 40rpx;"> -</span> {{end_time}}</view>
+			
+			<u-icon name="camera" color="#018B3F" size="52" @click="takephoto"></u-icon>
+		</view>
+		<view class="imglist" v-if="imglists.length>0">
+			<view class="imglist_box" v-for="(item,index) in imglists" :key="index" >
+				<view class="top">识别:{{item.indentify_count}} 
+					<span class="yficonfont icon-shanchu float-right" v-if="delShow" @click="delImage(item)"></span>
+					<!-- <u-icon v-if="delShow" @click="delImage(item)" class="float-right" name="trash-fill" color="#FF5951" size="28"></u-icon> -->
+				</view>
+				<image class="img-flex" :src="item.addr+'?x-oss-process=image/resize,w_130/quality,q_50'" mode="" @click="imageDetail(item)"></image>
+				<view class="bottom">{{item.addtime}}</view>
+			</view>
+		</view>
+		<view v-else class="notip">
+			暂无数据
+		</view>
+	
+	</view>
+</template>
+
+<script>
+	import jsencrypt from '@/components/jsencrypt/jsencrypt.vue';
+	export default {
+		data() {
+			return {
+				maxDate:'2050-12-31',
+				value1:'',
+				value2:'',
+				searchObj:{
+					is_pest:'',
+					pest_name:''
+				},
+				pestOptions:[
+					{label: '全部',value: ''},
+					{label: '有虫',value: '1'},
+					{label: '无虫',value: '2'},
+				],
+				timeend:'',
+				timestart:'',
+				imglists:[],
+				page:1,
+				device_type:'',
+				device_id:'',
+				d_id:'',
+				calendarShow:false,
+				start_time:'',
+				end_time:'',
+				delShow:false,
+				loadMore:true
+			}
+		},
+		methods: {
+			imageDetail(item){
+				console.log(item)
+				if(this.delShow){
+					return
+				}
+				uni.navigateTo({
+					url: '/pages/cb/cbd/equip-set/photoResults'  + '?d_id=' + this.d_id + "&device_id=" + this.device_id + "&device_type=" + this.device_type + "&time=" + item.addtime
+				});
+			},
+			imgOperate(){
+				this.delShow = true
+			},
+			clickLeft() {
+				uni.navigateBack()
+			},
+			dropDownChange(){
+				this.loadMore = true
+				this.page = 1
+				this.imglists = []
+				this.getImgData()
+			},
+			change(e){
+				this.loadMore = true
+				console.log(e)
+				this.start_time = e.startDate 
+				this.end_time = e.endDate 
+				this.page = 1
+				this.imglists = []
+				this.getImgData()
+			},
+			async getImgData(){
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=new_gateway.photo_info.photo_list',
+					data: {
+						id: this.d_id,
+						device_type_id:this.device_type,
+						page: this.page,
+						page_number: 12,
+						start: +new Date(this.start_time+' 00:00:00') / 1000,
+						end: +new Date(this.end_time+' 23:59:59') / 1000, 
+						...this.searchObj
+					}
+				})
+				if(res.data.length==0){
+					// 加载完了
+					this.loadMore = false
+					return
+				}
+			
+				this.imglists = this.imglists.concat(res.data)
+				
+		
+			},
+			// 删除
+			delImage(item){
+				uni.showModal({
+				    title: '提示',
+				    content: '确认删除?',
+				    success:  async (res)=> {
+				        if (res.confirm) {
+				            const res = await this.$myRequest({
+				            	url: '/api/api_gateway?method=new_gateway.photo_info.delete_photo',
+				            	data: {
+				            		device_type_id: this.device_type,
+				            		ids: item.id
+				            	}
+				            })
+				            this.delShow = false
+				            
+				            uni.showToast({
+				            	title: res.msg,
+				            	duration: 2000
+				            });
+				            this.imglists = []
+				            this.getImgData()
+				        } else if (res.cancel) {
+				            
+				        }
+				    }
+				});
+				
+			},
+	
+			onReachBottom() {
+				if(this.loadMore){
+					this.page++
+					this.getImgData()
+				}
+				
+			},
+			anew() {
+				this.discern("again")
+				this.imgbg = true
+			},
+			examine(url) {
+				console.log(url)
+				var imgarr = []
+				imgarr.push(url.image)
+				console.log(imgarr)
+				uni.previewImage({
+					urls: imgarr
+				});
+			},
+			async takephoto() { //拍照
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=new_gateway.device_info.send_control',
+					data: {
+						device_type_id: this.device_type,
+						id: this.device_id,
+						cmd: "0004"
+					}
+				})
+				console.log(res)
+	
+				if (res == true) {
+					uni.showToast({
+						title: '指令下发成功!',
+						duration: 2000
+					});
+		
+				} else {
+					uni.showToast({
+						title: '指令下发失败!',
+						duration: 2000,
+						icon: "none"
+					});
+				}
+			
+			},
+		},
+		onLoad(option) {
+
+			console.log('图片详情',option)
+			this.device_id = option.device_id
+			this.d_id = option.d_id
+			this.device_type = option.device_type
+			let endTime = +new Date()/1000
+			let startTime = endTime - 60 * 60 * 24
+			
+			this.end_time = this.formatTime(endTime*1000,'yyyy-MM-dd')
+			this.start_time = this.formatTime(startTime*1000,'yyyy-MM-dd')
+			// this.imglists = []
+			
+			this.getImgData()
+		
+		},
+	}
+</script>
+
+<style lang="scss" scoped>
+	/deep/.u-calendar__action {
+		display: flex;
+		justify-content: space-around;
+	
+		.u-calendar__action__text {
+			line-height: 25px;
+		}
+	}
+	/deep/.u-flex{
+		display: flex;
+	}
+	page {
+		background: #F7F7F7;
+		.notip{
+			text-align: center;
+			color: #666666;
+			margin-top: 100rpx;
+		}
+	.search-item{
+		// padding: 0rpx 48rpx;
+		box-sizing: border-box;
+		background: #F7F7F7;
+		line-height: 80rpx;
+		color: #656C74;
+		position: relative;
+		.right{
+			position: absolute;
+			z-index: 11;
+			right: 48rpx;
+			top: 0;
+		}
+		.right::before{
+			content: '|';
+			color: #C3CBCF;
+			padding-right: 10rpx;
+		}
+	}
+	.tile-item{
+		margin-top: 16rpx;
+		padding: 0rpx 48rpx;
+		box-sizing: border-box;
+		height: 92rpx;
+		line-height: 92rpx;
+		display: flex;
+		justify-content: space-between;
+		background: #F7F7F7;
+		.calendar{
+			width: 83%;
+			background-color: #fff;
+			border-radius: 10rpx;
+			padding: 0 18rpx;
+			color: #5C5C5C;
+			text-align: center;
+		}
+		.camera{
+			
+		}
+	}	
+		.imglist{
+				display: flex;
+				flex-flow: row wrap;
+				padding: 0rpx 48rpx;
+				box-sizing: border-box;
+				background: #F7F7F7;
+				margin-top: 6rpx;
+				// justify-content: space-around;
+				// gap: 16rpx;
+			.imglist_box{
+				box-sizing: border-box;
+				flex: 0 0 33.3333%;
+				height: 224rpx;
+				padding: 6rpx;
+				border-radius: 4rpx;
+				position: relative;
+				.top{
+					position: absolute;
+					top: 6rpx;
+					left: 6rpx;
+					background: rgba(0, 0, 0, 0.6);
+					color: #fff;
+					border-top-left-radius: 4rpx;
+					border-top-right-radius: 4rpx;
+					padding: 0 20rpx;
+					font-size: 10px;
+					z-index: 1;
+					width: 75.5%;
+					.float-right{
+						float: right;
+						color: #FF5951;
+						font-size: 36rpx;
+					}
+				}
+				.bottom{
+					position: absolute;
+					bottom: 6rpx;
+					left: 6rpx;
+					background: rgba(0, 0, 0, 0.6);
+					color: #fff;
+					border-bottom-left-radius: 4rpx;
+					border-bottom-right-radius: 4rpx;
+					text-align: center;
+					font-size: 10px;
+					width: 94.5%;
+					padding: 4rpx 0;
+				}
+				.img-flex{
+					border-radius: 4rpx;
+					width: 100%;
+					height: 100%;
+				}
+			}
+		}
+}
+</style>

+ 318 - 0
pages/cb/cbd/equip-set/photoResults.vue

@@ -0,0 +1,318 @@
+<template>
+	<view style="background-color: #f7f7f7;padding-top: 88rpx;height: calc(100vh - 88rpx);">
+		
+		<uni-nav-bar @clickLeft="clickLeft" left-icon="back" title="识别结果" backgroundColor="#F7F7F7"></uni-nav-bar>
+		<u-calendar v-model="calendarShow" mode="range" @change="change" @maxDate="maxDate"></u-calendar>
+		<view class="img-result">
+			<view class="tile-item">
+				
+				<view @click="calendarShow = true" class="calendar">{{start_time}} <span style="margin: 0 40rpx;"> -</span> {{end_time}}</view>
+				
+			</view>
+
+		<view class="images_box">
+
+			<view class="canvas-bg">
+				<img v-if="photos.length>0" :src="photos[active].addr+'?x-oss-process=image/resize,w_130/quality,q_90'" alt=""  @click="examine()"/>
+			</view>
+			<view class="image-flex" >
+				<view v-for="(item,index) in photos" :key="index">
+					<image class="my-img" :class="active==index?'active':''" :src="item.addr" @click="imgClick(item,index)" mode=""></image>
+				</view>
+			</view>
+		</view>
+		<view class="information">
+			<view class="btn">
+				<p class="title">当前图片识别结果</p>
+				<u-button size="mini" :loading='respetLoading' class="btn_box" throttle-time="500" @click="resetPest" :customStyle="customStyle">重新识别</u-button>
+			</view>
+			<view class="notip" v-if="isObject(pestResult)">
+				暂无识别结果
+			</view>
+			<view v-else class="information_data" v-for="(value,key) in pestResult">
+				<p> <span>{{key}}</span> <span>{{value}}头</span> </p>
+			</view>
+		</view>
+		
+			
+		</view>
+	</view>
+</template>
+
+<script>
+	import jsencrypt from '@/components/jsencrypt/jsencrypt.vue';
+	import insect_dict from "../../../../static/data/cbd_pest_library.js"
+	export default {
+		data() {
+			return {
+				maxDate:'2050-12-31',
+				device_type:'',
+				device_id:'',
+				d_id:'',
+				calendarShow:false,
+				start_time:'',
+				end_time:'',
+				photos:[],
+				
+				active:0,
+				respetLoading:false
+			}
+		},
+		computed:{
+			customStyle(){
+				return {
+					background: '#018B3F',
+					fontSize:'12px',
+					border:'none',
+					color:'#fff'
+				}
+			},
+			pestResult(){
+				if(this.photos==0){
+					return {}
+				}
+				let obj = {}
+				let item = this.photos[this.active]
+				console.log('选中',item)
+				if(item.is_mark==0){
+					// 机器识别
+					let aiLabel = []
+					if (item.label) {
+					    aiLabel = JSON.parse(item.label.replace(/'/g, '"'))
+						aiLabel.forEach(label => {
+							const text = Object.keys(label)[0]
+							if (obj[insect_dict[text]]) {
+								obj[insect_dict[text]]++
+							} else {
+								obj[insect_dict[text]] = 1
+							} 
+						})
+					}
+				}else{
+					item.mark.forEach(item => {
+					  if (obj[item.text]) {
+						obj[item.text]++
+					  } else {
+						obj[item.text] = 1
+					  }
+					})
+				}
+				return obj
+			},
+			previewImages(){
+				let list = []
+				if(this.photos.length>0){
+					this.photos.forEach(photo=>{
+						list.push(photo.addr)
+					})
+					return list
+				}else{
+					return []
+				}
+				
+			}
+		},
+		methods: {
+			clickLeft() {
+				uni.navigateBack()
+			},
+			isObject(obj){
+				return Object.keys(obj).length==0
+			},
+			change(e){
+				this.start_time = e.startDate 
+				this.end_time = e.endDate 
+				this.page = 1
+				this.photos = []
+				this.getImgData()
+			},
+			async getImgData(){
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=new_gateway.photo_info.photo_list',
+					data: {
+						id: this.d_id,
+						device_type_id:this.device_type,
+						page: 1,
+						page_number: 99999,
+						start: +new Date(this.start_time+' 00:00:00') / 1000,
+						end: +new Date(this.end_time+' 23:59:59') / 1000
+					}
+				})
+				this.photos = this.photos.concat(res.data)
+				console.log(this.photos,'---')
+				// this.photos = res.data
+			},
+			async resetPest(){
+				this.respetLoading = true
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=new_gateway.photo_info.identify_again',
+					data: {
+						id: this.photos[this.active].id,
+						device_type_id:this.device_type
+					}
+				})
+				this.respetLoading = false
+				if(res.code==2000){
+					uni.showToast({
+						title: '操作成功',
+						duration: 2000
+					})
+				}else{
+					uni.showToast({
+						title: res.msg,
+						duration: 2000
+					})
+				}
+			},
+			examine() {
+				uni.previewImage({
+					urls: this.previewImages
+				});
+			},
+			imgClick(item,index){
+				this.active = index	
+			}
+		},
+		onLoad(option) {
+			console.log('结果页面:',option)
+			this.device_id = option.device_id
+			this.d_id = option.d_id
+			this.device_type = option.device_type
+			let endTime = +new Date(option.time)/1000 + 60 * 60 * 24
+			let startTime = +new Date(option.time)/1000
+			
+			this.end_time = this.formatTime(endTime*1000,'yyyy-MM-dd')
+			this.start_time = this.formatTime(startTime*1000,'yyyy-MM-dd')
+			this.getImgData()
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	/deep/.u-calendar__action {
+		display: flex;
+		justify-content: space-around;
+	
+		.u-calendar__action__text {
+			line-height: 25px;
+		}
+	}
+	page{
+		background: #F7F7F7;
+	}
+	.img-result{
+		padding: 0rpx 48rpx;
+		background-color: #F7F7F7;
+		// height: calc(100vh - 120rpx);
+	}
+	.tile-item{
+		margin-top: 32rpx;
+		// padding: 0rpx 32rpx;
+		box-sizing: border-box;
+		height: 92rpx;
+		line-height: 92rpx;
+		display: flex;
+		justify-content: space-between;
+		background: #F7F7F7;
+		.calendar{
+			width: 100%;
+			background-color: #fff;
+			border-radius: 24rpx;
+			padding: 0 18rpx;
+			color: #5C5C5C;
+			text-align: center;
+		}
+		.camera{
+			
+		}
+	}
+	.images_box {
+		width: 100%;
+		height: 742rpx;
+		padding: 32rpx;
+		margin: 32rpx 0;
+		box-sizing: border-box;
+		background: #fff;
+		border-radius: 24rpx;
+		.canvas-bg{
+			height: 558rpx;
+			position: relative;
+			margin-bottom: 16rpx;
+			img{
+				width: 100%;
+				height: 100%;
+			}
+		}
+		.image-flex {
+			width: 100%;
+			overflow-x: scroll;
+			display: flex;
+			flex-wrap: nowrap;
+			gap: 20rpx;
+			padding: 10rpx 0;
+			box-sizing: border-box;
+			.my-img {
+				width: 96rpx;
+				height: 96rpx;
+				border-radius: 4rpx;
+				opacity: 0.5;
+			}
+			.active{
+				border: 4px solid #ccc;
+				animation: borderAnimation 1s;
+				position: relative;
+				top: -4px;
+				opacity: 1;
+			}
+		}
+	}
+
+	.information {
+		padding-bottom: 2rpx;
+		.btn{
+			overflow: hidden;
+		}
+		.title {
+			float: left;
+			color: #999999;
+		}
+		.notip{
+			text-align: center;
+			color: #999999;
+			margin-top: 100rpx;
+		}
+		.btn_box{
+			float: right;
+			// border-radius: 8rpx;
+			// background: #018B3F;
+			// padding: 2rpx 10rpx;
+			// color: #fff;
+			// font-size: 24rpx;
+		}
+		.information_data {
+			margin: 32rpx 0;
+			display: flex;
+			background-color: #fff;
+			// padding: 20rpx 10rpx;
+			height: 104rpx;
+			line-height: 104rpx;
+			border-radius: 24rpx;
+			padding: 0 32rpx;
+			p {
+				// margin-right: 20rpx;
+				font-size: 24rpx;
+				color: #666666;
+				
+			}
+		}
+	}
+	
+	@keyframes borderAnimation {
+	  0% { 
+		opacity: 0.5;
+	  }
+	  100% { 
+		opacity: 1;
+	  }
+	}
+</style>

+ 556 - 0
pages/cb/equip-detail/equip-detail-new.vue

@@ -0,0 +1,556 @@
+<template>
+	<view>
+		<view class="title">基本信息</view>
+		<view class="info">
+			<view class="device-id" @click="copy(equipInfo)">
+				<image class="logo" :src="`http://www.hnyfwlw.com:8006/bigdata_pc/equipdistribute/${equipInfo.type}.png`" mode=""></image>
+				{{equipInfo.imei||equipInfo.device_id}}
+				<image src="https://www.hnyfwlw.com:8006/bigdata_app/image/environment/fuzhi.png" mode="" class="tishi">
+				</image>
+				<view :class="['float-right','yficonfont',equipInfo.is_online==1?'on icon-zaixian':'off icon-lixian']">
+					{{equipInfo.is_online==1?'在线':'离线'}}
+				</view>
+			</view>
+			<view class="info-list">
+				<span class="float-left">诱虫量:</span> <span class="float-right">{{equipInfo.bug_count?equipInfo.bug_count.join('/'):'0/0/0'}}</span>
+			</view>
+			<view class="info-list">
+				<span class="float-left">最新上报时间:</span> <span class="float-right">{{equipInfo.addtime||equipInfo.uptime | timeFormat}}</span>
+			</view>
+			<view class="info-list">
+				<span class="float-left">设备地址:</span> <span class="float-right">{{equipInfo.address?equipInfo.address:"--"}}</span>
+			</view>
+			<view class="info-list" @click="calendar_show=true">
+				<span class="float-left">诱芯到期时间</span>
+				<span>  </span>
+				<span class="float-right"> 
+				<span v-if="equipInfo.xy_expire_time>0">
+					{{ equipInfo.xy_expire_time | timeFormat}}
+				</span>
+				 <span v-else> 暂未设置诱芯	</span>
+					<u-icon class="arrow" name="arrow-right" color="#666666" size="26"></u-icon>
+				</span>
+			</view>
+			<u-popup v-model="yxShow" mode="center" width="600rpx">
+				<u-field label="诱芯到期时间" @click="calendar_show=true" label-width='240' required :error-message="xyErr" v-model="decoy" class="field"
+					:field-style="fieldstyle" >
+				</u-field>
+				<view class="btn-box">
+					<u-button @click="yxSubmit" size="mini" type="success">确定</u-button>
+				</view>
+			</u-popup>
+			<u-calendar v-model="calendar_show" mode="date" :max-date="date" @change="timeChange($event,'decoy','xyErr')">
+			</u-calendar>
+			<u-toast ref="toast" />
+		</view>
+		<view class="title">基本操作</view>
+		<view class="newState" >
+			<view class="item" v-for="item in curEquip" @click="partClick(item.path)">
+				<view class="item_info_img">
+					<image :src="'https://www.hnyfwlw.com:8006/bigdata_app'+item.icon" mode="widthFix"></image>
+				</view>
+				<view class="info-text">
+					{{item.tex}}
+				</view>
+			</view>
+		</view>
+		<view class="title">实时状态</view>
+		<view class="newtishi" v-if="dataloadingtf">
+			<p class="dataloading">加载中</p>
+		</view>
+		<view class="newtishi" v-else-if="newtishitf">
+			暂无数据
+		</view>
+		<view class="newState" v-else>
+			<view class="item" v-for="item in curState">
+				<view class="item_info_img">
+					<image :src="'https://www.hnyfwlw.com:8006/bigdata_app'+item.icon" mode="widthFix"></image>
+				</view>
+				<view class="info-con">
+					<view class="active">
+						{{item.value | formatValue(item.txt,type)}}
+					</view>
+					<view class="val">
+						{{item.txt}} 
+					</view>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import equipState from "../../../static/js/equipState_dict.json"
+	import {
+		QueryPermission,getPermissionById,getUserPermission
+	} from "../../../util/QueryPermission.js"
+	export default {
+		data() {
+			return {
+				fieldstyle: {
+					border: "2rpx solid #f6f6f6",
+					"border-radius": "24px",
+					"padding-left": "20rpx",
+					"background-color": "#f6f6f6"
+				},
+				city: "",
+				type: null, //设备类型
+				device_status: null,
+				equipInfo: {},
+				cbd: [
+					
+				],
+				newState: {}, //设备最新状态
+				setTimeShow: false,
+				calendar_show: false,
+				culErr: '',
+				yxShow: false, //诱芯弹框
+				xyErr: '',
+				decoy: '',
+				newtishitf: false, //暂无数据提示
+				dataloadingtf: true, //加载中提示
+				date: "", //日历最大可选日期
+			}
+		},
+		computed: {
+			curEquip(){
+				this.cbd = [{
+						icon: '/image/cb/4.png',
+						tex: '设备控制',
+						path: '/pages/cb/cbd/equip-set/equip-set-new',
+						tf: true
+					}, {
+						icon: '/image/cb/6.png',
+						tex: 'sim卡详情',
+						path: '/pages/prevention/sim',
+						tf: true
+					}, {
+						icon: '/image/environment/7.png',
+						tex: '一键报修',
+						path: '/pages/afterSale/addafter',
+						tf: true
+					}]
+				let permission = getPermissionById(getUserPermission(),this.equipInfo.pur_id)
+				console.log(permission,'权限')
+				permission.forEach(item=>{
+					
+					if(item.purview_name =='查看图片'){
+						this.cbd.unshift({
+							icon: '/image/cb/1.png',
+							tex: item.purview_name,
+							path: '/pages/cb/cbd/equip-set/photo',
+							tf: true
+						})
+					}else if(item.purview_name =='数据详情'){
+						this.cbd.unshift({
+							icon: '/image/cb/2.png',
+							tex: item.purview_name,
+							path: '/pages/cb/cbd/equip-set/newhistoryfile',
+							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/analyse',
+							tf: true
+						})
+					}
+				})
+				return this.cbd
+			},
+			curState() {
+				return [{
+						icon: '/image/cb/icon02.png',
+						txt: '在线状态',
+						value: this.newState.status,
+					},
+					{
+						icon: '/image/cb/icon05.png',
+						txt: '开关状态',
+						value: Number(this.newState.ds) == 1 ? '开机' : '关机'
+					},
+					 {
+						icon: '/image/cb/icon08.png',
+						txt: '环境温度(℃)',
+						value: this.newState.tem
+					}, {
+						icon: '/image/cb/icon07.png',
+						txt: '环境湿度(%)',
+						value: this.newState.hum
+					}, {
+						icon: '/image/prevention/icon16.png',
+						txt: '信号强度',
+						value: this.newState.signal
+					}, {
+						icon: '/image/cb/icon12.png',
+						txt: '设备版本',
+						value: this.newState.dver_num
+					},
+					{
+						icon: '/image/cb/icon17.png',
+						txt: '雨控状态',
+						value: this.newState.rps
+					}, {
+						icon: '/image/cb/icon14.png',
+						txt: '温控状态',
+						value: this.newState.tps
+					}, {
+						icon: '/image/cb/icon06.png',
+						txt: '光控状态',
+						value: this.newState.lps
+					}
+				]
+			}
+				
+		},
+		filters: {
+			equipType(type) {
+				switch (type) {
+					case 3:
+						return "虫情测报灯";
+					case 7:
+						return "孢子仪";
+					case 4:
+						return "性诱测报"
+
+				}
+			},
+			formatValue(val, a1, a2) {
+				if (a2 == 4 && a1 == "电池状态") {
+					switch (Number(val)) {
+						case 0:
+							return '正常';
+							break;
+						case 1:
+							return '欠压';
+							break;
+						case 2:
+							return '过压';
+							break;
+					}
+				} else {
+
+					return val ? val : '无'
+				}
+			}
+		},
+		onLoad(option) {
+			this.equipInfo = JSON.parse(option.info)
+			this.getDeviceStatus()
+			this.type = Number(this.equipInfo.type) || Number(this.equipInfo.equip_type) || Number(this.equipInfo
+				.device_type_id)
+			this.equipInfo.type = this.type
+			this.device_status = this.equipInfo.is_online
+			
+			this.getState()
+		
+			// this.selectaddress(Number(this.equipInfo.lat), Number(this.equipInfo.lng))
+			var times = new Date()
+			this.date = times.getFullYear() + 1 + "-" + Number(times.getMonth() + 1) + "-" + times.getDate()
+		},
+		methods: {
+			async getDeviceStatus() {
+				
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=new_gateway.device_info.devices_list',
+					data: {
+						device_type_id: this.equipInfo.type,
+						id: this.equipInfo.imei|| this.equipInfo.device_id,
+						page:1,
+						size:999
+					}
+				})
+				let newRes = res.device[0]
+				this.equipInfo ={...this.equipInfo,...newRes} 
+				console.log('响应',this.equipInfo)
+			},
+			async getState() {
+				this.dataloadingtf = true
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=new_gateway.device_info.device_status',
+					data: {
+						device_type_id: this.equipInfo.type,
+						id: this.equipInfo.d_id
+					}
+				})
+				this.newState = res
+				this.dataloadingtf = false
+				console.log('res',res)
+			},
+	
+			partClick(path) {
+				console.log(path)
+				var device_id = this.equipInfo.device_id || this.equipInfo.imei
+				uni.navigateTo({
+					url: path + '?d_id=' + this.equipInfo.d_id + "&device_id=" + device_id + "&device_type=" + this
+						.type
+				});
+			},
+	
+
+			timeChange(e, filed,errType) {
+				this[filed] = e.result
+				this[errType] = ""
+				this.yxSubmit()
+			},
+		
+			async addYx(d_id) {
+				this.decoy = this.formatTime(this.equipInfo.xy_expire_time*1000,'yyyy-MM-dd');
+				this.yxShow = true
+			},
+			async yxSubmit() {
+				if (!this.decoy) {
+					this.xyErr = "请填写诱芯到期时间";
+					return false
+				}
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=new_gateway.device_info.youxin',
+					data: {
+						device_type_id: this.equipInfo.type,
+						id: this.equipInfo.device_id,
+						xy_expire_time:  +new Date(this.decoy) / 1000 
+					}
+				})
+				if (res) {
+					this.xyErr = ""
+					this.yxShow = false
+					this.$refs.toast.show({
+						title: '设置成功!',
+						type: 'success',
+					})
+					this.getDeviceStatus()
+					// this.equipInfo.xy_expire_time = +new Date(this.decoy) / 1000
+				}
+			},
+			selectaddress(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: res => {
+						console.log(res)
+						this.city = res.data.regeocode.formatted_address
+					}
+				});
+			},
+			copy(item) {
+				console.log(item)
+				uni.setClipboardData({
+					data: item.imei || item.device_id,
+					success: function() {
+						console.log('success');
+					}
+				});
+			}
+		},
+	}
+</script>
+
+<style lang='scss'>
+	page {
+		padding: 0rpx 48rpx;
+		box-sizing: border-box;
+		background: #F7F7F7;
+		.title{
+			color: #999999;
+			margin: 32rpx 0;
+		}
+		.logo{
+			width: 36rpx;
+			height: 36rpx;
+			margin-right: 12rpx;
+			position: relative;
+			top: 8rpx;
+		}
+		.device-id{
+			height: 60rpx;
+			line-height: 60rpx;
+			margin-bottom: 18rpx;
+			color: #5C5C5C;
+			.float-right{
+				float: right;
+				width: 88px;
+				height: 30px;
+				text-align: center;
+				position: absolute;
+				top: 0;
+				right: 0;
+				border-top-right-radius: 24rpx;
+			}
+		}
+		
+		.on {
+			background-image: url('/static/images/cb/online.png');
+			color: #fff;
+		}
+		
+		.off {
+			background-image: url('/static/images/cb/outline.png');
+			color: #999999;
+		}
+		.info {
+			position: relative;
+			padding: 8rpx 32rpx 32rpx 32rpx;
+			
+			line-height: 50rpx;
+			font-size: 26rpx;
+			border-radius: 24rpx;
+			
+			background-color: #fff;
+			
+			box-sizing: border-box;
+			width: 100%;
+			.info-list{
+				overflow: hidden;
+				font-size: 12px;
+				.float-right{
+					float: right;
+					color: #666;
+					.arrow{
+						margin-left: 10rpx;
+					}
+				}
+				.float-left{
+					float: left;
+					color: #999;
+				}
+				
+			}
+			.tishi {
+				width: 28rpx;
+				height: 28rpx;
+				margin: 0rpx 0 0 12rpx;
+				position: relative;
+				top: 6rpx;
+			}
+		}
+
+		
+
+		
+
+		.tit {
+			font-weight: 800;
+			height: 50rpx;
+			font-size: 30rpx;
+			margin-bottom: 20rpx;
+			display: flex;
+			justify-content: space-between;
+
+			.span {
+				color: #6e6c76;
+				font-size: 24rpx;
+				display: flex;
+				justify-content: space-between;
+				/* margin-top: 12rpx; */
+			}
+		}
+
+		.newtishi {
+			width: 90%;
+			margin: 0 auto;
+			text-align: center;
+			padding-top: 40rpx;
+			font-size: 32rpx;
+
+			.dataloading:after {
+				overflow: hidden;
+				display: inline-block;
+				vertical-align: bottom;
+				animation: ellipsis 2s infinite;
+				content: "\2026";
+			}
+
+			@keyframes ellipsis {
+				from {
+					width: 2px;
+				}
+
+				to {
+					width: 15px;
+				}
+			}
+		}
+
+		.newState {
+			display: flex;
+			flex-wrap: wrap;
+			text-align: center;
+			margin: 0 -10rpx;
+
+			.item {
+				display: flex;
+				flex-wrap: nowrap;
+				margin: 10rpx;
+				width: 316rpx;
+				justify-content: flex-start;
+				padding: 20rpx 10rpx;
+				box-sizing: border-box;
+				border-radius: 4px;
+			
+				background-color: #fff;
+				font-size: 24rpx;
+				.info-text{
+					line-height: 76rpx;
+					padding-left: 30rpx;
+					font-size: 14px;
+					color: #666666;
+				}
+				.info-con {
+					padding-left: 30rpx;
+					text-align: left;
+					line-height: 40rpx;
+					color: #666666;
+					.active{
+						font-size: 36rpx;
+					}
+					.val{
+						font-size: 24rpx;
+					}
+				}
+
+				.item_info_img {
+					width: 30%;
+					text-align: center;
+
+					image {
+						width: 64rpx;
+						height: 64rpx;
+						margin-top: 10rpx;
+					}
+				}
+				
+			}
+		}
+
+		.btn-box {
+			text-align: center;
+			padding: 30rpx;
+		}
+
+		.field {
+			/deep/.uni-input-input {
+				border: 2rpx solid #FF0000;
+				border-radius: 24rpx;
+				width: 140px;
+				padding-left: 10rpx;
+				box-sizing: border-box;
+			}
+		}
+	}
+
+	/deep/.u-calendar__action {
+		display: flex;
+		justify-content: space-around;
+
+		.u-calendar__action__text {
+			line-height: 25px;
+		}
+	}
+
+	.red {
+		color: rgb(235, 103, 101);
+	}
+</style>

+ 106 - 154
pages/cb/index/index.vue

@@ -15,10 +15,11 @@
 					<image :src="'https://www.hnyfwlw.com:8006/bigdata_app'+'/image/cb/banner.jpg'" mode="widthFix"></image>
 				</view>
 				<view class="tab-box">
-					<view v-for="(item,index) in equipArr" :key="item.type" v-if="item.tf" @click="tabClick(index)" :class="['tab-item',active==index?'active':'']">
-						<text>{{item.name}}</text>
+					<view v-for="(item,index) in equipArr" :key="index" @click="tabClick(index,item)" :class="['tab-item',active==index?'active':'']">
+						<text>{{item.type_name}}</text>
 						<text class="bottom-line"></text>
 					</view>
+					<!-- <u-tabs :list="equipArr"  :current="active" active-color="#14A478" @change="tabClick"></u-tabs> -->
 				</view>
 			</view>
 			<view class="loading" v-if="loadingtf">
@@ -26,7 +27,7 @@
 			</view>
 			<view class="" style="position: absolute;top: 190px;width: 100%;">
 				<view class="content">
-					<template v-for="(item,index) in equipArr[active].list">
+					<template v-for="(item,index) in equipArr[active].list" >
 						<equipItem @click.native="itemClick(item)" v-bind:item="item" :key="index">
 							<view class="date">
 								<p>设备ID:{{item.imei||item.device_id}}</p>
@@ -52,20 +53,23 @@
 			<view class="backtop" @click="top" v-if="isTop">
 				<image src="../../../static/images/1.png" mode="" class="img0"></image>
 			</view>
+			
 			<view class="more">
-				<view class="box" @click="online" v-show="filtrateTF">
+				<view class="box" @click="findSearch(1)" v-show="filtrateTF">
 					<p>在线</p>
 				</view>
-				<view class="box" @click="offline" v-show="filtrateTF">
+				<view class="box" @click="findSearch(0)" v-show="filtrateTF">
 					<p>离线</p>
 				</view>
-				<view class="box" @click="complete" v-show="filtrateTF">
+				<view class="box" @click="findSearch('')" v-show="filtrateTF">
 					<p>全部</p>
 				</view>
 				<view @click="filtrate">
 					<image src="../../../static/images/b0bcdb0e3fe8690520f743aa8303bf2.png" mode="" class="img1"></image>
 				</view>
 			</view>
+			
+			
 		</view>
 	</view>
 </template>
@@ -78,112 +82,34 @@
 			return {
 				active: 0, //默认选中虫情测报
 				equipArr: [{
-						name: '虫情测报',
-						type: 3, //3虫情测报灯 7孢子仪 4智能性诱
-						list: [],
-						pageIndex: 1,
-						tf:false,
-					}, {
-						name: '孢子仪',
-						type: 7, //3虫情测报灯 7孢子仪 4智能性诱
-						list: [],
-						pageIndex: 1,
-						tf:false,
-					}, {
-						name: '性诱测报',
-						type: 4, //3虫情测报灯 7孢子仪 4智能性诱
-						list: [],
-						pageIndex: 1,
-						tf:false,
-						device_model: 1
-					},
-					{
-						name: '性诱2.0',
-						type: 10, //3虫情测报灯 7孢子仪 4智能性诱 性诱2.0
-						list: [],
-						pageIndex: 1,
-						tf:false
-					},
-					{
-						name: '性诱3.0',
-						type: 8, //3虫情测报灯 7孢子仪 4智能性诱 性诱2.0
-						list: [],
-						pageIndex: 1,
-						tf: false
-					}, {
-						name: '吸虫塔',
-						type: 12, //3虫情测报灯 7孢子仪 4智能性诱 性诱2.0
-						list: [],
-						pageIndex: 1,
-						tf: false
-					}, {
-						name: '病虫害可视监测',
-						type: 14, //3虫情测报灯 7孢子仪 4智能性诱 性诱2.0
-						list: [],
-						pageIndex: 1,
-						tf: false
-					}
-				],
-				device_id: '3', //筛选的设备id
+					name: ''
+				}],
 				isTop: false,
 				filtrateTF:false,
 				device_status:"",
 				loadingtf:false,//设备列表加载中
-				device_type:"3",
+				device_type:3,
 				show: false,
 				title: "",
 				content: "",
+				searchinput:'',
+				data:{search:''}
 			}
 		},
-		onLoad() {
-			uni.getStorage({
-				key:"jurisdiction",
-				success:(res)=>{
-					let items = JSON.parse(res.data).filter((item) => {
-						return item.pur_id == 36
-					})
-					var arr = items[0].children
-					for (var i = 0; i < arr.length; i++) {
-						switch (arr[i].pur_id) {
-							case 37:
-								this.equipArr[0].tf = true //"虫情测报灯"
-								this.getEquipList(0)
-								break
-							case 38:
-								this.equipArr[2].tf = true //"性诱测报"
-								this.getEquipList(2)
-								break
-							case 39:
-								this.equipArr[1].tf = true //"孢子仪"
-								this.getEquipList(1)
-								break
-							case 161:
-								this.equipArr[3].tf = true //"性诱2.0"
-								this.getxyEquipList(3)
-								break
-							case 198:
-								this.equipArr[4].tf = true //"性诱2.0"
-								this.getthxyEquipList(4)
-								break
-							case 171:
-								this.equipArr[5].tf = true //"性诱3.0"
-								this.getxctEquipList(5)
-								break
-							case 167:
-								this.equipArr[6].tf = true //"性诱3.0"
-								this.getEquipList(6)
-								break
-						}
-					}
-					for(var i=0;i<this.equipArr.length;i++){
-						if(this.equipArr[i].tf){
-							this.active = i
-							this.device_type = this.equipArr[i].type
-							break
-						}
-					}
+		computed:{
+			tabActiveStyle(){
+				return {
+					color: '#303133',
+					fontWeight: 'bold'
 				}
-			})
+			}
+		},
+		onLoad() {
+			this.equipArr = [{
+					name: ''
+				}]
+			this.usertype()
+			
 		},
 		onShow() {
 
@@ -241,12 +167,38 @@
 			return true;
 		},
 		methods: {
+			search(){
+				
+			},
+			//获取用户测报设备列表
+			async usertype() { 
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=home.homes.user_device_type',
+					data:{
+						model:'测报'
+					}
+				})
+				console.log('设备列表',res)
+				// this.equipArr = res
+				this.equipArr.shift()
+				res.forEach(item=>{
+					item.name=item.type_name
+					item.list = []
+					item.pageIndex = 1
+					this.equipArr.push(item)
+				})
+				if (res.length) {
+					this.device_type =this.equipArr[0].id
+					this.choosePOST()
+				}
+			},
 			async getEquipList(act) {
+				
 				this.loadingtf = true
 				const res = await this.$myRequest({
 					url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
 					data: {
-						device_type_id: this.equipArr[act].type,
+						device_type_id: this.equipArr[act].id,
 						page: this.equipArr[act].pageIndex,
 						page_size: 10,
 						device_status:this.device_status,
@@ -268,14 +220,15 @@
 						this.equipArr[act].list[i]['device_expiretext'] = "即将到期"
 					}
 				}
-				console.log(this.equipArr[act].list)
+				console.log('处理后的结果',this.equipArr[act].list)
 			},
+			// 性诱2.0
 			async getxyEquipList(act) {
 				this.loadingtf = true
 				const res = await this.$myRequest({
 					url: '/api/api_gateway?method=sex_lure_nl.sex_lure.nl_device_list',
 					data: {
-						device_type_id: this.equipArr[act].type,
+						device_type_id: this.equipArr[act].id,
 						page: this.equipArr[act].pageIndex,
 						page_size: 10,
 						device_status:this.device_status
@@ -286,12 +239,13 @@
 				this.equipArr[act].list = [...this.equipArr[act].list, ...res.data]
 				console.log(this.equipArr[act].list)
 			},
+			// 性诱3.0
 			async getthxyEquipList(act) {
 				this.loadingtf = true
 				const res = await this.$myRequest({
 					url: '/api/api_gateway?method=forecast.worm_lamp.xy_three_list',
 					data: {
-						device_type_id: this.equipArr[act].type,
+						device_type_id: this.equipArr[act].id,
 						page: this.equipArr[act].pageIndex,
 						page_size: 10,
 						device_status: this.device_status,
@@ -302,12 +256,13 @@
 				this.equipArr[act].list = [...this.equipArr[act].list, ...res.data]
 				console.log(this.equipArr[act].list)
 			},
+			// 吸虫塔
 			async getxctEquipList(act) {
 				this.loadingtf = true
 				const res = await this.$myRequest({
 					url: '/api/api_gateway?method=forecast.worm_lamp.xct_list',
 					data: {
-						device_type_id: this.equipArr[act].type,
+						device_type_id: this.equipArr[act].id,
 						page: this.equipArr[act].pageIndex,
 						page_size: 10,
 						device_status: this.device_status,
@@ -319,19 +274,42 @@
 				console.log(this.equipArr[act].list)
 			},
 			tabClick(index) {
+				
 				this.active = index;
-				this.device_id = this.equipArr[index].type
-				this.device_type = this.equipArr[index].type
+				this.device_type = this.equipArr[index].id
+				this.choosePOST()
+			},
+			
+			choosePOST(){
+				let index = this.active
+				let typeId = this.device_type
+				if(typeId == 10){
+					// 性诱2.0
+					this.getxyEquipList(index)
+				}else if(typeId == 8){
+					// 性诱3.0
+					this.getthxyEquipList(index)
+				}else if(typeId == 12){
+					// 吸虫塔
+					this.getxctEquipList(index)
+				}
+				else{
+					// 测报接口
+					this.getEquipList(index)
+				}
 			},
 			clickRight() {
 				uni.navigateTo({
-					url: "./search?device_id=" + this.device_id
+					url: "./search?device_id=" + this.device_type
 				})
 			},
 			itemClick(itemOld) {
 				let item = JSON.parse(JSON.stringify(itemOld))
-				item.type = this.equipArr[this.active].type
+				item.type= this.equipArr[this.active].id
+				item.pur_id = this.equipArr[this.active].pur_id||0
 				let data = JSON.stringify(item)
+			
+				
 				if (item.type == 10) {
 					uni.navigateTo({
 						url: '/pages/cb/xy2.0/particulars?info=' + data
@@ -349,6 +327,10 @@
 					uni.navigateTo({
 						url: '/pages/cb/sy/detail?detail=' + data
 					});
+				}else if (item.type == 32||item.type == 33||item.type == 34||item.type == 35) {
+					uni.navigateTo({
+						url: '/pages/cb/equip-detail/equip-detail-new?info=' + data
+					});
 				} else{
 					uni.navigateTo({
 						url: '/pages/cb/equip-detail/equip-detail?info=' + data
@@ -369,49 +351,12 @@
 					duration: 500
 				})
 			},
-			online(){
-				this.equipArr[this.active].pageIndex=1
-				this.equipArr[this.active].list =[]
-				this.device_status = 1
-				if (this.active == 4) {
-					this.getthxyEquipList(4)
-				} else if (this.active == 5) {
-					this.getxctEquipList(5)
-				} else if (this.active == 3) {
-					this.getxyEquipList(3)
-				} else {
-					this.getEquipList(this.active)
-				}
-				this.filtrateTF = !this.filtrateTF
-			},
-			offline(){
-				this.equipArr[this.active].pageIndex=1
-				this.equipArr[this.active].list =[]
-				this.device_status = 0
-				if (this.active == 4) {
-					this.getthxyEquipList(4)
-				} else if (this.active == 5) {
-					this.getxctEquipList(5)
-				} else if (this.active == 3) {
-					this.getxyEquipList(3)
-				} else {
-					this.getEquipList(this.active)
-				}
-				this.filtrateTF = !this.filtrateTF
-			},
-			complete(){
+			findSearch(device_status){
+				
+				this.device_status = device_status	
 				this.equipArr[this.active].pageIndex=1
 				this.equipArr[this.active].list =[]
-				this.device_status = ""
-				if (this.active == 4) {
-					this.getthxyEquipList(4)
-				} else if (this.active == 5) {
-					this.getxctEquipList(5)
-				} else if (this.active == 3) {
-					this.getxyEquipList(3)
-				} else {
-					this.getEquipList(this.active)
-				}
+				this.choosePOST()
 				this.filtrateTF = !this.filtrateTF
 			},
 			examine(e) {
@@ -468,7 +413,7 @@
 		}
 	}
 	.bases_search {
-		width: 60%;
+		width: 80%;
 		background-color: #FFFFFF;
 		position: absolute;
 		top: 10rpx;
@@ -495,6 +440,14 @@
 			}
 		}
 	}
+	// .tab-box {
+	// 	font-size: 30rpx;
+	// 	line-height: 80rpx;
+	// 	background-color: #ffffff;
+	// 	width: 100vw;
+	// 	z-index: 2;
+	// 	margin-top: -10rpx;		
+	// }
 	.tab-box {
 		// position: fixed;
 		// top: 170px;
@@ -532,7 +485,6 @@
 			}
 		}
 	}
-
 	.top {
 		position: fixed;
 		right: 10px;

File diff suppressed because it is too large
+ 754 - 748
pages/equipList/index.vue


+ 12 - 0
pages/irrigate/index.vue

@@ -180,6 +180,18 @@
 					list: [],
 					pageIndex: 1,
 					tf: false,
+				}, {
+					name: '水肥一体化(X)',
+					type: 13, //5 环境监测 15 管式墒情
+					list: [],
+					pageIndex: 1,
+					tf: true,
+				}, {
+					name: '水肥一体化',
+					type: 'xph', //5 环境监测 15 管式墒情
+					list: [],
+					pageIndex: 1,
+					tf: true,
 				}],
 				active: 0, //tab选中的下标
 				side_type: 17, //当前选中的设备类型

+ 7 - 7
pages/prevention/equipmentdetails.vue

@@ -22,20 +22,20 @@
 				</view>
 			</view>
 			<view class="control">
-				<view class="control_item" v-if="$QueryPermission(75)" @click="control">
-					<image :src="'https://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/8.png'" mode=""></image>
+				<view class="control_item" v-if="$QueryPermission(316) || $QueryPermission(75)" @click="control">
+					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/8.png'" mode=""></image>
 					<p>设备控制</p>
 				</view>
-				<view class="control_item" v-if="$QueryPermission(77)" @click="charts">
-					<image :src="'https://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/10.png'" mode=""></image>
+				<view class="control_item" v-if="$QueryPermission(318)|| $QueryPermission(77)" @click="charts">
+					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/10.png'" mode=""></image>
 					<p>历史数据</p>
 				</view>
-				<view class="control_item" v-if="$QueryPermission(76)" @click="sim">
-					<image :src="'https://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/9.png'" mode=""></image>
+				<view class="control_item" v-if="$QueryPermission(317)|| $QueryPermission(76)" @click="sim">
+					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/9.png'" mode=""></image>
 					<p>SIM卡详情</p>
 				</view>
 				<view class="control_item" @click="repairs">
-					<image :src="'https://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/7.png'" mode=""></image>
+					<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/7.png'" mode=""></image>
 					<p>一键报修</p>
 				</view>
 			</view>

+ 126 - 74
pages/prevention/index.vue

@@ -1,26 +1,26 @@
 <template>
 	<view>
 		<view class="status_bar"></view>
-		<view class="" style="position: relative;top: 40px;">
+		<view class="" style="position: relative;top: 44px;">
 			<view style="position: fixed;z-index: 100;">
-				<uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回"
-				 size="16">
-				 <view class="bases_search">
-				 	<view class="bases_search_text" @click="clickRight">
-				 		<u-icon name="search" class="search" @click="search"></u-icon>
-				 		<input type="text" v-model="data.search" placeholder="设备ID搜索" disabled/>
-				 	</view>
-				 </view>
-				 </uni-nav-bar>
+				<uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="防治系统" right-icon="search"
+					@clickRight="clickRight" size="16"></uni-nav-bar>
+				<view class="inputs" :style="{'width':width+'rpx'}">
+					<input type="text" value="" placeholder="请输入设备ID或设备名称" v-model="imports" @input="searchinp"
+						class="inputbox" :clearable="false" />
+					<u-icon name="search" size="40" class="icon" @click="search"></u-icon>
+				</view>
 			</view>
-			<image :src="'https://www.hnyfwlw.com:8006/bigdata_app'+'/image/prevention/1.png'" mode="" class="image"></image>
+			<image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/prevention/1.png'" mode="" class="image">
+			</image>
 			<view class="loading" v-if="loadingtf">
 				<image src="../../static/images/ajax-loader.gif" mode="" class="img"></image>
 			</view>
 			<view class="prevents">
 				<view class="prevents_item" v-for="item,index in eqlistdata" :key="index" @click="eqdetails(item)">
-					<image :src="item.is_online==1?'https://www.hnyfwlw.com:8006/bigdata_app/image/prevention/6.png':'https://www.hnyfwlw.com:8006/bigdata_app/image/prevention/7.png'"
-					 mode="" class="prevents_item_img"></image>
+					<image
+						:src="item.is_online==1?'http://www.hnyfwlw.com:8006/bigdata_app/image/prevention/6.png':'http://www.hnyfwlw.com:8006/bigdata_app/image/prevention/7.png'"
+						mode="" class="prevents_item_img"></image>
 					<view class="prevents_item_top">
 						<p>设备名称:{{item.device_name==""?"无":item.device_name}}</p>
 						<p :class="item.is_online==1?'green':'red'" v-text="item.is_online==1?'在线':'离线'"></p>
@@ -28,7 +28,8 @@
 					<view class="prevents_item_bot">
 						<p>设备 ID:{{item.imei}}</p>
 						<p>最新上报时间:{{item.addtime|timeFormat()}}</p>
-						<view class="" style="display: flex;justify-content: space-between;" v-if="$QueryPermission(325)">
+						<view class="" style="display: flex;justify-content: space-between;"
+							v-if="showLastTime">
 							<p>设备到期情况:<span
 									:class="'prevents_item_bot_sapn'+item.device_expire">{{item.device_expiretext}}</span>
 							</p>
@@ -38,7 +39,8 @@
 				</view>
 			</view>
 		</view>
-		<u-modal v-model="show" :title="title" :showConfirmButton="false" :title-style="{'text-align':'left','padding-left':'10px','font-weight':700}" :mask-close-able="true">
+		<u-modal v-model="show" :title="title" :showConfirmButton="false"
+			:title-style="{'text-align':'left','padding-left':'10px','font-weight':700}" :mask-close-able="true">
 			<view class="slot-content">
 				<rich-text :nodes="content"></rich-text>
 			</view>
@@ -48,7 +50,7 @@
 				<image src="../../static/images/1.png" mode="" class="img0"></image>
 			</view>
 			<view class="more">
-				<view class="box" @click="allwormdel" v-show="allqingchong&&filtrateTF">
+				<view class="box" @click="allwormdel" v-show="allqingchong && filtrateTF">
 					<p>清虫</p>
 				</view>
 				<view class="box" @click="online" v-show="filtrateTF">
@@ -69,23 +71,47 @@
 </template>
 
 <script>
+	import {
+		Debounce
+	} from "../../util/anitthro.js"
 	export default {
 		data() {
 			return {
 				page: 1,
 				size: 10,
 				eqlistdata: [],
-				isTop:false,
-				filtrateTF:false,
-				device_status:"",
-				loadingtf:false,//loading
+				isTop: false,
+				filtrateTF: false,
+				device_status: "",
+				width: 0,
+				imports: "", //搜索内容
+				loadingtf: false, //loading
 				show: false,
 				title: "",
 				content: "",
-				allqingchong:false
+				allqingchong: false,
+				showLastTime: false,
 			}
 		},
 		methods: {
+			testId(id, list) {
+				for (var i = 0; i < list.length; i++) {
+					if (list[i].children) {
+						var data = list[i].children
+						for (var j = 0; j < data.length; j++) {
+							if (data[j].children) {
+								var item = data[j].children
+								for (var k = 0; k < item.length; k++) {
+									if (item[k].pur_id == id) {
+										return true
+									}
+								}
+							}
+
+						}
+					}
+				};
+			},
 			async eqlist() { //设备列表
 				this.loadingtf = true
 				const res = await this.$myRequest({
@@ -93,8 +119,9 @@
 					data: {
 						device_type_id: 2,
 						page: this.page,
-						page_size: 10,
-						device_status:this.device_status
+						page_size: "10",
+						device_status: this.device_status,
+						device_id: this.imports
 					}
 				})
 				this.loadingtf = false
@@ -116,16 +143,17 @@
 				})
 			},
 			clickRight() {
-				uni.navigateTo({
-					url: "./search"
-				})
+				// uni.navigateTo({
+				// 	url: "./search"
+				// })
+				this.width = 600
 			},
 			eqdetails(data) {
 				uni.navigateTo({
 					url: "./equipmentdetails?shebei=" + JSON.stringify(data)
 				})
 			},
-			filtrate(){
+			filtrate() {
 				this.filtrateTF = !this.filtrateTF
 			},
 			top() {
@@ -134,32 +162,44 @@
 					duration: 500
 				})
 			},
-			online(){
-				this.eqlistdata=[]
+			online() {
+				this.eqlistdata = []
 				this.page = 1
 				this.device_status = 1
 				this.eqlist()
 				this.filtrateTF = !this.filtrateTF
 			},
-			offline(){
-				this.eqlistdata=[]
+			offline() {
+				this.eqlistdata = []
 				this.page = 1
 				this.device_status = 0
 				this.eqlist()
 				this.filtrateTF = !this.filtrateTF
 			},
-			complete(){
-				this.eqlistdata=[]
+			complete() {
+				this.eqlistdata = []
 				this.page = 1
 				this.device_status = ""
 				this.eqlist()
 				this.filtrateTF = !this.filtrateTF
 			},
+			search() { //搜索按钮搜索
+				// this.eqlistdata = []
+				this.searchinp()
+			},
+			searchinp() { //自动搜索
+				Debounce(() => {
+					this.page = 1
+					this.eqlistdata = []
+					this.eqlist()
+				}, 1000)()
+			},
 			examine(e) {
 				// console.log(this)
 				this.show = true
 				this.title = e.device_expiretext
-				this.content = `<p style="padding-left:10px;margin:10px 0;font-size:14px;">到期时间  ${this.timezhuan(e.device_expire_time)}
+				this.content =
+					`<p style="padding-left:10px;margin:10px 0;font-size:14px;">到期时间  ${this.timezhuan(e.device_expire_time)}
 				</p><p style="font-size:14px;text-align:right;color:#3C84FE;margin-bottom:10px;padding-right:10px">注:请前往PC端进行充值</p>`
 			},
 			timezhuan(time) {
@@ -198,6 +238,12 @@
 		onLoad() {
 			this.getworm()
 			this.eqlist()
+			uni.getStorage({
+				key: "jurisdiction",
+				success: (res) => {
+					this.showLastTime = this.testId(325, JSON.parse(res.data));
+				}
+			})
 		},
 		onReachBottom() {
 			this.page++
@@ -214,56 +260,56 @@
 </script>
 
 <style lang="scss">
+	.inputs {
+		height: 54rpx;
+		background-color: #E4E4E4;
+		border-radius: 27rpx;
+		position: absolute;
+		right: 20rpx;
+		top: 24rpx;
+		transition: width 0.5s;
+		overflow: hidden;
+		padding-top: 8rpx;
+		box-sizing: border-box;
+
+		.inputbox {
+			width: 85%;
+			text-indent: 1rem;
+			font-size: 26rpx;
+		}
+
+		.icon {
+			position: absolute;
+			top: 8rpx;
+			right: 26rpx;
+		}
+	}
+
 	/deep/.uni-icons {
 		font-size: 40rpx !important;
 	}
 
 	.image {
 		position: fixed;
-		top: 83px;
+		top: 88px;
 		width: 100%;
 		height: 160rpx;
 		z-index: 555;
 	}
-	.loading{
+
+	.loading {
 		position: fixed;
 		top: 440px;
 		width: 95%;
 		left: 2.5%;
 		text-align: center;
-		.img{
+
+		.img {
 			width: 300rpx;
 			height: 40rpx;
 		}
 	}
-	.bases_search {
-		width: 60%;
-		background-color: #FFFFFF;
-		position: absolute;
-		top: 10rpx;
-		left: 50%;
-		margin-left: -33%;
-		.bases_search_text {
-			width: 90%;
-			margin: 0 auto;
-			background-color: #F8F8F8;
-			height: 60rpx;
-			border-radius: 30rpx;
-			display: flex;
-			line-height: 60rpx;
-	
-			.search {
-				padding: 0 20rpx;
-				font-size: 34rpx;
-			}
-	
-			input {
-				width: 80%;
-				margin-top: 10rpx;
-				font-size: 28rpx;
-			}
-		}
-	}
+
 	.prevents {
 		width: 100%;
 		position: absolute;
@@ -295,11 +341,11 @@
 				font-size: 26rpx;
 
 				.red {
-					color: #ff0000;
+					color: #FF4747;
 				}
 
 				.green {
-					color: #7DBB91;
+					color: #00B075;
 				}
 			}
 
@@ -307,41 +353,47 @@
 				margin-top: 20rpx;
 				font-size: 26rpx;
 				color: #BDBDBD;
+
 				.prevents_item_bot_sapn0 {
 					color: #00B075;
 				}
-				
+
 				.prevents_item_bot_sapn1 {
 					color: #FF4747;
 				}
-				
+
 				.prevents_item_bot_sapn2 {
 					color: #FFAB00;
 				}
 			}
 		}
 	}
+
 	.top {
 		position: fixed;
 		right: 10px;
 		bottom: 40px;
 		z-index: 100;
+
 		image {
 			width: 100rpx;
 			height: 100rpx;
 		}
-		.backtop{
+
+		.backtop {
 			display: flex;
 			justify-content: flex-end;
 			margin-bottom: 10rpx;
 		}
-		.more{
+
+		.more {
 			display: flex;
 		}
-		.box{
+
+		.box {
 			width: 80rpx;
 			height: 80rpx;
-			background-color: rgba(161,161,161,0.45);
+			background-color: rgba(161, 161, 161, 0.45);
 			border-radius: 50%;
 			text-align: center;
 			line-height: 80rpx;
@@ -350,4 +402,4 @@
 			color: #fff;
 		}
 	}
-</style>
+</style>

+ 22 - 14
pages/prevention/sim.vue

@@ -1,6 +1,8 @@
 <template>
-	<view>
+	<view style="background-color: #f7f7f7;padding-top: 2rpx;height: calc(100vh - 90rpx);">
+		
 		<view>
+			
 			<view class="sim_info" v-if="iccidObj.data_iccid">
 				<view class="sim_info_loding" v-if="loding">
 					<image src="../../static/images/cb/6286299.gif" mode="" class="img"></image>
@@ -145,21 +147,25 @@
 				console.log(res);
 			},
 			async simid(data) { //获取sim卡号
+				this.loding2 = true
+			
 				const res = await this.$myRequest({
 					url: '/api/api_gateway?method=forecast.send_control.device_sim_new',
 					data: {
 						d_id: data
 					}
 				})
+			
 				if(res.data_iccid == '' && res.photo_iccid == '') {
 					if(res.is_editor) {
 						this.isPhotoFault = true;
 						this.iccidObj = res;
-						this.siminfo = {
-							photo: {
-								iccid: ''
-							}
-						}
+						this.siminfo.photo.iccid = ''
+						// this.siminfo = {
+						// 	photo: {
+						// 		iccid: ''
+						// 	}
+						// }
 						this.loding2 = false;
 					} else {
 						uni.showToast({
@@ -179,14 +185,15 @@
 				} else if(res.is_editor) {
 					this.isPhotoFault = true;
 					this.iccidObj = res;
-					this.siminfo = {
-						photo: {
-							iccid: ''
-						}
-					}
+					this.siminfo.photo.iccid = ''
+					// this.siminfo = {
+					// 	photo: {
+					// 		iccid: ''
+					// 	}
+					// }
 					this.loding2 = false;
 				}
-				console.log(res);
+				console.log('sim=====',this.siminfores);
 
 			},
 			async simdata(data, type) { //获取sim信息
@@ -223,7 +230,7 @@
 					this.isPhotoFault = false;
 				}
 				this.siminfo[type] = res;
-				console.log(this.siminfo[type])
+				console.log('sim----',this.siminfo[type])
 			},
 			clickLeft() {
 				uni.navigateBack({
@@ -268,7 +275,8 @@
 		position: relative;
 		width: 90%;
 		margin: 30rpx auto;
-		box-shadow: 0 0 10rpx #bcb9ca;
+		// box-shadow: 0 0 10rpx #bcb9ca;
+		background: #fff;
 		padding: 30rpx 20rpx 50rpx;
 		border-radius: 20rpx;
 		box-sizing: border-box;

+ 7 - 30
project.config.json

@@ -1,7 +1,8 @@
 {
   "description": "项目配置文件",
   "packOptions": {
-    "ignore": []
+    "ignore": [],
+    "include": []
   },
   "setting": {
     "urlCheck": true,
@@ -40,37 +41,13 @@
   },
   "compileType": "miniprogram",
   "libVersion": "2.16.1",
-  "appid": "wx8b73392672bcdac0",
+  "appid": "wxa67985a99191095e",
   "projectname": "miniprogram-1",
-  "debugOptions": {
-    "hidedInDevtools": []
-  },
-  "scripts": {},
-  "staticServerOptions": {
-    "baseURL": "",
-    "servePath": ""
-  },
-  "isGameTourist": false,
   "simulatorType": "wechat",
   "simulatorPluginLibVersion": {},
-  "condition": {
-    "search": {
-      "list": []
-    },
-    "conversation": {
-      "list": []
-    },
-    "game": {
-      "list": []
-    },
-    "plugin": {
-      "list": []
-    },
-    "gamePlugin": {
-      "list": []
-    },
-    "miniprogram": {
-      "list": []
-    }
+  "condition": {},
+  "editorSetting": {
+    "tabIndent": "insertSpaces",
+    "tabSize": 2
   }
 }

+ 7 - 0
project.private.config.json

@@ -0,0 +1,7 @@
+{
+  "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+  "projectname": "%E4%BA%91%E9%A3%9E%E6%99%BA%E6%8E%A7",
+  "setting": {
+    "compileHotReLoad": true
+  }
+}

File diff suppressed because it is too large
+ 1095 - 332
static/data/cbd_pest_library.js


File diff suppressed because it is too large
+ 11 - 3
static/iconfont/iconfont.css


BIN
static/images/cb/gaofengqi.png


BIN
static/images/cb/online.png


BIN
static/images/cb/outline.png


BIN
static/images/cb/shijianqi.png


BIN
static/images/cb/zhongjianqi.png


+ 23 - 2
util/QueryPermission.js

@@ -21,6 +21,27 @@ function QueryPermission(id) {
 	}
 	return false
 }
+function getUserPermission(){
+	let list = []
+	if(uni.getStorageSync("jurisdiction")){
+		list = JSON.parse(uni.getStorageSync("jurisdiction"))
+	}
+	return list
+}
+function getPermissionById(node = getUserPermission(),id) {
+		for (const child of node) {			
+			if(id == child.pur_id){				
+				return child.children || []
+			}
+			if(child.children){
+				let result = getPermissionById(child.children,id) 
+				if(result){
+					return result
+				}				
+			} 
+		}
+		return null
+}
 export {
-	QueryPermission
-}
+	QueryPermission,getPermissionById,getUserPermission
+}

+ 2 - 2
util/api.js

@@ -1,9 +1,9 @@
 // let BASE_URL = 'http://114.55.0.7:8002'
 // const BASE_URL='http://8.136.98.49:8002'
-// let BASE_URL = 'http://192.168.2.183:8006'
+// let BASE_URL = 'http://218.28.198.186:10505'
 // let BASE_URL = 'https://wx.hnyfwlw.com'
 let BASE_URL = 'https://wx.hnyfwlw.com'
-// let BASE_URL = 'http://192.168.2.163:8003'
+// let BASE_URL = 'http://218.28.198.186:10505'
 export const myRequest=(options)=>{
 	// BASE_URL=uni.getStorageSync('http')
 	// if(BASE_URL==''){