页面加载后从后面带数据到前台
功能名称:initializeAction
切入类型:after
事件名称:com.kingdee.bos.webframework.dynamic.handler.view.WebPageOnLoadEventHandler;
1 package com.kingdee.eas.re.sales.costmarkout.handler;
2
3 import java.util.HashMap;
4 import java.util.Map;
5
6 import org.springframework.ui.ModelMap;
7
8 import com.kingdee.bos.eventbus.event.view.AbstractOnRequestEvent;
9 import com.kingdee.bos.webframework.dynamic.application.WebSymbolConstant;
10 import com.kingdee.bos.webframework.dynamic.handler.view.WebPageOnLoadEventHandler;
11 import com.kingdee.bos.webframework.exception.WafException;
12 import com.kingdee.bos.webframework.json.JSONUtils;
13 import com.kingdee.eas.fdc.crm.basedata.SellProjectInfo;
14 import com.kingdee.eas.re.sales.web.utils.SalesContext;
15
16 public class WebPageOnloadDetailEventHandler extends WebPageOnLoadEventHandler {
17 @Override
18 public void onLoad(AbstractOnRequestEvent event) throws WafException {
19 // TODO Auto-generated method stub
20 ModelMap modelMap = event.getReqeustContext().get(ModelMap.class);
21 SellProjectInfo sellInfo = SalesContext.getSellProject();
22 Map initData = JSONUtils.convertJsonToObject((String) modelMap.get(WebSymbolConstant.PAGE_INITDATA_VAR));
23 if (initData == null) {
24 initData = new HashMap();
25 }
26
27 if(sellInfo!=null){
28 initData.put("sellProjectId", sellInfo.getId().toString());
29 }
30 modelMap.put(WebSymbolConstant.PAGE_INITDATA_VAR,JSONUtils.convertObjectToJson(initData));
31 }
32 }
前台js取值
_self._pageInitData.sellProjectId