global.js 5.3 KB

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