main_tree_col.js 24 KB

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