Procházet zdrojové kódy

增加高空测报灯,默认用户站点,

yf_wsy před 3 roky
rodič
revize
6532046af8

+ 80 - 6
bigdata2/src/components/Index.vue

@@ -141,7 +141,7 @@
 					</el-menu-item>
 				</el-menu>
 
-				<div style="margin: 13px 0 0 0; width: 95%">
+				<div v-if="isTree" style="margin: 13px 0 0 0; width: 95%">
 					<ul>
 						<li style="display: flex; justify-content: space-between">
 							<div style="display: flex; margin: 0 0 0 5px">
@@ -169,13 +169,18 @@
 								v-if="userinfo.staff == 1"
 							/>
 						</li>
-
+						<!-- @node-contextmenu="rightClick"  右键增加事件 -->
 						<li id="tree">
 							<el-tree
+								ref="treeRef"
 								:data="data"
 								:props="defaultProps"
+								node-key="id"
+								:current-node-key="firstItem"
+								:default-expand-all="true"
 								@node-click="handleNodeClick"
 								@node-contextmenu="rightClick"
+								highlight-current
 							></el-tree>
 						</li>
 					</ul>
@@ -250,6 +255,9 @@ export default {
 			}
 		}
 		return {
+			isTree:true,
+			firstItem:"",
+			firstShow:true,
 			isRouter: true,
 			// 被激活导航地址
 			// activePath:this.$store.state.activePath,
@@ -284,6 +292,12 @@ export default {
 					pur_id: 3
 				},
 				{
+					purview_name: '高空测报灯',
+					menu: 'gkcbd',
+					parent_perm_id: 9,
+					pur_id: 3
+				},
+				{
 					purview_name: '物联网杀虫灯',
 					menu: 'scd',
 					parent_perm_id: 4,
@@ -340,12 +354,16 @@ export default {
 			dataObj: {
 				flag: true,
 				siteID: null,
-				allList: []
+				allList: [],
+				siteNameTitle:""
 			},
 			flag: true,
 			req: '', // 站点列表是否显示有无设备的站点
 			equip_type: '', //选中的设备类型
 			siteID: null, // 需要传递给子组件的站点id
+
+			// 保存点击默认树形站点数据
+			loadData:{}
 		}
 	},
 	created: function () {
@@ -387,6 +405,9 @@ export default {
 		this.options = city
 
 		var url = this.$route.path
+
+
+
 		url = url.split('/index', 2)
 		if (url[1] == '/xycb') {
 			sessionStorage.setItem('tltIndex', 0)
@@ -438,6 +459,9 @@ export default {
 				this.userinfo = res.data
 				localStorage.setItem('have_type', this.userinfo.have_type) // 0管理员  1用户   2项目
 				localStorage.setItem('staff', this.userinfo.staff) // 1是admin
+				localStorage.setItem('site_id', this.userinfo.site_id) // 站点id
+				localStorage.setItem('siteName', this.userinfo.site) // 站点name
+
 			})
 		},
 
@@ -450,17 +474,22 @@ export default {
 
 		// 树形插件
 		handleNodeClick(data) {
+			console.log(this.$route.path);
+			console.log("shushushususssssssssssssssssss",data);
+			this.loadData = data;
 			if (this.$route.path !== '/index/scdList') {
 				this.dataObj.siteID = data.id
 				this.dataObj.allList = this.data
-				this.siteNameTitle = data.label
+				this.dataObj.siteNameTitle = data.label
+				// this.siteNameTitle = data.label
 				this.$refs.mychild.getEquipList(data, 1)
 			} else {
 				this.$router.push('/index/scd')
 
 				this.dataObj.siteID = data.id
 				this.dataObj.allList = this.data
-				this.siteNameTitle = data.label
+				this.dataObj.siteNameTitle = data.label
+				// this.siteNameTitle = data.label
 				var that = this
 				var time = setTimeout(function()  {
 					that.$refs.mychild.getEquipList(data, 1)
@@ -527,12 +556,47 @@ export default {
 						})
 						this.data = arrList
 						console.log(arrList)
+						// 默认子站点
+						// this.siteNameTitle =  data[0].child[0].site_name;
+						// this.firstItem = data[0].child[0].site_id;
+						// 默认选中第一个站点
+						if(localStorage.getItem('siteName')=='超级管理员'){
+							this.siteNameTitle = "瑞通集团总站"
+						}else{
+							this.siteNameTitle = localStorage.getItem('siteName');
+						}
+						this.firstItem = localStorage.getItem('site_id');
+						let data = {};
+						this.treeIterator(arrList,res => {
+							if(res.id==this.firstItem){
+								data = res
+							}
+						})
+						this.$nextTick(()=>{
+							this.$refs.treeRef.setCurrentKey(this.firstItem);
+							// if(this.siteNameTitle=="0"){
+							// 	data ="" 
+							// }
+							const childrenItem = data;
+							if(this.firstShow){
+								this.handleNodeClick(childrenItem);
+								this.objData.id = childrenItem.id
+								this.firstShow = false;
+							}
+						})
 					}
 				})
 				.catch((err) => {
 					console.log(err)
 				})
 		},
+		treeIterator(tree, func) {
+			let node, curTree = [...tree]
+			while ((node = curTree.shift())) {
+			func(node)
+			node.children && curTree.push(...node.children)
+			}
+		},
 
 		// 全部-添加新站点
 		addStation() {
@@ -629,12 +693,14 @@ export default {
 
 		// 获取到当前点击菜单的数据
 		handleOpen(key, keyPath) {
+			this.isTree = true
 			var data = key
 			var typeIndex = data.split('/index/')
 			if (typeIndex[1] == 'xycb') {
 				// 性诱测报
 				this.req = 'hide'
 				this.equip_type = '4'
+				this.$refs.mychild.getEquipList(this.loadData,1)
 			} else if (typeIndex[1] == 'bzy') {
 				// 孢子仪
 				this.req = 'hide'
@@ -647,7 +713,15 @@ export default {
 				// 杀虫灯
 				this.req = 'hide'
 				this.equip_type = '2'
-			} else {
+			} else if (typeIndex[1] == 'userManger'){
+				this.isTree = false
+			}
+			else if (typeIndex[1] == 'gkcbd') {
+				// 高空测报
+				this.req = 'hide'
+				this.equip_type = '8'
+			 } 
+			else {
 				this.req = ''
 				this.equip_type = ''
 			}

+ 115 - 14
bigdata2/src/pages/cure/scd/scd.vue

@@ -6,7 +6,7 @@
 				'el-icon-arrow-right ' + (flag.flag == false ? 'breadcrumb_tab' : '')
 			"
 		>
-			<el-breadcrumb-item>物联网杀虫灯</el-breadcrumb-item>
+			<el-breadcrumb-item>{{flag.siteNameTitle}}  物联网杀虫灯 </el-breadcrumb-item>
 		</el-breadcrumb>
 		<div v-loading="dataloading">
 			<el-row :gutter="10">
@@ -16,12 +16,12 @@
 					:md="12"
 					:lg="8"
 					:xl="6"
-					v-for="item in equipList"
+					v-for="(item,index) in equipList"
 					:key="item.imei"
 				>
 					<el-card class="box-card">
-						<div @click="scdList(item)" style="display: flex; justify-content: space-around">
-							<div style="margin: 22px 0 0 0">
+						<div style="display: flex; justify-content: space-around">
+							<div style="margin: 22px 0 0 0"  @click="scdList(item)">
 								<img
 									src="../../../assets/images/cure/scd/1.png"
 									alt=""
@@ -29,7 +29,7 @@
 								/>
 							</div>
 
-							<ul class="">
+							<ul class=""  @click="scdList(item)">
 								<li
 									class="plot_list"
 									style="display: flex; margin: 0 0 -10px 0"
@@ -62,11 +62,13 @@
 									<span :title="item.site_name">{{ item.site_name | ellipsis }}</span>
 								</li>
 
-								<li class="plot_list">
+								<li v-if="index < equipList.length-1" class="plot_list">
 									<span>建立日期:</span>
 									<span>{{ item.c_time }}</span>
 								</li>
 							</ul>
+						<i v-if="index < equipList.length-1 && item.plot_id!=0 && item.plot_id!=9999" class="iconfont icon-shanchu"  @click="delePolt(item)"></i>
+						<i v-if="index < equipList.length-1 && item.plot_id!=0 && item.plot_id!=9999" class="iconfont icon-iconfontedit"  @click="updatePlot(item)"></i>
 						</div>
 					</el-card>
 				</el-col>
@@ -118,7 +120,8 @@ export default {
 		flag: {
 			flag: Boolean,
 			siteID: Number,
-			allList: Array
+			allList: Array,
+			siteNameTitle:String
 		}
 	},
 	data() {
@@ -127,7 +130,7 @@ export default {
 			equipList: [],
 			dialogVisible: false,
 			plot_name: '',
-			addSiteShow: '', // true是可以添加  false是不能添加
+			addSiteShow: 'true', // true是可以添加  false是不能添加
 		}
 	},
 	watch: {
@@ -149,8 +152,16 @@ export default {
 	},
 	mounted() {
 		console.log(this.flag.siteID)
+		let data = {
+			id:this.flag.siteID
+		}
+		if(this.flag.siteID){
+			this.getEquipList(data)
+		}else{
+			this.getEquipList()
+		}
 		// 地块列表
-		this.getEquipList('')
+		
 	},
 	computed: {
 		userType: function () {
@@ -170,6 +181,95 @@ export default {
 		}
 	},
 	methods: {
+		// 删除地块
+		delePolt(e){
+			let plot_id = e.plot_id
+			let data = {
+				id:e.site_id
+			}
+			this.$confirm('是否确定删除此地块, 是否继续?', '提示', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning'
+			}).then(() => {
+				var postData = this.qs.stringify({
+				plot_id :plot_id,
+				req : 'delete'
+			})
+				this.$axios({
+					method: 'post',
+					url: '/add_plot',
+					data:postData,
+				}).then((res) => {
+					if (res.data.status == 1) {
+						this.$message({
+							message: '删除成功',
+							type: 'success',
+							duration: 1500
+						})
+						this.getEquipList(data)
+					} else {
+						this.$message({
+							message: '删除失败',
+							type: 'error',
+							duration: 1500
+						})
+					}
+				}).catch((err) => {
+					console.log(err)
+				})
+			}).catch(() => {
+				this.$message({
+					type: 'info',
+					message: '已取消删除'
+				});          
+			});
+		},
+		// 更新
+		updatePlot(e){
+			let plot_id = e.plot_id
+			let data = {
+				id:e.site_id
+			}
+			this.$prompt('请输入修改的地块名', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				// type: 'warning'
+			}).then(({value}) => {
+				var postData = this.qs.stringify({
+					plot_name:value,
+					req : 'update',
+					plot_id: plot_id
+				})
+				this.$axios({
+					method: 'post',
+					url: '/add_plot',
+					data: postData,
+				}).then((res) => {
+					if (res.data.status == 1) {
+						this.$message({
+							message: '地块名称修改成功',
+							type: 'success',
+							duration: 1500
+						})
+						this.getEquipList(data)
+					} else {
+						this.$message({
+							message: '地块修改失败',
+							type: 'error',
+							duration: 1500
+						})
+						}
+				}).catch((err) => {
+					console.log(err)
+				})
+			}).catch(() => {    
+				this.$message({
+					type: 'info',
+					message: '已取消更改'
+				});          
+			});
+		},
 		// 增加地块 - 确定
 		addMassif() {
 			if (this.addSiteShow == 'false') {
@@ -192,24 +292,25 @@ export default {
 				})
 			} else if (this.addSiteShow == 'true') {
 				var postData = this.qs.stringify({
+					req: 'add',
 					plot_name: this.plot_name,
 					site_id: this.flag.siteID
 				})
+				let data = {id:this.flag.siteID}
 				this.$axios({
 					method: 'post',
 					url: '/add_plot',
 					data: postData
 				})
 					.then((res) => {
-						console.log(res)
-						if (res.data.msg == '成功') {
+						if (res.data.status == 1) {
 							this.$message({
-								message: '地块添加' + res.data.msg,
+								message: '地块添加成功',
 								type: 'success',
 								duration: 1500
 							})
 							this.dialogVisible = false
-							this.getEquipList('')
+							this.getEquipList(data)
 						} else {
 							this.$message({
 								message: '地块添加失败',
@@ -231,7 +332,6 @@ export default {
 
 		// 地块列表
 		getEquipList(data) {
-			console.log(data)
 			var postData = this.qs.stringify({
 				site_id: data.id !== undefined ? data.id : '',
 				page: this.page,
@@ -309,6 +409,7 @@ export default {
 	text-align: center;
 	color: #555;
 	font-size: 13px;
+	height: 161px;
 	.superOperate {
 		position: absolute;
 		right: 10px;

+ 3 - 0
bigdata2/src/pages/cure/scd/scdList.vue

@@ -20,6 +20,7 @@
 		>
 		</search-bar>
 		<el-button
+			v-if="!(isequipment==9999||isequipment==0)"
 			type="success"
 			size="mini"
 			style="position: absolute; right: 5px; top: 0"
@@ -382,6 +383,7 @@ export default {
 	},
 	data() {
 		return {
+			isequipment:null,
 			dataloading: false,
 			//图表和表格切换
 			displayType: '1',
@@ -463,6 +465,7 @@ export default {
 	mounted() {
 		this.getEquipList()
 		console.log(this.facilityType)
+		this.isequipment =  this.$route.query.plot_id;
 		// console.log(this.$route.query.plot_id)
 		// console.log(this.$route.query.site_id)
 	},

+ 8 - 6
bigdata2/src/pages/equipmanger/EquipList.vue

@@ -11,11 +11,12 @@
 					placeholder="请选择设备类型"
 					@change="searchChange()"
 				>
-					<el-option label="全部" value="2347"></el-option>
+					<el-option label="全部" value="23478"></el-option>
 					<el-option label="性诱测报" value="4"></el-option>
 					<el-option label="孢子仪" value="7"></el-option>
 					<el-option label="虫情测报" value="3"></el-option>
 					<el-option label="杀虫灯" value="2"></el-option>
+					<el-option label="高空测报灯" value="8"></el-option>
 				</el-select>
 				<el-input
 					size="small"
@@ -74,8 +75,8 @@
 							<p>孢子仪</p>
 						</template>
 						<template v-if="item.equip_type == '8'">
-							<img src="@/assets/images/equipdistribute/xyOn.png" />
-							<p>性诱设备</p>
+							<img src="@/assets/images/equipdistribute/cbdIconOn.png" />
+							<p>高空测报灯</p>
 						</template>
 						<template v-if="item.equip_type == 9">
 							<img src="@/assets/images/equipdistribute/tccbOn.png" />
@@ -201,7 +202,7 @@ export default {
 			queryInfo: {
 				f_id: '',
 				page: 1,
-				device_type_id: '2347',
+				device_type_id: '23478',
 				start_time: '',
 				end_time: ''
 			},
@@ -227,7 +228,7 @@ export default {
 	methods: {
 		//获取设备列表
 		getEquipList(obj, page) {
-			console.log(obj)
+			console.log("111111111111",this.queryInfo.device_type_id)
 			if (obj) {
 				console.log(obj)
 				this.queryInfo.page = page
@@ -244,7 +245,7 @@ export default {
 				method: 'POST',
 				url: '/equiplist_filter',
 				data: this.qs.stringify({
-					f_type: this.queryInfo.device_type_id,
+					f_type: this.queryInfo.device_type_id,//设备id
 					f_id: this.queryInfo.f_id,
 					page_size: 12,
 					f_tbegin: this.queryInfo.start_time,
@@ -256,6 +257,7 @@ export default {
 			}).then((res) => {
 				this.dataList = res.data.dat
 				this.totalNum = res.data.nums
+				console.log(this.dataList);
 			})
 		},
 		searchChange() {

+ 3 - 2
bigdata2/src/pages/forecasting/bzy/Bzy.vue

@@ -1,7 +1,7 @@
 <template>
 	<div>
 		<el-breadcrumb separator-class="el-icon-arrow-right" :class="'el-icon-arrow-right '+ (flag.flag == false ? 'breadcrumb_tab' : '')">
-			<el-breadcrumb-item>植物孢子捕捉仪</el-breadcrumb-item>
+			<el-breadcrumb-item>{{flag.siteNameTitle}}  植物孢子捕捉仪</el-breadcrumb-item>
 		</el-breadcrumb>
 		<div class="check-btns">
 			<div class="type-check">
@@ -404,7 +404,8 @@ export default {
 	props: {
 		flag: {
 			flag: Boolean,
-			siteID: Number
+			siteID: Number,
+			siteNameTitle:String
 		},
 	},
 	data() {

+ 7 - 6
bigdata2/src/pages/forecasting/cbd/Cbd.vue

@@ -4,7 +4,7 @@
 			separator-class="el-icon-arrow-right"
 			:class="'el-icon-arrow-right ' + (flag.flag == false ? 'breadcrumb_tab' : '')"
 		>
-			<el-breadcrumb-item>物联网虫情测报</el-breadcrumb-item>
+			<el-breadcrumb-item>{{flag.siteNameTitle}}  物联网虫情测报</el-breadcrumb-item>
 		</el-breadcrumb>
 		<search-bar
 			@fun="getDisplayType"
@@ -418,7 +418,8 @@ export default {
 	props: {
 		flag: {
 			flag: Boolean,
-			siteID: Number
+			siteID: Number,
+			siteNameTitle:String
 		},
 	},
 	data() {
@@ -486,9 +487,7 @@ export default {
 		},
 		//获取设备列表
 		getEquipList(obj, page) {
-			console.log(obj)
 			if (obj) {
-				console.log(obj)
 				this.queryInfo.page = page
 				this.objData = obj
 			}
@@ -511,7 +510,8 @@ export default {
 					f_id: this.queryInfo.f_id,
 					dver: this.queryInfo.dver,
 					// site_id: obj == undefined ? '' : obj.id,
-					site_id: id
+					site_id: id,
+					equip_type_id:3
 				})
 			}).then(
 				(res) => {
@@ -580,7 +580,8 @@ export default {
 								url: '/equipmanage_cbd',
 								data: this.qs.stringify({
 									req: 'paramconf',
-									id: id
+									id: id,
+									equip_type_id:3
 								})
 							}).then(
 								(res) => {

+ 854 - 0
bigdata2/src/pages/forecasting/cbd/gkcbd.vue

@@ -0,0 +1,854 @@
+<template>
+	<div v-loading="pageLoading">
+		<el-breadcrumb
+			separator-class="el-icon-arrow-right"
+			:class="'el-icon-arrow-right ' + (flag.flag == false ? 'breadcrumb_tab' : '')"
+		>
+			<el-breadcrumb-item>{{flag.siteNameTitle}}  高空测报灯</el-breadcrumb-item>
+		</el-breadcrumb>
+		<search-bar
+			@fun="getDisplayType"
+			@fun2="getIDName"
+			@fun3="getIsOnline"
+		></search-bar>
+		<div v-loading="tableLoading">
+			<template v-if="displayType == 1">
+				<el-row :gutter="10">
+					<el-col
+						:xs="24"
+						:sm="24"
+						:md="12"
+						:lg="8"
+						:xl="6"
+						v-for="item in equipList"
+						:key="item.imei"
+					>
+						<el-card class="box-card">
+							<equip-item :is_online="item.device_status">
+								<!-- <span slot="title">虫情测报</span> -->
+								<span slot="title">{{
+									(item.device_name == '' ? '无' : item.device_name) | ellipsis
+								}}</span>
+								<div slot="content" class="content">
+									<p>
+										<i class="iconfont icon-yonghu"></i>
+										设备ID:{{ item.device_id }}
+									</p>
+									<!-- <p :title="item.device_name">
+										<i class="iconfont icon-biaoqian"></i>
+										设备名称:{{
+											(item.device_name == '' ? '无' : item.device_name)
+												| ellipsis
+										}}
+									</p> -->
+									<p class="onlineState">
+										<i class="iconfont icon-diannao"></i>在线状态:
+										<span
+											:class="{
+												red: item.device_status == 0,
+												green: item.device_status == 1
+											}"
+											>{{ item.device_status == 0 ? '离线' : '在线' }}</span
+										>
+									</p>
+									<p>
+										<i class="iconfont icon-shijian"></i>
+										最新上报时间 : {{ item.status_time }}
+									</p>
+									<p>
+										<i class="iconfont icon-dizhi"></i>
+										地址 : {{ item.address || '无' }}
+									</p>
+									<p class="btns">
+										<i class="iconfont icon-yemiancaozuo"></i>
+										<!-- <el-button
+											size="mini"
+											type="info"
+											@click="viewPhotoDialog(item.device_id, item.d_id)"
+											>查看图片</el-button
+										> -->
+										<el-button
+											size="mini"
+											type="warning"
+											@click="EquipControl(item.device_id)"
+											>设备控制</el-button
+										>
+										<!-- <el-button size="mini" type="success" v-if="item.disc==1" @click="showTimeControlDialog(item.device_id)">害虫统计</el-button> -->
+										<!-- <el-button
+											size="mini"
+											type="success"
+											@click="
+												showTimeControlDialog(
+													item.device_id,
+													item.device_name,
+													item.address
+												)
+											"
+											>害虫统计</el-button
+										> -->
+										<el-button
+											size="mini"
+											type="danger"
+											@click="
+												dataDetails(
+													item.device_id,
+													item.device_name,
+													item.address
+												)
+											"
+											>数据详情</el-button
+										>
+									</p>
+								</div>
+							</equip-item>
+						</el-card>
+					</el-col>
+				</el-row>
+			</template>
+			<template v-if="displayType == 2">
+				<el-card class="box-card">
+					<el-table :data="equipList" stripe style="width: 100%">
+						<el-table-column prop="device_id" label="设备ID" width="180">
+							<template slot-scope="scope">{{ scope.row.device_id }}</template>
+						</el-table-column>
+						<el-table-column prop="device_name" label="设备名称" width="180">
+							<template slot-scope="scope">{{
+								scope.row.device_name == '' ? '无' : scope.row.device_name
+							}}</template>
+						</el-table-column>
+						<el-table-column prop="device_status" label="在线状态">
+							<template slot-scope="scope">
+								<p style="color: #17bb89" v-if="scope.row.device_status == 1">
+									在线
+								</p>
+								<p style="color: #eb6765" v-if="scope.row.device_status == 0">
+									离线
+								</p>
+							</template>
+						</el-table-column>
+						<el-table-column prop="address" label="地址">
+							<template slot-scope="scope">
+								{{ scope.row.address == '' ? '暂无地址' : scope.row.address }}
+							</template>
+						</el-table-column>
+						<el-table-column prop="status_time" label="最新上报时间">
+							<template slot-scope="scope">{{
+								scope.row.status_time
+							}}</template>
+						</el-table-column>
+						<el-table-column label="操作" width="400">
+							<template slot-scope="scope">
+								<el-button
+									size="mini"
+									type="info"
+									@click="viewPhotoDialog(scope.row.device_id, scope.row.d_id)"
+									>查看图片</el-button
+								>
+								<el-button
+									size="mini"
+									type="warning"
+									@click="EquipControl(scope.row.d_id)"
+									>设备控制</el-button
+								>
+								<el-button
+									size="mini"
+									type="success"
+									@click="
+										showTimeControlDialog(
+											scope.row.device_id,
+											scope.row.device_name,
+											scope.row.address
+										)
+									"
+									>害虫统计</el-button
+								>
+								<el-button
+									size="mini"
+									type="danger"
+									@click="
+										dataDetails(
+											scope.row.device_id,
+											scope.row.device_name,
+											scope.row.address
+										)
+									"
+									>数据详情</el-button
+								>
+							</template>
+						</el-table-column>
+					</el-table>
+				</el-card>
+			</template>
+			<!-- 暂无数据 -->
+			<div
+				class="expertDiagnosis_referral_units_not"
+				v-if="equipList.length <= 0 && displayType == 1"
+			>
+				<img
+					src="@/assets/images/zanwu.png"
+					alt
+					class="expertDiagnosis_referral_units_notImg"
+				/>
+			</div>
+		</div>
+
+		<el-pagination
+			v-if="equipList.length > 0"
+			background
+			:page-size="8"
+			layout="prev, pager, next"
+			:total="totalNum"
+			:current-page="queryInfo.page"
+			@current-change="changePage"
+		></el-pagination>
+		<!-- 设备控制对话框 -->
+		<el-dialog
+			title="设备控制"
+			:visible.sync="equipControlDialogVisible"
+			@close="resetEquipControlDialogClosed"
+			width="600px"
+		>
+			<div class="handAddForm">
+				<el-form
+					ref="equipContrlRef"
+					:model="equipContrlForm"
+					label-position="right"
+					label-width="120px"
+				>
+					<el-form-item label="工作模式:" prop="ws">
+						<el-select
+							v-model="ws"
+							placeholder="请选择害虫名称"
+							@change="wsChange()"
+						>
+							<el-option label="节能" :value="0"></el-option>
+							<el-option label="常规" :value="1"></el-option>
+							<el-option label="加强" :value="2"></el-option>
+						</el-select>
+					</el-form-item>
+					<el-form-item label="定时模式:" prop="ts">
+						<el-select
+							v-model="equipContrlForm.ts"
+							placeholder="请选择害虫名称"
+						>
+							<el-option label="光控" :value="0"></el-option>
+							<el-option label="时控" :value="1"></el-option>
+						</el-select>
+					</el-form-item>
+					<el-form-item
+						v-if="equipContrlForm.ts == 1"
+						label="开始结束时间:"
+						prop="st"
+					>
+						<el-col :span="11">
+							<el-time-select
+								placeholder="起始时间"
+								v-model="equipContrlForm.st"
+								:picker-options="{
+									start: '00:00',
+									step: '01:00',
+									end: '24:00'
+								}"
+							></el-time-select>
+						</el-col>
+						<el-col class="line" :span="2">-</el-col>
+						<el-col :span="11">
+							<el-time-select
+								placeholder="结束时间"
+								v-model="equipContrlForm.et"
+								:picker-options="{
+									start: '00:00',
+									step: '01:00',
+									end: '24:00'
+								}"
+							></el-time-select>
+						</el-col>
+					</el-form-item>
+					<el-form-item
+						v-if="equipContrlForm.ts != 1"
+						label="定时时长:"
+						prop="tt"
+					>
+						<div class="sliderParent">
+							<div class="block">
+								<el-slider
+									v-model="equipContrlForm.tt"
+									show-input
+									:min="1"
+									:max="10"
+								></el-slider>
+							</div>
+						</div>
+					</el-form-item>
+					<el-form-item label="落虫时间:" prop="collt">
+						<div class="sliderParent">
+							<div class="block">
+								<el-slider
+									v-model="equipContrlForm.collt"
+									show-input
+									:min="1"
+									:max="20"
+								></el-slider>
+							</div>
+						</div>
+					</el-form-item>
+					<el-form-item label="加热时间:" prop="htim">
+						<div class="sliderParent">
+							<div class="block">
+								<el-slider
+									v-model="equipContrlForm.htim"
+									show-input
+									:min="1"
+									:max="20"
+								></el-slider>
+							</div>
+						</div>
+					</el-form-item>
+					<el-form-item label="加热温度:" prop="hst">
+						<div class="sliderParent">
+							<div class="block">
+								<el-slider
+									v-model="equipContrlForm.hst"
+									show-input
+									:min="75"
+									:max="120"
+								></el-slider>
+							</div>
+						</div>
+					</el-form-item>
+					<el-form-item label="高温保护阈值:" prop="tph">
+						<div class="sliderParent">
+							<div class="block">
+								<el-slider
+									v-model="equipContrlForm.tph"
+									show-input
+									:min="50"
+									:max="70"
+								></el-slider>
+							</div>
+						</div>
+					</el-form-item>
+					<el-form-item label="低温保护阈值:" prop="tpl">
+						<div class="sliderParent">
+							<div class="block">
+								<el-slider
+									v-model="equipContrlForm.tpl"
+									show-input
+									:min="1"
+									:max="10"
+								></el-slider>
+							</div>
+						</div>
+					</el-form-item>
+					<el-form-item label="数据上传间隔:" prop="datt">
+						<div class="sliderParent">
+							<div class="block">
+								<el-slider
+									v-model="equipContrlForm.datt"
+									:step="10"
+									show-input
+									:min="10"
+									:max="60"
+								></el-slider>
+							</div>
+						</div>
+					</el-form-item>
+					<el-form-item label="图片分辨率:" prop="imgres">
+						<el-select
+							v-model="equipContrlForm.imgres"
+							placeholder="请选择害虫名称"
+						>
+							<el-option label="高" :value="0"></el-option>
+							<el-option label="中" :value="1"></el-option>
+							<el-option label="低" :value="2"></el-option>
+						</el-select>
+					</el-form-item>
+					<el-form-item class="handAddFormBtn">
+						<el-button type="primary" size="mini" @click="equipControlSubm()"
+							>确定</el-button
+						>
+						<el-button size="mini" @click="equipControlDialogVisible = false"
+							>取消</el-button
+						>
+					</el-form-item>
+				</el-form>
+			</div>
+		</el-dialog>
+		<!-- 管理员操作弹框 -->
+		<el-dialog title="信息" :visible.sync="operationDialogVisible" width="30%">
+			<el-divider content-position="left">强制操作</el-divider>
+			<el-row>
+				<el-button
+					type="primary"
+					size="mini"
+					@click="equipBtnControl('takephoto')"
+					>拍照</el-button
+				>
+				<el-button type="primary" size="mini" @click="equipBtnControl('update')"
+					>升级</el-button
+				>
+				<el-button type="primary" size="mini" @click="equipBtnControl('reboot')"
+					>重启</el-button
+				>
+				<el-button
+					type="primary"
+					size="mini"
+					@click="equipBtnControl('open_shake')"
+					>震动开启</el-button
+				>
+				<el-button
+					type="primary"
+					size="mini"
+					@click="equipBtnControl('close_shake')"
+					>震动关闭</el-button
+				>
+			</el-row>
+			<el-divider content-position="left">板子设置</el-divider>
+			<el-row>
+				<el-button type="primary" size="mini">查看原始imei</el-button>
+				<el-button type="primary" size="mini">更改imei</el-button>
+			</el-row>
+		</el-dialog>
+	</div>
+</template>
+<script>
+import SearchBar from '@/components/SearchBar'
+import EquipItem from '@/components/EquipItem'
+export default {
+	props: {
+		flag: {
+			flag: Boolean,
+			siteID: Number,
+			siteNameTitle:String
+		},
+	},
+	data() {
+		return {
+			//图表和表格切换
+			displayType: '1',
+			//设备列表
+			equipList: [],
+			// 设备加载loading
+			tableLoading: false,
+			pageLoading: false,
+			device_id: '',
+			currid: '', //选中配置设备id
+			ws: 0, //工作模式
+			equipContrlForm: {
+				st: '',
+				et: '',
+				ts: 0,
+				tt: null,
+				collt: null,
+				htim: null,
+				hst: null,
+				tph: null,
+				tpl: null,
+				datt: null,
+				imgres: 0
+			},
+			//参数
+			queryInfo: {
+				page: 1,
+				is_online: '',
+				f_id: '',
+				ename: ''
+			},
+			totalNum: 0,
+			//设备控制对话框
+			equipControlDialogVisible: false,
+			operationDialogVisible: false,
+			objData: {}
+		}
+	},
+	mounted() {
+		this.getEquipList()
+	},
+	computed: {
+		userType: function () {
+			//获取用户类型
+			return window.sessionStorage.getItem('myuser_type')
+		}
+	},
+	methods: {
+		getIsOnline(data) {
+			this.queryInfo.is_online = data
+			this.queryInfo.page = 1
+			this.getEquipList()
+		},
+		getIDName(data) {
+			this.queryInfo.f_id = data.f_id
+			this.queryInfo.ename = data.ename
+			this.queryInfo.page = 1
+			this.getEquipList()
+		},
+		getDisplayType(data) {
+			this.displayType = data
+		},
+		//获取设备列表
+		getEquipList(obj, page) {
+			if (obj) {
+				this.queryInfo.page = page
+				this.objData = obj
+			}
+
+			var id = ''
+			if (this.objData !== undefined) {
+				id = this.objData.id
+			} else if (obj !== undefined) {
+				id = obj.id
+			}
+			this.tableLoading = true
+			this.$axios({
+				method: 'POST',
+				url: '/equipmanage_cbd',
+				data: this.qs.stringify({
+					req: 'filter',
+					page: this.queryInfo.page,
+					is_online: this.queryInfo.is_online,
+					ename: this.queryInfo.ename,
+					f_id: this.queryInfo.f_id,
+					dver: this.queryInfo.dver,
+					// site_id: obj == undefined ? '' : obj.id,
+					site_id: id,
+					equip_type_id:8
+				})
+			}).then(
+				(res) => {
+					this.tableLoading = false
+					if (res.status == 200) {
+						var dataArr = []
+						var dat = res.data.dat
+						for (var i = 0; i < dat.length; i++) {
+							dataArr.push({
+								address: dat[i].locat,
+								device_id: dat[i].equip_id,
+								device_name: dat[i].equip_name,
+								device_status: parseInt(dat[i].is_online),
+								status_time: dat[i].upl_time
+							})
+						}
+						this.equipList = dataArr
+						this.totalNum = res.data.nums
+					}
+				},
+				(error) => {
+					this.dataloading = false
+					this.$message.error('获取失败')
+				}
+			)
+		},
+		//改变page
+		changePage(val) {
+			this.queryInfo.page = val
+			this.getEquipList()
+		},
+		// 数据详情
+		dataDetails(e_id, name, address) {
+			this.device_id = e_id
+			this.$router.push({
+				path: `/index/cbdDataDetails`,
+				query: { id: e_id, name, address }
+			})
+		},
+		// 查看图片
+		viewPhotoDialog(id, d_id) {
+			this.device_id = id
+			this.$router.push({
+				path: `/index/cbdDataPhotos/${id}`,
+				query: { d_id: d_id }
+			})
+		},
+		//设备控制
+		EquipControl(id) {
+			this.currid = id
+			this.pageLoading = true
+			this.$axios({
+				method: 'POST',
+				url: '/cbd_mqtt',
+				data: this.qs.stringify({
+					req: 'read',
+					topicid: id,
+					kind: 'paramconf'
+				})
+			}).then(
+				(res) => {
+					if (res.data == 0) {
+						setTimeout(() => {
+							this.$axios({
+								method: 'POST',
+								url: '/equipmanage_cbd',
+								data: this.qs.stringify({
+									req: 'paramconf',
+									id: id,
+									equip_type_id:8
+								})
+							}).then(
+								(res) => {
+									this.pageLoading = false
+									if (res.data.paramconf) {
+										this.equipContrlForm = eval('(' + res.data.paramconf + ')')
+									} else {
+										this.equipContrlForm = {
+											collt: 10,
+											datt: 20,
+											et: 6,
+											hst: 85,
+											htim: 10,
+											shake: 0,
+											shake_sec: 1,
+											st: 20,
+											tph: 70,
+											tpl: 5,
+											ts: 1,
+											tt: 8,
+											imgres: 1
+										}
+									}
+									this.equipControlDialogVisible = true
+								},
+								(error) => {
+									this.pageLoading = false
+									this.$message({
+										type: 'error',
+										message: '请求失败'
+									})
+								}
+							)
+						}, 3000)
+					}
+				},
+				(error) => {
+					this.pageLoading = false
+					this.$message({
+						type: 'error',
+						message: '请求失败'
+					})
+				}
+			)
+		},
+		//设备控制提交
+		equipControlSubm() {
+			var dat = {
+				dropTime: this.equipContrlForm.collt,
+				dataUpTime: this.equipContrlForm.datt,
+				end: this.equipContrlForm.et,
+				calefactionTemperature: this.equipContrlForm.hst,
+				calefactionTime: this.equipContrlForm.htim,
+				begin: this.equipContrlForm.st,
+				highLimit: this.equipContrlForm.tph,
+				lowLimit: this.equipContrlForm.tpl,
+				timing: this.equipContrlForm.ts,
+				timingLength: this.equipContrlForm.tt,
+				imgres: this.equipContrlForm.imgres,
+				id: this.currid,
+				req: 'set'
+			}
+			this.$axios({
+				method: 'POST',
+				url: '/cbd_mqtt',
+				data: this.qs.stringify(dat)
+			}).then((res) => {
+				if (res.data == 0) {
+					this.$message.success('设备控制修改成功')
+					this.equipControlDialogVisible = false
+				} else {
+					this.$message.error('设备控制修改失败')
+				}
+			})
+		},
+		resetEquipControlDialogClosed() {
+			this.$refs.equipContrlRef.resetFields()
+			this.ws = 0
+		},
+		//害虫统计
+		showTimeControlDialog(id, name, address) {
+			this.device_id = id
+			console.log(name)
+			console.log(address)
+			this.$router.push({
+				path: '/index/pestsStats/',
+				query: { id: id, name: name, address: address }
+			})
+		},
+		//设备控制->工作模式切换
+		wsChange() {
+			this.$confirm('确定修改工作模式?', '提示', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning'
+			})
+				.then(() => {
+					this.$axios({
+						method: 'POST',
+						url: '/api_gateway?method=forecast.send_control.device_control',
+						data: this.qs.stringify({
+							device_type_id: 3,
+							d_id: this.d_id,
+							work_type: this.ws
+						})
+					}).then((res) => {
+						if (res.data.message == '') {
+							this.$message({
+								type: 'success',
+								message: '修改成功!'
+							})
+						} else {
+							this.$message({
+								type: 'error',
+								message: res.data.message
+							})
+						}
+					})
+				})
+				.catch(() => {
+					this.$message({
+						type: 'info',
+						message: '已取消修改'
+					})
+				})
+		},
+		equipOperation(d_id) {
+			this.d_id = d_id
+			this.operationDialogVisible = true
+		},
+		equipBtnControl(cmd) {
+			this.$axios({
+				method: 'POST',
+				url: '/api_gateway?method=forecast.send_control.admin_device_control',
+				data: this.qs.stringify({
+					cmd,
+					device_type_id: 3,
+					d_id: this.d_id
+				})
+			}).then((res) => {
+				if (res.data.message == '') {
+					this.$message.success('指令下发成功!')
+				}
+			})
+		}
+	},
+	components: {
+		SearchBar,
+		EquipItem
+	},
+	filters: {
+		ellipsis(value) {
+			if (!value) return ''
+			if (value.length > 20) {
+				return value.slice(0, 20) + '...'
+			}
+			return value
+		}
+	}
+}
+</script>
+<style lang="less" scoped>
+.handAddForm {
+	/deep/.el-form-item {
+		margin-bottom: 8px;
+	}
+	.handAddFormBtn {
+		text-align: right;
+	}
+}
+.sliderParent {
+	display: flex;
+	.block {
+		flex: 1;
+		margin-right: 10px;
+		/deep/.el-slider__runway,
+		/deep/.el-slider__bar {
+			height: 10px;
+		}
+	}
+	> span {
+		width: 40px;
+	}
+}
+.swi-box {
+	text-align: center;
+	padding: 10px 0;
+	label {
+		color: #333;
+		margin-right: 8px;
+		font-size: 14px;
+	}
+	i.el-icon-edit {
+		margin-right: 8px;
+	}
+}
+
+.real-time {
+	display: flex;
+	justify-content: left;
+	align-items: center;
+	padding: 20px 0;
+	.left {
+		margin-right: 10px;
+		.icon-box {
+			border-radius: 50%;
+			width: 46px;
+			height: 46px;
+			padding: 5px;
+			box-sizing: border-box;
+			margin-bottom: 3px;
+			img {
+				width: 100%;
+				height: auto;
+			}
+		}
+		.aisle {
+			text-align: center;
+			font-size: 14px;
+			color: #666;
+		}
+	}
+	.right {
+		color: #333;
+		.num {
+			font-weight: 600;
+			font-size: 20px;
+			margin-bottom: 3px;
+		}
+		.unit {
+			font-size: 14px;
+			color: #666;
+		}
+	}
+}
+.checkData {
+	text-align: right;
+	font-size: 14px;
+	span {
+		cursor: pointer;
+	}
+}
+.red {
+	color: rgb(235, 103, 101);
+}
+.green {
+	color: rgb(23, 187, 137);
+}
+.el-date-editor--time-select {
+	width: 100% !important;
+}
+.el-form .line {
+	text-align: center;
+}
+.el-select {
+	width: 100%;
+}
+.onlineState .icon-diannao {
+	margin: 0 21px 0 -2px !important;
+}
+// 暂无数据
+.expertDiagnosis_referral_units_not {
+	width: 272px;
+	margin: 0 auto;
+}
+
+.breadcrumb_tab {
+	top: 60px !important;
+}
+</style>

+ 71 - 12
bigdata2/src/pages/forecasting/xycb/xycb.vue

@@ -1,7 +1,7 @@
 <template>
 	<div>
 		<el-breadcrumb separator-class="el-icon-arrow-right" :class="'el-icon-arrow-right '+ (flag.flag == false ? 'breadcrumb_tab' : '')">
-			<el-breadcrumb-item>智能性诱测报 </el-breadcrumb-item>
+			<el-breadcrumb-item>{{flag.siteNameTitle}} 智能性诱测报</el-breadcrumb-item>
 		</el-breadcrumb>
 		<SearchBar @fun="getDisplayType" @fun2="getIDName" @fun3="getIsOnline">
 		</SearchBar>
@@ -46,11 +46,13 @@
 									</p>
 									<p>
 										<i class="iconfont icon-chouchongbug"></i>
-										监测害虫名称 : {{ item.pest_name || '未填写' }}
+										监测害虫名称 : {{ item.pest_name }}
+										<!-- || '未填写'  -->
 										<span
-											@click="setName(item.imei, item.pest_name)"
+											@click="setName(item.imei, item.pest_name)" 
 											class="el-icon-edit"
 										></span>
+										
 									</p>
 									<p>
 										<i class="iconfont icon-shijian"></i>
@@ -84,7 +86,7 @@
 										<el-button
 											size="mini"
 											type="warning"
-											@click="dataDetails(item.imei, item.equip_name)"
+											@click="dataDetails(item.imei, item.equip_name,item.pest_name )"
 											>数据详情</el-button
 										>
 									</p>
@@ -139,7 +141,7 @@
 								<el-button
 									size="mini"
 									type="warning"
-									@click="dataDetails(scope.row.imei, scope.row.equip_name)"
+									@click="dataDetails(scope.row.imei, scope.row.equip_name,item.pest_name)"
 									>数据详情</el-button
 								>
 							</template>
@@ -227,11 +229,23 @@
 			:visible.sync="setNameDialogVisible"
 			width="420px"
 		>
-			<el-form ref="form" :model="xyform" label-width="130px">
+			<!-- <el-form ref="form" :model="xyform" label-width="130px">
 				<el-form-item label="监测害虫名称:">
 					<el-input v-model="xyform.name"></el-input>
 				</el-form-item>
-			</el-form>
+			</el-form> -->
+			<div class="setpestname">
+				<div style="margin-right:20px">监测害虫名称:</div>
+				<el-select v-model="value" placeholder="请选择">
+					<el-option
+					v-for="item in options"
+					:key="item.value"
+					:label="item.label"
+					:value="item.label">
+					</el-option>
+				</el-select>
+			</div>
+			
 			<span slot="footer" class="dialog-footer">
 				<el-button @click="setNameDialogVisible = false">取 消</el-button>
 				<el-button type="primary" @click="setNameSubm()">确 定</el-button>
@@ -456,11 +470,38 @@ export default {
 	props: {
 		flag: {
 			flag: Boolean,
-			siteID: Number
+			siteID: Number,
+			siteNameTitle:String
 		},
 	},
 	data() {
 		return {
+		options: [{
+			value: '1',
+			label: '草地贪夜蛾'
+			}, {
+			value: '2',
+			label: '斜纹夜蛾'
+			}, {
+			value: '3',
+			label: '棉铃虫'
+			}, {
+			value: '4',
+			label: '甜菜夜蛾'
+			}, {
+			value: '5',
+			label: '玉米螟'
+			},{
+			value: '6',
+			label: '地老虎'
+			},{
+			value: '7',
+			label: '二点委夜蛾'
+			},{
+			value: '8',
+			label: '玉米粘虫'
+        }],
+        value: '',
 			newtime: '',
 			//图表和表格切换
 			displayType: '1',
@@ -584,6 +625,9 @@ export default {
 			this.d_id = id
 			this.xyform.name = name
 			this.setNameDialogVisible = true
+			if(this.xyform.name!=""){
+				this.value = this.xyform.name
+			}
 		},
 		//诱芯更换时间
 		setTime(id, core) {
@@ -593,12 +637,18 @@ export default {
 		},
 		//诱芯更换诱虫名称
 		setNameSubm() {
+			if(this.value==''){
+				 this.$message('不能为空');
+				 return
+			}
+			console.log(this.value);
 			this.$axios({
 				method: 'POST',
 				url: '/ybq_pest_set',
 				data: this.qs.stringify({
 					e_id: this.d_id,
-					pest: this.xyform.name
+					// pest: this.xyform.name
+					pest:this.value
 				})
 			}).then((res) => {
 				if (res.data == 0) {
@@ -631,8 +681,11 @@ export default {
 		},
 		//获取设备列表
 		getEquipList(obj, page) {
+				console.log('obj',obj)
+				console.log('objData',this.objData)
+				console.log(this.objData)
+
 			if (obj) {
-				console.log(obj)
 				this.queryInfo.page = page
 				this.objData = obj
 			}
@@ -688,11 +741,11 @@ export default {
 			this.getEquipList()
 		},
 		// 数据详情
-		dataDetails(id, name) {
+		dataDetails(id, name,pest_name) {
 			this.currImei = id
 			this.$router.push({
 				path: `/index/xycbDataDetail/`,
-				query: { e_id: id, name: name }
+				query: { e_id: id, name: name ,pest_name:pest_name}
 			})
 		},
 		//sim卡状态
@@ -952,4 +1005,10 @@ export default {
 .breadcrumb_tab {
 	top: 60px !important;
 }
+
+.setpestname{
+	display: flex;
+	align-items: center;
+	// justify-content: space-between;
+}
 </style>

+ 5 - 1
bigdata2/src/pages/forecasting/xycb/xycbDataDetail.vue

@@ -92,6 +92,7 @@ export default {
 			isSelectYear:true,
 			device_model: 1, //性诱1型或II型
 			name:this.$route.query.name,
+			pest_name:this.$route.query.pest_name,
 			btnSelected: '',
 			lineTime: '',
 			dataTime: '',
@@ -513,7 +514,10 @@ export default {
 							align: 'left'
 						},
 						subtitle: {
-							text: ''
+							text: this.pest_name,
+							align: 'right',          //设置水平左对齐
+							x:0,
+							y:12,
 						},
 						xAxis: {
 							crosshair: true, //十字基准线

+ 6 - 0
bigdata2/src/router/index.js

@@ -24,6 +24,8 @@ const CbdHistoryData = () => import( /* webpackChunkName: "qxz" */ '@/Pages/fore
 const PestsStats = () => import( /* webpackChunkName: "qxz" */ '@/Pages/forecasting/cbd/PestsStats')
 const MessageWarn = () => import( /* webpackChunkName: "qxz" */ '@/Pages/forecasting/cbd/MessageWarn')
 
+//---------------------------------------测报模块-----------------------------高空测报灯-------------------------
+const gkcbd = () => import( /* webpackChunkName: "bzy" */ '@/Pages/forecasting/cbd/gkcbd')
 
 //---------------------------------------测报模块-----------------------------孢子仪-------------------------
 const Bzy = () => import( /* webpackChunkName: "bzy" */ '@/Pages/forecasting/bzy/Bzy')
@@ -68,6 +70,10 @@ export default new Router({
         component: Cbd
       },
       {
+        path:'gkcbd',
+        component:gkcbd
+      },
+      {
         path: 'cbdDataDetails',
         component: CbdDataDetails
       },