global.js 4.6 KB

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