/** * Created by CSL on 2017-07-19. * dispExpr: F8*(L-1); expression: "@('8') * (L-1)"; * 说明:F后跟行号,L替换人工系数值,@后跟ID。用到L的规则必须有labourCoeID属性(反过来不要求), * 用到费率的规则必须有feeRateID属性,当有该属性时,会自动显示费率值。 */ class CalcProgram { constructor(project){ this.project = project; this.datas = []; this.calc = new Calculation(); project.registerModule(ModuleNames.calc_program, this); }; getSourceType () { return ModuleNames.calc_program; }; loadData (datas) { this.datas = datas; }; doAfterUpdate (err, data) { if(!err){ // do } }; // 经测试,全部编译一次耗时0.003~0.004秒。耗时基本忽略不计。 compileAllTemps(){ let calcFeeRates = this.project.FeeRate.datas.rates; let calcLabourCoes = this.project.labourCoe.datas.coes; let calcTemplates = this.project.calcProgram.datas.templates; this.calc.compilePublics(calcFeeRates, calcLabourCoes, feeType, rationCalcBase); for (let ct of calcTemplates){ this.calc.compileTemplate(ct); }; }; calculate(treeNode){ treeNode.data.gljList = this.project.ration_glj.getGljArrByRation(treeNode.data.ID); this.calc.calculate(treeNode); projectObj.mainController.refreshTreeNode([treeNode]); }; }