let element = "";
|
sgworld = window.external.createSgworld();
|
let RootType = getUrlParam("type");
|
let IsFirst = -1;
|
let ChooseWXType = [];
|
|
var lb = new leftBottomDatlog();
|
var rT = new rightTopDatlog();
|
var rb = new rightBottomDatlog();
|
|
//滚动条
|
new CusScrollBar({
|
contentSelector: '.scroll_cont1', //滚动内容区
|
barSelector: '.scroll_bar1', //滚动条
|
sliderSelector: '.scroll_slider1' //滚动滑块
|
});
|
layui.use('element', function () {
|
element = layui.element;
|
InitSencondCatlog();
|
CollapseLister();
|
});
|
|
//初始化左侧树
|
function InitSencondCatlog() {
|
var Rhtml = "";
|
var panme = "";
|
var bf = false;
|
|
let SencondAndThirdTree = "";
|
if (RootType == RootCatlogExBase.Type) {
|
SencondAndThirdTree = BaseDataSecond;
|
}
|
if (RootType == RootCatlogExBasezhuanti.Type) {
|
SencondAndThirdTree = ZhuanTiDataSecond;
|
}
|
if (RootType == RootCatlogExYingYong.Type) {
|
SencondAndThirdTree = YingYongDataSencond;
|
}
|
|
$.each(SencondAndThirdTree, function (j, value) {
|
if (panme != value.name) {
|
if (bf == false) {
|
|
Rhtml += '<div class="layui-colla-item" ><h2 class="layui-colla-title" data-color="f" title=' + value.name + '>' +
|
'<img class="tlimg" src="img/a7.png" />' + ((value.name.length > 9) ? value.name.substring(0, 9) : value.name) +
|
'</h2><div class="layui-colla-content"><ul><li class="yx" data-name="' + value.rootname + '\\' + value.name + '\\' + value.sname + '" data-color="f" data-ck="' + value.Type + '" title=' + value.sname + '><span class="layui-badge-dot layui-bg-gray"></span>' + ((value.sname.length > 10) ? value.sname.substring(0, 10) : value.sname) + '</li>';
|
bf = true;
|
} else {
|
Rhtml += '</ul></div></div><div class="layui-colla-item"><h2 class="layui-colla-title" data-color="f" title=' + value.name + '>' +
|
'<img class="tlimg" src="img/a7.png" />' + ((value.name.length > 9) ? value.name.substring(0, 9) : value.name) +
|
'</h2><div class="layui-colla-content"><ul><li class="yx" data-name="' + value.rootname + '\\' + value.name + '\\' + value.sname + '" data-color="f" data-ck="' + value.Type + '" title=' + value.sname + ' ><span class="layui-badge-dot layui-bg-gray"></span>' + ((value.sname.length > 10) ? value.sname.substring(0, 10) : value.sname) + '</li> ';
|
}
|
} else {
|
Rhtml += '<li class="yx" data-name="' + value.rootname + '\\' + value.name + '\\' + value.sname + '" data-color="f" data-ck="' + value.Type + '"><span class="layui-badge-dot layui-bg-gray"></span>' + ((value.sname.length > 10) ? value.sname.substring(0, 10) : value.sname) + '</li>';
|
}
|
panme = value.name;
|
});
|
$(".layui-collapse").empty();
|
$(".layui-collapse").append(Rhtml);
|
element.render('collapse');
|
//添加子项监听事件
|
SonClick();
|
}
|
|
//折叠面板点击事件
|
function CollapseLister() {
|
element.on('collapse(filter)', function (data) {
|
// CloseAllDatlog();
|
window.external.loadMainWebFunc("OranginOne", "");
|
if (data.show == true) {
|
$(this).find("img").attr("src", "img/a8.png");
|
} else {
|
$(this).find("img").attr("src", "img/a7.png");
|
}
|
|
})
|
}
|
|
|
//子项点击事件
|
function SonClick() {
|
$(".yx").click(function () {
|
//debugger;
|
//获取数据是否打开
|
let ItemColor = $(this).attr("data-color");
|
//获取数据是基础数据、专题数据、应用数据
|
let RootName = $(this).attr("data-name");
|
let SonRootType = $(this).attr("data-ck");
|
localStorage.setItem("type", SonRootType);
|
//基础数据
|
if (RootType == RootCatlogExBase.Type) {
|
|
RootBaseCloseDatlog();
|
|
InitLayer(RootCatlogExBase.name);
|
if (ItemColor == "f") {
|
//改变颜色
|
$(this).attr("data-color", "t");
|
$(this).css("background-color", "#055FA4");
|
//获取数据对象
|
let CurrentRoot = BaseDataSecond.filter(function (item) { return item.Type == SonRootType });
|
//不包含年份
|
if (CurrentRoot[0].ChildRen == undefined || CurrentRoot[0].ChildRen == "undefined") {
|
let cureentId = sgworld.ProjectTree.FindItem(RootName);
|
if (cureentId == "") return;
|
sgworld.ProjectTree.SetVisibility(cureentId, true);
|
} else {
|
window.external.closeDialog("右上");
|
ChooseWXType.push(SonRootType);
|
let WXParm = ArrayJoin(ChooseWXType);
|
//打开影像页面
|
window.external.createPmDialogDock("右上", url + "SatelliteImagery.html?SonRootType=" + WXParm, rT.width, rT.height, rT.top, rT.left, rT.bottom, rT.right);
|
}
|
} else {
|
//背景颜色恢复
|
$(this).attr("data-color", "f");
|
$(this).css("background-color", "#000000");
|
var LayerId = sgworld.ProjectTree.FindItem(RootName);
|
sgworld.ProjectTree.SetVisibility(LayerId, false);
|
var arrIndex = GetArrayIndex(ChooseWXType, SonRootType);
|
if (arrIndex != -1) {
|
ChooseWXType.splice(arrIndex, 1);
|
}
|
if (ChooseWXType.length > 0) {
|
let WXParm = ArrayJoin(ChooseWXType);
|
window.external.createPmDialogDock("右上", url + "SatelliteImagery.html?SonRootType=" + WXParm, rT.width, rT.height, rT.top, rT.left, rT.bottom, rT.right);
|
} else {
|
window.external.closeDialog("右上");
|
}
|
}
|
}
|
|
//专题数据
|
if (RootType == RootCatlogExBasezhuanti.Type) {
|
BaseCloseDatlog();
|
InitLayer(RootCatlogExBasezhuanti.name);
|
|
if (ItemColor == "f") {
|
let CurrentRoot = ZhuanTiDataSecond.filter(function (item) { return item.Type == SonRootType });
|
//改变颜色
|
$(".yx").attr("data-color", "f");
|
$(".yx").css("background-color", "#000000");
|
$(this).attr("data-color", "t");
|
$(this).css("background-color", "#055FA4");
|
//获取数据对象
|
|
//需要添加fly的数据
|
if (CurrentRoot[0].Fly != undefined) {
|
var ParentLayId = sgworld.ProjectTree.FindItem(CurrentRoot[0].rootname + "\\" + CurrentRoot[0].name + "\\" + CurrentRoot[0].sname);
|
if (ParentLayId == "") {
|
var LayId = sgworld.ProjectTree.FindItem(CurrentRoot[0].rootname + "\\" + CurrentRoot[0].name);
|
var layer = sgworld.ProjectTree.LoadFlyLayer(CurrentRoot[0].Fly, LayId);
|
sgworld.ProjectTree.SetVisibility(layer, false);
|
sgworld.ProjectTree.RenameGroup(layer, CurrentRoot[0].sname);
|
}
|
}
|
//其他数据处理
|
if (CurrentRoot[0].ChildRen != "undefined") {
|
//弹出框
|
window.external.closeDialog("右上");
|
window.external.createPmDialogDock("右上", url + "thirdCatlog.html?type=" + SonRootType, rT.width, rT.height, rT.top, rT.left, rT.bottom, rT.right);
|
}
|
let urlpathName = CurrentRoot[0].rootname + "\\" + CurrentRoot[0].name + "\\" + CurrentRoot[0].sname;
|
let typeName = CurrentRoot[0].sname;
|
let type = CurrentRoot[0].Type;
|
|
//图表弹出
|
switch (type) {
|
case "DTJZ":
|
window.external.createPmDialogDock("右下", url + "chart/chartJZfirst.html?Action=GetAll", rb.width, rb.height, rb.top, rb.left, rb.bottom, rb.right);
|
break;
|
}
|
|
if (CurrentRoot[0].ChildRenType != "undefined" && CurrentRoot[0].ChildRenType == "wfs") {
|
window.external.closeDialog("右上");
|
window.external.closeDialog("右中");
|
window.external.closeDialog("右下");
|
switch (type) {
|
case "QHLD":
|
case "QHCD":
|
case "QHDB":
|
case "QHHM":
|
case "QHSD":
|
window.external.createPmDialogDock("右上", url + "threeQH.html?typeName=" + typeName + "&tableType=" + type, rT.width, rT.height, rT.top, rT.left, rT.bottom, rT.right);
|
window.external.createPmDialogDock("右下", url + "chart/chartQHFZ.html?typeName=" + typeName + "&tableType=" + type, rb.width, rb.height, rb.top, rb.left, rb.bottom, rb.right);
|
break;
|
case "DLRL":
|
window.external.createPmDialogDock("右上", url + "threeDL.html?typeName=" + typeName + "&tableType=" + type + "&urlPath=" + urlpathName, rT.width, rT.height, rT.top, rT.left, rT.bottom, rT.right);
|
window.external.createPmDialogDock("左下", url + "timeTD.html?title=" + typeName + "&Type=" + type, lb.width, lb.height, lb.top, lb.left, lb.bottom, lb.right);
|
break;
|
}
|
}
|
} else {
|
$(this).attr("data-color", "f");
|
$(this).css("background-color", "#000000");
|
}
|
}
|
|
//应用数据
|
if (RootType == RootCatlogExYingYong.Type) {
|
BaseCloseDatlog();
|
InitLayer(RootCatlogExYingYong.name);
|
if (ItemColor == "f") {
|
let CurrentRoot = YingYongDataSencond.filter(function (item) { return item.Type == SonRootType });
|
$(".yx").attr("data-color", "f");
|
$(".yx").css("background-color", "#000000");
|
$(this).attr("data-color", "t");
|
$(this).css("background-color", "#055FA4");
|
let typeName = CurrentRoot[0].sname;
|
let type = CurrentRoot[0].Type;
|
let id = CurrentRoot[0].id;
|
let urlpathName = CurrentRoot[0].rootname + "\\" + CurrentRoot[0].name + "\\" + CurrentRoot[0].sname;
|
switch (type) {
|
case "QHLD":
|
case "QHCD":
|
case "QHDB":
|
case "QHHM":
|
case "QHSD":
|
window.external.createPmDialogDock("右上", url + "threeQH.html?typeName=" + typeName + "&tableType=" + type, rT.width, rT.height, rT.top, rT.left, rT.bottom, rT.right);
|
window.external.createPmDialogDock("右下", url + "chart/chartQHFZ.html?typeName=" + typeName + "&tableType=" + type, rb.width, rb.height, rb.top, rb.left, rb.bottom, rb.right);
|
return;
|
break;
|
case "HHCD":
|
case "HHLD":
|
window.external.createPmDialogDock("右上", url + "threeHH.html?title=" + typeName + "&Type=" + type, rT.width, rT.height, rT.top, rT.left, rT.bottom, rT.right);
|
window.external.createPmDialogDock("左下", url + "timeHH.html?title=" + typeName + "&Type=" + type, lb.width, lb.height, lb.top, lb.left, lb.bottom, lb.right);
|
return;
|
break;
|
case "DLTD":
|
case "DLDB":
|
case "DLSD":
|
case "DLRL":
|
|
window.external.createPmDialogDock("右上", url + "threeDL.html?typeName=" + typeName + "&tableType=" + type + "&urlPath=" + urlpathName, rT.width, rT.height, rT.top, rT.left, rT.bottom, rT.right);
|
window.external.createPmDialogDock("左下", url + "timeTD.html?title=" + typeName + "&Type=" + type, lb.width, lb.height, lb.top, lb.left, lb.bottom, lb.right);
|
break;
|
case "DLDZ":
|
|
window.external.createPmDialogDock("右上", url + "threeDL.html?typeName=" + typeName + "&tableType=" + type + "&urlPath=" + urlpathName, rT.width, rT.height, rT.top, rT.left, rT.bottom, rT.right);
|
window.external.createPmDialogDock("左下", url + "timeDLDZ.html?title=" + typeName + "&Type=" + type, lb.width, lb.height, lb.top, lb.left, lb.bottom, lb.right);
|
return;
|
break;
|
}
|
if (CurrentRoot[0].ChildRen != undefined) {
|
window.external.createPmDialogDock("右上", url + "thirdCatlogQL.html?type=" + type, rT.width, rT.height, rT.top, rT.left, rT.bottom, rT.right);
|
}
|
} else {
|
$(this).attr("data-color", "f");
|
$(this).css("background-color", "#000000");
|
}
|
}
|
})
|
}
|
|
|
//初始化界面
|
function InitLayer(parm) {
|
var ParentLayId = sgworld.ProjectTree.FindItem(parm);
|
sgworld.ProjectTree.SetVisibility(ParentLayId, false);
|
//删除边框线
|
//删除打开的影像
|
DeleteYX();
|
DeletePoyline();
|
|
//改变初始项状态
|
window.external.loadMainWebFunc("OranginOne", "");
|
//默认修改到初始状态
|
sgworld.ProjectTree.SetVisibility("", false);
|
|
let RTIL = sgworld.ProjectTree.FindItem(RootInitLayer);
|
sgworld.ProjectTree.SetVisibility(RTIL, true);
|
sgworld.Navigate.FlyTo(RTIL);
|
|
|
}
|
|
|
|
//获取数组下标
|
function GetArrayIndex(arr, parm) {
|
|
for (var i = 0; i < arr.length; i++) {
|
if (parm == arr[i]) {
|
return i;
|
}
|
}
|
}
|
|
//数组连接到一块
|
function ArrayJoin(arr) {
|
let result = "";
|
for (var i = 0; i < arr.length; i++) {
|
result += arr[i] + "~";
|
}
|
if (result.length > 0) {
|
result = result.substring(0, result.length - 1);
|
}
|
return result;
|
|
|
}
|