| | |
| | | ({ |
| | | doinit : function(component, event, helper) { |
| | | component.set('v.login',true); |
| | | |
| | | component.set("v.awsdata",{}); |
| | | |
| | | var action = component.get("c.getfiledsmap"); |
| | | action.setCallback(this, function(response) { |
| | | var state = response.getState(); |
| | | if(state === "SUCCESS") { |
| | | var res = response.getReturnValue(); |
| | | |
| | | component.set("v.filedsmap", res); |
| | | } else if (state === "ERROR") { |
| | | var errors = response.getError(); |
| | |
| | | if(state === "SUCCESS") { |
| | | var acList = response.getReturnValue(); |
| | | component.set("v.accounts", acList); |
| | | component.set('v.login',false); |
| | | helper.Decrypt(component,helper,function(){ |
| | | component.set('v.login',false); |
| | | }) |
| | | |
| | | |
| | | } else if (state === "ERROR") { |
| | | var errors = response.getError(); |
| | | var toastEvent = $A.get("e.force:showToast"); |
| | |
| | | component.set('v.login',false); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action2); |
| | | |
| | | |
| | | var action3 = component.get("c.GetConfig"); |
| | | action3.setCallback(this, function(response) { |
| | | var state = response.getState(); |
| | | if(state === "SUCCESS") { |
| | | var res = response.getReturnValue(); |
| | | //AWSService.sfSessionId = res.sessionId; |
| | | component.set("v.staticResource",JSON.parse(res.staticResource)); |
| | | $A.enqueueAction(action2); |
| | | |
| | | } else if (state === "ERROR") { |
| | | var errors = response.getError(); |
| | | var toastEvent = $A.get("e.force:showToast"); |
| | | toastEvent.setParams({ |
| | | "title": "错误", |
| | | "type":"error", |
| | | "message": errors[0].message |
| | | }); |
| | | toastEvent.fire(); |
| | | } |
| | | }); |
| | | $A.enqueueAction(action3); |
| | | |
| | | |
| | | }, |
| | | |
| | | clearContact: function(component, event, helper) { |
| | |
| | | component.set('v.login',true); |
| | | var hosStr = component.get("v.hosStr"); |
| | | var conStr = component.get("v.conStr"); |
| | | var action = component.get("c.searchAccounts"); |
| | | action.setParams({"hosStr": hosStr, "conStr": conStr}); |
| | | |
| | | var action = component.get("c.searchAccounts2"); |
| | | let awsdata = component.get("v.awsdata"); |
| | | let staticResource = component.get("v.staticResource"); |
| | | action.setCallback(this, function(response) { |
| | | var state = response.getState(); |
| | | if(state === "SUCCESS") { |
| | | var acList = response.getReturnValue(); |
| | | component.set("v.accounts", acList); |
| | | component.set('v.login',false); |
| | | helper.Decrypt(component,helper,function(){ |
| | | component.set('v.login',false); |
| | | }) |
| | | } else if (state === "ERROR") { |
| | | var errors = response.getError(); |
| | | var toastEvent = $A.get("e.force:showToast"); |
| | |
| | | component.set('v.login',false); |
| | | } |
| | | }); |
| | | |
| | | if (conStr) { |
| | | AWSService.search(staticResource.searchUrl,JSON.stringify({ |
| | | "name":conStr |
| | | }),function(data){ |
| | | $A.getCallback(function(){ |
| | | let dataIds = []; |
| | | if(data.object && data.object.length > 0){ |
| | | for(let d of data.object){ |
| | | if(d.dataId){ |
| | | dataIds.push(d.dataId); |
| | | awsdata[d.dataId] = d; |
| | | } |
| | | } |
| | | } |
| | | |
| | | action.setParams({"hosStr": hosStr, awsids:dataIds}); |
| | | $A.enqueueAction(action); |
| | | })() |
| | | |
| | | },staticResource.token); |
| | | }else{ |
| | | action.setParams({"hosStr": hosStr}); |
| | | $A.enqueueAction(action); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | }, |
| | | Decrypt :function(component, helper, callback){ |
| | | let awsdata = component.get("v.awsdata"); |
| | | let need_query = []; |
| | | let acList = component.get("v.accounts"); |
| | | let staticResource = component.get("v.staticResource"); |
| | | for (const acc of acList) { |
| | | if(acc.AWS_Data_Id__c && |
| | | (!awsdata.hasOwnProperty(acc.AWS_Data_Id__c) || !awsdata[acc.AWS_Data_Id__c]) |
| | | ){ |
| | | need_query.push(acc.AWS_Data_Id__c); |
| | | } |
| | | } |
| | | let Foo = function(){ |
| | | for (const acc of acList) { |
| | | if(acc.AWS_Data_Id__c && awsdata.hasOwnProperty(acc.AWS_Data_Id__c)){ |
| | | acc.awsdata = awsdata[acc.AWS_Data_Id__c]; |
| | | } |
| | | } |
| | | component.set("v.accounts", acList); |
| | | if(callback)callback(); |
| | | } |
| | | |
| | | if(need_query.length>0){ |
| | | AWSService.search(staticResource.searchUrl,JSON.stringify({ |
| | | "dataIds":need_query |
| | | }),function(data){ |
| | | $A.getCallback(function(){ |
| | | if(data.object && data.object.length > 0){ |
| | | for(let d of data.object){ |
| | | if(d.dataId){ |
| | | awsdata[d.dataId] = d; |
| | | } |
| | | } |
| | | } |
| | | |
| | | Foo(); |
| | | })() |
| | | |
| | | },staticResource.token); |
| | | }else{ |
| | | Foo(); |
| | | } |
| | | }, |
| | | saveLog:function(component,module,url,request,response,status){ |
| | | var action = component.get("c.SaveLog"); |
| | | action.setParams({ |
| | | "module": hosStr, |
| | | "content": content, |
| | | "status": status, |
| | | "respMsg": respMsg |
| | | }); |
| | | |
| | | $A.enqueueAction(action); |
| | | } |
| | | }) |