main_tree_col.js 24 KB

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