From 05383bf8baa1a173bbbd3af6ce211bc3e4f042aa Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 15 Jun 2021 16:54:50 +0800
Subject: [PATCH] 删除打印信息

---
 widgets/searchL/Widget.js |  210 +++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 181 insertions(+), 29 deletions(-)

diff --git a/widgets/searchL/Widget.js b/widgets/searchL/Widget.js
index e2bb50b..1f4ca0f 100644
--- a/widgets/searchL/Widget.js
+++ b/widgets/searchL/Widget.js
@@ -29,13 +29,14 @@
 			layers: {},
 			states: 'one',
 			searchDatas: '',
+			addOneEntitys: null,
 			startup: function () {
 				var that = this;
 
 				//关键词&&坐标
 				$("#i-f-gjz").click(function () {
 					that.states = 'one';
-					$("#i-f-zb").css({ 'backgroundColor': '#fff', 'color': '#000' });
+					$("#i-f-zb").css({ 'backgroundColor': '#fff', 'color': '#969696' });
 					$("#i-f-gjz").css({ 'backgroundColor': '#3E9FFC', 'color': '#fff' });
 					// $("#inputTwo").css({ 'display': 'none' });
 					// $("#local_data").css({ 'display': 'inline-block' });
@@ -44,7 +45,7 @@
 				})
 				$("#i-f-zb").click(function () {
 					that.states = 'two';
-					$("#i-f-gjz").css({ 'backgroundColor': '#fff', 'color': '#000' });
+					$("#i-f-gjz").css({ 'backgroundColor': '#fff', 'color': '#969696' });
 					$("#i-f-zb").css({ 'backgroundColor': '#3E9FFC', 'color': '#fff' });
 					// $("#local_data").css({ 'display': 'none' });
 					// $("#inputTwo").css({ 'display': 'inline-block' });
@@ -59,6 +60,9 @@
 						if (han.test(that.searchDatas) || that.searchDatas == '  ') {
 							that.getData(0, that.searchDatas);
 							$('.searchLMain').show();
+							$('.searchLMain').find('ul.layui-tab-title li:eq(0)').addClass('layui-this').siblings().removeClass('layui-this');
+							$('.searchLMain').find('div.layui-tab-content > div.layui-tab-item:eq(0)').addClass('layui-show').siblings().removeClass('layui-show');
+
 						} else {
 							layui.use(function () { //亦可加载特定模块:layui.use(['layer', 'laydate', function(){
 								//得到各种内置组件
@@ -72,6 +76,11 @@
 						}
 					} else {
 						if (that.searchDatas[0] && that.searchDatas[1]) {
+							that.map.camera.flyTo({
+								// destination: Cesium.Cartesian3.fromDegrees(Number(lng), Number(lat), Number(gaodu))
+								destination: Cesium.Cartesian3.fromDegrees(Number(that.searchDatas[0]), Number(that.searchDatas[1]), Number(8000))
+
+							});
 						} else {
 							layui.use(function () { //亦可加载特定模块:layui.use(['layer', 'laydate', function(){
 								//得到各种内置组件
@@ -86,6 +95,32 @@
 				})
 				$(".searchColce").click(function () {
 					$('.searchLMain').hide();
+					that.addOneEntitys.removeAll();
+				})
+
+				$("#local_data").keyup(function (e) {
+					console.log(e);
+					that.getInputData();
+					if (e.keyCode == 13 && typeof that.searchDatas == 'string') {
+						var han = /^[\u4e00-\u9fa5]+$/;
+						if (han.test(that.searchDatas) || that.searchDatas == '  ') {
+							that.getData(0, that.searchDatas);
+							$('.searchLMain').show();
+							$('.searchLMain').find('ul.layui-tab-title li:eq(0)').addClass('layui-this').siblings().removeClass('layui-this');
+							$('.searchLMain').find('div.layui-tab-content > div.layui-tab-item:eq(0)').addClass('layui-show').siblings().removeClass('layui-show');
+
+						} else {
+							layui.use(function () { //亦可加载特定模块:layui.use(['layer', 'laydate', function(){
+								//得到各种内置组件
+								var layer = layui.layer //弹层
+								// layer.msg('请先填写关键字', { icon: 1, time: 1000, shift: 6 });
+								layer.tips('请先填写关键字', '.searchImg', {
+									tips: [2, '#FF5722']
+								});
+							})
+							$('.searchLMain').hide();
+						}
+					}
 				})
 
 			},
@@ -126,7 +161,7 @@
 				})
 			},
 			createDatas: function (d, n) {
-				this.map.entities.removeAll();//清除图标点
+				this.addOneEntitys.removeAll();//清除图标点
 				if (d == []) {
 					if (n == 0) {
 						this.beginLayUi(d);
@@ -153,6 +188,9 @@
 				}
 			},
 			onOpen: function () {
+				var dataSourceOne = new Cesium.CustomDataSource();
+				this.addOneEntitys = dataSourceOne.entities;
+				this.map.dataSources.add(dataSourceOne);
 				//面板打开的时候触发
 				var that = this;
 				that.getData(0)
@@ -171,6 +209,75 @@
 						that.getData(val, that.searchDatas);
 					});
 				});
