side_tools.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. /**
  2. * Created by Mai on 2017/6/16.
  3. */
  4. $(window).resize(function() {
  5. autoFlashHeight();
  6. if ($('#stdRationChapter').width() > 0) {
  7. sheetCommonObj.setColumnWidthByRate($('#stdRationChapter').width() - 30, rationLibObj.rationChapterSpread, rationLibObj.rationChapterTreeSetting.cols);
  8. }
  9. billsGuidance.refreshWorkBook();
  10. rationLibObj.refreshSpread();
  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. projectObj.refreshMainSpread();
  37. refreshSubSpread();
  38. if (sideResizeEles.eleObj.module === 'stdBillsGuidanceTab') {//清单精灵(规则)
  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-5`,//5: resize.height()
  62. notTopSpread: 0,
  63. notBottomSpread: 0,
  64. totalHeight: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#deToolsBar').height()-5`
  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-5`,//5: resize.height()
  83. notTopSpread: 0,
  84. notBottomSpread: 0,
  85. totalHeight: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#searchPanel').height()-5`
  86. };
  87. return resizeObj;
  88. }
  89. let locateLibResize = getLocateLibResize();
  90. SlideResize.verticalSlide(locateLibResize.eleObj, locateLibResize.limit, function () {
  91. locateObject.refreshWorkBook();
  92. });
  93. function getBookmarkResize() {
  94. let resizeObj = {};
  95. resizeObj.eleObj = {
  96. module: 'bookmark',
  97. resize: $('#bookmark_resize'),
  98. top: $('#bookmarkTopDiv'),
  99. topSpread: $('#bookmarkSpread'),
  100. bottom: $('#annotationDiv'),
  101. bottomSpread: $('#annotationTextarea')
  102. };
  103. resizeObj.limit = {
  104. min: 150,
  105. max: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#searchPanel').height()-100-5`,//5: resize.height()
  106. notTopSpread: 35,
  107. notBottomSpread: 15,
  108. totalHeight: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#searchPanel').height()-5`//5: resize.height()
  109. };
  110. return resizeObj;
  111. }
  112. let bookMarkLibResize = getBookmarkResize();
  113. SlideResize.verticalSlide(bookMarkLibResize.eleObj, bookMarkLibResize.limit, function () {
  114. locateObject.refreshWorkBook();
  115. });
  116. // 块模板库上下拖动(上中)
  117. let blockLibTopMid = {};
  118. blockLibTopMid.eleObj = {
  119. module: 'kmbk',
  120. resize: $('#kmbkResizeA'),
  121. top: $('#kmbkTopDiv'),
  122. topSpread: $('#div_block_tree'),
  123. bottom: $('#kmbkMidDiv'),
  124. bottomSpread: $('#div_block_bill')
  125. };
  126. blockLibTopMid.limit = {
  127. min: 100,
  128. max: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#kmbkToolsBar').height()-$('#kmbkBottomDiv').height()-100-5*2`,
  129. notTopSpread: 0,
  130. notBottomSpread: 0,
  131. totalHeight: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#kmbkToolsBar').height()-$('#kmbkBottomDiv').height()-5*2` //5: resize.height()
  132. };
  133. SlideResize.verticalSlide(blockLibTopMid.eleObj, blockLibTopMid.limit, function () {
  134. blockLibObj.refreshSpread();
  135. });
  136. // 块模板库上下拖动(中下)
  137. let blockLibMidBottom = {};
  138. blockLibMidBottom.eleObj = {
  139. module: 'kmbk',
  140. resize: $('#kmbkResizeB'),
  141. top: $('#kmbkMidDiv'),
  142. topSpread: $('#div_block_bill'),
  143. bottom: $('#kmbkBottomDiv'),
  144. bottomSpread: $('#div_block_ration')
  145. };
  146. blockLibMidBottom.limit = {
  147. min: 100,
  148. max: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#kmbkToolsBar').height()-$('#kmbkTopDiv').height()-100-5*2`,
  149. notTopSpread: 0,
  150. notBottomSpread: 0,
  151. totalHeight: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#kmbkToolsBar').height()-$('#kmbkTopDiv').height()-5*2` //5: resize.height()
  152. };
  153. SlideResize.verticalSlide(blockLibMidBottom.eleObj, blockLibMidBottom.limit, function () {
  154. blockLibObj.refreshSpread();
  155. });
  156. //加载块模板库多个结构的变量对象
  157. let blockLibMulti = {
  158. module: 'kmbk',
  159. eles: [
  160. {container: $('#kmbkTopDiv'), spread: $('#div_block_tree'), notSpread: 0, defaultProportion: 0.6},
  161. {container: $('#kmbkMidDiv'), spread: $('#div_block_bill'), notSpread: 0, defaultProportion: 0.15},
  162. {container: $('#kmbkBottomDiv'), spread: $('#div_block_ration'), notSpread: 0, defaultProportion: 0.25},
  163. ],
  164. totalHeight: `$(window).height()-$('.header').height()-$('.toolsbar').height()-$('#kmbkToolsBar').height()-5*2`
  165. };
  166. //加载各库内部上下高度(有的库需要上下拖动)
  167. function loadSideToolsHeight() {
  168. //定额库
  169. if ($('#de').is(':visible')) {
  170. SlideResize.loadVerticalHeight(rationLibResizeEles.eleObj.module, rationLibResizeEles.eleObj, rationLibResizeEles.limit, function () {
  171. rationLibObj.refreshSpread();
  172. });
  173. } else if ($('#locate').is(':visible')) {
  174. //查找定位
  175. let options = $("input[name='content_type']:checked").val();
  176. locateObject.refreshView(options, true);
  177. } else if ($('#kmbk').is(':visible')) {
  178. SlideResize.loadMultiVerticalHeight(blockLibMulti.module, blockLibMulti.eles, blockLibMulti.totalHeight, function () {
  179. blockLibObj.refreshSpread();
  180. });
  181. }
  182. }
  183. var sideToolsObj = {
  184. showSideTools: function (tabPanel, show, id) {
  185. sideResizeEles.eleObj.module = id;
  186. if (show) {
  187. //刚打开各库时的默认比例
  188. sideResizeEles.eleObj.left.css('width', '66.666667%');
  189. sideResizeEles.eleObj.right.css('width', '33.333333%');
  190. SlideResize.setResizeWidth(sideResizeEles.eleObj.resize);
  191. $('.main-side .tab-pane').hide();
  192. id === 'locateTab'?tabPanel.show(locateObject.onshow):tabPanel.show();//locateTab要等div显示后才执行刷新操作
  193. //加载打开的库与主界面的宽度比
  194. SlideResize.loadHorizonWidth(id, [sideResizeEles.eleObj.resize], [sideResizeEles.eleObj.left, sideResizeEles.eleObj.right], function(){
  195. if (id === 'stdRationTab') {//加载定额库内部上下高度
  196. SlideResize.loadVerticalHeight(rationLibResizeEles.eleObj.module, rationLibResizeEles.eleObj, rationLibResizeEles.limit, function () {
  197. sheetCommonObj.setColumnWidthByRate($('#stdRationChapter').width() - 30, rationLibObj.rationChapterSpread, rationLibObj.rationChapterTreeSetting.cols);
  198. });
  199. } else if (id === 'blockLibTab') {//块模板库
  200. SlideResize.loadMultiVerticalHeight(blockLibMulti.module, blockLibMulti.eles, blockLibMulti.totalHeight, function () {
  201. blockLibObj.refreshSpread();
  202. });
  203. }
  204. });
  205. } else {
  206. sideResizeEles.eleObj.left.css('width', '100%');
  207. sideResizeEles.eleObj.right.css('width', '0%');
  208. tabPanel.hide();
  209. }
  210. adaptiveTzjnrWidth();
  211. autoFlashHeight();
  212. subObj.initGljSubTab();
  213. subObj.initQDSubTab();
  214. pageCCOprObj.resizeWidth();
  215. billsGuidance.refreshWorkBook();
  216. billsLibObj.refreshBillsSpread();
  217. refreshSubSpread();
  218. billsLibObj.refreshBillsRelaSpread();
  219. rationLibObj.refreshSpread();//subSpread、jobSpread、itemSpread显示问题
  220. zmhs_obj.refresh();
  221. }
  222. };
  223. $('.right-nav-link').bind('click', function () {//$('.side-tabs ul li a').bind 2018-11-23 使用更多标签,所以不能这样绑定事件了
  224. var tab = $(this), tabPanel = $(tab.attr('relaPanel'));
  225. if(tab.hasClass('disabled')){
  226. return;
  227. }
  228. let setActiveTab = tab.hasClass("dropdown-item")?tab.parent().prev('.nav-link'):tab;//如果是点击了更多下拉菜单的子项,则需设置成active 的tab是“更多”
  229. if (!(setActiveTab.hasClass('active')&&tabPanel.is(":visible"))) {
  230. $('.side-tabs ul li a').removeClass('active');
  231. setActiveTab.addClass('active');
  232. sideToolsObj.showSideTools(tabPanel, true, tab.attr('id'));
  233. } else {
  234. setActiveTab.removeClass('active');
  235. sideToolsObj.showSideTools(tabPanel, false, tab.attr('id'));
  236. }
  237. projectObj.refreshMainSpread();
  238. });