/** * Created by zhang on 2018/1/31. */ var installation_fee = { createNew: function (project) { // 用户定义private方法 var tools = {}; // 所有通过this访问的属性,都不应在此单元外部进行写入操作 var installation_fee = function (proj) { // this.project = proj; this.datas = []; var sourceType = ModuleNames.installation_fee; this.getSourceType = function () { return sourceType; } proj.registerModule(ModuleNames.installation_fee, this); }; // prototype用于定义public方法 installation_fee.prototype.loadData = function (datas) { this.datas = datas; }; installation_fee.prototype.getInstallationFeeByLibID=function(libID){ return _.find(this.datas,{'libID':libID}); }; installation_fee.prototype.getFeeRuleByFeeItem = function (feeItem) { let installFee = projectObj.project.installation_fee.getInstallationFeeByLibID(feeItem.libID); let impacRules = _.filter(installFee.feeRule,{'feeItemId':feeItem.ID}); return impacRules; }; installation_fee.prototype.getFeeRuleBySection = function (section) { let installFee = projectObj.project.installation_fee.getInstallationFeeByLibID(section.libID); let impacRules = _.filter(installFee.feeRule,{'sectionId':section.ID}); return impacRules; }; installation_fee.prototype.getInstallSectionsByfeeItemID=function(libID,feeItemId){ let installationFee = this.getInstallationFeeByLibID(libID); let installSections = _.filter(installationFee.installSection,{'feeItemId':feeItemId}); return installSections; }; installation_fee.prototype.getInstallSectionByID = function(libID,ID){ let installFee = projectObj.project.installation_fee.getInstallationFeeByLibID(libID); return _.find(installFee.installSection,{'ID':ID}); }; installation_fee.prototype.getFeeRuleBySectionID=function(libID,sectionId){ let installationFee = this.getInstallationFeeByLibID(libID); let feeRules = _.filter(installationFee.feeRule,{'sectionId':sectionId}); return feeRules; }; installation_fee.prototype.getFeeRuleByID = function (libID,feeRuleID) { let installationFee = this.getInstallationFeeByLibID(libID); return _.find(installationFee.feeRule,{'ID':feeRuleID}); }; // 提交数据后返回数据处理 installation_fee.prototype.doAfterUpdate = function(err, data){ }; return new installation_fee(project); } };