微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Salesforce闪电组件中未填充多级数据

如何解决Salesforce闪电组件中未填充多级数据

由于选择列表下拉列表中未显示生产中的数据,而是同一闪电组件在暂存中显示了level1 level2 level3数据,因此该问题更加严重

产品等级1中未显示任何数据,请在阶段1中填充任何数据,请使用相同的配置和设置来帮助查找,生产和阶段完全相同

分期和生产之间唯一的区别是生产有6000条记录,而分期有大约250条记录,这是一个选择列表问题吗?

enter image description here

这是picklisthandler.cmp代码

                    <aura:component controller="PickListHandler" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningquickaction" access="global" >
                        <!-- Actions-->
                        <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
                        <!-- variable-->
                        <aura:attribute name="lstLevel1" type="String[]" />
                         <aura:attribute name="lstLevel2" type="String[]" />
                          <aura:attribute name="lstL3" type="String[]" />
                        <span> Level 1</span>
                        <ui:inputSelect aura:id="ddLevel1" change="{!c.getLvl1}">
                            <ui:inputSelectOption label="-Select-" value="true"/>        
                            <aura:iteration items="{!v.lstLevel1}" var="value">          
                                <ui:inputSelectOption label="{!value}" text="{!value}" />
                            </aura:iteration>
                        </ui:inputSelect>
                        <span>Level 2</span>
                        <ui:inputSelect aura:id="ddLevel2" change="{!c.getSelectedValue}">
                            <ui:inputSelectOption label="-Select-" value="true"/>        
                            <aura:iteration items="{!v.lstLevel2}" var="value">          
                                <ui:inputSelectOption label="{!value}" text="{!value}" />
                            </aura:iteration>
                        </ui:inputSelect>
                         <span>Level 3</span>
                        <ui:inputSelect aura:id="ddLevel3" >
                            <ui:inputSelectOption label="-Select-" value="true"/>        
                            <aura:iteration items="{!v.lstL3}" var="value">          
                                <ui:inputSelectOption label="{!value}" text="{!value}" />
                            </aura:iteration>
                        </ui:inputSelect>
                       <lightning:button variant="brand" label="Save" onclick="{!c.onConfirm}" />
                    </aura:component>

这是picklisthandlercontroller.js代码

            ({
                doInit : function(component,event,helper) {
                    var action = component.get("c.getLevel1");
                    action.setCallback(this,function(e) {
                        if(e.getState()=='SUCCESS'){
                            var result=e.getReturnValue();
                            component.set("v.lstLevel1",result);
                        }
                    });
                    $A.enqueueAction(action);
                },getLvl1:function(component,helper){
                   
                    var picklist=component.find('ddLevel1');
                    var picklistvalue=picklist.get('v.value');
                    var action = component.get("c.getLevel2");
                    action.setParams({  'strName' : picklistvalue  });
                    action.setCallback(this,function(e) {
                        if(e.getState()=='SUCCESS'){
                            var result=e.getReturnValue();
                            component.set("v.lstLevel2",result);
                        }
                    });
                    $A.enqueueAction(action);
                        },getSelectedValue:function(component,helper){
                    var picklist=component.find('ddLevel1');
                    var picklistvalue=picklist.get('v.value');
                    var picklistdep=component.find('ddLevel2');
                    var picklistvaluedep2=picklistdep.get('v.value');
                    var action = component.get("c.getLevel3");
                    action.setParams({  'strName1' : picklistvalue,'strName2' : picklistvaluedep2});//
                    action.setCallback(this,function(e) {
                        if(e.getState()=='SUCCESS'){
                            var result=e.getReturnValue();
                            component.set("v.lstL3",onConfirm:function(component,helper){
                    var picklist=component.find('ddLevel1');
                    var picklistvalue=picklist.get('v.value');
                    var picklistdep=component.find('ddLevel2');
                    var picklistvaluedep2=picklistdep.get('v.value');
                   
                    var picklistdep3=component.find('ddLevel3');
                    var picklistvaluedep3=picklistdep3.get('v.value');
                    var action = component.get("c.savecasetype");
                    
                    action.setParams({  'level1' : picklistvalue,'level2' : picklistvaluedep2,'level3' : picklistvaluedep3,'id' : component.get("v.recordId")});
                                      
                    
                    var toastEvent = $A.get("e.force:showToast");
                    action.setCallback(this,function(e) {
                        if(e.getState()=='SUCCESS'){
                            var result=e.getReturnValue();
                            if(result==='successfull'){
                                toastEvent.setParams({
                                    "title": "Success!","message": "The record has been inserted  successfully."
                                });
                                toastEvent.fire();
                            }else{
                                toastEvent.setParams({
                                    "title": "Error","message": "The record has not been inserted  successfully."
                                });
                                toastEvent.fire();
                            }
                        }
                    });
                    $A.enqueueAction(action);
                   
                }
            })

这是顶点代码

                public class PickListHandler {
                    @AuraEnabled
                    public static List<String> getLevel1(){
                    List<String> tempLst1 = new List<String>();
                        for(AggregateResult  ar : [select Level_1__c,COUNT(id) from Case_Type_Data__c  group by Level_1__c])
                    {
                        tempLst1.add(''+ar.get('Level_1__c'));
                    }

                    return tempLst1;
                      
                      
                    } 
                    
                    @AuraEnabled
                    public static List<String> getLevel2(string strName){
                    List<String> tempLst2 = new List<String>();
                       for(AggregateResult  ar : [select Level_2__c,COUNT(id) from Case_Type_Data__c where Level_1__c=:strName  group by Level_2__c])
                    {
                       tempLst2.add(''+ar.get('Level_2__c'));
                    }

                    return tempLst2;
                      
                    } 
                    
                    @AuraEnabled
                    public static List<String> getLevel3(string strName1,string strName2){
                     List<String> tempLst3 = new List<String>();
                      for(AggregateResult  ar : [select Level_3__c,COUNT(id) from Case_Type_Data__c  where Level_1__c=:strName1 and Level_2__c=:strName2 group by Level_3__c])
                    {
                       tempLst3.add(''+ar.get('Level_3__c'));
                    }

                    return tempLst3;
                      
                      
                    } 
                         
                     @AuraEnabled
                     public  static String  savecasetype(string level1,string level2,string level3,string id){
                     string strMsg='successfull';
                          try{
                     ERT_Case_Type__c obj=new ERT_Case_Type__c();
                     Obj.Case__c = id;
                     System.debug('CASE  = '+ Obj.Case__c); 
                     Obj.Level_1__c=level1;
                     System.debug('Level1  = '+ Obj.Level_1__c); 
                     Obj.Level_2__c=level2;
                     System.debug('Level2  = '+ Obj.Level_2__c); 
                     Obj.Level_3__c=level3;
                     System.debug('Level3  = '+ Obj.Level_3__c); 
                     Insert obj;
                  
                     }
                     
                    catch(Exception ex){
                            strMsg='error';
                        }
                     return strMsg;  
                }
                    
                     
                    
                    

                }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。