define(function (require, exports, module) {
    var global = require("../../js/global");

    function init() {
        initGlobalEvent();
        initEvent();
        initDom();

        function initEvent() {
            //默认加载设备管理页面
            //			$(".selectDeviceContent").load("./faultDiagMenu/html/selectDevice.html");
            var curElement = ".selectDeviceContent", nextPageUrl = "./hz/html/initEg.html";
            global.enterPageCallback(curElement, nextPageUrl);

            //注册菜单切换事件
            $(".faultDiagItem").on("click", function () {
                console.log('on change');
                $(".faultDiagItem").removeClass("curSelectItem");
                $(this).addClass("curSelectItem");
            });

            $("#initEg").click(function () {
                console.log('click initEg');
                global.curClickPageId = ".selectDeviceContent|#initEg";
                var curElement = ".selectDeviceContent", nextPageUrl = "./hz/html/initEg.html";
                global.enterPageCallback(curElement, nextPageUrl);
            });

            $("#diagLegend").click(function () {
                global.curClickPageId = ".selectDeviceContent|#diagLegend";
                var curElement = ".selectDeviceContent", nextPageUrl = "./faultDiagMenu/html/diagLegend.html";
                global.enterPageCallback(curElement, nextPageUrl);
            });
        }
        function initDom() {
            $('#uploadModal').modal({
                backdrop: 'static',
                show: false
            });

            if (global.userMgrIns.hasPermission('downloadLog')) {
                $('#logDownload').show();
            }
        }
        function initGlobalEvent() {
            global.exitPageCallback.exitFun = function () {
                return true;
            }
        }
    }
    exports.init = init;
});