| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427 | 
							- /**
 
-  * Created by Mai on 2017/7/25.
 
-  */
 
- let MainTreeCol = {
 
-     getText: {
 
-         subType: function (node) {
 
-             if (node.sourceType === projectObj.project.Bills.getSourceType()) {
 
-                 return billText[node.data.type];
 
-                 // CSL, 2017-11-29
 
-             } else if (node.sourceType === projectObj.project.Ration.getSourceType()) {
 
-                 if (node.data.type == 1 || node.data.type == undefined)    // 兼容旧定额
 
-                     return '定'
 
-                 else if (node.data.type == 2) {    // 量价
 
-                     return volumePriceMaps[node.data.subType];
 
-                 }
 
-                 else if (node.data.type == 3) {    // 工料机定额
 
-                     return projectObj.project.projectGLJ.getShortNameByID(node.data.subType);//工料机名字缩写
 
-                 }else if(node.data.type == 4){//安装增加费生成的定额
 
-                     return '安';
 
-                 }
 
-             } else if (node.sourceType === projectObj.project.ration_glj.getSourceType()) {
 
-                 return projectObj.project.projectGLJ.getShortNameByID(node.data.subType);//工料机名字缩写
 
-             }
 
-         },
 
-         quantity:function (node) {
 
-           if(node.sourceType === projectObj.project.ration_glj.getSourceType()){
 
-               return gljOprObj.getTotalQuantity(node.data);
 
-           }else {
 
-               return calcTools.uiNodeQty(node)?calcTools.uiNodeQty(node):null;
 
-           }
 
-         },
 
-         // CSL, 2017-11-28
 
-         calcProgramName: function (node) {
 
-             let programID = node.data.programID;
 
-             if (!programID) return
 
-             else return projectObj.project.calcProgram.compiledTemplateMaps[programID];
 
-         },
 
-         calcBase: function (node) {
 
-             if (node.data.calcBase && node.data.calcBase != ""){
 
-                 return cbParser.toFExpr(node.data.calcBase);
 
-             }
 
-         },
 
-         code: function (node) {
 
-             if(node.sourceType === projectObj.project.Ration.getSourceType() && node.data.type === rationType.ration
 
-                 && isDef(node.data.code) && isDef(node.data.prefix) && node.data.prefix !== ''){
 
-                 return node.data.prefix + node.data.code.replace(new RegExp(node.data.prefix, 'g'), '');
 
-             }
 
-             return isDef(node.data.code) ? node.data.code : '';
 
-         },
 
-         marketPrice:function (node) {
 
-             if((node.sourceType === projectObj.project.Ration.getSourceType()&&node.data.type!=rationType.ration)||node.sourceType==projectObj.project.ration_glj.getSourceType()){
 
-                 return calcTools.uiGLJPrice(node.data.marketUnitFee);
 
-             }
 
-         }
 
-     },
 
-     readOnly: {
 
-         // Vincent, 2018-01-09
 
-         subType: function (node) {
 
-             if (calcTools.isVolumePrice(node)) return false;
 
-             if(MainTreeCol.readOnly.bills(node)){
 
-                 return true;
 
-             }
 
-             if(MainTreeCol.readOnly.ration(node)){
 
-                 return true;
 
-             }
 
-             if(MainTreeCol.readOnly.non_editSubType(node)){
 
-                 return true;
 
-             }else if(gljOprObj.hasComposition(node.data,node.sourceType === ModuleNames.ration)){
 
-                 return true;
 
-             }
 
-             return false;
 
-         },
 
-         calcProgramName: function (node) {
 
-             if (
 
-                 node.sourceType === projectObj.project.Ration.getSourceType() ||
 
-                 (calcTools.isLeafBill(node) && projectObj.project.property.billsCalcMode === leafBillGetFeeType.billsPrice)
 
-             ) return false
 
-             else return true;
 
-         },
 
-         non_editSubType: function (node) {
 
-             return node.data.subType != 201 && node.data.subType != 4 && node.data.subType != 5
 
-         },
 
-         commonUnitFee: function (node) {
 
-             return true;//!calcTools.isNullBill(node); 设置为只读,有新需求再修改
 
-         },
 
-         //根据节点、父节点类型判断是否可用计算基数
 
-         calcBaseType: function (node) {
 
-             function isDef(v) {
 
-                 return v !== undefined && v !== null;
 
-             }
 
-             function isFlag(v) {
 
-                 return this.isDef(v.flagsIndex) && this.isDef(v.flagsIndex.fixed);
 
-             }
 
-             let calcBase = projectObj.project.calcBase;
 
-             let parent = node.parent;
 
-             if (isFlag(node.data) && (node.data.flagsIndex.fixed.flag === calcBase.fixedFlag.SUB_ENGINERRING
 
-                 || node.data.flagsIndex.fixed.flag === calcBase.fixedFlag.CONSTRUCTION_TECH)) {
 
-                 return true;
 
-             }
 
-             else if (isFlag(node.data) && node.data.flagsIndex.fixed.flag === calcBase.fixedFlag.CONSTRUCTION_ORGANIZATION) {
 
-                 return false;
 
-             }
 
-             else {
 
-                 if (!parent) {
 
-                     return false;
 
-                 }
 
-                 else {
 
-                     return this.calcBaseType(parent);
 
-                 }
 
-             }
 
-         },
 
-         bills: function (node) {
 
-             return node.sourceType === projectObj.project.Bills.getSourceType();
 
-         },
 
-         ration: function (node) {
 
-             return calcTools.isRationItem(node);
 
-         },
 
-         isSubcontract: function (node) {
 
-             return !calcTools.isRationCategory(node);
 
-         },
 
-         glj: function (node) {
 
-             return node.sourceType == projectObj.project.ration_glj.getSourceType();
 
-         },
 
-         volumePrice: function (node) {
 
-             return (node.data.type == rationType.volumePrice || node.data.type == rationType.gljRation);
 
-         },
 
-         non_bills: function (node) {
 
-             return node.sourceType !== projectObj.project.Bills.getSourceType();
 
-         },
 
-         non_ration: function (node) {
 
-             return node.sourceType !== projectObj.project.Ration.getSourceType();
 
-         },
 
-         non_volumePrice: function (node) {
 
-             return !(node.data.type == rationType.volumePrice || node.data.type == rationType.gljRation);
 
-         },
 
-         billsParent: function (node) {
 
-             return node.sourceType === projectObj.project.Bills.getSourceType() && node.source.children.length > 0;
 
-         },
 
-         leafBillsWithDetail: function (node) {
 
-             return (!MainTreeCol.readOnly.billsParent(node)) && (node.children.length > 0);
 
-         },
 
-         forCalcBase: function (node) {
 
-             // to do according to billsParentType
 
-             return MainTreeCol.readOnly.billsParent(node) || MainTreeCol.readOnly.non_bills(node) || MainTreeCol.readOnly.leafBillsWithDetail(node) || MainTreeCol.readOnly.calcBaseType(node);
 
-         },
 
-         forUnitFee: function (node) {
 
-             return MainTreeCol.readOnly.ration(node) || MainTreeCol.readOnly.billsParent(node) || MainTreeCol.readOnly.leafBillsWithDetail(node);
 
-         },
 
-         forTotalFee: function (node) {
 
-             return MainTreeCol.readOnly.non_bills(node) || MainTreeCol.readOnly.billsParent(node) || (MainTreeCol.readOnly.leafBillsWithDetail(node));
 
-         },
 
-         forQuantifyDetail: function (node) {
 
-             return !(node.sourceType == ModuleNames.ration || !MainTreeCol.readOnly.billsParent(node));
 
-         },
 
-         forFeeRate: function (node) {
 
-             let readOnly = true;
 
-             let Bills = projectObj.project.Bills;
 
-             //只有当选中节点是清单,并且不属于“分部分项工程”或“技术措施项目”,并且是叶子清单且没有定额/量价/工料机时,费率列才可编辑
 
-             if(MainTreeCol.readOnly.bills(node)){
 
-                 if(!Bills.isFBFX(node)&&!Bills.isTechMeasure(node)&&node.children.length<=0){//不属于“分部分项工程”或“技术措施项目”,并且是叶子清单且没有定额/量价/工料机
 
-                     readOnly = false;
 
-                 }
 
-             }
 
-             return readOnly;
 
-         },
 
-         forQuantity: function (node) {
 
-             if(node.sourceType === projectObj.project.Bills.getSourceType()){
 
-                 if(node.data.type==billType.DXFY||node.data.type==billType.FB||(node.data.type==billType.BILL&&MainTreeCol.readOnly.billsParent(node))){//大项费用、分部、清单父项行,工程量只读。
 
-                     return true;
 
-                 }
 
-             }else if(MainTreeCol.readOnly.glj(node)){
 
-                 return true;
 
-             }
 
-             return false;
 
-         },
 
-         forMarketPrice: function (node) {
 
-             return MainTreeCol.readOnly.bills(node) ||
 
-                 (node.sourceType === ModuleNames.ration && node.data.type == rationType.ration) ||
 
-                 gljOprObj.marketPriceReadOnly(node);
 
-         },
 
-         forContain:function (node) {
 
-             return MainTreeCol.readOnly.non_ration(node)&&!MainTreeCol.readOnly.glj(node);
 
-         },
 
-         forCode:function (node) {
 
-             return MainTreeCol.readOnly.glj(node)|| (node.sourceType === projectObj.project.Ration.getSourceType()&&node.data.type===rationType.gljRation);
 
-         },
 
-         forUnit:function (node) {
 
-             if(MainTreeCol.readOnly.bills(node)&&(node.data.type==billType.DXFY||node.data.type==billType.FB)){//在大项费用、分部行,计量单位只读。
 
-                 return true;
 
-             }else {
 
-                return calcTools.isRationItem(node);
 
-             }
 
-         },
 
-         forContentCharacter: function (node) {
 
-             return !MainTreeCol.readOnly.bills(node) || (node.data.type !== billType.BILL && node.data.type !== billType.FX);
 
-         },
 
-         forRuleText: function (node) {
 
-             if(MainTreeCol.readOnly.bills(node)){
 
-                 if(node.data.type === billType.FX || (node.data.type === billType.BILL && node.source.children.length === 0)){
 
-                     return false;
 
-                 }
 
-             }
 
-             return true;
 
-         }
 
-     },
 
-     cellType: {
 
-         unit: function () {
 
-             //let combo = new GC.Spread.Sheets.CellTypes.ComboBox();
 
-             let dynamicCombo = sheetCommonObj.getDynamicCombo(true);
 
-             dynamicCombo.itemHeight(10).items(['m', 'm2', 'm3', 'km', 't', 'kg', '台班', '工日', '昼夜', '元', '项', '处', '个', '件',
 
-                 '根', '组', '系统', '台', '套', '株', '丛', '缸', '支', '只', '块', '座', '对', '份', '樘', '攒', '榀']).editable(true);
 
-             return dynamicCombo;
 
-         },
 
-         units: function () {
 
-             this.unit;
 
-         },
 
-         feeRate: function () {
 
-             return feeRateObject.getFeeRateEditCellType();
 
-         },
 
-         calcBase: function () {
 
-             return calcBaseView.getCalcBaseCellType('bills');
 
-         },
 
-         // CSL, 2017-11-28
 
-         calcProgramName: function (node) {
 
-             if (
 
-                 node.sourceType === projectObj.project.Ration.getSourceType() ||
 
-                 (calcTools.isLeafBill(node) && projectObj.project.property.billsCalcMode === leafBillGetFeeType.billsPrice)
 
-             ) {
 
-                 // var names = new GC.Spread.Sheets.CellTypes.ComboBox();
 
-                 var names = sheetCommonObj.getDynamicCombo();
 
-                 names.items(projectObj.project.calcProgram.compiledTemplateNames);
 
-                 return names;
 
-             }
 
-         },
 
-         // Vincent, 2018-01-09
 
-         subType: function (node) {
 
-             if(node.sourceType!=projectObj.project.Bills.getSourceType()){
 
-                 let VPType = sheetCommonObj.getDynamicCombo();
 
-                 if(node.sourceType == projectObj.project.Ration.getSourceType()){//是定额类型
 
-                     if(node.data.type == rationType.volumePrice){
 
-                         VPType.itemHeight(5).items(["人工", "材料", "机械", "主材", "设备"])
 
-                         return VPType;
 
-                     }else if(node.data.type == rationType.gljRation){
 
-                         if(!MainTreeCol.readOnly.non_editSubType(node)&&gljOprObj.hasComposition(node.data,true)==false){
 
-                             VPType.itemHeight(3).items(["材料", "主材", "设备"]);
 
-                             return VPType;
 
-                         }
 
-                     }
 
-                 }else if(node.sourceType === projectObj.project.ration_glj.getSourceType()){//是工料机类型
 
-                     if(!MainTreeCol.readOnly.non_editSubType(node)&&gljOprObj.hasComposition(node.data)==false){
 
-                         VPType.itemHeight(3).items(["材料", "主材", "设备"]);
 
-                         return VPType;
 
-                     }
 
-                 }
 
-             }
 
-         },
 
-         isSubcontract: function (node){
 
-             if (calcTools.isRationCategory(node))
 
-                 return new GC.Spread.Sheets.CellTypes.CheckBox();
 
-         },
 
-         isEstimate:function (node) {
 
-             //只对分项、补项、材料(包括混凝土等)、主材、设备有效
 
-             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))){
 
-                 return new GC.Spread.Sheets.CellTypes.CheckBox();
 
-             }
 
