side_tools.js 9.4 KB

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