side_tools.js 9.0 KB

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