赣州市洪水风险预警系统三维版本
guoshilong
2023-02-27 4d8c6dd77427e8e581fda17b6b65ba86bfb7a815
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
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 
///////////////////////////////////////////////////////////////////////////
// Copyright © 2019 zhongsong. All Rights Reserved.
// 模块描述: 站网详情
///////////////////////////////////////////////////////////////////////////
define(['dojo/_base/declare', 'dojo/_base/lang', 'dojo/_base/array', 'dojo/_base/html', 'dojo/topic', 'jimu/BaseWidget', 'libs/layer/layer.js'], function (declare, lang, array, html, topic, BaseWidget, layer) {
    return declare([BaseWidget], {
        baseClass: 'jimu-widget-HydroNetWorkDetails',
        name: 'HydroNetWorkDetails',
        _waterPrimitive: null,
        _rowData: null,
        startup: function startup() {
            // this.inherited(arguments);
            topic.subscribe("openDetails", lang.hitch(this, this.openDetails));
            $('.jimu-widget-HydroNetWorkDetails .net-work-close i').click(function () {
                $('.jimu-widget-HydroNetWorkDetails .net-work-details').stop().hide();
                $('.jimu-widget-HydroNetWorkDetails .net-work-details-btn').stop().show();
            });
 
            $(".jimu-widget-HydroNetWorkDetails .net-work-tab ul li").click(function () {
                if ($(this).text() != "") {
                    $(this).addClass('on').siblings().removeClass('on');
                    if ($(this).index() == 0) {
                        $(".net-work-monitor").stop().show();
                        $(".ner-work-panorama").stop().hide();
                    } else if ($(this).index() == 2) {
                        $(".net-work-monitor").stop().hide();
                        $(".ner-work-panorama").stop().show();
                    }
                }
            });
 
            //音频播放对象点击事件
            var player = $("#bgMusic")[0];
            $(".jimu-widget-HydroNetWorkDetails .monitor-child-audio").click(function () {
 
                if (player.paused) { /*如果已经暂停*/
                    player.play(); /*播放*/
                    $(".jimu-widget-HydroNetWorkDetails .monitor-child-audio").css('background-image', "url(images/open-play-Monitoring.png)");
                } else {
                    player.pause();/*暂停*/
                    $(".jimu-widget-HydroNetWorkDetails .monitor-child-audio").css('background-image', "url(images/close-paly-Monitoring.png)");
                }
            });
 
            $('.jimu-widget-HydroNetWorkDetails .net-work-details-btn').click(function () {
                $('.jimu-widget-HydroNetWorkDetails .net-work-details').stop().show();
                $('.jimu-widget-HydroNetWorkDetails .net-work-details-btn').stop().hide();
                $('.jimu-widget-HydroNetWorkDetails .net-work-tab ul li:eq(0)').trigger('click');
            });
 
            $('.jimu-widget-HydroNetWorkDetails .ner-work-panorama').on('click', 'i', function () {
                var el = document.documentElement;
                var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullscreen;
                if (typeof rfs != "undefined" && rfs) {
                    rfs.call($('.jimu-widget-HydroNetWorkDetails .ner-work-panorama iframe')[0]);
                };
                return;
            });
 
            $('.jimu-widget-HydroNetWorkDetails .net-work-monitor').on('click', 'img', function () {
                var _layer$open;
 
                var wid = $(window).width() + 'px';
                var hei = $(window).height() + 'px';
                var url = $(this).attr('src');
                var title = $('.jimu-widget-HydroNetWorkDetails .net-work-title').text();
                layer.open((_layer$open = {
                    id: 'net-work-bigmonitor',
                    title: title,
                    type: 1,
                    shadeClose: true,
                    shade: false,
                    maxmin: true, //开启最大化最小化按钮
                    area: [wid, hei],
                    offset: ['0px', '0px'],
                    content: '<img src=\'' + url + '\' width=\'100%\' height=\'100%\' style=\'vertical-align: middle;\'>'
                }, _defineProperty(_layer$open, 'id', "ComprehensiveSupervise"), _defineProperty(_layer$open, 'closeBtn', 1), _defineProperty(_layer$open, 'success', function success(layero, index) {}), _layer$open));
            });
        },
        openDetails: function openDetails(item) {
            $('.net-work-img').empty();
            $('.net-work-monitor').empty();
            $('.ner-work-panorama').empty();
 
            $("#bgMusic").attr('src', "widgets/HydroNetWorkDetails/audio/" + item.audio + ".mp3");
 
            if (item) {
                $('.net-work-title').text(item.name);
                if (item.image != "") {
                    $('.net-work-img').append('<img src="' + item.image + '"></img>');
                }
                if (item.introduce != "") {
                    $('.jimu-widget-HydroNetWorkDetails p').text(item.introduce);
                }
                if (item.monitor != "") {
                    $('.net-work-monitor').removeClass("on").append('<img src="' + item.monitor + '"></img>');
                } else {
                    $('.net-work-monitor').addClass('on').text('暂无有效监控');
                }
                if (item.panorama != "") {
                    $('.ner-work-panorama').removeClass("on").append('<i class=\'btn\'><img src="./images/net-work-big.png"></img></i> <iframe src="' + item.panorama + '" scrolling="no"></iframe>');
                } else {
                    $('.ner-work-panorama').addClass('on').text('暂无有效体验');
                }
            }
        },
 
        onOpen: function onOpen() {
            //面板打开的时候触发 (when open this panel trigger)
        },
 
        onClose: function onClose() {
            //面板关闭的时候触发 (when this panel is closed trigger)
        },
 
        onMinimize: function onMinimize() {
            this.resize();
        },
 
        onMaximize: function onMaximize() {
            this.resize();
        },
 
        resize: function resize() {},
 
        destroy: function destroy() {
            //销毁的时候触发
            //todo
            //do something before this func
            this.inherited(arguments);
        }
 
    });
});