赣州市洪水风险预警系统二维版本
xiebin
2023-03-02 b39483c96ae572121d3c619c0b9d37634e682cc4
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
define(["base/AppEvent",
        "manager/configmanager",
        "manager/widgetsmanager",
        "manager/mapmanager",
        "manager/querymanager",
        "manager/routemanager",
        "dojo/dom",
        "base/ConfigData",
        "dojo/_base/declare",
        "dojo/on",
        "dojo/_base/lang",
        "dojo/dom-style",
        "dojo/dom-class",
        "dojo/dom-attr",
        "dojo/dom-construct",
        "controls/loader/Loader",
        "dojo/query",
        "dojo/window"
    ],
    function (AppEvent,
              configmanager,
              widgetsmanager,
              mapmanager,
              querymanager,
              routemanager,
              dom,
              ConfigData,
              declare,
              on,
              lang,
              domStyle,
              domClass,
              domAttr,
              domConstruct,
              Loader,
              query,
              win) {
        return declare("Framework", null, {
            _configmanager: null,
            _widgetmanager: null,
            _mapmanager: null,
            _querymanager: null,
            _showsider: true,
            _loader: null,
            /**
             * 头部的高度
             */
            headerHeight: 0,
            /**
             * 侧边栏的宽度
             */
            siderWidth: 350,
            popupWindow: null,
 
            constructor: function () {
                var thisObj = this;
                _configmanager = new configmanager();
                _widgetmanager = new widgetsmanager();
                _mapmanager = new mapmanager();
                _querymanager = new querymanager();
                _routemanager = new routemanager();
                _widgetmanager.MapManager = _mapmanager;
                var fun = lang.hitch(this, this.onConfigLoaded);
                AppEvent.addAppEventListener(AppEvent.CONFIG_LOADED, fun);
                AppEvent.dispatchAppEvent(AppEvent.APPLICATION_LOAD, {}); //派发应用加载事件
                AppEvent.addAppEventListener(AppEvent.BASE_MAP_LAYER_LOADED, this.onMapLoaded);
                AppEvent.addAppEventListener(AppEvent.BASE_MAP_LAYER_LOADED_ERROR, this.onMapLoadedError);
                AppEvent.addAppEventListener(AppEvent.SHOW_LOAD, lang.hitch(this, this.onShowLoad));
                AppEvent.addAppEventListener(AppEvent.HIDE_LOAD, lang.hitch(this, function (evt) {
                    this._loader.hide();
                }));
                AppEvent.addAppEventListener(AppEvent.APPLICATION_FULLSCREEN, lang.hitch(this, this.onFullScreen));
                _configmanager.loadconfig("config.json");
                this._loader = new Loader();
                //注册窗体变化事件
                window.onload = lang.hitch(thisObj, function () {
                    this.resize();
                });
                window.onresize = lang.hitch(thisObj, function () {
                    this.resize();
                });
            },
            onShowLoad: function (data) {
                this._loader.show(data.text);
            },
            onConfigLoaded: function () {
                //dom.byId("copyrightspan").innerHTML += ConfigData.copyright;
                var siderbutton = dom.byId("siderbutton");
                if (siderbutton != undefined || siderbutton != null) {
                    on(siderbutton, "click", lang.hitch(this, this.onSiderButtonClick));
                }
 
            },
            _onClickShowPlatform: function () {
                require(["controls/popupwindow/PopupWindow"], function (PopupWindow) {
                    if (!this.popupWindow) {
                        this.popupWindow = new PopupWindow;
                    }
                    this.popupWindow.show({
                        "title": "关于平台",
                        "width": "749",
                        "height": "654",
                        "parent": this.body
                    });
                    this.popupWindow.setContent('<iframe style="border:none;width:100%;height:100%;" src="../main/aboutplatform.html"></div>');
                });
 
            },
            _onClickShowAboutus: function () {
                require(["controls/popupwindow/PopupWindow"], function (PopupWindow) {
                    if (!this.popupWindow) {
                        this.popupWindow = new PopupWindow;
                    }
                    this.popupWindow.show({
                        "title": "关于我们",
                        "width": "749",
                        "height": "654",
                        "parent": this.body
                    });
                    this.popupWindow.setContent('<iframe style="border:none;width:100%;height:100%;" src="../main/about.html"></div>');
                });
            },
            _onClickShowDisclaimer: function () {
                require(["controls/popupwindow/PopupWindow"], function (PopupWindow) {
                    if (!this.popupWindow) {
                        this.popupWindow = new PopupWindow;
                    }
                    this.popupWindow.show({
                        "title": "免责声明",
                        "width": "749",
                        "height": "654",
                        "parent": this.body
                    });
                    this.popupWindow.setContent('<iframe style="border:none;width:100%;height:100%;" src="../main/disclaimer.html"></div>');
                });
            },
            createPopupWindow: function () {
                require(["controls/popupwindow/PopupWindow"], function (PopupWindow) {
 
                });
            },
            _onClickMobileMap: function () {
                AppEvent.dispatchAppEvent(AppEvent.RUN_WIDGET, "MobileMapWidget");
            },
            _onClickShixianZhitong: function () {
                AppEvent.dispatchAppEvent(AppEvent.RUN_WIDGET, "CityExpressWidget");
            },
            _onClickZonghe: function () {
                AppEvent.dispatchAppEvent(AppEvent.RUN_WIDGET, "ThematicWidget");
            },
            onSiderButtonClick: function () {//侧边栏隐藏按钮点击事件
                var tabcontainer = dom.byId("tabcontainer");
                var siderbutton = dom.byId("siderbutton");
                if (this._showsider) {
                    domStyle.set(tabcontainer, "display", "none");
                    if ($('#module-side-container').is(':visible')) {
                        domClass.remove(siderbutton, "siderbutton-normal-plus");
                        domClass.add(siderbutton, "siderbutton-shrink-plus");
                        this.siderWidth = 50;
                    } else {
                        domClass.remove(siderbutton, "siderbutton-normal");
                        domClass.add(siderbutton, "siderbutton-shrink");
                        this.siderWidth = 0;
                    }
                } else {
                    domStyle.set(tabcontainer, "display", "");
                    if ($('#module-side-container').is(':visible')) {
                        domClass.remove(siderbutton, "siderbutton-shrink-plus");
                        domClass.add(siderbutton, "siderbutton-normal-plus");
                        this.siderWidth = 400;
                    } else {
                        domClass.remove(siderbutton, "siderbutton-shrink");
                        domClass.add(siderbutton, "siderbutton-normal");
                        this.siderWidth = 350;
                    }
                }
                this._showsider = !this._showsider;
                this.resize();
            },
            onSiderContainerShow: function () {
                // domStyle.set(dom.byId("tabcontainer"), "left", "50px");
                domClass.add(dom.byId("siderbutton"), "siderbutton-normal-plus");
                this.siderWidth += 50;
                this.resize();
            },
            onSiderContainerHide: function () {
                domStyle.set(dom.byId("tabcontainer"), "left", "0px");
                this.siderWidth -= 50;
                this.resize();
            },
            onGetLogUser: function (data) {
                //需要确认权限
                if (window.parent.LoginManager != undefined && window.parent.LoginManager != null) {
                    this._loader.show("正在获取用户信息...");
                    window.parent.LoginManager.checkLogInfo(dojo.hitch(this, function (userInfo) {
                        this._loader.hide();
                        if (data.callback) {
                            data.callback(userInfo);
                        }
                    }));
                } else {
                    if (data.callback) {
                        data.callback({
                            status: false,
                            errmsg: "请联系系统管理员,缺少认证模块!"
                        });
                    }
                }
            },
            onMapLoaded: function () {
                /*setTimeout(function() {
                    var bgDom = dom.byId("loadbg");
                    domConstruct.destroy(bgDom);
                }, 1000);*/
                //domStyle.set(dom.byId("siderbutton"), "display", "block");
            },
            onMapLoadedError: function (errMsg) {
                /*setTimeout(function() {
                    var bgDom = dom.byId("loadbg");
                    domConstruct.destroy(bgDom);
                }, 1000);*/
                //console.log("加载底图有误"errMsg);
            },
            resize: function () {
                this.headerHeight = 0;
                domStyle.set(dom.byId("app_content"), "top", this.headerHeight + "px");
                domStyle.set(dom.byId("app_content"), "height", (win.getBox().h - this.headerHeight) + "px");
                domStyle.set(dom.byId("mapcontentClass"), "width", (win.getBox().w - this.siderWidth) + "px");
                // domStyle.set(dom.byId("mapcontentClassBox"), "width", (win.getBox().w - this.siderWidth) + "px");
                domStyle.set(dom.byId("mapcontentClass"), "left", this.siderWidth + "px");
                // domStyle.set(dom.byId("mapcontentClassBox"), "left", this.siderWidth + "px");
                domStyle.set(dom.byId("siderbutton"), "top", ((win.getBox().h - this.headerHeight) / 2 - 45 + this.headerHeight) + "px");
                AppEvent.dispatchAppEvent(AppEvent.APPLICATION_RESIZE, {});
            },
            onFullScreen: function (data) {
                var siderbutton = dom.byId("siderbutton");
                if (data.fullscreen) {
                    //调整头部的高度,隐藏侧边框、侧边框收缩按钮、logo和logo顶部的菜单
                    this.headerHeight = 114;
                    this.siderWidth = 0;
                    domStyle.set(tabcontainer, "display", "none");
                    domStyle.set(siderbutton, "display", "none");
                    domStyle.set(dom.byId("logo-top"), "display", "none");
                    domStyle.set(dom.byId("topmenu-right"), "display", "none");
                    domStyle.set(dom.byId("tabbuttonbar"), "display", "none");
                    domStyle.set(dom.byId("topWidgetContainer"), "top", "0px");
                    domStyle.set(query(".logo")[0], "display", "none"); //隐藏tab标签
                    domStyle.set(dom.byId("topWidgetContainer"), "left", "0px"); //顶部widget跟随政区导航移动
                    this._showsider = false;
                } else {
                    //调整头部的高度,显示侧边框、侧边框收缩按钮、logo和logo顶部的菜单
                    this.headerHeight = 114;
                    this.siderWidth = 350;
                    domStyle.set(tabcontainer, "display", "");
                    domStyle.set(siderbutton, "display", "block");
                    domStyle.set(dom.byId("logo-top"), "display", "block");
                    domStyle.set(dom.byId("topmenu-right"), "display", "block");
                    domStyle.set(dom.byId("tabbuttonbar"), "display", "block"); //显示tab标签
                    domStyle.set(dom.byId("topWidgetContainer"), "top", this.headerHeight - 45 + "px");
                    domStyle.set(query(".logo")[0], "display", "block");
                    //默认打开侧边栏
                    domClass.remove(siderbutton, "siderbutton-shrink");
                    domClass.add(siderbutton, "siderbutton-normal");
                    domStyle.set(dom.byId("topWidgetContainer"), "left", "370px"); //顶部widget移动
                    this._showsider = true;
                }
                //重新设置头部的高度
                domStyle.set(dom.byId("app-header"), "height", this.headerHeight + "px");
                //domStyle.set(query(".header")[0],"height",this.headerHeight+"px");
                //通知框架重新计算侧边栏和地图控件的高度
                this.resize();
            }
        });
    });