13693261870
2024-04-02 2a1b873b4b78b508d5d53c57992e734c56619df8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
var form = "";
var rb = new rightBottomDatlog();
new CusScrollBar({
    contentSelector: '.scroll_cont1', //滚动内容区
    barSelector: '.scroll_bar1', //滚动条
    sliderSelector: '.scroll_slider1' //滚动滑块
});
layui.use('form', function () {
    form = layui.form;
    GetLakeMessage();
    form.on('checkbox(hupo)', function (data) {
        var name = "";
        $("input:checkbox[name='hupo']:checked").each(function (i) {
            name += $(this).val() + "*";
        });
        if (name == "") {
            $(".timeYear").empty();
            return false;
        }
        GetLakeYear(name.substring(0, name.length - 1));
    });
 
});
 
function GetLakeMessage() {
    $.ajax({
        url: "../../Ashx/DataLake.ashx",
        type: "post",
        data: { Action: "GetLakeMessage", type: "SSHP" },//81258c6425be4694af2575731f4e8831
        dataType: "json",
        async: false,
        success: function (result) {
            var htmlStr = '<div class="layui-form-item"><label class="layui-form-label">湖泊:</label><div class="layui-input-block">';
            $.each(result, function (index, value) {
                if (value.tname.indexOf("青海湖") > -1) {
                    //<input type="checkbox" name="like[hupo]" title="青海湖"  lay-skin="primary">
                    htmlStr += '<input type="checkbox" name="hupo" lay-skin="primary" lay-filter="hupo" value="青海湖"  title="青海湖"  data-lake="' + value.tname + '"  data-url="' + value.rtname + '\\' + value.fname + '\\' + value.sname + '\\' + value.tname + '">';
                }
 
                if (value.tname.indexOf("哈拉湖") > -1) {
                    htmlStr += '<input type="checkbox" name="hupo" lay-skin="primary" lay-filter="hupo" value="哈拉湖"  title="哈拉湖" data-lake="' + value.tname + '"   data-url="' + value.rtname + '\\' + value.fname + '\\' + value.sname + '\\' + value.tname + '">';
                }
                if (value.tname.indexOf("库赛湖") > -1) {
                    htmlStr += '<input type="checkbox" name="hupo" lay-skin="primary" lay-filter="hupo" value="库赛湖"  title="库赛湖" data-lake="' + value.tname + '"   data-url="' + value.rtname + '\\' + value.fname + '\\' + value.sname + '\\' + value.tname + '">';
                }
                if (value.tname.indexOf("扎陵湖-鄂陵湖") > -1) {
                    htmlStr += '<input type="checkbox" name="hupo" lay-skin="primary" lay-filter="hupo" value="扎陵湖-鄂陵湖"  title="扎陵湖-鄂陵湖" data-lake="' + value.tname + '"   data-url="' + value.rtname + '\\' + value.fname + '\\' + value.sname + '\\' + value.tname + '">';
                }
                if (value.tname.indexOf("星星海") > -1) {
                    htmlStr += '<input type="checkbox" name="hupo" lay-skin="primary" lay-filter="hupo" value="星星海"  title="星星海" data-lake="' + value.tname + '"   data-url="' + value.rtname + '\\' + value.fname + '\\' + value.sname + '\\' + value.tname + '">';
                }
                if (value.tname.indexOf("可可西里盐湖") > -1) {
                    htmlStr += '<input type="checkbox" name="hupo" lay-skin="primary" lay-filter="hupo" value="可可西里盐湖"  title="可可西里盐湖" data-lake="' + value.tname + '"  data-url="' + value.rtname + '\\' + value.fname + '\\' + value.sname + '\\' + value.tname + '">';
                }
            })
            $(".tmessageLake").empty();
            $(".tmessageLake").append(htmlStr + "</div></div>");
            form.render();
        }
    })
}
//获取年份
function GetLakeYear(simName) {
    $.ajax({
        url: "../../Ashx/DataLake.ashx",
        type: "post",
        data: { Action: "GetHPyear", simName: simName },
        dataType: "json",
        async: false,
        success: function (result) {
            var html = "";
            $.each(result, function (index, value) {
                html += '<input type="checkbox" name="year" value="' + value.time + '"  title="' + value.time + '" lay-skin="primary">'
            });
            $(".timeYear").empty();
            $(".timeYear").append(html);
            form.render();
        },
        error: function () {
 
        }
    })
}
 
function sure() {
    var type = "";
    var arrYear = new Array();
    var arrName = new Array();
    var arrSigName = new Array();
    var arrtitle = new Array();
    $("input:checkbox[name='year']:checked").each(function (i) {
        arrYear[i] = $(this).val();
    });
    $("input:checkbox[name='hupo']:checked").each(function (i) {
        arrSigName[i] = $(this).attr("data-lake");
        arrName[i] = $(this).attr("data-url");
        arrtitle[i] = $(this).attr("title");
    });
 
    if (arrYear.length == 0) {
        alert("请选择年份");
        return false;
    }
    if (arrName.length == 0) {
        alert("请选择湖泊");
        return false;
    }
 
    //单年单选
    if (arrYear.length == 1 & arrName.length == 1) {
        type = "simYearSimName";
    }
    //单年多选
    if (arrYear.length == 1 & arrName.length > 1) {
        type = "simYearManyName";
    }
    //多年单选
    if (arrYear.length > 1 & arrName.length == 1) {
        type = "manyYearSimName";
    }
 
    //多年多选
    if (arrYear.length > 1 & arrName.length > 1) {
        type = "manyYearManyName";
    }
 
    //关闭所有的图层
    // sgworld.ProjectTree.SetVisibility("", false);
    //定义所需要的json对象存储内容
    var lakeUrl = [];
    //循坏打开需要打开的图层
    for (var i = 0; i < arrName.length; i++) {
        for (var j = 0; j < arrYear.length; j++) {
            var path = arrName[i] + "\\" + arrYear[j] + "\\" + arrYear[j];
            //var layerId = sgworld.ProjectTree.FindItem(path);
            ////关闭其他图层
            //sgworld.ProjectTree.SetVisibility(layerId, true);
            var obj = new ObjLake(arrSigName[i], arrYear[j], arrtitle[i]);
            lakeUrl.push(obj);
        }
    }
    //存储到持久化机制里面
    localStorage.setItem("openShp", JSON.stringify(lakeUrl));
    //获取文件的路径
    var url = getRootPath();
 
 
    window.external.closeDialog("右下");
    window.external.createPmDialogDock("右下", url + "/chart/chartSSHP.html?Type=" + type, rb.width, rb.height, rb.top, rb.left, rb.bottom, rb.right);
}
 
function closeCurrent() {
    window.external.closeDialog("右上");
    window.external.closeDialog("右下");
}
 
 
function ObjLake(name, year, titleName) {
    this.name = name;
    this.year = year;
    this.titleName = titleName;
}