global.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*全局自适应高度*/
  2. function autoFlashHeight(){
  3. let headerHeight = $(".header").height();
  4. let toolsbarHeight = $(".toolsbar").height();
  5. let ftoolsbarHeight = $(".toolsbar-f").height();
  6. let btntoolsbarHeight = $(".btn-toolbar").height();
  7. // var feeRateToolsbarHeight = $(".toolsbar_feeRate").height();
  8. let toolsBarHeightQ = $(".tools-bar-height-q").height();
  9. let toolsBarHeightD = $(".tools-bar-height-d").height();
  10. let toolsBarHeightZ = $(".tools-bar-height-z").height();
  11. //$(".main-data-side-q").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightQ-302);
  12. $(".main-data-side-q").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightQ-$('#qd').find('.bottom-content').find('.p-0').height()-5);
  13. //$(".main-data-side-d").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightD-302);
  14. $(".main-data-side-d").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightD-$('#stdSectionRations').height()-5);
  15. $(".main-data-side-zb").height(($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightZ) - $('#billsGuidance_items').height() - 5);
  16. /*$(".main-data-side-zi").height($(window).height()-headerHeight-toolsbarHeight- toolsBarHeightZ - $(".main-data-side-zb").height());*/
  17. $('.main-content').width($(window).width()-$('.main-nav').width()-$('.main-side').width()-5);
  18. $('#glj_tree_div .modal-content').width($(window).width() < 1020 + 20 ? $(window).width() - 20 : 1020);
  19. //$("#main .main-data-top").height($(window).height()-headerHeight-toolsbarHeight-bottomContentHeight-1);
  20. typeof(loadMainSize)== 'function' ?loadMainSize():'';//zhang 2018-06-04 统一加载高度方法
  21. typeof(loadProjectGljSize)== 'function'?loadProjectGljSize():'';
  22. $(".main-data-full").height($(window).height()-headerHeight-toolsbarHeight-1);
  23. $(".main-data-full-fl").height($(window).height()-headerHeight-toolsbarHeight-37);
  24. $(".main-data-full-feeRate").height($(window).height()-headerHeight-78);
  25. $(".main-data-full-tender").height($(window).height()-headerHeight-btntoolsbarHeight-10);
  26. $(".main-data-not").height($(window).height()-headerHeight-1);
  27. $(".main-data-side-search").height($(window).height()-headerHeight-toolsbarHeight-64);
  28. $(".side-content").height($(window).height()-headerHeight );
  29. $(".poj-list").height($(window).height()-headerHeight-toolsbarHeight);
  30. $(".gc-list").height($(window).height()-headerHeight-toolsbarHeight-40);
  31. $(".share-list").height($(window).height()-headerHeight-toolsbarHeight-40);
  32. $(".form-view").height($(window).height()-headerHeight-ftoolsbarHeight);
  33. $(".form-list").height($(window).height()-headerHeight-50 );
  34. typeof(adaptiveTzjnrWidth)== 'function' ?adaptiveTzjnrWidth():''
  35. };
  36. /*全局自适应高度结束*/
  37. $(function () {
  38. $(window).resize(autoFlashHeight);
  39. /*侧滑*/
  40. /* $(".open-sidebar").click(function () {
  41. $(".slide-sidebar").animate({width: "800"}).addClass("open");
  42. });
  43. $("body").click(function (event) {
  44. var e = event || window.event; //浏览器兼容性
  45. if (!$(event.target).is('a')) {
  46. var elem = event.target || e.srcElement;
  47. while (elem) { //循环判断至跟节点,防止点击的是div子元素
  48. if (elem.className == "open-sidebar" || elem.className == 'slide-sidebar open') {
  49. return false;
  50. }
  51. elem = elem.parentNode;
  52. }
  53. $(".slide-sidebar").animate({width: "0"}).removeClass("open")// 关闭处理
  54. }
  55. });*/
  56. /*侧滑*/
  57. /*工具提示*/
  58. $(function () {
  59. $('[data-toggle="tooltip"]').tooltip();
  60. $('[data-toggle="tooltip"]').click(function () {
  61. $(this).tooltip('hide');
  62. })
  63. });
  64. });
  65. /**
  66. * 设置本地缓存
  67. *
  68. * @param {String} key
  69. * @param {String|Number} value
  70. * @return {void}
  71. */
  72. function setLocalCache(key, value) {
  73. const storage = window.localStorage;
  74. if (!storage || key === '' || value === '') {
  75. return;
  76. }
  77. storage.setItem(key, value);
  78. }
  79. /**
  80. * 获取本地缓存
  81. *
  82. * @param {String} key
  83. * @return {String}
  84. */
  85. function getLocalCache(key) {
  86. const storage = window.localStorage;
  87. if (!storage || key === '') {
  88. return null;
  89. }
  90. return storage.getItem(key);
  91. }
  92. function removeLocalCache(key) {
  93. const storage = window.localStorage;
  94. if (!storage || key === '') {
  95. return null;
  96. }
  97. return storage.removeItem(key);
  98. }
  99. function getFormatter(decimal) {
  100. var pre = "0.";
  101. if (decimal <= 0) {
  102. return "0";
  103. }
  104. for (let i = 0; i < decimal; i++) {
  105. pre += "0"
  106. }
  107. return pre;
  108. }
  109. function getFeeIndex(fees) {
  110. let feesIndex = {};
  111. if (fees) {
  112. for(let fee of fees){
  113. fee.unitFee = parseFloat(fee.unitFee);
  114. fee.totalFee = parseFloat(fee.totalFee);
  115. fee.tenderUnitFee = parseFloat(fee.tenderUnitFee);
  116. fee.tenderTotalFee = parseFloat(fee.tenderTotalFee);
  117. feesIndex[fee.fieldName] = fee;
  118. }
  119. }
  120. return feesIndex;
  121. }
  122. function replaceAll(FindText, RepText,str) {
  123. let regExp = new RegExp(FindText, "g");
  124. return str.replace(regExp, RepText);
  125. };