From 4d8ef5d02421b1bb60f575e56b75d43a1ea4c2bb Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 15 Jun 2021 14:56:47 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/pyhmap
---
widgets/instructions/Widget.js | 123 ++++++++++++++++++++++++++++++++++++----
1 files changed, 110 insertions(+), 13 deletions(-)
diff --git a/widgets/instructions/Widget.js b/widgets/instructions/Widget.js
index 7e580d1..034a3f0 100644
--- a/widgets/instructions/Widget.js
+++ b/widgets/instructions/Widget.js
@@ -3,16 +3,16 @@
// 模块描述:显示坐标
///////////////////////////////////////////////////////////////////////////
define([
- 'dojo/_base/declare',
- 'dojo/_base/lang',
- 'dojo/_base/array',
- 'dojo/_base/html',
- 'dojo/topic',
- 'jimu/BaseWidget',
- 'jimu/utils',
- 'jimu/css!libs/zTree_v3/css/zTreeStyle/zTreeStyle.css',
- 'libs/zTree_v3/js/jquery.ztree.all'
-],
+ 'dojo/_base/declare',
+ 'dojo/_base/lang',
+ 'dojo/_base/array',
+ 'dojo/_base/html',
+ 'dojo/topic',
+ 'jimu/BaseWidget',
+ 'jimu/utils',
+ 'jimu/css!libs/zTree_v3/css/zTreeStyle/zTreeStyle.css',
+ 'libs/zTree_v3/js/jquery.ztree.all'
+ ],
function (declare,
lang,
array,
@@ -29,11 +29,109 @@
layers: {},
startup: function () {
// 暴露在外的接口
+ var that = this,
+ url = 'http://171.34.76.171:8880/pyh-station/metaWetlandProtect/queryNameAndIdAssembleMap',
+ token = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJlY2hpc2FuIiwic3ViIjoiYWRtaW4iLCJpYXQiOjE2MjMzOTIwNTcsImV4cCI6MTYyNTk4NDA1N30.wyhtQWDfyBM4Wvu9x_GpzWErqDkZ3J-PWEjyzoaHT9w6mMBenso5q0ZdnFueCZaCOjsHM5AMwLawATT0Zqc4aQ";
+ axios.get(url, {
+ headers: {
+ "token": token
+ }
+ }).then((res) => {
+ if (res.data.code == 200) {
+ var data = res.data.data;
+ // console.log(data, 99999);
+ that.beginLayuiDropdown(data)
+
+
+ }
+ })
},
+ beginLayuiDropdown: function (data) {
+ var that = this;
+ var d = [];
+ for (var k in data) {
+ var obj = {
+ title: data[k].NAME,
+ id: data[k].id,
+ }
+ if (data[k].seviceUrl) {
+ obj.src = data[k].seviceUrl
+ }
+ d.push(obj)
- closeToolBox: function (item) {
+
+ }
+ layui.use(['dropdown', 'util', 'layer', 'table'], function () {
+ var dropdown = layui.dropdown,
+ util = layui.util,
+ layer = layui.layer,
+ table = layui.table,
+ $ = layui.jquery;
+
+
+ dropdown.render({
+ elem: '.demo1',
+ data: d,
+ trigger: 'hover',
+ className: 'site-dropdown-demo',
+ click: function (obj) {
+ //点击事件
+ // layer.tips('点击了:' + obj.title, this.elem, { tips: [1, '#5FB878'] })
+ var str = obj.title;
+
+ $('.jimu-widget-instructions').find('.instructions-title').empty().append(str);
+
+ console.log(d, obj, 684)
+ for (var i = 0; i < d.length; i++) {
+ if (that['layer' + d[i].id]) {
+ that.map.imageryLayers.remove(that['layer' + d[i].id]);
+ }
+ }
+
+ if (obj.src) {
+ $.ajax({
+ url: obj.src + '/maps.json',
+ type: 'get',
+ dataType: 'JSON',
+ success: function (result) {
+
+ that['layer' + obj.id] = that.map.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({
+ url: result[0].path,
+ }));
+
+ that['layer' + obj.id].alpha = 1;
+
+ that['layer' + obj.id].getViewableRectangle().then(function (rectangle) {
+ return that.map.camera.flyTo({
+ destination: rectangle
+ });
+ });
+
+ }
+ })
+ } else {
+
+ layui.use(function () { //亦可加载特定模块:layui.use(['layer', 'laydate', function(){
+ //得到各种内置组件
+ var layer = layui.layer //弹层
+ // layer.msg('请先填写关键字', { icon: 1, time: 1000, shift: 6 });
+ layer.tips('暂无该服务', '.jimu-widget-instructions', {
+ tips: [2, '#FF5722']
+ });
+ })
+ }
+
+
+
+
+
+
+ }
+ });
+ });
},
+ closeToolBox: function (item) {},
onOpen: function () {
//面板打开的时候触发 (when open this panel trigger)
@@ -54,8 +152,7 @@
resize: function () {
},
- begin: function () {
- },
+ begin: function () {},
destroy: function () {
//销毁的时候触发
--
Gitblit v1.9.3