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