-         }
 
-     },
 
-     editChecking:function(node){
 
-         if(node.sourceType==projectObj.project.Bills.getSourceType()&&projectObj.project.isBillsLocked()){
 
-             return true;
 
-         }
 
-         if(gljOprObj.isInstallationNode(node)){//如果是通过安装增加费自动生成的,都是只读类型
 
-             return true;
 
-         }
 
-         return false;
 
-     },
 
-     setAutoHeight:function (cell,node) {//设置自动行高
 
-         cell.wordWrap(MainTreeCol.needAutoFit(node));
 
-     },
 
-     setAutoFitRow:function (sheet,node) {
 
-         if(MainTreeCol.needAutoFit(node)){
 
-             sheet.autoFitRow(node.serialNo());
 
-         }
 
-     },
 
-     needAutoFit:function (node) {
 
-         let displaySetting = projectObj.project.property.displaySetting;
 
-         let billsAutoH = displaySetting && displaySetting.billsAutoHeight?displaySetting.billsAutoHeight:false;
 
-         let rationAutoH = displaySetting && displaySetting.rationAutoHeight?displaySetting.rationAutoHeight:false;
 
-         if(node.sourceType === projectObj.project.Bills.getSourceType()&&billsAutoH == true){
 
-             return true;
 
-         }
 
-         if(node.sourceType !== projectObj.project.Bills.getSourceType()&& rationAutoH == true){
 
-             return true;
 
-         }
 
-         return false;
 
-     },
 
