calc_program.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * Created by CSL on 2017-07-19.
  3. * dispExpr: F8*(L-1); expression: "@('8') * (L-1)";
  4. * 说明:F后跟行号,L替换人工系数值,@后跟ID。用到L的规则必须有labourCoeID属性(反过来不要求),
  5. * 用到费率的规则必须有feeRateID属性,当有该属性时,会自动显示费率值。
  6. */
  7. class CalcProgram {
  8. constructor(project){
  9. this.project = project;
  10. this.datas = [];
  11. this.calc = new Calculation();
  12. project.registerModule(ModuleNames.calc_program, this);
  13. };
  14. getSourceType () {
  15. return ModuleNames.calc_program;
  16. };
  17. loadData (datas) {
  18. this.datas = datas;
  19. };
  20. doAfterUpdate (err, data) {
  21. if(!err){
  22. // do
  23. }
  24. };
  25. compileAllTemps(){
  26. let calcFeeRates = this.project.FeeRate.datas.rates;
  27. let calcLabourCoes = this.project.labourCoe.datas.coes;
  28. let calcTemplates = this.project.calcProgram.datas.templates;
  29. this.calc.compilePublics(calcFeeRates, calcLabourCoes, feeType, rationCalcBase);
  30. for (let ct of calcTemplates){
  31. this.calc.compileTemplate(ct);
  32. };
  33. };
  34. calculate(treeNode){
  35. treeNode.data.gljList = this.project.ration_glj.getGljArrByRation(treeNode.data.ID);
  36. this.calc.calculate(treeNode);
  37. projectObj.mainController.refreshTreeNode([treeNode]);
  38. };
  39. }