功能名称:listDataAction
切入类型:before
事件名称:com.kingdee.bos.webframework.dynamic.event.view.WebListDataEvent;
package com.kingdee.eas.re.sales.costmarkout.handler; import org.apache.commons.lang3.StringUtils;
import org.springframework.ui.ModelMap;
import com.kingdee.bos.metadata.query.util.CompareType;
import com.kingdee.bos.ui.face.UIRuleUtil;
import com.kingdee.bos.webframework.dynamic.event.view.IWebListDataEventHandler;
import com.kingdee.bos.webframework.dynamic.event.view.WebListDataEvent;
import com.kingdee.bos.webframework.dynamic.handler.view.WebListDataEventHandler;
import com.kingdee.bos.webframework.exception.WafException; import com.kingdee.eas.fdc.sales.MoneyTypeEnum; public class ListDataFilterEventHandler implements IWebListDataEventHandler {
public static final String DATAGRID_ENTITYVIEW = "DataGridEntityView";
public void onRequest(WebListDataEvent event) throws WafException,BOSException {
// TODO Auto-generated method stub
ModelMap modelMap = event.getReqeustContext().get(ModelMap.class);
HttpServletRequest request = event.getReqeustContext().getHttpServletRequest();
EntityViewInfo entityViewInfo = (EntityViewInfo) modelMap.get(DATAGRID_ENTITYVIEW);
SellProjectInfo sellInfo = SalesContext.getSellProject();
if (entityViewInfo == null) {
entityViewInfo = new EntityViewInfo();
}
if(sellInfo!=null){
FilterInfo filterInfo = getFilter(request);
//FilterInfo filterInfo = new FilterInfo();
filterInfo.getFilterItems().add(new FilterItemInfo("sellProject.id",sellInfo.getId().toString(),CompareType.EQUALS));
if(FilterUtility.hasFilterItem(entityViewInfo.getFilter())) {
entityViewInfo.getFilter().mergeFilter(filterInfo,"and");
}else {
entityViewInfo.setFilter(filterInfo);
}
}
modelMap.put(DATAGRID_ENTITYVIEW, entityViewInfo);
}