/** * Created by Mai on 2017/4/1. */ var ration_ass = { createNew: function (project) { // 用户定义private方法 var tools = {}; // 所有通过this访问的属性,都不应在此单元外部进行写入操作 var ration_ass = function (proj) { this.gljTree = cacheTree.createNew(this); // this.project = proj; this.datas = []; var sourceType = ModuleNames.ration_ass; this.getSourceType = function () { return sourceType; } proj.registerModule(ModuleNames.ration_ass, this); }; // prototype用于定义public方法 ration_ass.prototype.loadData = function (datas) { this.datas = datas; }; // 提交数据后返回数据处理 ration_ass.prototype.doAfterUpdate = function(err, data){ if(!err){ if(data.updateTpye=='ut_update'){ this.refreshAfterUpdate(data); }else if(data.updateTpye=='ut_delete'){ this.refreshAfterDelete(data); } else { this.refreshAfterSave(data); } } }; ration_ass.prototype.refreshAfterSave=function(data){ }; ration_ass.prototype.refreshAfterUpdate=function(data){ this.updateRation(data.rationID,data.doc); //this.updateRationGLJ(data.ration_glj_list); gljOprObj.assSheetData[data.editIndex].actualValue = data.actualValue; sheetCommonObj.showData(gljOprObj.assSheet,gljOprObj.assSetting,gljOprObj.assSheetData); }; ration_ass.prototype.updateRation = function (rationID,doc) { var index = _.findIndex(projectObj.project.Ration.datas,(ration)=>{ return ration.ID==rationID; }) projectObj.project.Ration.datas[index].rationAssList = doc.rationAssList; }; ration_ass.prototype.updateRationGLJ = function (updateList) { for(var i=0;i{ return glj.ID==updateList[i].ID; }) projectObj.project.ration_glj.datas[index].quantity=updateList[i].quantity; var showIndex = _.findIndex(gljOprObj.sheetData,(shglj)=>{ return shglj.ID==updateList[i].ID; }) gljOprObj.sheetData[showIndex].quantity=updateList[i].quantity; } sheetCommonObj.showData(gljOprObj.sheet,gljOprObj.setting,gljOprObj.sheetData); }; ration_ass.prototype.refreshAfterDelete=function(data){ var glj_list = projectObj.project.ration_coe.datas; _.remove(glj_list,data.query); _.remove(gljOprObj.sheetData,data.query); sheetCommonObj.showData(gljOprObj.coeSheet,gljOprObj.coeSetting,gljOprObj.sheetData); }; ration_ass.prototype.CreateNewAss = function (std) { var newAssList = [] if(std.hasOwnProperty('rationAssList')&&std.rationAssList.length>0){ for(var i=0;i