installation_fee.js 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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.getFeeItemByID = function(libID,ID){
  41. let installFee = projectObj.project.installation_fee.getInstallationFeeByLibID(libID);
  42. return _.find(installFee.installFeeItem,{'ID':ID});
  43. };
  44. installation_fee.prototype.getInstallSectionByID = function(libID,ID){
  45. let installFee = projectObj.project.installation_fee.getInstallationFeeByLibID(libID);
  46. return _.find(installFee.installSection,{'ID':ID});
  47. };
  48. installation_fee.prototype.getFeeRuleBySectionID=function(libID,sectionId){
  49. let installationFee = this.getInstallationFeeByLibID(libID);
  50. let feeRules = _.filter(installationFee.feeRule,{'sectionId':sectionId});
  51. return feeRules;
  52. };
  53. installation_fee.prototype.getFeeRuleByID = function (libID,feeRuleID) {
  54. let installationFee = this.getInstallationFeeByLibID(libID);
  55. return _.find(installationFee.feeRule,{'ID':feeRuleID});
  56. };
  57. // 提交数据后返回数据处理
  58. installation_fee.prototype.doAfterUpdate = function(err, data){
  59. };
  60. return new installation_fee(project);
  61. }
  62. };