installation_fee.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /**
  2. * Created by zhang on 2018/1/31.
  3. */
  4. var installation_fee = {
  5. createNew: function (project) {
  6. // 用户定义private方法
  7. var tools = {};
  8. // 所有通过this访问的属性,都不应在此单元外部进行写入操作
  9. var installation_fee = function (proj) {
  10. // this.project = proj;
  11. this.datas = [];
  12. var sourceType = ModuleNames.installation_fee;
  13. this.getSourceType = function () {
  14. return sourceType;
  15. }
  16. proj.registerModule(ModuleNames.installation_fee, this);
  17. };
  18. // prototype用于定义public方法
  19. installation_fee.prototype.loadData = function (datas) {
  20. this.datas = datas;
  21. };
  22. installation_fee.prototype.getInstallationFeeByLibID=function(libID){
  23. return _.find(this.datas,{'libID':libID});
  24. };
  25. installation_fee.prototype.getFeeRuleByFeeItem = function (feeItem) {
  26. let installFee = projectObj.project.installation_fee.getInstallationFeeByLibID(feeItem.libID);
  27. let impacRules = _.filter(installFee.feeRule,{'feeItemId':feeItem.ID});
  28. return impacRules;
  29. };
  30. installation_fee.prototype.getFeeRuleBySection = function (section) {
  31. let installFee = projectObj.project.installation_fee.getInstallationFeeByLibID(section.libID);
  32. let impacRules = _.filter(installFee.feeRule,{'sectionId':section.ID});
  33. return impacRules;
  34. };
  35. installation_fee.prototype.getInstallSectionsByfeeItemID=function(libID,feeItemId){
  36. let installationFee = this.getInstallationFeeByLibID(libID);
  37. let installSections = _.filter(installationFee.installSection,{'feeItemId':feeItemId});
  38. return installSections;
  39. };
  40. installation_fee.prototype.getInstallSectionByID = function(libID,ID){
  41. let installFee = projectObj.project.installation_fee.getInstallationFeeByLibID(libID);
  42. return _.find(installFee.installSection,{'ID':ID});
  43. };
  44. installation_fee.prototype.getFeeRuleBySectionID=function(libID,sectionId){
  45. let installationFee = this.getInstallationFeeByLibID(libID);
  46. let feeRules = _.filter(installationFee.feeRule,{'sectionId':sectionId});
  47. return feeRules;
  48. };
  49. installation_fee.prototype.getFeeRuleByID = function (libID,feeRuleID) {
  50. let installationFee = this.getInstallationFeeByLibID(libID);
  51. return _.find(installationFee.feeRule,{'ID':feeRuleID});
  52. };
  53. // 提交数据后返回数据处理
  54. installation_fee.prototype.doAfterUpdate = function(err, data){
  55. };
  56. return new installation_fee(project);
  57. }
  58. };