From 8b483ff15d984ac88ede940ea80a50a1bee42ebb Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 11 Jun 2021 17:28:10 +0800
Subject: [PATCH] 目录树,中间搜索,下拉菜单,完善
---
widgets/LeftNavigationBar/Widget.js | 89 ++++++++++++++++-------------
widgets/instructions/Widget.js | 6 +
widgets/instructions/data.json | 46 +++++++++++++++
widgets/searchL/Widget.js | 25 ++++++++
4 files changed, 126 insertions(+), 40 deletions(-)
diff --git a/widgets/LeftNavigationBar/Widget.js b/widgets/LeftNavigationBar/Widget.js
index c9ef115..e0dcc05 100644
--- a/widgets/LeftNavigationBar/Widget.js
+++ b/widgets/LeftNavigationBar/Widget.js
@@ -61,6 +61,51 @@
});
$('#left-navigation-bar-main-search').click(() => { //搜索事件
+ leftSearchItemLayer()
+ })
+
+ $(".jimu-widget-LeftNavigationBar input[type='search']").bind('input propertychange', function () {
+ //做一些事情
+ var val = $(this).val();
+
+ if (val == '') {
+ that.changeData(that.dataAllArray, val); //重写数据
+ layui.use('tree', function () {
+ layui.tree.reload('demoId1', {
+ data: that.data
+ });
+
+ var jqDom = $("#left-tree-list > .layui-tree > div");
+
+ for (var i = 0; i < jqDom.length; i++) {
+ if ($(jqDom[i]).text().indexOf("三维倾斜数据") != -1) {
+ $(jqDom[i]).find('.layui-btn-group').remove()
+ }
+
+ var textList = $(jqDom[i]).find('.layui-tree-txt');
+
+ for (var j = 0; j < textList.length; j++) {
+ $(textList[j]).attr('title', $(textList[j]).text())
+
+ }
+
+ }
+ })
+ }
+
+ })
+
+ $(".jimu-widget-LeftNavigationBar input[type='search']").keyup(function (e) {
+ if (e.keyCode == 13) {
+ leftSearchItemLayer()
+ }
+ })
+
+ $(".jimu-widget-LeftNavigationBar .tree-layer-opcity .close").click(function () {
+ $(".jimu-widget-LeftNavigationBar .tree-layer-opcity").stop().hide();
+ })
+
+ function leftSearchItemLayer() {
var val = $('#left-navigation-bar-main-input').val();
if (val != '') {
var clearOur = () => {
@@ -119,43 +164,8 @@
useit(that.data);
})
- } else {}
- })
-
- $(".jimu-widget-LeftNavigationBar input[type='search']").bind('input propertychange', function () {
- //做一些事情
- var val = $(this).val();
-
- if (val == '') {
- that.changeData(that.dataAllArray, val); //重写数据
- layui.use('tree', function () {
- layui.tree.reload('demoId1', {
- data: that.data
- });
-
- var jqDom = $("#left-tree-list > .layui-tree > div");
-
- for (var i = 0; i < jqDom.length; i++) {
- if ($(jqDom[i]).text().indexOf("三维倾斜数据") != -1) {
- $(jqDom[i]).find('.layui-btn-group').remove()
- }
-
- var textList = $(jqDom[i]).find('.layui-tree-txt');
-
- for (var j = 0; j < textList.length; j++) {
- $(textList[j]).attr('title', $(textList[j]).text())
-
- }
-
- }
- })
}
-
- })
-
- $(".jimu-widget-LeftNavigationBar .tree-layer-opcity .close").click(function () {
- $(".jimu-widget-LeftNavigationBar .tree-layer-opcity").stop().hide();
- })
+ }
},
closeToolBox: function (item) {},
@@ -238,7 +248,7 @@
} else {
- if (that[a.id]) {
+ if (that[a.id]) {
that.map.imageryLayers.remove(that[a.id]);
}
@@ -250,7 +260,7 @@
b[k].children = [];
b[k].who = 'father';
inits(d[k].children, b[k].children)
- }
+ }
}
};
@@ -454,13 +464,14 @@
if (obj.checked == true) {
if (obj.data.model) {
+ that.map.scene.globe.depthTestAgainstTerrain = false;
var host = that.returnStr(obj.data.src).host;
var scene = that.map.scene;
var partOfUrl = that.returnStr(obj.data.src).partOfUrl;
//添加S3M图层服务
that[obj.data.id] = scene.open(host + partOfUrl);
//定位到场景
-
+
Cesium.loadJson(host + partOfUrl + '/scenes.json').then(function (scenes) {
// var sname = scenes[0].name;
// Cesium.loadJson(host + partOfUrl + '/scenes/' + sname + '.json').then(function (jsonData) {
diff --git a/widgets/instructions/Widget.js b/widgets/instructions/Widget.js
index 5308dce..177b20e 100644
--- a/widgets/instructions/Widget.js
+++ b/widgets/instructions/Widget.js
@@ -42,6 +42,8 @@
var data = res.data.data;
// console.log(data, 99999);
that.beginLayuiDropdown(data)
+
+
}
})
@@ -70,7 +72,9 @@
// layer.tips('点击了:' + obj.title, this.elem, { tips: [1, '#5FB878'] })
var str = obj.title;
$('.jimu-widget-instructions').find('.instructions-title').empty().append(str);
-
+
+
+
}
});
diff --git a/widgets/instructions/data.json b/widgets/instructions/data.json
new file mode 100644
index 0000000..960bdde
--- /dev/null
+++ b/widgets/instructions/data.json
@@ -0,0 +1,46 @@
+{
+ "code": "200",
+ "data": [{
+ "id": "1",
+ "seviceUrl": "http://171.34.76.172:8090/iserver/services/map-PYHBHD_BJ/rest",
+ "NAME": "余干康山候鸟县级自然保护区"
+ },
+ {
+ "id": "2",
+ "seviceUrl": "http://171.34.76.172:8090/iserver/services/map-PYHBHD_BJ/rest",
+ "NAME": "东鄱阳湖国家湿地公园"
+ },
+ {
+ "id": "3",
+ "seviceUrl": "http://171.34.76.172:8090/iserver/services/map-PYHBHD_BJ/rest",
+ "NAME": "鄱阳湖南矶湿地国家级自然保护区"
+ },
+ {
+ "id": "4",
+ "seviceUrl": "http://171.34.76.172:8090/iserver/services/map-PYHBHD_BJ/rest",
+ "NAME": "鄱阳湖国家级自然保护区"
+ },
+ {
+ "id": "6",
+ "seviceUrl": "http://171.34.76.172:8090/iserver/services/map-PYHBHD_BJ/rest",
+ "NAME": "都昌候鸟省级自然保护区"
+ },
+ {
+ "id": "7",
+ "seviceUrl": "http://171.34.76.172:8090/iserver/services/map-PYHBHD_BJ/rest",
+ "NAME": "庐山星湖湾省级湿地公园"
+ },
+ {
+ "id": "8",
+ "seviceUrl": "http://171.34.76.172:8090/iserver/services/map-PYHBHD_BJ/rest",
+ "NAME": "都昌北鄱阳湖省级湿地公园"
+ },
+ {
+ "id": "9",
+ "seviceUrl": "",
+ "NAME": "五星白鹤保护小区"
+ }
+ ],
+ "success": true,
+ "message": "查询成功"
+}
\ No newline at end of file
diff --git a/widgets/searchL/Widget.js b/widgets/searchL/Widget.js
index 7a04cee..8218931 100644
--- a/widgets/searchL/Widget.js
+++ b/widgets/searchL/Widget.js
@@ -92,6 +92,31 @@
that.map.entities.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();
+ }
+ }
+ })
+
},
getInputData: function () {
if (this.states == 'one') {
--
Gitblit v1.9.3