123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- /*全局自适应高度*/
- function autoFlashHeight(){
- let headerHeight = $(".header").height();
- let toolsbarHeight = getToolsbarHeight();
- let ftoolsbarHeight = $(".toolsbar-f").height();
- let btntoolsbarHeight = $(".btn-toolbar").height();
- // var feeRateToolsbarHeight = $(".toolsbar_feeRate").height();
- let toolsBarHeightQ = $(".tools-bar-height-q").height();
- let toolsBarHeightD = $(".tools-bar-height-d").height();
- let toolsBarHeightZ = $(".tools-bar-height-z").height();
- //$(".main-data-side-q").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightQ-302);
- $(".main-data-side-q").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightQ-$('#qd').find('.bottom-content').find('.p-0').height()-5);
- //$(".main-data-side-d").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightD-302);
- $(".main-data-side-d").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightD-$('#stdSectionRations').height()-5);
- $(".main-data-side-zb").height(($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightZ));
- /*$(".main-data-side-zi").height($(window).height()-headerHeight-toolsbarHeight- toolsBarHeightZ - $(".main-data-side-zb").height());*/
- $('.main-content').width($(window).width()-$('.main-nav').width()-$('.main-side').width()-5);
- $('#glj_tree_div .modal-content').width($(window).width() < 1020 + 20 ? $(window).width() - 20 : 1020);
- //$("#main .main-data-top").height($(window).height()-headerHeight-toolsbarHeight-bottomContentHeight-1);
- typeof(loadMainSize)== 'function' ?loadMainSize():'';//zhang 2018-06-04 统一加载高度方法
- typeof(loadProjectGljSize)== 'function'?loadProjectGljSize():'';
- typeof(onResize)== 'function'?onResize():'';
- $(".main-data-full").height($(window).height()-headerHeight-toolsbarHeight-1);
- $(".main-data-full-fl").height($(window).height()-headerHeight-toolsbarHeight-37);
- $(".main-data-full-feeRate").height($(window).height()-headerHeight-78);
- $(".main-data-full-tender").height($(window).height()-headerHeight-btntoolsbarHeight-10);
- $(".main-data-not").height($(window).height()-headerHeight-1);
- $(".main-data-side-search").height($(window).height()-headerHeight-toolsbarHeight-64);
- $(".side-content").height($(window).height()-headerHeight );
- $(".poj-list").height($(window).height()-headerHeight-toolsbarHeight);
- $(".gc-list").height($(window).height()-headerHeight-toolsbarHeight);
- $(".share-list").height($(window).height()-headerHeight-toolsbarHeight);
- $(".form-view").height($(window).height()-headerHeight-ftoolsbarHeight);
- $(".form-list").height($(window).height()-headerHeight);
- $('#comments').find('textarea').height($('#comments').height() - 25);
- typeof(adaptiveTzjnrWidth)== 'function' ?adaptiveTzjnrWidth():'';
- $('#project-glj-main').width($(window).width()-($('.main-nav').width()+ 2)-($('.filterType').width()+12)-5); //2、12是padding宽度,width 是不算padding宽度的
- $('#config_material').width($(window).width()-($('.main-nav').width()+ 2)-($('.filterType').width()+12)-5); //2、12是padding宽度,width 是不算padding宽度的
- $('#material_adjust').width($(window).width()-($('.main-nav').width()+ 2)-($('.filterType').width()+12)-5);//材料调差
- $('#index_content').width($(window).width()-($('.main-nav').width()+ 2)-($('#index_nav').width()+12)-5);//材料调差
- //typeof zmhs_obj === 'object' ? zmhs_obj.loadSideResize() : '';
- };
- function getToolsbarHeight() {//动态获取toolsbar高度,由于页面有多个toolsbar高度,直接取取不到当前页的toolsbar
- for(let t of $(".toolsbar")) {
- let height = $(t).height();
- if(height != -1) return height;
- }
- return 0;
- }
- /*全局自适应高度结束*/
- $(function () {
- //拖动头部
- $('body').on("show.bs.modal", ".modal", function(){
- if (typeof $(this).find('.modal-content').draggable === 'function') {
- $(this).find('.modal-content').draggable({handle: '.modal-header', cancel: 'a, button'});
- }
- });
- $(window).resize(autoFlashHeight);
- /*侧滑*/
- /* $(".open-sidebar").click(function () {
- $(".slide-sidebar").animate({width: "800"}).addClass("open");
- });
- $("body").click(function (event) {
- var e = event || window.event; //浏览器兼容性
- if (!$(event.target).is('a')) {
- var elem = event.target || e.srcElement;
- while (elem) { //循环判断至跟节点,防止点击的是div子元素
- if (elem.className == "open-sidebar" || elem.className == 'slide-sidebar open') {
- return false;
- }
- elem = elem.parentNode;
- }
- $(".slide-sidebar").animate({width: "0"}).removeClass("open")// 关闭处理
- }
- });*/
- /*侧滑*/
- /*显示QQ交流群*/
- $("#showqqgroup").hover(function(){
- $("#qqgroup").toggle();
- });
- /*工具提示*/
- $(function () {
- $('[data-toggle="tooltip"]').tooltip();
- if( $('[data-submenu]').submenupicker) $('[data-submenu]').submenupicker();
- $('[data-toggle="tooltip"]').click(function () {
- $(this).tooltip('hide');
- })
- });
- });
- /**
- * 设置本地缓存
- *
- * @param {String} key
- * @param {String|Number} value
- * @return {void}
- */
- let storageErrCount = 0;
- function setLocalCache(key, value) {
- const storage = window.localStorage;
- if (!storage || key === '' || value === '') {
- return;
- }
- try {
- storage.setItem(key, value);
- storageErrCount = 0;
- } catch (err) {
- storageErrCount++;
- if (storageErrCount > 1) {
- alert(`字段“${key}”数据过大,存入本地缓存失败。`)
- storageErrCount = 0;
- return;
- }
- storage.clear();
- setLocalCache(key, value);
- }
- }
- /**
- * 获取本地缓存
- *
- * @param {String} key
- * @return {String}
- */
- function getLocalCache(key) {
- const storage = window.localStorage;
- if (!storage || key === '') {
- return null;
- }
- return storage.getItem(key);
- }
- function removeLocalCache(key) {
- const storage = window.localStorage;
- if (!storage || key === '') {
- return null;
- }
- return storage.removeItem(key);
- }
- function getFormatter(decimal) {
- var pre = "0.";
- if (decimal <= 0) {
- return "0";
- }
- for (let i = 0; i < decimal; i++) {
- pre += "0"
- }
- return pre;
- }
- function getFeeIndex(fees) {
- let feesIndex = {};
- if (fees) {
- for(let fee of fees){
- const parsedUnitFee = parseFloat(fee.unitFee);
- const parsedTotalFee = parseFloat(fee.totalFee);
- const parsedTenderUnitFee = parseFloat(fee.tenderUnitFee);
- const parsedTenderTotalFee = parseFloat(fee.tenderTotalFee);
- fee.unitFee = parsedUnitFee || 0;
- fee.totalFee = parsedTotalFee || 0;
- fee.tenderUnitFee = parsedTenderUnitFee || 0;
- fee.tenderTotalFee = parsedTenderTotalFee || 0;
- feesIndex[fee.fieldName] = fee;
- }
- }
- return feesIndex;
- }
- function replaceAll(FindText, RepText,str) {
- let regExp = new RegExp(FindText, "g");
- return str.replace(regExp, RepText);
- };
- function setTimeoutSync(handle, time) {
- return new Promise(function(resolve, reject) {
- setTimeout(function () {
- if (handle && typeof handle === 'function') {
- handle();
- }
- resolve();
- }, time);
- });
- }
|