|
|
var arr = [], obj = {}, zTreeObj, nNodes;
|
var url = "http://71.3.21.231:6080/arcgis/rest/services/DJBD_DN/YX2019NEW/ImageServer"
|
|
/**
|
* 获取权限
|
*/
|
var permissions = null;
|
var permissions = "edit";
|
function getPermissions() {
|
|
let url = IPurl + '/sys/menu/nav';
|
|
var p2 = "role:ztsj:list";
|
var p1 = "role:ztsj:edit";
|
|
$.ajax({
|
url: url,
|
type: "POST",
|
data: {},
|
async: false,
|
dataType: "JSON",
|
contentType: "application/json;charset=UTF-8",
|
success: function (data) {
|
|
if (data.permissions.indexOf(p1) > -1) {
|
permissions = "edit";
|
return;
|
}
|
if (data.permissions.indexOf(p2) > -1) {
|
permissions = "list";
|
return;
|
}
|
},
|
error: function () {
|
}
|
})
|
|
};
|
|
|
var setting = {
|
async: {
|
enable: true,
|
url: IPurl + "/spcData/queryMenu",
|
type: "get",
|
dataFilter: function (treeId, parentNode, childNodes) {
|
if (!parentNode)
|
return childNodes.Menu;
|
else {
|
var cc = _.filter(childNodes.Menu, function (value, key) {
|
return parentNode.id == value.pId;
|
})
|
return cc;
|
}
|
}
|
},
|
data: {
|
view: {
|
showLine: false,
|
|
},
|
simpleData: {
|
enable: true, //开启简单数据模式
|
// idkey: 'id',
|
// pIdkey: "parentLayerId",//节点数据中保存其父节点唯一标识的属性名称
|
// rootPid: 't1',
|
},
|
// key: {
|
// name: 'menuName'
|
// }
|
},
|
view: {
|
addHoverDom: addHoverDom,
|
removeHoverDom: removeHoverDom,
|
},
|
edit: {
|
enable: true,
|
showRemoveBtn: false,
|
showRenameBtn: false,
|
},
|
|
check: {
|
enable: true, //开启复选框
|
chkStyle: 'checkbox',
|
chkboxType: {
|
"Y": "ps",
|
"N": "ps"
|
},
|
// nocheckInherit: true
|
},
|
callback: {
|
onCheck: NodeCheckEvent,
|
onClick: ClickEvent,
|
beforeRightClick: zTreeBeforeRightClick,
|
// addDiyDom: addDiyDom
|
}
|
}
|
|
|
$(function () {
|
initTreeDom();
|
getPermissions();
|
})
|
|
// 查询专题菜单,初始化树结构
|
function initTreeDom() {
|
zTreeObj = $.fn.zTree.init($("#treeDemo"), setting) //初始化树
|
}
|
|
|
function PostAjax(url, data, callback) {
|
$.ajax({
|
url: url,
|
type: "POST",
|
data: data,
|
dataType: "JSON",
|
contentType: "application/json;charset=UTF-8",
|
success: function (data) {
|
callback && callback(data)
|
},
|
})
|
}
|
function GetAjax(url, data, callback) {
|
$.ajax({
|
url: url,
|
type: "get",
|
data: data,
|
dataType: "JSON",
|
contentType: "application/json;charset=UTF-8",
|
success: function (data) {
|
callback && callback(data);
|
}, error: function (e) {
|
console.log(e);
|
}
|
})
|
}
|
// 树的勾选事件
|
function NodeCheckEvent(e, treeId, treeNode) {
|
|
getMap().showOrHideZtms('fadeOutUp');
|
|
console.log(treeNode);
|
let obj = {
|
url: 'http://71.3.110.202:6080/arcgis/rest/services/HYHD/HAX/MapServer/0'
|
// url:treeNode.url
|
}
|
// 父节点
|
if (treeNode.isParent && treeNode.checked) {
|
EachChildNode(treeNode, addLayer);
|
}
|
|
if (treeNode.isParent && treeNode.checked == false) {
|
// EachChildNode(treeNode, Removelayer)
|
EachChildNode(treeNode, addLayer);
|
}
|
// 子节点
|
if (treeNode.isParent == false && treeNode.checked) {
|
EachChildNode(treeNode, addLayer);
|
}
|
|
if (treeNode.isParent == false && treeNode.checked == false) {
|
// EachChildNode(treeNode, Removelayer)
|
EachChildNode(treeNode, addLayer);
|
}
|
}
|
|
|
function EachChildNode(node, callback) {
|
// console.log(node.name);
|
if (node.children) {
|
node.children.map(function (item) {
|
EachChildNode(item, callback);
|
})
|
} else {
|
|
|
//查询元数据主要是服务地址
|
queryMetaDataSome(node.id, node.name, function (params) {
|
if (!params) {
|
layer.msg(node.name + "的元数据为空");
|
return;
|
}
|
var url = JSON.parse(params.metadata)["服务地址"];
|
if (url) {
|
let obj = {
|
// url: 'http://71.3.110.202:6080/arcgis/rest/services/HYHD/HAX/MapServer/0'
|
url: url,
|
tcbh: node.id,
|
checked: node.checked,
|
node: node
|
}
|
callback && callback(obj);
|
}
|
else {
|
layer.msg("数据服务地址为空或格式不对!");
|
}
|
let option = {
|
id: node.id + "_TC",
|
url: url
|
}
|
checkLayer(option, node.checked);
|
});
|
}
|
}
|
var layerID = [];
|
var layer = [];
|
function checkLayer(option, checked) {
|
// var option = {
|
// id:"13_TC",
|
// url:"http://71.3.110.202:6080/arcgis/rest/services/HYHD/HYQS/MapServer/0"
|
// }
|
if (checked) {
|
// addLayer_tc(option);
|
getMap().addLayer_tc(option)
|
} else {
|
// removeLayer_tc(option);
|
getMap().removeLayer_tc(option);
|
}
|
}
|
|
function ClickEvent(event, treeid, treeNode) {
|
// if (treeNode.isParent) return;
|
// if (treeNode.pId == null) {
|
// $('.tab').hide()
|
// return
|
// }
|
// $('.tab').show()
|
// //查询元数据
|
// querymetadata(treeNode.id, treeNode.name)
|
// $('.tab table').attr('data-treeid', treeNode.id)
|
|
getMap().showOrHideZtms('fadeOutUp');
|
|
document.getElementById("iframeMap").contentWindow.ClickEvent(event, treeid, treeNode)
|
}
|
|
var template = `
|
<tr><td><input type="text" value="名称" style="width:90% !important"/><span style="color:red;font-weight:800;font-size:22px">*</span></td><td contenteditable="true" style="border: solid gray 1px;" ><input type="text" placeholder="请输入元数据值"/></td><td class="DelTr"><button>-</button></td></tr>
|
<tr><td><input type="text" value="空间覆盖范围" style="width:90% !important"/><span style="color:red;font-weight:800;font-size:22px">*</span></td><td contenteditable="true" style="border: solid gray 1px;"><input value="-" type="text" placeholder="请输入元数据值"/></td><td class="DelTr"><button>-</button></td></tr>
|
<tr><td><input type="text" value="水深覆盖范围" style="width:90% !important"/><span style="color:red;font-weight:800;font-size:22px">*</span></td><td contenteditable="true" style="border: solid gray 1px;"><input value="-" type="text" placeholder="请输入元数据值"/></td><td class="DelTr"><button>-</button></td></tr>
|
<tr><td><input type="text" value="时间覆盖范围" style="width:90% !important"/><span style="color:red;font-weight:800;font-size:22px">*</span></td><td contenteditable="true" style="border: solid gray 1px;"><input value="-" type="text" placeholder="请输入元数据值"/></td><td class="DelTr"><button>-</button></td></tr>
|
<tr><td><input type="text" value="时空分辨率" style="width:90% !important"/><span style="color:red;font-weight:800;font-size:22px">*</span></td><td contenteditable="true" style="border: solid gray 1px;"><input value="-" type="text" placeholder="请输入元数据值"/></td> <td class="DelTr"><button>-</button></td></tr>
|
<tr><td><input type="text" value="摘要说明" style="width:90% !important"/><span style="color:red;font-weight:800;font-size:22px">*</span></td><td contenteditable="true" style="border: solid gray 1px;"><input type="text" placeholder="请输入元数据值"/></td> <td class="DelTr"><button>-</button></td></tr>
|
<tr><td><input type="text" value="访问限制" style="width:90% !important"/><span style="color:red;font-weight:800;font-size:22px">*</span></td><td contenteditable="true" style="border: solid gray 1px;"><input value="-" type="text" placeholder="请输入元数据值"/></td> <td class="DelTr"><button>-</button></td></tr>
|
<tr><td><input type="text" value="使用限制" style="width:90% !important"/><span style="color:red;font-weight:800;font-size:22px">*</span></td><td contenteditable="true" style="border: solid gray 1px;"><input value="-" type="text" placeholder="请输入元数据值"/></td> <td class="DelTr"><button>-</button></td></tr>
|
<tr><td><input type="text" value="坐标系" style="width:90% !important"/><span style="color:red;font-weight:800;font-size:22px">*</span></td><td contenteditable="true" style="border: solid gray 1px;"><input value="WGS84" type="text" placeholder="请输入元数据值"/></td> <td class="DelTr"><button>-</button></td></tr>
|
<tr><td><input type="text" value="要素类型" style="width:90% !important"/><span style="color:red;font-weight:800;font-size:22px">*</span></td><td contenteditable="true" style="border: solid gray 1px;"><input type="text" placeholder="请输入元数据值"/></td> <td class="DelTr"><button>-</button></td></tr>
|
<tr><td><input type="text" value="要素个数" style="width:90% !important"/><span style="color:red;font-weight:800;font-size:22px">*</span></td><td contenteditable="true" style="border: solid gray 1px;"><input type="text" placeholder="请输入元数据值"/></td> <td class="DelTr"><button>-</button></td></tr>
|
<tr><td><input type="text" value="数据来源" style="width:90% !important"/><span style="color:red;font-weight:800;font-size:22px">*</span></td><td contenteditable="true" style="border: solid gray 1px;"><input type="text" placeholder="请输入元数据值"/></td> <td class="DelTr"><button>-</button></td></tr>
|
<tr><td><input type="text" value="专题分类" style="width:90% !important"/><span style="color:red;font-weight:800;font-size:22px">*</span></td><td contenteditable="true" style="border: solid gray 1px;"><input type="text" placeholder="请输入元数据值"/></td> <td class="DelTr"><button>-</button></td></tr>
|
<tr><td><input type="text" value="更新频率" style="width:90% !important"/><span style="color:red;font-weight:800;font-size:22px">*</span></td><td contenteditable="true" style="border: solid gray 1px;"><input type="text" placeholder="请输入元数据值"/></td> <td class="DelTr"><button>-</button></td></tr>
|
<tr><td><input type="text" value="更新时间" style="width:90% !important"/><span style="color:red;font-weight:800;font-size:22px">*</span></td><td contenteditable="true" style="border: solid gray 1px;"><input value="2021/06/24" type="text" placeholder="请输入元数据值"/></td> <td class="DelTr"><button>-</button></td></tr>
|
<tr><td><input type="text" value="维护人" style="width:90% !important"/><span style="color:red;font-weight:800;font-size:22px">*</span></td><td contenteditable="true" style="border: solid gray 1px;"><input value="郭雪" type="text" placeholder="请输入元数据值"/></td> <td class="DelTr"><button>-</button></td></tr>
|
<tr><td><input type="text" value="服务地址" style="width:90% !important"/></td><td contenteditable="true" style="border: solid gray 1px;"><input type="text" placeholder="请输入元数据值"/></td> <td class="DelTr"><button>-</button></td></tr>
|
<tr><td><input type="text" value="数据表名" style="width:90% !important"/></td><td contenteditable="true" style="border: solid gray 1px;"><input type="text" placeholder="请输入元数据值"/></td> <td class="DelTr"><button>-</button></td></tr>
|
`;
|
|
// var template = `
|
// <tr><td>数据名称</td><td contenteditable="true" style="border: solid gray 1px;" ></td><td class="DelTr">删除</td></tr>
|
// <tr><td>制作人</td><td contenteditable="true" style="border: solid gray 1px;"></td><td class="DelTr">删除</td></tr>
|
// <tr><td>录入时间</td><td contenteditable="true" style="border: solid gray 1px;"></td><td class="DelTr">删除</td></tr>
|
// <tr><td>数据类型</td><td contenteditable="true" style="border: solid gray 1px;"></td><td class="DelTr">删除</td></tr>
|
// <tr><td>数据来源</td><td contenteditable="true" style="border: solid gray 1px;"></td><td class="DelTr">删除</td></tr>
|
// <tr><td>面积</td><td contenteditable="true" style="border: solid gray 1px;"></td><td class="DelTr">删除</td></tr>
|
// <tr><td>长度</td><td contenteditable="true" style="border: solid gray 1px;"></td><td class="DelTr">删除</td></tr>
|
// <tr><td>数据服务地址</td><td contenteditable="true" style="border: solid gray 1px;"></td> <td class="DelTr">删除</td></tr>
|
// `
|
|
/**
|
* 获取元数据的某个
|
* @param {*} params
|
* @param {*} name
|
*/
|
function queryMetaDataSome(params, name, fun) {
|
let tabdata = {
|
"menuId": params,
|
"metadata": ''
|
}
|
|
PostAjax(IPurl + '/spcData/queryMetaData', JSON.stringify(tabdata), function (params) {
|
if (params.data == null) {
|
$('#metadata>tbody').empty()
|
}
|
fun(params.data)
|
})
|
}
|
/**
|
* 获取元数据填充到列表
|
* @param {*} params
|
* @param {*} name
|
*/
|
|
var currentid = null;
|
|
var currentMetaData = null;
|
|
function querymetadata(params, name) {
|
let tabdata = {
|
"menuId": params,
|
"metadata": ''
|
}
|
if ((permissions == "list" || permissions == null)) {
|
|
$('#metadata>thead').empty().append(` <tr>
|
<th>元数据名称</th>
|
<th>元数据值</th>
|
</tr>`)
|
}
|
else {
|
|
$('#metadata>thead').empty().append(` <tr>
|
<th>元数据名称</th>
|
<th>元数据值</th>
|
<th>操作</th>
|
</tr>`)
|
}
|
|
PostAjax(IPurl + '/spcData/queryMetaData', JSON.stringify(tabdata), function (params) {
|
if (params.data == null) {
|
$('#metadata>tbody').empty()
|
}
|
|
|
|
/**
|
* 必填标记
|
*/
|
var requirePro = ["名称", "空间覆盖范围", "水深覆盖范围", "时间覆盖范围", "时空分辨率", "摘要说明", "访问限制", "使用限制", "坐标系", "要素类型", "要素个数", "数据来源", "专题分类", "更新频率", "更新时间", "维护人", "服务地址", "数据表名"];
|
var requirePro = ["名称", "要素类型", "要素个数", "数据来源", "专题分类", "维护人"];
|
|
/**
|
* 权限字段
|
*/
|
var permissionsPro = ["服务地址", "数据表名"];
|
|
if (params.code == 0 && params.data && params.data.metadata) {
|
$('#metadata>tbody').empty()
|
let object = JSON.parse(params.data.metadata);
|
currentMetaData = object;
|
for (const key in object) {
|
if (object.hasOwnProperty(key)) {
|
const element = object[key];
|
let temp = ``;
|
|
if ((permissions == "list" || permissions == null) && permissionsPro.indexOf(key) > -1) {
|
continue;
|
}
|
|
if (requirePro.indexOf(key) > -1) {
|
temp = ` <tr>
|
<td contenteditable="true"><input type="text" value="${key}" placeholder="请输入元数据名称" style="width:90% !important;"/><span style="color:red;font-weight:800;font-size:22px">*</span></td>
|
<td contenteditable="true" style="border: solid gray 1px;"><input type="text" value="${element}" placeholder="请输入元数据值"/></td>
|
<td class="DelTr"><button style="display: `+ ((permissions == "list" || permissions == null) ? "none" : "block") + ` !important">-</button></td>
|
</tr>`
|
}
|
else {
|
temp = ` <tr>
|
<td contenteditable="true"><input type="text" value="${key}" placeholder="请输入元数据名称"/></td>
|
<td contenteditable="true" style="border: solid gray 1px;"><input type="text" value="${element}" placeholder="请输入元数据值"/></td>
|
<td class="DelTr"><button style="display: `+ ((permissions == "list" || permissions == null) ? "none" : "block") + ` !important">-</button></td>
|
</tr>`
|
}
|
$('#metadata>tbody').append(temp)
|
}
|
}
|
} else {
|
|
$('#metadata>tbody').append(template);
|
$('#metadata>tbody>tr:eq(0)>td:eq(1)>input').val(name);
|
console.warn("请求元数据服务出错!");
|
}
|
if (params && params.data)
|
currentid = params.data.id;
|
})
|
|
if (permissions == "list" || permissions == null) {
|
$(".subbox").hide();
|
}
|
}
|
// 添加表格数据
|
function addtabtr() {
|
$('#metadata>tbody').append(`<tr>
|
<td contenteditable="true" style="border: solid gray 1px;"><input type="text" placeholder="请输入元数据名称"/></td>
|
<td contenteditable="true" style="border: solid gray 1px;"><input type="text" placeholder="请输入元数据值"/></td>
|
<td class="DelTr"><button>-</button></td>
|
</tr>`);
|
$('#metadata>tbody')[0].scrollTop = $('#metadata>tbody')[0].scrollHeight;
|
}
|
|
// 左键取消menu显示
|
document.addEventListener("click", function () {
|
$('.rkeymenu').css("display", 'none');
|
});
|
|
|
// 获取鼠标当前位置的函数
|
function getMousePos(event) {
|
var event = event || window.event;
|
// let obj = $('#leftwindow')[0];
|
// let x = event.clientX - obj.offsetLeft
|
let x = event.clientX;
|
let y = event.clientY;
|
return {
|
'x': x,
|
'y': y
|
};
|
}
|
|
// 禁用鼠标右键事件
|
// document.oncontextmenu = function (event) {
|
// event.returnValue = false;
|
// }
|
|
var uid, newarr = [], currentNode, posobj1;
|
//右键点击之前的事件
|
function zTreeBeforeRightClick(treeId, treeNode) {
|
// debugger
|
console.log(treeNode);
|
var treeobj = $.fn.zTree.getZTreeObj("treeDemo")
|
var curnode = treeobj.getNodes()
|
if (curnode.length > 0) {
|
treeobj.selectNode(treeNode)
|
}
|
var nodes = treeobj.transformToArray(treeNode)
|
newarr = nodes.map(params => {
|
return params.id
|
})
|
|
//
|
if (permissions == "list" || permissions == null) return;
|
|
if (treeNode == null || treeNode == '') {
|
// 非节点时
|
posobj1 = getMousePos();
|
$('.rkeymenu').css({
|
"display": 'block',
|
"top": posobj1.y,
|
"left": posobj1.x
|
});
|
$('#pzstyle2,#pzstyle3').hide()
|
uid = 0
|
} else {
|
// 选中文字时
|
posobj1 = getMousePos();
|
$('#pzstyle2,#pzstyle3').show()
|
$('.rkeymenu').css({
|
"display": 'block',
|
"top": posobj1.y,
|
"left": posobj1.x
|
});
|
uid = treeNode.id
|
currentNode = treeNode
|
}
|
};
|
|
|
$(document).on('click', '.close>span', function (params) {
|
$('.tab').hide()
|
})
|
|
|
$(document).on('click', '.rkeymenu>ul>li', function (params) {
|
let menuItem = $(this).text()
|
switch (menuItem) {
|
case '增加数据':
|
$('.renamebox2').show()
|
$("#dlg").dialog("open")
|
break;
|
case '删除数据':
|
Delmenu();
|
break;
|
case '修改数据':
|
$('.renamebox').show()
|
$("#dlg").dialog("open")
|
// modeifyinputposition();
|
break;
|
}
|
})
|
|
// 增加节点
|
function addMenuNode(params) {
|
if (uid == "" || uid == null || uid == undefined) {
|
uid = 0
|
}
|
PostAjax(IPurl + '/spcData/addMenu', JSON.stringify({
|
"metadataId": 0,
|
"name": params,
|
"pId": uid,
|
"tableName": "123",
|
"type": 0
|
}), function (data) {
|
if (data.code == 0) {
|
var nodes = zTreeObj.getSelectedNodes();
|
var silent = false;
|
var type = "refresh";
|
zTreeObj.reAsyncChildNodes(nodes[0], type, silent);
|
} else {
|
console.warn('节点添加服务出错!');
|
}
|
$("#dlg").dialog("close")
|
})
|
}
|
|
function Delmenu() {
|
PostAjax(IPurl + '/spcData/delMenu', JSON.stringify(newarr), function (data) {
|
if (data.code == 0) {
|
// initTreeDom()
|
var nodes = zTreeObj.getSelectedNodes();
|
var node = nodes[0].getParentNode();
|
var silent = false;
|
var type = "refresh";
|
zTreeObj.reAsyncChildNodes(node, type, silent);
|
} else {
|
console.log('删除失败!');
|
}
|
})
|
}
|
function updatemenu(x) {
|
currentNode.name = x
|
PostAjax(IPurl + '/spcData/modifySpcDataMenu', JSON.stringify(currentNode), function (data) {
|
if (data.code == 0) {
|
var nodes = zTreeObj.getSelectedNodes();
|
var node = nodes[0].getParentNode()
|
var silent = false;
|
var type = "refresh";
|
zTreeObj.reAsyncChildNodes(node, type, silent);
|
|
// initTreeDom()
|
} else {
|
console.warn('更新菜单服务报错!');
|
}
|
$("#dlg").dialog("close")
|
})
|
}
|
|
|
//初始化
|
|
$(function () {
|
|
|
$(".renamebox input").bind("keypress", function (event) {
|
if (event.keyCode == "13") {
|
let modname = $(this).val().trim()
|
if (modname == '') {
|
console.log('名称为空!')
|
} else {
|
updatemenu(modname)
|
$(".renamebox").hide()
|
$(".renamebox input").val('')
|
}
|
}
|
})
|
|
$(document).bind("keyup", function (event) {
|
if (event.keyCode == "27") {
|
$(".renamebox,.renamebox2").hide()
|
}
|
})
|
|
$(".renamebox button").click(function (event) {
|
let modname = $('.renamebox input').val().trim()
|
if (modname == '') {
|
console.log('名称为空!')
|
} else {
|
updatemenu(modname)
|
$(".renamebox").hide()
|
$(".renamebox input").val('')
|
}
|
})
|
|
$(".renamebox2 input").bind("keypress", function (event) {
|
if (event.keyCode == "13") {
|
debugger
|
let menuname = $('.renamebox2 input').val().trim()
|
if (menuname == '') {
|
console.log('名称为空!')
|
} else {
|
addMenuNode(menuname)
|
$(".renamebox2").hide()
|
$(".renamebox2 input").val('')
|
}
|
}
|
})
|
|
$(".renamebox2 button").click(function () {
|
debugger
|
let menuname = $('.renamebox2 input').val().trim()
|
if (menuname == '') {
|
console.log('名称为空!')
|
} else {
|
addMenuNode(menuname)
|
$(".renamebox2").hide()
|
$(".renamebox2 input").val('')
|
}
|
})
|
});
|
|
// 获取元数据表格内容
|
function submitmetadata(params) {
|
arr = [], obj = {}
|
var mytable = document.getElementById('metadata')
|
for (let i = 1, rows = mytable.rows.length; i < rows; i++) {
|
for (let j = 0, cells = mytable.rows[i].cells.length; j < cells; j++) {
|
if (j > 1) {
|
break
|
} else {
|
arr.push(mytable.rows[i].cells[j].children[0].value)
|
// arr.push(mytable.rows[i].cells[j].innerHTML)
|
}
|
}
|
}
|
for (let i = 0; i < arr.length; i = i + 2) {
|
obj[arr[i]] = arr[i + 1]
|
}
|
return JSON.stringify(obj)
|
}
|
|
// 提交元数据
|
function submitfunc() {
|
let treeid = $('.tab table').attr('data-treeid')
|
console.log(submitmetadata());
|
let tabdata = {
|
"menuId": treeid,
|
"metadata": submitmetadata(),
|
"id": currentid
|
}
|
PostAjax(IPurl + '/spcData/addMetaData', JSON.stringify(tabdata), function (data) {
|
if (data.code == 0) {
|
// initTreeDom()
|
//$('.tab').hide();
|
layer.msg('添加成功')
|
currentid = null;
|
} else {
|
console.log('提交失败!')
|
currentid = null;
|
}
|
})
|
}
|
//关闭统计图表
|
$(document).on('click', '.switchBtn', function () {
|
$('.echartsbox').hide()
|
})
|
|
|
//服务加载
|
function LoadLayer(params) {
|
|
}
|
// //添加地形
|
// var option = {
|
// requestVertexNormals: true,
|
// url: "http://36.7.136.132:11080/china/"
|
// };
|
// sgworld.Creator.createTerrain("默认地形", option, "0", true, "");
|
|
//图层创建
|
var Existimglayer = [],
|
ExistimglayerId = []
|
function addLayer(option) {
|
|
var layerObject = {
|
layerId: option.tcbh + "_TC",
|
layerUrl: option.url,
|
layerType: "dynamic",
|
tcmc: option.node.name
|
}
|
if (option.node.name.indexOf('影像') > -1) {
|
layerObject.layerType = 'tiled';
|
}
|
// getMap().getMyLayer();
|
if (option.node.layer) {
|
// getMap().myLayer.checked(layerObject, option.checked)
|
getMap().map2.imageLayers.addImageLayer(layerObject, option.checked)
|
}
|
else {
|
if (option.checked)
|
option.node.layer = getMap().map2.imageLayers.addImageLayer(layerObject, option.checked);
|
}
|
};
|
|
// 添加自定义控件事件
|
function addHoverDom(treeId, treeNode) {
|
// if (treeNode.pId == null && treeNode.isParent == true) {
|
// return;
|
// }
|
if (treeNode.isParent == true) {
|
return;
|
}
|
// var aObj = $("#" + treeNode.tId);
|
var aObj = $("#" + treeNode.tId + "_a");
|
// if ($("#diyBtn_" + treeNode.id).length > 0) return;
|
if ($("#diyBtn_space_" + treeNode.id).length > 0) return;
|
var editStr = `<img class='diyBtn1' src="./js/ztreev3/css/zTreeStyle/img/diy/search.png" id="diyBtn_space_${treeNode.id}" title="表格查询" onclick="DivEventClick(${treeNode.id},'${treeNode.name}')"> `
|
// var editStr = "<span class='diyBtn1' id='diyBtn_space_" + treeNode.id + "' ></span>"
|
// + "<button type='button' id='diyBtn_" + treeNode.id
|
// + "' title='" + treeNode.name + "' onclick='DivEventClick();'></button>";
|
aObj.append(editStr);
|
// var btn = $("#diyBtn_"+treeNode.id);
|
// if (btn) btn.bind("click", function(){console.log("diy Button for " + treeNode.name);});
|
};
|
|
// 移除自定义控件事件
|
function removeHoverDom(treeId, treeNode) {
|
$("#diyBtn_space_" + treeNode.id).unbind().remove();
|
};
|
|
|
function DivEventClick(id, name) {
|
event.stopPropagation()
|
// (title, width, height, src)
|
queryMetaDataSome(id, name, function (params) {
|
if (!params) {
|
layer.msg("元数据为空");
|
return;
|
}
|
//var 数据表名 = JSON.parse(params.metadata)["数据表名"];
|
var tcmc=JSON.parse(params.metadata)["名称"];
|
//if (数据表名) {
|
if (tcmc) {
|
$("#hideGridBtn").show();
|
$('#content-arc').layout('show', 'south');
|
$('#content-arc').layout('panel', 'south').panel('resize', { height: 300 });
|
// diaLog.diaLogWincenter(name + '-数据记录', 800, 490, './html/table.html?table=' + 数据表名)
|
//$("#grid").empty().append($(`<iframe src="html/table1.html?table=${数据表名}" frameborder="none" width="100%" height="100%"></iframe>`))
|
$("#grid").empty().append($(`<iframe src="html/table1.html?tcmc=${tcmc}" frameborder="none" width="100%" height="100%"></iframe>`))
|
}
|
else
|
layer.msg("元数据数据表名为空");
|
})
|
}
|
|
$(".leftclosebtn").on("click", function () {
|
if (parseInt($(this).parent("div").css("left")) >= 0)
|
$(this).parent("div").animate({ "left": "-340px" })
|
else
|
$(this).parent("div").animate({ "left": "10px" })
|
});
|
|
$(".rightclosebtn").on("click", function () {
|
if (parseInt($(this).parent("div").css("right")) >= 0)
|
$(this).parent("div").animate({ "right": "-360px" })
|
else
|
$(this).parent("div").animate({ "right": "10px" })
|
});
|
|
window.onload = function () {
|
// document.getElementById("treeDemo").oncontextmenu = function (event) {
|
// event.returnValue = false;
|
|
// if (permissions == "list" || permissions == null) return;
|
// posobj1 = getMousePos();
|
// $('.rkeymenu').css({
|
// "display": 'block',
|
// "top": posobj1.y,
|
// "left": posobj1.x
|
// });
|
// // $('#pzstyle2,#pzstyle3').hide()
|
// }
|
|
// layui.use(['element', 'colorpicker'], function () {
|
// colorpicker = layui.colorpicker;
|
|
|
// colorpicker.render({
|
// elem: '#setting',
|
// color: 'rgba(75, 143, 255, 0.83)',
|
// format: 'rgb',
|
// predefine: true,
|
// alpha: true,
|
// done: function (color) {
|
// console.log("done", color);
|
// document.documentElement.style.setProperty('--bgcolor', color);
|
// },
|
// change: function (color) {
|
// console.log("change", color);
|
// document.documentElement.style.setProperty('--bgcolor', color);
|
// window.localStorage.setItem('--bgcolor', color);
|
// }
|
// })
|
// })
|
|
}
|
var map;
|
function removeMark() {
|
|
getMap();
|
try {
|
map.removeMark();
|
}
|
catch (ex) { }
|
}
|
function pointToByCoord(a, b, c, d, e, f) {
|
getMap();
|
//map.pointToByCoord(a, b, c, d, e, f)
|
map.map2.Navigate.flyTowkt(c);
|
}
|
|
function getMap() {
|
if (!map) {
|
map = document.getElementById("iframeMap").contentWindow;
|
}
|
return map;
|
}
|
|
|
function openInResource() {
|
var url = currentMetaData["服务地址"]
|
// url = "http://10.3.1.60:6080/arcgis/rest/services/GJHD/YYZS/MapServer/23";
|
// var obj = { serverurl: url };
|
PostAjax(IPurl + '/res/ResExtMapUrl/queryResourceId?serverurl=' + url, {}, function (data) {
|
// PostAjax(+'/res/ResExtMapUrl/queryResourceId?serverurl=' + url, obj, function (data) {
|
if (data && data.resourceid) {
|
console.log(resourceUrl + '/res/ZiYuan/ZiYuanBaseInfo?resourceid=' + data.resourceid);
|
window.open(resourceUrl + '/res/ZiYuan/ZiYuanBaseInfo?resourceid=' + data.resourceid)
|
|
// initTreeDom()
|
} else {
|
layer.msg('资源池未找到此服务!');
|
}
|
// $("#dlg").dialog("close");
|
});
|
}
|