side_tools.js 9.4 KB

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