-     getEvent: function (eventName) {
 
-         let names = eventName.split('.');
 
-         let event = this;
 
-         for (let name of names) {
 
-             if (event[name]) {
 
-                 event = event[name];
 
-             } else {
 
-                 return null;
 
-             }
 
-         }
 
-         if (event && Object.prototype.toString.apply(event) !== "[object Function]") {
 
-             return null;
 
-         } else {
 
-             return event;
 
-         }
 
-     },
 
-     getNumberFormatter: function (digit, align) {    // CSL, 2017-11-30 扩展:小数点是否对齐。
 
-         if (align) {
 
-             switch (digit) {
 
-                 case 1:
 
-                     return '0.0';
 
-                 case 2:
 
-                     return '0.00';
 
-                 case 3:
 
-                     return '0.000';
 
-                 case 4:
 
-                     return '0.0000';
 
-                 case 5:
 
-                     return '0.00000';
 
-                 case 6:
 
-                     return '0.000000';
 
-                 default:
 
-                     return '0.00';
 
-             }
 
-             ;
 
-         }
 
-         else {
 
-             switch (digit) {
 
-                 case 1:
 
-                     return '0.#';
 
-                 case 2:
 
-                     return '0.##';
 
-                 case 3:
 
-                     return '0.###';
 
-                 case 4:
 
-                     return '0.####';
 
-                 case 5:
 
-                     return '0.#####';
 
-                 case 6:
 
-                     return '0.######';
 
-                 default:
 
-                     return '0.##';
 
-             }
 
-             ;
 
-         }
 
-     }
 
