From 0fc2b1ded886d7eac96f6263c053372665e6ad00 Mon Sep 17 00:00:00 2001
From: 张宇恒 <bxyun0@163.com>
Date: 星期三, 13 四月 2022 18:01:04 +0800
Subject: [PATCH] 612和603更改
---
force-app/main/default/aura/AgencyAccount/AgencyAccountHelper.js | 132 +++++++++++++++++++++++++++++++++++++++++--
1 files changed, 125 insertions(+), 7 deletions(-)
diff --git a/force-app/main/default/aura/AgencyAccount/AgencyAccountHelper.js b/force-app/main/default/aura/AgencyAccount/AgencyAccountHelper.js
index e505988..0e1d348 100644
--- a/force-app/main/default/aura/AgencyAccount/AgencyAccountHelper.js
+++ b/force-app/main/default/aura/AgencyAccount/AgencyAccountHelper.js
@@ -1,12 +1,14 @@
({
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();
@@ -27,7 +29,11 @@
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");
@@ -40,7 +46,31 @@
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) {
@@ -53,15 +83,17 @@
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");
@@ -74,6 +106,92 @@
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);
}
})
\ No newline at end of file
--
Gitblit v1.9.1