| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 | /** * Created by Mai on 2017/3/10. */$(function () {    loadMainSize();    $("#header-menu").removeAttr('style');    $('#tab_baobiao').on('shown.bs.tab', function (e) {        $(e.relatedTarget.hash).removeClass('active');        // do something    });    $('#tab_zaojiashu').on('shown.bs.tab', function (e) {        //设置sessionStorage,重载时用        sessionStorage.setItem('mainTab', '#tab_zaojiashu');        $(e.relatedTarget.hash).removeClass('active');        $("#subItems").addClass('active');        $(gljOprObj.activeTab).addClass('active');        autoFlashHeight();        projectObj.refreshMainSpread();        billsGuidance.refreshWorkBook();        billsLibObj.refreshBillsSpread();        billsLibObj.refreshBillsRelaSpread();        rationLibObj.refreshSpread();        subObj.initGljSubTab();        subObj.initQDSubTab();        if($('#linkJSCX').hasClass('active'))            calcProgramObj.refreshCalcProgram(projectObj.project.mainTree.selected, 2);        //refreshSubSpread();    });    $('#tab_report').on('shown.bs.tab', function(e){        projectObj.project.calcProgram.doTenderCalc();   // 进入报表前先自动调价计算一遍        sessionStorage.setItem('mainTab', '#tab_report');        autoFlashHeight();    });    let mainResizeEles = getMainResizeEles();    SlideResize.verticalSlide(mainResizeEles.eleObj, mainResizeEles.limit, function(){        projectObj.mainSpread.refresh();        refreshSubSpread();        $('#comments').find('textarea').height($('#comments').height() - 25);        $("#tzCharacterText").height($("#tzSubDiv").height()-30);    });    const projectId = scUrlUtil.GetQueryString('project');    // 绑定点击事件    projectObj.mainSpread.bind(GC.Spread.Sheets.Events.CellClick, function(sender, info) {        if (info.row !== undefined && projectId !== undefined) {            setLocalCache('lastRow:' + projectId, info.row);            setLocalCache('lastCol:' + projectId, info.col);        }    });});function getMainResizeEles() {    // 读取本地存储的高度(必须放在载入spread之前)    let mainResizeEles = {};    mainResizeEles.eleObj = {        module: 'mainVertical',        resize: $('#mainVerticalResize'),        top: $('#top_div'),        topSpread: $('#top_div').children('.main-data-top'),        bottom: $('#bottom_div'),        bottomSpread: $('#bottom_div').children().find('.main-data-bottom'),    };    mainResizeEles.limit = {        min: 180,        max: `$(window).height()-$('.header').height()-$('#headerToolsBar').height()-180-5`,        notTopSpread: 0,        notBottomSpread: $('#bottom_div ul').height(),        totalHeight: `$(window).height()-$('.header').height()-$('#headerToolsBar').height()-5`    };    return mainResizeEles;}function getMaxLim(ele) {    $(window).height()-$('.header').height()-$('#headerToolsBar').height()-150-10}function loadMainSize() {//加载造价书页面各高度    // 读取本地存储的高度(必须放在载入spread之前)    let mainResizeEles = getMainResizeEles();    SlideResize.loadVerticalHeight(mainResizeEles.eleObj.module, mainResizeEles.eleObj, mainResizeEles.limit, function () {        refreshSubSpread();        //zmhs_obj.refresh();        $("#tzCharacterText").height($("#tzSubDiv").height()-30);    });}function getResizeWidthPercent(nearSize, farSize){    const resizeWidth = 6;    nearSize = parseFloat(nearSize);    farSize = parseFloat(farSize);    let nearPercent = (nearSize / (resizeWidth + nearSize + farSize) * 100) + '%';    let farPercent = (farSize / (resizeWidth + nearSize + farSize) * 100) + '%';    return {nearPercent, farPercent};}function setSizeWithPercent(tag,eles,nearSize,farSize,type) {    nearSize = parseFloat(nearSize);    farSize = parseFloat(farSize);    if(type !== 'width') {        let headerHeight = $(".header").height();        let toolsbarHeight = $(".toolsbar").height();        let exand = tag == "#main" ? 1:50;        let totalHeight = $(window).height() - headerHeight - toolsbarHeight-exand;        const navSize = eles.nav ? eles.nav[type]() + 4 : 0;        totalHeight = totalHeight - navSize;        nearSize = (nearSize/(nearSize + farSize))* totalHeight;        eles.nearSpread[type](nearSize);        eles.farSpread[type](totalHeight - nearSize);        eles.farElement[type](totalHeight - nearSize + navSize);    }}function setDefaultSize(tag,eles,type) {    let o_nearSize = 5;    let o_farSize = 2;    if(type == 'height'){        let headerHeight = $(".header").height();        let toolsbarHeight = $(".toolsbar").height();        let exand = tag == "#main" ? 1:50;        let totalHeight = $(window).height() - headerHeight - toolsbarHeight-exand;        const navSize = eles.nav ? eles.nav[type]() + 4 : 0;        totalHeight = totalHeight - navSize;        let nearSize = (o_nearSize/(o_nearSize + o_farSize))* totalHeight;        eles.nearSpread[type](nearSize);        eles.farSpread[type](totalHeight - nearSize);        eles.farElement[type](totalHeight - nearSize + navSize);    }}function disableRightMenu(id,spread,rowChangeFunction) {    let me = this;    $.contextMenu({        selector: '#'+id,        build: function ($trigger, e) {            let oldRow = spread.getActiveSheet().getSelections()[0].row;            var target = SheetDataHelper.safeRightClickSelection($trigger, e, spread);            if(rowChangeFunction){                if(oldRow != target.row){                    rowChangeFunction(target.row)                }            }            return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;        },        items: {            "disable": {                name: "",                visible: function () {                    return false;                },                callback: function (key, opt) {                }            },        }    });}/*window.onunload=show;  页面唯一性可以用session storage 来做function show(){    return "exit"};*///页面失去焦点时触发/*window.onblur = function () {  console.log("test")};*/
 |