- };
 
- let colSettingObj = {
 
-     settingSpread: null,
 
-     checkBox: new GC.Spread.Sheets.CellTypes.CheckBox(),
 
-     loadSetting: function (sheet, setting) {
 
-         sheet.suspendPaint();
 
-         sheet.suspendEvent();
 
-         sheet.setRowCount(setting.cols.length);
 
-         sheet.setColumnCount(setting.headRows, GC.Spread.Sheets.SheetArea.rowHeader);
 
-         sheet.setColumnCount(1);
 
-         sheet.getRange(-1, 0, -1, 1).cellType(this.checkBox).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
 
-         sheet.getCell(0, 0, GC.Spread.Sheets.SheetArea.colHeader).value('显示');
 
-         sheet.setColumnWidth(0, 100);
 
-         sheet.setColumnWidth(0, 150, GC.Spread.Sheets.SheetArea.rowHeader);
 
-         setting.cols.forEach(function (col, index) {
 
-             let i, iCol = 0, cell;
 
-             for (i = 0; i < col.head.spanCols.length; i++) {
 
-                 if (col.head.spanCols[i] !== 0) {
 
-                     cell = sheet.getCell(index, iCol, GC.Spread.Sheets.SheetArea.rowHeader);
 
-                     cell.value(col.head.titleNames[i]).font(col.head.font).hAlign(col.head.hAlign[i]).vAlign(col.head.vAlign[i]);
 
-                 }
 
-                 if (col.head.spanCols[i] > 1 || col.head.spanRows[i] > 1) {
 
-                     sheet.addSpan(index, iCol, col.head.spanRows[i], col.head.spanCols[i], GC.Spread.Sheets.SheetArea.rowHeader);
 
-                 }
 
-                 iCol += col.head.spanRows[i];
 
-             };
 
-             let colWidth = sheet.getColumnWidth(index, GC.Spread.Sheets.SheetArea.rowHeader);
 
-             colWidth = colWidth > col.width ? colWidth : col.width;
 
-             //sheet.setColumnWidth(index, colWidth, GC.Spread.Sheets.SheetArea.rowHeader);
 
-             cell = sheet.getCell(index, 0).value(col.visible);
 
-             sheet.autoFitRow(index);
 
-         });
 
-         sheet.resumeEvent();
 
-         sheet.resumePaint();
 
-     },
 
-     initSettingSpread: function () {
 
-         this.settingSpread = SheetDataHelper.createNewSpread($('#col_setting_spread')[0], {sheetCount: 1});
 
-         this.settingSpread.options.showScrollTip = GC.Spread.Sheets.ShowScrollTip.vertical;
 
-         this.loadSetting(this.settingSpread.getActiveSheet(), projectObj.project.projSetting.main_tree_col);
 
-     }
 
- };
 
