问题描述
由于选择列表下拉列表中未显示生产中的数据,而是同一闪电组件在暂存中显示了level1 level2 level3数据,因此该问题更加严重
产品等级1中未显示任何数据,请在阶段1中填充任何数据,请使用相同的配置和设置来帮助查找,生产和阶段完全相同
分期和生产之间唯一的区别是生产有6000条记录,而分期有大约250条记录,这是一个选择列表问题吗?
这是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 (将#修改为@)