main_tree_col.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. /**
  2. * Created by Mai on 2017/7/25.
  3. */
  4. let MainTreeCol = {
  5. getText: {
  6. subType: function (node) {
  7. if (node.sourceType === projectObj.project.Bills.getSourceType()) {
  8. return billText[node.data.type];
  9. // CSL, 2017-11-29
  10. } else if (node.sourceType === projectObj.project.Ration.getSourceType()) {
  11. if (node.data.type == 1 || node.data.type == undefined) // 兼容旧定额
  12. return '定'
  13. else if (node.data.type == 2) { // 量价
  14. return volumePriceMaps[node.data.subType];
  15. }
  16. else if (node.data.type == 3) { // 工料机定额
  17. return projectObj.project.projectGLJ.getShortNameByID(node.data.subType);//工料机名字缩写
  18. }else if(node.data.type == 4){//安装增加费生成的定额
  19. return '安';
  20. }
  21. } else if (node.sourceType === projectObj.project.ration_glj.getSourceType()) {
  22. return projectObj.project.projectGLJ.getShortNameByID(node.data.subType);//工料机名字缩写
  23. }
  24. },
  25. quantity:function (node) {
  26. if(node.sourceType === projectObj.project.ration_glj.getSourceType()){
  27. return gljOprObj.getTotalQuantity(node.data);
  28. }else {
  29. return calcTools.uiNodeQty(node)?calcTools.uiNodeQty(node):null;
  30. }
  31. },
  32. // CSL, 2017-11-28
  33. calcProgramName: function (node) {
  34. let programID = node.data.programID;
  35. if (!programID) return
  36. else return projectObj.project.calcProgram.compiledTemplateMaps[programID];
  37. },
  38. calcBase: function (node) {
  39. if (node.data.calcBase && node.data.calcBase != ""){
  40. return cbParser.toFExpr(node.data.calcBase);
  41. }
  42. },
  43. code: function (node) {
  44. if(node.sourceType === projectObj.project.Ration.getSourceType() && node.data.type === rationType.ration
  45. && isDef(node.data.code) && isDef(node.data.prefix) && node.data.prefix !== ''){
  46. return node.data.prefix + node.data.code.replace(new RegExp(node.data.prefix, 'g'), '');
  47. }
  48. return isDef(node.data.code) ? node.data.code : '';
  49. },
  50. marketPrice:function (node) {
  51. if((node.sourceType === projectObj.project.Ration.getSourceType()&&node.data.type!=rationType.ration)||node.sourceType==projectObj.project.ration_glj.getSourceType()){
  52. return calcTools.uiGLJPrice(node.data.marketUnitFee);
  53. }
  54. },
  55. feeRate:function (node) {
  56. if(node.data.feeRateID){
  57. let rate = projectObj.project.FeeRate.getFeeRateByID(node.data.feeRateID);
  58. if (rate) return rate.rate;
  59. }
  60. return node.data.feeRate;
  61. }
  62. },
  63. readOnly: {
  64. // Vincent, 2018-01-09
  65. subType: function (node) {
  66. if (calcTools.isVolumePrice(node)) return false;
  67. if(MainTreeCol.readOnly.bills(node)){
  68. return true;
  69. }
  70. if(MainTreeCol.readOnly.ration(node)){
  71. return true;
  72. }
  73. if(MainTreeCol.readOnly.non_editSubType(node)){
  74. return true;
  75. }else if(gljOprObj.hasComposition(node.data,node.sourceType === ModuleNames.ration)){
  76. return true;
  77. }
  78. return false;
  79. },
  80. calcProgramName: function (node) {
  81. if (
  82. node.sourceType === projectObj.project.Ration.getSourceType() ||
  83. (calcTools.isLeafBill(node) && projectObj.project.property.billsCalcMode === leafBillGetFeeType.billsPrice)
  84. ) return false
  85. else return true;
  86. },
  87. non_editSubType: function (node) {
  88. return node.data.subType != 201 && node.data.subType != 4 && node.data.subType != 5
  89. },
  90. commonUnitFee: function (node) {
  91. return !(calcTools.isLeafBill(node) && !calcTools.isCalcBaseBill(node) && !calcTools.isInheritFrom(node, [fixedFlag.SUB_ENGINERRING, fixedFlag.MEASURE]));
  92. },
  93. //根据节点、父节点类型判断是否可用计算基数
  94. calcBaseType: function (node) {
  95. function isDef(v) {
  96. return v !== undefined && v !== null;
  97. }
  98. function isFlag(v) {
  99. return this.isDef(v.flagsIndex) && this.isDef(v.flagsIndex.fixed);
  100. }
  101. let calcBase = projectObj.project.calcBase;
  102. let parent = node.parent;
  103. if (isFlag(node.data) && (node.data.flagsIndex.fixed.flag === calcBase.fixedFlag.SUB_ENGINERRING
  104. || node.data.flagsIndex.fixed.flag === calcBase.fixedFlag.CONSTRUCTION_TECH)) {
  105. return true;
  106. }
  107. else if (isFlag(node.data) && node.data.flagsIndex.fixed.flag === calcBase.fixedFlag.CONSTRUCTION_ORGANIZATION) {
  108. return false;
  109. }
  110. else {
  111. if (!parent) {
  112. return false;
  113. }
  114. else {
  115. return this.calcBaseType(parent);
  116. }
  117. }
  118. },
  119. bills: function (node) {
  120. return node.sourceType === projectObj.project.Bills.getSourceType();
  121. },
  122. ration: function (node) {
  123. return calcTools.isRationItem(node);
  124. },
  125. isSubcontract: function (node) {
  126. return !calcTools.isRationCategory(node);
  127. },
  128. glj: function (node) {
  129. return node.sourceType == projectObj.project.ration_glj.getSourceType();
  130. },
  131. volumePrice: function (node) {
  132. return (node.data.type == rationType.volumePrice || node.data.type == rationType.gljRation);
  133. },
  134. non_bills: function (node) {
  135. return node.sourceType !== projectObj.project.Bills.getSourceType();
  136. },
  137. non_ration: function (node) {
  138. return node.sourceType !== projectObj.project.Ration.getSourceType();
  139. },
  140. non_volumePrice: function (node) {
  141. return !(node.data.type == rationType.volumePrice || node.data.type == rationType.gljRation);
  142. },
  143. billsParent: function (node) {
  144. return node.sourceType === projectObj.project.Bills.getSourceType() && node.source.children.length > 0;
  145. },
  146. leafBillsWithDetail: function (node) {
  147. return (!MainTreeCol.readOnly.billsParent(node)) && (node.children.length > 0);
  148. },
  149. forCalcBase: function (node) {
  150. // to do according to billsParentType
  151. return MainTreeCol.readOnly.billsParent(node) || MainTreeCol.readOnly.non_bills(node) || MainTreeCol.readOnly.leafBillsWithDetail(node) || MainTreeCol.readOnly.calcBaseType(node);
  152. },
  153. forUnitFee: function (node) {
  154. return MainTreeCol.readOnly.ration(node) || MainTreeCol.readOnly.billsParent(node) || MainTreeCol.readOnly.leafBillsWithDetail(node);
  155. },
  156. forTotalFee: function (node) {
  157. return MainTreeCol.readOnly.non_bills(node) || MainTreeCol.readOnly.billsParent(node) || (MainTreeCol.readOnly.leafBillsWithDetail(node));
  158. },
  159. forQuantifyDetail: function (node) {
  160. return !(node.sourceType == ModuleNames.ration || !MainTreeCol.readOnly.billsParent(node));
  161. },
  162. forFeeRate: function (node) {
  163. let readOnly = true;
  164. let Bills = projectObj.project.Bills;
  165. //只有当选中节点是清单,并且不属于“分部分项工程”或“技术措施项目”,并且是叶子清单且没有定额/量价/工料机时,费率列才可编辑
  166. if(MainTreeCol.readOnly.bills(node)){
  167. if(!Bills.isFBFX(node)&&!Bills.isTechMeasure(node)&&node.children.length<=0){//不属于“分部分项工程”或“技术措施项目”,并且是叶子清单且没有定额/量价/工料机
  168. readOnly = false;
  169. }
  170. }
  171. return readOnly;
  172. },
  173. forQuantity: function (node) {
  174. if(node.sourceType === projectObj.project.Bills.getSourceType()){
  175. if(node.data.type==billType.DXFY||node.data.type==billType.FB||(node.data.type==billType.BILL&&MainTreeCol.readOnly.billsParent(node))){//大项费用、分部、清单父项行,工程量只读。
  176. return true;
  177. }
  178. }else if(MainTreeCol.readOnly.glj(node)){
  179. return true;
  180. }
  181. return false;
  182. },
  183. forMarketPrice: function (node) {
  184. return MainTreeCol.readOnly.bills(node) ||
  185. (node.sourceType === ModuleNames.ration && node.data.type == rationType.ration) ||
  186. gljOprObj.marketPriceReadOnly(node);
  187. },
  188. forContain:function (node) {
  189. return MainTreeCol.readOnly.non_ration(node)&&!MainTreeCol.readOnly.glj(node);
  190. },
  191. forCode:function (node) {
  192. return MainTreeCol.readOnly.glj(node)|| (node.sourceType === projectObj.project.Ration.getSourceType()&&node.data.type===rationType.gljRation);
  193. },
  194. forUnit:function (node) {
  195. if(MainTreeCol.readOnly.bills(node)&&(node.data.type==billType.DXFY||node.data.type==billType.FB)){//在大项费用、分部行,计量单位只读。
  196. return true;
  197. }else {
  198. return calcTools.isRationItem(node);
  199. }
  200. },
  201. forContentCharacter: function (node) {
  202. return !MainTreeCol.readOnly.bills(node) || (node.data.type !== billType.BILL && node.data.type !== billType.FX);
  203. },
  204. forRuleText: function (node) {
  205. if(MainTreeCol.readOnly.bills(node)){
  206. if(node.data.type === billType.FX || (node.data.type === billType.BILL && node.source.children.length === 0)){
  207. return false;
  208. }
  209. }
  210. return true;
  211. }
  212. },
  213. cellType: {
  214. unit: function () {
  215. //let combo = new GC.Spread.Sheets.CellTypes.ComboBox();
  216. let dynamicCombo = sheetCommonObj.getDynamicCombo(true);
  217. dynamicCombo.itemHeight(10).items(['m', 'm2', 'm3', 'km', 't', 'kg', '台班', '工日', '昼夜', '元', '项', '处', '个', '件',
  218. '根', '组', '系统', '台', '套', '株', '丛', '缸', '支', '只', '块', '座', '对', '份', '樘', '攒', '榀']).editable(true);
  219. return dynamicCombo;
  220. },
  221. units: function () {
  222. this.unit;
  223. },
  224. feeRate: function () {
  225. return feeRateObject.getFeeRateEditCellType();
  226. },
  227. quantity:function (node) {
  228. if(!MainTreeCol.readOnly.forQuantity(node)){
  229. return quantityEditObj.getQuantityEditCellType();
  230. }
  231. },
  232. calcBase: function () {
  233. return calcBaseView.getCalcBaseCellType('bills');
  234. },
  235. // CSL, 2017-11-28
  236. calcProgramName: function (node) {
  237. if (
  238. node.sourceType === projectObj.project.Ration.getSourceType() ||
  239. (calcTools.isLeafBill(node) && projectObj.project.property.billsCalcMode === leafBillGetFeeType.billsPrice)
  240. ) {
  241. // var names = new GC.Spread.Sheets.CellTypes.ComboBox();
  242. var names = sheetCommonObj.getDynamicCombo();
  243. names.items(projectObj.project.calcProgram.compiledTemplateNames);
  244. return names;
  245. }
  246. },
  247. // Vincent, 2018-01-09
  248. subType: function (node) {
  249. if(node.sourceType!=projectObj.project.Bills.getSourceType()){
  250. let VPType = sheetCommonObj.getDynamicCombo();
  251. if(node.sourceType == projectObj.project.Ration.getSourceType()){//是定额类型
  252. if(node.data.type == rationType.volumePrice){
  253. VPType.itemHeight(5).items(["人工", "材料", "机械", "主材", "设备"])
  254. return VPType;
  255. }else if(node.data.type == rationType.gljRation){
  256. if(!MainTreeCol.readOnly.non_editSubType(node)&&gljOprObj.hasComposition(node.data,true)==false){
  257. VPType.itemHeight(3).items(["材料", "主材", "设备"]);
  258. return VPType;
  259. }
  260. }
  261. }else if(node.sourceType === projectObj.project.ration_glj.getSourceType()){//是工料机类型
  262. if(!MainTreeCol.readOnly.non_editSubType(node)&&gljOprObj.hasComposition(node.data)==false){
  263. VPType.itemHeight(3).items(["材料", "主材", "设备"]);
  264. return VPType;
  265. }
  266. }
  267. }
  268. },
  269. isSubcontract: function (node){
  270. if (calcTools.isRationCategory(node))
  271. return new GC.Spread.Sheets.CellTypes.CheckBox();
  272. },
  273. isEstimate:function (node) {
  274. //只对分项、补项、材料(包括混凝土等)、主材、设备有效
  275. if(MainTreeCol.readOnly.glj(node)||(calcTools.isGljRation(node)&&projectObj.project.projectGLJ.isEstimateType(node.data.subType))||(MainTreeCol.readOnly.bills(node)&&(node.data.type == billType.BX||node.data.type == billType.FX))){
  276. return new GC.Spread.Sheets.CellTypes.CheckBox();
  277. }
  278. }
  279. },
  280. editChecking:function(node){
  281. if(node.sourceType==projectObj.project.Bills.getSourceType()&&projectObj.project.isBillsLocked()&&projectObj.project.withinBillsLocked(node)){
  282. return true;
  283. }
  284. if(gljOprObj.isInstallationNode(node)){//如果是通过安装增加费自动生成的,都是只读类型
  285. return true;
  286. }
  287. return false;
  288. },
  289. setAutoHeight:function (cell,node) {//设置自动行高
  290. cell.wordWrap(MainTreeCol.needAutoFit(node));
  291. },
  292. setAutoFitRow:function (sheet,node) {
  293. if(MainTreeCol.needAutoFit(node)){
  294. sheet.autoFitRow(node.serialNo());
  295. }
  296. },
  297. needAutoFit:function (node) {
  298. let displaySetting = projectObj.project.property.displaySetting;
  299. let billsAutoH = displaySetting && displaySetting.billsAutoHeight?displaySetting.billsAutoHeight:false;
  300. let rationAutoH = displaySetting && displaySetting.rationAutoHeight?displaySetting.rationAutoHeight:false;
  301. if(node.sourceType === projectObj.project.Bills.getSourceType()&&billsAutoH == true){
  302. return true;
  303. }
  304. if(node.sourceType !== projectObj.project.Bills.getSourceType()&& rationAutoH == true){
  305. return true;
  306. }
  307. return false;
  308. },
  309. getEvent: function (eventName) {
  310. let names = eventName.split('.');
  311. let event = this;
  312. for (let name of names) {
  313. if (event[name]) {
  314. event = event[name];
  315. } else {
  316. return null;
  317. }
  318. }
  319. if (event && Object.prototype.toString.apply(event) !== "[object Function]") {
  320. return null;
  321. } else {
  322. return event;
  323. }
  324. },
  325. getNumberFormatter: function (digit, align) { // CSL, 2017-11-30 扩展:小数点是否对齐。
  326. if (align) {
  327. switch (digit) {
  328. case 1:
  329. return '0.0';
  330. case 2:
  331. return '0.00';
  332. case 3:
  333. return '0.000';
  334. case 4:
  335. return '0.0000';
  336. case 5:
  337. return '0.00000';
  338. case 6:
  339. return '0.000000';
  340. default:
  341. return '0';
  342. }
  343. ;
  344. }
  345. else {
  346. switch (digit) {
  347. case 1:
  348. return '0.#';
  349. case 2:
  350. return '0.##';
  351. case 3:
  352. return '0.###';
  353. case 4:
  354. return '0.####';
  355. case 5:
  356. return '0.#####';
  357. case 6:
  358. return '0.######';
  359. default:
  360. return '0';
  361. }
  362. ;
  363. }
  364. }
  365. };
  366. let colSettingObj = {
  367. settingSpread: null,
  368. checkBox: new GC.Spread.Sheets.CellTypes.CheckBox(),
  369. loadSetting: function (sheet, setting) {
  370. sheet.suspendPaint();
  371. sheet.suspendEvent();
  372. sheet.setRowCount(setting.cols.length);
  373. sheet.setColumnCount(setting.headRows, GC.Spread.Sheets.SheetArea.rowHeader);
  374. sheet.setColumnCount(1);
  375. sheet.getRange(-1, 0, -1, 1).cellType(this.checkBox).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
  376. sheet.getCell(0, 0, GC.Spread.Sheets.SheetArea.colHeader).value('显示');
  377. sheet.setColumnWidth(0, 100);
  378. sheet.setColumnWidth(0, 150, GC.Spread.Sheets.SheetArea.rowHeader);
  379. setting.cols.forEach(function (col, index) {
  380. let i, iCol = 0, cell;
  381. for (i = 0; i < col.head.spanCols.length; i++) {
  382. if (col.head.spanCols[i] !== 0) {
  383. cell = sheet.getCell(index, iCol, GC.Spread.Sheets.SheetArea.rowHeader);
  384. cell.value(col.head.titleNames[i]).font(col.head.font).hAlign(col.head.hAlign[i]).vAlign(col.head.vAlign[i]);
  385. }
  386. if (col.head.spanCols[i] > 1 || col.head.spanRows[i] > 1) {
  387. sheet.addSpan(index, iCol, col.head.spanRows[i], col.head.spanCols[i], GC.Spread.Sheets.SheetArea.rowHeader);
  388. }
  389. iCol += col.head.spanRows[i];
  390. };
  391. let colWidth = sheet.getColumnWidth(index, GC.Spread.Sheets.SheetArea.rowHeader);
  392. colWidth = colWidth > col.width ? colWidth : col.width;
  393. //sheet.setColumnWidth(index, colWidth, GC.Spread.Sheets.SheetArea.rowHeader);
  394. cell = sheet.getCell(index, 0).value(col.visible);
  395. sheet.autoFitRow(index);
  396. });
  397. sheet.resumeEvent();
  398. sheet.resumePaint();
  399. },
  400. initSettingSpread: function () {
  401. this.settingSpread = SheetDataHelper.createNewSpread($('#col_setting_spread')[0], {sheetCount: 1});
  402. this.settingSpread.options.showScrollTip = GC.Spread.Sheets.ShowScrollTip.vertical;
  403. this.settingSpread.bind(GC.Spread.Sheets.Events.ButtonClicked, function (sender, args) {
  404. if(args.sheet.isEditing()){
  405. args.sheet.endEdit(true);
  406. }
  407. });
  408. this.loadSetting(this.settingSpread.getActiveSheet(), projectObj.project.projSetting.main_tree_col);
  409. },
  410. dataChanged: function () {
  411. let sheet = this.settingSpread.getActiveSheet();
  412. for(let row = 0; row < sheet.getRowCount(); row++){
  413. let orgData = projectObj.project.projSetting.main_tree_col.cols[row].visible;
  414. let newData = sheet.getValue(row, 0);
  415. if(orgData != newData){
  416. return true;
  417. }
  418. }
  419. return false;
  420. },
  421. updateColSetting: function (skipSetValue = false) {
  422. let mainSheet = projectObj.mainSpread.getActiveSheet();
  423. if(!skipSetValue){
  424. let sheet = this.settingSpread.getActiveSheet();
  425. for (let iRow = 0; iRow < sheet.getRowCount(); iRow++) {
  426. projectObj.project.projSetting.main_tree_col.cols[iRow].visible = sheet.getValue(iRow, 0);
  427. projectObj.project.projSetting.mainGridSetting.cols[iRow].visible = sheet.getValue(iRow, 0);
  428. }
  429. }
  430. SheetDataHelper.massOperationSheet(mainSheet, function () {
  431. SheetDataHelper.refreshColumnVisible(projectObj.project.projSetting.mainGridSetting, mainSheet);
  432. //左右滚动条到最左边
  433. mainSheet.showColumn(projectObj.project.projSetting.mainGridSetting.frozenCols, GC.Spread.Sheets.HorizontalPosition.left);
  434. });
  435. //refresh nodes to autoFitRow
  436. projectObj.mainController.refreshTreeNode(projectObj.project.mainTree.roots, true);
  437. if(!skipSetValue){
  438. //列设置将项目特征和工作内容都取消打钩后,更新快速列设置
  439. if(!this.getVisible('itemCharacterText')){
  440. switchTznrHtml(true);
  441. }
  442. if(this.getVisible('itemCharacterText')){
  443. switchTznrHtml(false);
  444. }
  445. }
  446. projectObj.project.pushNow('editColSetting', projectObj.project.projSetting.moduleName, {
  447. projectID: projectObj.project.ID(),
  448. main_tree_col: projectObj.project.projSetting.main_tree_col
  449. });
  450. },
  451. setVisible: function (field, visible) {
  452. let mainTreeCols = projectObj.project.projSetting.main_tree_col.cols;
  453. for(let colSetting of mainTreeCols){
  454. if(colSetting.data.field === field){
  455. colSetting.visible = visible;
  456. break;
  457. }
  458. }
  459. let mainGridCols = projectObj.project.projSetting.mainGridSetting.cols;
  460. for(let colSetting of mainGridCols){
  461. if(colSetting.data.field === field){
  462. colSetting.visible = visible;
  463. break;
  464. }
  465. }
  466. },
  467. getVisible: function(field){
  468. let cols = projectObj.project.projSetting.main_tree_col.cols;
  469. for(let colSetting of cols){
  470. if(colSetting.data.field === field){
  471. return colSetting.visible;
  472. }
  473. }
  474. return false;
  475. },
  476. getColByField: function (field) {
  477. let cols = projectObj.project.projSetting.main_tree_col.cols;
  478. for(let i = 0; i < cols.length; i++){
  479. let colSetting = cols[i];
  480. if(colSetting.data.field === field){
  481. return i;
  482. }
  483. }
  484. return null;
  485. },
  486. getFieldByCol: function (col) {
  487. let cols = projectObj.project.projSetting.main_tree_col.cols;
  488. let colSetting = cols[col];
  489. return colSetting ? colSetting.data.field : null;
  490. }
  491. };
  492. function switchTznrHtml(show) {
  493. if(projectReadOnly){
  494. return;
  495. }
  496. if(show){
  497. let newHmtl = $('#switchTznr').html().replace('隐藏', '显示');
  498. $('#switchTznr').html(newHmtl);
  499. $('#switchTznr').find('i').removeClass('fa-eye-slash');
  500. $('#switchTznr').find('i').addClass('fa-eye');
  501. }
  502. else {
  503. let newHmtl = $('#switchTznr').html().replace('显示', '隐藏');
  504. $('#switchTznr').html(newHmtl);
  505. $('#switchTznr').find('i').removeClass('fa-eye');
  506. $('#switchTznr').find('i').addClass('fa-eye-slash');
  507. }
  508. }
  509. $('#switchTznr').click(function () {
  510. let me = colSettingObj;
  511. let cur = $(this).text();
  512. if(cur.includes('显示特征')){
  513. switchTznrHtml(false);
  514. me.setVisible('itemCharacterText', true);
  515. //me.setVisible('jobContentText', true);
  516. me.updateColSetting(true);
  517. }
  518. else {
  519. switchTznrHtml(true);
  520. me.setVisible('itemCharacterText', false);
  521. //me.setVisible('jobContentText', false);
  522. me.updateColSetting(true);
  523. }
  524. });
  525. $('#poj-set').on('shown.bs.modal', function (e) {
  526. if (!colSettingObj.settingSpread) {
  527. colSettingObj.initSettingSpread();
  528. if(projectReadOnly){
  529. disableSpread(colSettingObj.settingSpread);
  530. }
  531. }
  532. if($('#tab_display_setting').hasClass('active')){
  533. let sheet = colSettingObj.settingSpread.getActiveSheet();
  534. SheetDataHelper.massOperationSheet(sheet, function () {
  535. for(let row = 0; row < sheet.getRowCount(); row++){
  536. let orgData = projectObj.project.projSetting.main_tree_col.cols[row].visible;
  537. sheet.setValue(row, 0, orgData);
  538. }
  539. });
  540. }
  541. });
  542. $('#poj-set').on('hidden.bs.modal', function (e) {
  543. if (colSettingObj.settingSpread) {
  544. //恢复
  545. let sheet = colSettingObj.settingSpread.getActiveSheet();
  546. SheetDataHelper.massOperationSheet(sheet, function () {
  547. for(let row = 0; row < sheet.getRowCount(); row++){
  548. let orgData = projectObj.project.projSetting.main_tree_col.cols[row].visible;
  549. sheet.setValue(row, 0, orgData);
  550. }
  551. });
  552. }
  553. });
  554. $('#tab_display_setting').on('shown.bs.tab', function () {
  555. if(colSettingObj.settingSpread){
  556. colSettingObj.settingSpread.refresh();
  557. }
  558. });