- $('#column').on('shown.bs.modal', function () {
 
-     if (!colSettingObj.settingSpread) {
 
-         colSettingObj.initSettingSpread();
 
-     }
 
- });
 
- $('#column').on('hide.bs.modal', function () {
 
-     let sheet = colSettingObj.settingSpread.getActiveSheet();
 
-     for (let iRow = 0; iRow < sheet.getRowCount(); iRow++) {
 
-         projectObj.project.projSetting.main_tree_col.cols[iRow].visible = sheet.getValue(iRow, 0);
 
-         projectObj.project.projSetting.mainGridSetting.cols[iRow].visible = sheet.getValue(iRow, 0);
 
-     }
 
-     SheetDataHelper.massOperationSheet(projectObj.mainSpread.getActiveSheet(), function () {
 
-         SheetDataHelper.refreshColumnVisible(projectObj.project.projSetting.mainGridSetting, projectObj.mainSpread.getActiveSheet());
 
-     });
 
-     //refresh nodes to autoFitRow
 
-     projectObj.mainController.refreshTreeNode(projectObj.project.mainTree.roots, true);
 
-     projectObj.project.pushNow('editColSetting', projectObj.project.projSetting.moduleName, {
 
-         projectID: projectObj.project.ID(),
 
-         main_tree_col: projectObj.project.projSetting.main_tree_col
 
-     });
 
- });
 
 
  |