From 25ce610f6ecca7325e7a743dc032c4a76559c63d Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 02 Jul 2021 09:10:26 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/pyhmap
---
widgets/instructions/Widget.js | 291 +++++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 195 insertions(+), 96 deletions(-)
diff --git a/widgets/instructions/Widget.js b/widgets/instructions/Widget.js
index 5308dce..526a624 100644
--- a/widgets/instructions/Widget.js
+++ b/widgets/instructions/Widget.js
@@ -3,110 +3,209 @@
// 模块描述:显示坐标
///////////////////////////////////////////////////////////////////////////
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'
-],
- function (declare,
- lang,
- array,
- html,
- topic,
- BaseWidget,
- aspect,
- string,
- utils
- ) {
- return declare([BaseWidget], {
- baseClass: 'jimu-widget-instructions',
- name: 'instructions',
- 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)
- }
- })
+ '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,
+ html,
+ topic,
+ BaseWidget,
+ aspect,
+ string,
+ utils
+ ) {
+ return declare([BaseWidget], {
+ baseClass: 'jimu-widget-instructions',
+ name: 'instructions',
+ layers: {},
+ startup: function () {
- },
- beginLayuiDropdown: function (data) {
- var d = [];
- for (var k in data) {
- d.push({
- title: data[k].name,
- id: data[k].id
- })
- }
- layui.use(['dropdown', 'util', 'layer', 'table'], function () {
- var dropdown = layui.dropdown
- , util = layui.util
- , layer = layui.layer
- , table = layui.table
- , $ = layui.jquery;
+ // 暴露在外的接口
+ 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;
+ that.beginLayuiDropdown(data)
- dropdown.render({
- elem: '.demo1'
- , data: d
- , 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);
-
-
- }
- });
- });
- },
- closeToolBox: function (item) {
- },
+ }
+ })
- onOpen: function () {
- //面板打开的时候触发 (when open this panel trigger)
- },
+ },
+ 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)
- onClose: function () {
- //面板关闭的时候触发 (when this panel is closed trigger)
- },
- onMinimize: function () {
- this.resize();
- },
+ }
+ layui.use(['dropdown', 'util', 'layer', 'table'], function () {
+ var dropdown = layui.dropdown,
+ util = layui.util,
+ layer = layui.layer,
+ table = layui.table,
+ $ = layui.jquery;
- onMaximize: function () {
- this.resize();
- },
- resize: function () {
+ 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;
- },
- begin: function () {
- },
+ $('.jimu-widget-instructions').find('.instructions-title').empty().append(str);
- destroy: function () {
- //销毁的时候触发
- //todo
- //do something before this func
- this.inherited(arguments);
- }
+ for (var i = 0; i < d.length; i++) {
+ var itemObj = {};
- });
- });
\ No newline at end of file
+ itemObj.src = d[i].src;
+
+ itemObj.title = d[i].title;
+
+ itemObj.id = 'layer' + d[i].id;
+
+
+ if (that[itemObj.id]) {
+
+ itemObj.alpha = that[itemObj.id].alpha;
+
+ that[itemObj.id].show = false;
+
+ topic.publish('removeItem', 'Layermanagement', itemObj);
+
+ }
+ }
+
+ if (obj.src) {
+
+ var itemObj = {};
+
+ itemObj.src = obj.src;
+
+ itemObj.title = obj.title;
+
+ itemObj.id = 'layer' + obj.id;
+
+
+ if (that[itemObj.id]) {
+
+ itemObj.alpha = that[itemObj.id].alpha;
+
+ that[itemObj.id].show = true;
+
+ that[itemObj.id].getViewableRectangle().then(function (rectangle) {
+ return that.map.camera.flyTo({
+ destination: rectangle
+ });
+ });
+
+ topic.publish('appendItem', 'Layermanagement', itemObj, that[itemObj.id]);
+
+ } else {
+ itemObj.alpha = 1;
+
+ $.ajax({
+ url: itemObj.src + '/maps.json',
+ type: 'get',
+ dataType: 'JSON',
+ success: function (result) {
+
+ that[itemObj.id] = that.map.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({
+ url: result[0].path,
+ }));
+
+ that[itemObj.id].alpha = 1;
+
+ topic.publish('appendItem', 'Layermanagement', itemObj, that[itemObj.id]);
+
+ that[itemObj.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)
+ },
+
+ onClose: function () {
+ //面板关闭的时候触发 (when this panel is closed trigger)
+ },
+
+ onMinimize: function () {
+ this.resize();
+ },
+
+ onMaximize: function () {
+ this.resize();
+ },
+
+ resize: function () {
+
+ },
+ begin: function () {},
+
+ destroy: function () {
+ //销毁的时候触发
+ //todo
+ //do something before this func
+ this.inherited(arguments);
+ }
+
+ });
+ });
\ No newline at end of file
--
Gitblit v1.9.3