side_tools.js 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /**
  2. * Created by Mai on 2017/6/16.
  3. */
  4. $(window).resize(function() {
  5. sheetCommonObj.setColumnWidthByRate($('#stdRationChapter').width() - 40, rationLibObj.rationChapterSpread, rationLibObj.rationChapterTreeSetting.cols);
  6. billsGuidance.setColumnWidthByRate(billsGuidance.elfItem.workBook, $('#zy').width(), billsGuidance.elfItem.headers);
  7. billsGuidance.refreshWorkBook();
  8. rationLibObj.refreshSpread();
  9. BillsElf.setColumnWidthByRate();
  10. loadSideToolsHeight();
  11. //刷新主界面与各库中间的拖动条宽度:始终保持为一个宽度(在小窗口打开一个库,再放大窗口后,该拖动条宽度会变大)
  12. SlideResize.setResizeWidth($('#sideResize'));
  13. subObj.initGljSubTab();
  14. refreshSubSpread();
  15. });
  16. //造价书与各库左右拖动
  17. let sideResizeEles = {};
  18. sideResizeEles.eleObj = {
  19. module: 'stdBillsGuidanceTab',
  20. resize: $('#sideResize'),
  21. parent: $('#mainRow'),
  22. left: $('#main'),
  23. right: $('#mainSide')
  24. };
  25. sideResizeEles.limit = {
  26. min: 150,
  27. max: `$('#mainRow').width()-150`
  28. };
  29. SlideResize.horizontalSlide(sideResizeEles.eleObj, sideResizeEles.limit, function(){
  30. // MaterialController.showReplaceDiv();
  31. subObj.initGljSubTab();
  32. pageCCOprObj.resizeWidth();
  33. BillsElf.setColumnWidthByRate();
  34. projectObj.refreshMainSpread();
  35. refreshSubSpread();
  36. if (sideResizeEles.eleObj.module === 'stdBillsGuidanceTab') {//清单精灵(规则)
  37. billsGuidance.setColumnWidthByRate(billsGuidance.elfItem.workBook, $('#zy').width(), billsGuidance.elfItem.headers);
  38. billsGuidance.refreshWorkBook();
  39. } else if (sideResizeEles.eleObj.module === 'stdRationTab') {//定额库
  40. sheetCommonObj.setColumnWidthByRate($('#stdRationChapter').width() - 40, rationLibObj.rationChapterSpread, rationLibObj.rationChapterTreeSetting.cols);
  41. rationLibObj.refreshSpread();
  42. } else if (sideResizeEles.eleObj.module === 'blockLibTab') {//块模板库
  43. blockLibObj.refreshSpread();
  44. } else if (sideResizeEles.eleObj.module === 'locateTab'){//查找定位
  45. locateObject.refreshWorkBook();
  46. }
  47. });
  48. //定额库上下拖动
  49. let rationLibResizeEles = {};
  50. rationLibResizeEles.eleObj = {
  51. module: 'de',
  52. resize: $('#deResize'),
  53. top: $('#deTopDiv'),
  54. topSpread: $('#stdRationChapter'),
  55. bottom: $('#deBottomDiv'),
  56. bottomSpread: $('#stdSectionRations')
  57. };
  58. rationLibResizeEles.limit = {
  59. min: 150,
  60. max: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#deToolsBar').height()-150-10`,//10: resize.height()
  61. notTopSpread: 0,
  62. notBottomSpread: 0,
  63. totalHeight: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#deToolsBar').height()-10`
  64. };
  65. SlideResize.verticalSlide(rationLibResizeEles.eleObj, rationLibResizeEles.limit, function () {
  66. rationLibObj.refreshSpread();
  67. });
  68. //查找定位上下拖动
  69. function getLocateLibResize(){
  70. let resizeObj = {};
  71. resizeObj.eleObj = {
  72. module: 'locate',
  73. resize: $('#locate_resize'),
  74. top: $('#locateTopDiv'),
  75. topSpread: $('#locate_result'),
  76. bottom: $('#locateBottomDiv'),
  77. bottomSpread: $('#locate_sub')
  78. };
  79. resizeObj.limit = {
  80. min: 150,
  81. max: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#searchPanel').height()-150-10`,//10: resize.height()
  82. notTopSpread: 0,
  83. notBottomSpread: 0,
  84. totalHeight: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#searchPanel').height()-10`
  85. };
  86. return resizeObj;
  87. }
  88. let locateLibResize = getLocateLibResize();
  89. SlideResize.verticalSlide(locateLibResize.eleObj, locateLibResize.limit, function () {
  90. locateObject.refreshWorkBook();
  91. });
  92. // 块模板库上下拖动(上中)
  93. let blockLibTopMid = {};
  94. blockLibTopMid.eleObj = {
  95. module: 'kmbk',
  96. resize: $('#kmbkResizeA'),
  97. top: $('#kmbkTopDiv'),
  98. topSpread: $('#div_block_tree'),
  99. bottom: $('#kmbkMidDiv'),
  100. bottomSpread: $('#div_block_bill')
  101. };
  102. blockLibTopMid.limit = {
  103. min: 100,
  104. max: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#kmbkToolsBar').height()-$('#kmbkBottomDiv').height()-100-10*2`,
  105. notTopSpread: 0,
  106. notBottomSpread: 0,
  107. totalHeight: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#kmbkToolsBar').height()-$('#kmbkBottomDiv').height()-10*2` //10: resize.height()
  108. };
  109. SlideResize.verticalSlide(blockLibTopMid.eleObj, blockLibTopMid.limit, function () {
  110. blockLibObj.refreshSpread();
  111. });
  112. // 块模板库上下拖动(中下)
  113. let blockLibMidBottom = {};
  114. blockLibMidBottom.eleObj = {
  115. module: 'kmbk',
  116. resize: $('#kmbkResizeB'),
  117. top: $('#kmbkMidDiv'),
  118. topSpread: $('#div_block_bill'),
  119. bottom: $('#kmbkBottomDiv'),
  120. bottomSpread: $('#div_block_ration')
  121. };
  122. blockLibMidBottom.limit = {
  123. min: 100,
  124. max: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#kmbkToolsBar').height()-$('#kmbkTopDiv').height()-100-10*2`,
  125. notTopSpread: 0,
  126. notBottomSpread: 0,
  127. totalHeight: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#kmbkToolsBar').height()-$('#kmbkTopDiv').height()-10*2` //10: resize.height()
  128. };
  129. SlideResize.verticalSlide(blockLibMidBottom.eleObj, blockLibMidBottom.limit, function () {
  130. blockLibObj.refreshSpread();
  131. });
  132. //加载块模板库多个结构的变量对象
  133. let blockLibMulti = {
  134. module: 'kmbk',
  135. eles: [
  136. {container: $('#kmbkTopDiv'), spread: $('#div_block_tree'), notSpread: 0, defaultProportion: 0.6},
  137. {container: $('#kmbkMidDiv'), spread: $('#div_block_bill'), notSpread: 0, defaultProportion: 0.15},
  138. {container: $('#kmbkBottomDiv'), spread: $('#div_block_ration'), notSpread: 0, defaultProportion: 0.25},
  139. ],
  140. totalHeight: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#kmbkToolsBar').height()-10*2`
  141. };
  142. //加载各库内部上下高度(有的库需要上下拖动)
  143. function loadSideToolsHeight() {
  144. //定额库
  145. if ($('#de').is(':visible')) {
  146. SlideResize.loadVerticalHeight(rationLibResizeEles.eleObj.module, rationLibResizeEles.eleObj, rationLibResizeEles.limit, function () {
  147. rationLibObj.refreshSpread();
  148. });
  149. } else if ($('#locate').is(':visible')) {
  150. //查找定位
  151. let options = $("input[name='content_type']:checked").val();
  152. locateObject.refreshView(options, true);
  153. } else if ($('#kmbk').is(':visible')) {
  154. SlideResize.loadMultiVerticalHeight(blockLibMulti.module, blockLibMulti.eles, blockLibMulti.totalHeight, function () {
  155. blockLibObj.refreshSpread();
  156. });
  157. }
  158. }
  159. var sideToolsObj = {
  160. showSideTools: function (tabPanel, show, id) {
  161. sideResizeEles.eleObj.module = id;
  162. if (show) {
  163. //刚打开各库时的默认比例
  164. sideResizeEles.eleObj.left.css('width', '66.666667%');
  165. sideResizeEles.eleObj.right.css('width', '33.333333%');
  166. SlideResize.setResizeWidth(sideResizeEles.eleObj.resize);
  167. $('.main-side .tab-pane').hide();
  168. id === 'locateTab'?tabPanel.show(locateObject.onshow):tabPanel.show();//locateTab要等div显示后才执行刷新操作
  169. //加载打开的库与主界面的宽度比
  170. SlideResize.loadHorizonWidth(id, [sideResizeEles.eleObj.resize], [sideResizeEles.eleObj.left, sideResizeEles.eleObj.right], function(){
  171. if (id === 'stdRationTab') {//加载定额库内部上下高度
  172. SlideResize.loadVerticalHeight(rationLibResizeEles.eleObj.module, rationLibResizeEles.eleObj, rationLibResizeEles.limit, function () {
  173. rationLibObj.refreshSpread();
  174. });
  175. } else if (id === 'blockLibTab') {//块模板库
  176. SlideResize.loadMultiVerticalHeight(blockLibMulti.module, blockLibMulti.eles, blockLibMulti.totalHeight, function () {
  177. blockLibObj.refreshSpread();
  178. });
  179. }
  180. });
  181. } else {
  182. sideResizeEles.eleObj.left.css('width', '100%');
  183. sideResizeEles.eleObj.right.css('width', '0%');
  184. tabPanel.hide();
  185. }
  186. adaptiveTzjnrWidth();
  187. autoFlashHeight();
  188. subObj.initGljSubTab();
  189. //MaterialController.showReplaceDiv();
  190. pageCCOprObj.resizeWidth();
  191. billsGuidance.refreshWorkBook();
  192. billsLibObj.refreshBillsSpread();
  193. BillsElf.setColumnWidthByRate();
  194. refreshSubSpread();
  195. billsLibObj.refreshBillsRelaSpread();
  196. rationLibObj.refreshSpread();//subSpread、jobSpread、itemSpread显示问题
  197. }
  198. };
  199. $('.right-nav-link').bind('click', function () {//$('.side-tabs ul li a').bind 2018-11-23 使用更多标签,所以不能这样绑定事件了
  200. var tab = $(this), tabPanel = $(tab.attr('relaPanel'));
  201. if(tab.hasClass('disabled')){
  202. return;
  203. }
  204. let setActiveTab = tab.hasClass("dropdown-item")?tab.parent().prev('.nav-link'):tab;//如果是点击了更多下拉菜单的子项,则需设置成active 的tab是“更多”
  205. if (!(setActiveTab.hasClass('active')&&tabPanel.is(":visible"))) {
  206. $('.side-tabs ul li a').removeClass('active');
  207. setActiveTab.addClass('active');
  208. sideToolsObj.showSideTools(tabPanel, true, tab.attr('id'));
  209. } else {
  210. setActiveTab.removeClass('active');
  211. sideToolsObj.showSideTools(tabPanel, false, tab.attr('id'));
  212. }
  213. projectObj.refreshMainSpread();
  214. });