+
+				// 地图图标点击事件
+				this.movehandLer();
+			},
+			// 获取鼠标事件
+			movehandLer: function movehandLer() {
+				// 取消默认双击事件
+				this.map.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
+				// 获取鼠标事件
+				this.mountainHandler = new Cesium.ScreenSpaceEventHandler(this.map.scene.canvas);
+				// 给鼠标左键添加事件函数
+				// this.mountainHandler.setInputAction(lang.hitch(this, this.mouseMove), Cesium.ScreenSpaceEventType.MOUSE_MOVE);
+				this.mountainHandler.setInputAction(lang.hitch(this, this.clickHand), Cesium.ScreenSpaceEventType.LEFT_CLICK);
+			},
+			// 注册鼠标左键单击事件
+			clickHand: function clickHand(data) {
+				var pickedObjects = this.map.scene.drillPick(data.position);
+				var data = pickedObjects[0].primitive.id.onceData[1];
+				if (pickedObjects[0].primitive.id.onceData[0] == 1) {//全景
+					var address = data.panAddress;
+					var dom = $('.header'),
+						str = `${data.name}--全景`;
+					dom.empty();
+					dom.append(str);
+
+					dom = $('#poput-m-t-quanjing');
+					str = `<iframe id="poput-m-t-quanjing-iframe" src="${address}" frameborder="0"></iframe>`;
+					dom.empty();
+					dom.append(str);
+					$('.jimu-widget-searchTabaPopup').css({ 'display': 'block' });
+					$('.jimu-widget-searchTabaPopup').find('.p-main').eq(0).css({ 'display': 'block' }).siblings().css({ 'display': 'none' });
+				}
+				if (pickedObjects[0].primitive.id.onceData[0] == 2) {//视频
+					var dom = $('.header'),
+						str = `${data.name}--实时视频`;
+					dom.empty();
+					dom.append(str);
+					if (data.flv) {
+						dom = $('#poput-m-t-video');
+						str = `
+							<video id="poput-m-t-video-video" ></video>
+					`;
+						dom.empty();
+						dom.append(str);
+						if (flvjs.isSupported()) {
+							var videoElement = document.getElementById('poput-m-t-video-video');
+							var flvPlayer = flvjs.createPlayer({
+								type: 'flv',
+								url: data.flv
+							});
+							flvPlayer.attachMediaElement(videoElement);
+							flvPlayer.load();
+							flvPlayer.play();
+						}
+						window.$myVideoFlvplayer = flvPlayer;
+						// var time = setTimeout(() => {
+
+						// }, 2000);
+					} else {
+						var dom = $('#poput-m-t-video'),
+							str = `
+							<div id="poput-m-t-video-none" >·暂无视频</div>
+					`;
+						dom.empty();
+						dom.append(str);
+					}
+					$('.jimu-widget-searchTabaPopup').css({ 'display': 'block' });
+					$('.jimu-widget-searchTabaPopup').find('.p-main').eq(0).css({ 'display': 'block' }).siblings().css({ 'display': 'none' });
+				}
 			},
 
 			onClose: function () {
@@ -197,7 +304,7 @@
 			//定位实体位置
 			shiti: function (data, i) {
 				var imgs = i == 1 ? 'images/addL/全景.png' : i == 2 ? 'images/addL/监控.png' : i == 3 ? 'images/addL/监测.png' : '';
-				this.map.entities.add({
+				this.addOneEntitys.add({
 					id: data.id, // 实体ID
 					name: data.name, // 实体名称
 					position: Cesium.Cartesian3.fromDegrees(Number(data.lon), Number(data.lat)), // x,y 实体经纬度
@@ -228,10 +335,12 @@
 						heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
 						disableDepthTestDistance: Number.POSITIVE_INFINITY,
 						// rotation: Cesium.Math.toRadians(angle),
-					}
+					},
+					onceData: [i, data]
 				})
 			},
 			beginLayUi: function (data = 1, data1 = 1, data2 = 1) {
+				// console.log(data,data1,data2)
 				var that = this;
 				layui.use(function () {
 					var element = layui.element
@@ -242,8 +351,7 @@
 
 						table.render({
 							elem: '#test'
-							// , url: './data'
-							, height: 475
+							// , url: './data'全景
 							, page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
 								// layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
 								layout: ['count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
@@ -254,9 +362,9 @@
 							}
 							, cols: [[
 								{ field: 'tableId', width: 59, align: 'center', unresize: true, title: '序号' }
-								, { field: 'name', width: 90, align: 'center', unresize: true, title: '图层名称' }
-								, { field: 'remarks', width: 95, align: 'center', unresize: true, title: '图层属性1' }
-								, { field: 'createTime', width: 95, align: 'center', unresize: true, title: '图层属性2' }
+								, { field: 'name', width: 90, align: 'center', unresize: true, title: '名称' }
+								, { field: 'protectArea', width: 95, align: 'center', unresize: true, title: '所属保护区' }
+								, { field: 'remarks', width: 95, align: 'center', unresize: true, title: '备注' }
 								, { fixed: 'right', align: 'center', unresize: true, title: '操作', toolbar: '#demoTable' }
 							]],
 							data: data,
@@ -280,10 +388,10 @@
 						});
 					}
 					if (data1 != 1) {
+
 						table.render({
 							elem: '#test1'
-							// , url: './data'
-							, height: 475
+							// , url: './data'//监控
 							, page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
 								// layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
 								layout: ['count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
@@ -294,9 +402,9 @@
 							}
 							, cols: [[
 								{ field: 'tableId', width: 59, align: 'center', unresize: true, title: '序号' }
-								, { field: 'name', width: 90, align: 'center', unresize: true, title: '图层名称' }
-								, { field: 'protectName', width: 95, align: 'center', unresize: true, title: '图层属性1' }
-								, { field: 'serviceUrl', width: 95, align: 'center', unresize: true, title: '图层属性2' }
+								, { field: 'name', width: 90, align: 'center', unresize: true, title: '站点' }
+								, { field: 'protectName', width: 95, align: 'center', unresize: true, title: '所属保护区' }
+								, { field: 'remark', width: 95, align: 'center', unresize: true, title: '备注' }
 								, { fixed: 'right', align: 'center', unresize: true, title: '操作', toolbar: '#demoTable1' }
 							]],
 							data: data1,
@@ -311,17 +419,39 @@
 							var data = obj.data //获得当前行数据
 								, layEvent = obj.event; //获得 lay-event 对应的值
 							if (layEvent === 'detail') {
-								//   layer.msg('查看操作');
-								var dom = $('#poput-m-t-video'),
-									str = `
-									<div class="header">${obj.data.name}--实时视频</div>
-									<video id="video1" class="video-js vjs-default-skin" width="100%" height="100%"
-										data-setup='{"controls" : true, "autoplay" : true, "preload" : "auto"}'>
-										<source src="${obj.data.flv}" type="video/x-flv">
-									</video>`;
+								var dom = $('.header'),
+									str = `${obj.data.name}--实时视频`;
 								dom.empty();
 								dom.append(str);
+								if (obj.data.flv) {
+									var dom = $('#poput-m-t-video'),
+										str = `
+											<video id="poput-m-t-video-video" ></video>
+									`;
+									dom.empty();
+									dom.append(str);
+									if (flvjs.isSupported()) {
+										var videoElement = document.getElementById('poput-m-t-video-video');
+										var flvPlayer = flvjs.createPlayer({
+											type: 'flv',
+											url: obj.data.flv
+										});
+										flvPlayer.attachMediaElement(videoElement);
+										flvPlayer.load();
+										flvPlayer.play();
+									}
+									window.$myVideoFlvplayer = flvPlayer;
+									// var time = setTimeout(() => {
 
+									// }, 2000);
+								} else {
+									var dom = $('#poput-m-t-video'),
+										str = `
+											<div id="poput-m-t-video-none" >·暂无视频</div>
+									`;
+									dom.empty();
+									dom.append(str);
+								}
 								$('.jimu-widget-searchTabaPopup').css({ 'display': 'block' });
 								$('.jimu-widget-searchTabaPopup').find('.p-main').eq(0).css({ 'display': 'block' }).siblings().css({ 'display': 'none' });
 							} else if (layEvent === 'edit') {
@@ -333,8 +463,7 @@
 
 						table.render({
 							elem: '#test2'
-							// , url: './data'
-							, height: 475
+							// , url: './data'//检测
 							, page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
 								// layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
 								layout: ['count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
@@ -345,9 +474,9 @@
 							}
 							, cols: [[
 								{ field: 'tableId', width: 59, align: 'center', unresize: true, title: '序号' }
-								, { field: 'name', width: 90, align: 'center', unresize: true, title: '图层名称' }
-								, { field: 'stcd', width: 95, align: 'center', unresize: true, title: '图层属性1' }
-								, { field: 'createTime', width: 95, align: 'center', unresize: true, title: '图层属性2' }
+								, { field: 'name', width: 90, align: 'center', unresize: true, title: '站点' }
+								, { field: 'wetlandName', width: 95, align: 'center', unresize: true, title: '所属保护区' }
+								, { field: 'remark', width: 95, align: 'center', unresize: true, title: '备注' }
 								, { fixed: 'right', align: 'center', unresize: true, title: '操作', toolbar: '#demoTable2' }
 							]],
 							data: data2,
@@ -358,6 +487,7 @@
 							, limit: 10 //每页默认显示的数量
 
 						});
+
 						table.on('tool(test2)', function (obj) { //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
 							var data = obj.data //获得当前行数据
 								, layEvent = obj.event; //获得 lay-event 对应的值
@@ -378,9 +508,15 @@
 							}
 						});
 					}
-
+					that.addTitle();
 					//…
 				});
+			},
+			addTitle: function () {
+				let tdom = $("[data-field]");
+				for (var i = 0; i < tdom.length; i++) {
+					$(tdom[i]).attr("title", $(tdom[i]).text())
+				}
 			},
 			setXiangqing(obj) {
 				var str = '';
@@ -449,6 +585,22 @@
 				})
 			},
 			setshishidata: function (data, stcd, id = '#shuiwenshishi') {
+				//给默认时间
+				var date = new Date();
+				var date1 = new Date(+new Date() + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '');
+				var myDate = date.setDate(date.getDate() - 7);
+				var date2 = new Date(+new Date(myDate) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '');
+				// console.log([date1, date2], 123456789);
+				//设置value
+				$('#test-startDate-1').val(date2);
+				$('#test-endDate-1').val(date1);
+				window.defultEchartsTimes = [date2, date1];
+				// var time = setTimeout(() => {
+				$('.jimu-widget-searchTabaPopup').find('#query').click();
+				// clearTimeout(time);
+				// time = null;
+				// }, 500);
+
 				var str = '',
 					shuiwenDom = $('.jimu-widget-searchTabaPopup').find(id)
 				shuiwenDom.empty();

--
Gitblit v1.9.3