global.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. };
  35. /*全局自适应高度结束*/
  36. $(function () {
  37. $(window).resize(autoFlashHeight);
  38. /*侧滑*/
  39. /* $(".open-sidebar").click(function () {
  40. $(".slide-sidebar").animate({width: "800"}).addClass("open");
  41. });
  42. $("body").click(function (event) {
  43. var e = event || window.event; //浏览器兼容性
  44. if (!$(event.target).is('a')) {
  45. var elem = event.target || e.srcElement;
  46. while (elem) { //循环判断至跟节点,防止点击的是div子元素
  47. if (elem.className == "open-sidebar" || elem.className == 'slide-sidebar open') {
  48. return false;
  49. }
  50. elem = elem.parentNode;
  51. }
  52. $(".slide-sidebar").animate({width: "0"}).removeClass("open")// 关闭处理
  53. }
  54. });*/
  55. /*侧滑*/
  56. /*工具提示*/
  57. $(function () {
  58. $('[data-toggle="tooltip"]').tooltip();
  59. });
  60. });
  61. /**
  62. * 设置本地缓存
  63. *
  64. * @param {String} key
  65. * @param {String|Number} value
  66. * @return {void}
  67. */
  68. function setLocalCache(key, value) {
  69. const storage = window.localStorage;
  70. if (!storage || key === '' || value === '') {
  71. return;
  72. }
  73. storage.setItem(key, value);
  74. }
  75. /**
  76. * 获取本地缓存
  77. *
  78. * @param {String} key
  79. * @return {String}
  80. */
  81. function getLocalCache(key) {
  82. const storage = window.localStorage;
  83. if (!storage || key === '') {
  84. return null;
  85. }
  86. return storage.getItem(key);
  87. }
  88. function removeLocalCache(key) {
  89. const storage = window.localStorage;
  90. if (!storage || key === '') {
  91. return null;
  92. }
  93. return storage.removeItem(key);
  94. }
  95. function getFormatter(decimal) {
  96. var pre = "0.";
  97. if (decimal <= 0) {
  98. return "0";
  99. }
  100. for (let i = 0; i < decimal; i++) {
  101. pre += "0"
  102. }
  103. return pre;
  104. }
  105. function getFeeIndex(fees) {
  106. let feesIndex = {};
  107. if (fees) {
  108. for(let fee of fees){
  109. fee.unitFee = parseFloat(fee.unitFee);
  110. fee.totalFee = parseFloat(fee.totalFee);
  111. fee.tenderUnitFee = parseFloat(fee.tenderUnitFee);
  112. fee.tenderTotalFee = parseFloat(fee.tenderTotalFee);
  113. feesIndex[fee.fieldName] = fee;
  114. }
  115. }
  116. return feesIndex;
  117. }