var storeCpye = new Ext.data.GroupingStore({ proxy : new Ext.data.HttpProxy({ url : 'cxgl_cpye.app?dateTime=' + new Date().getTime() + '&subTranCode=list' }), reader : new Ext.data.JsonReader({ root : 'hstamcx', totalProperty : "results", fields : ["zfe_hz","khbh","bankacc","fundacc","xxsdm","dxjgdm", "cpdm","tazh","tajyzh","tadm","hybh","zfe","lsdjfe", "cqdjfe","zhtzfe","bddjfe","fhfs","yfhfs","fhbl", "zrzfe","fejg","khlb","zjtzbz","bqsy","sybl","mrcb", "ljsr","wfsy","wfsydj","dtsy","glfzkl","glfje", "dqglf","glfrq","gxrq","apex1","apex2","apex3"] })//, //sortInfo : { // field : 'cpdm', // direction : 'DESC' //}, //groupField : 'cpdm' }); var colMArray = new Array(); colMArray = [{header : "产品代码", dataIndex : "cpdm", width : 100}, {header : "代销机构代码", dataIndex : "dxjgdm", width : 100}, //{header : "总份额汇总", dataIndex : "zfe_hz", width : 100}, {header : "总份额", dataIndex : "zfe", width : 100, align:"right"}, {header : "客户编号", dataIndex : "khbh", width : 100}, {header : "理财账号", dataIndex : "bankacc", width : 100}, {header : "客户资金账号", dataIndex : "fundacc", width : 100}, {header : "本行销售商代码", dataIndex : "xxsdm", width : 100}, {header : "TA账号", dataIndex : "tazh", width : 100}, {header : "TA交易账号", dataIndex : "tajyzh", width : 100}, {header : "TA代码", dataIndex : "tadm", width : 100}, {header : "合约编号", dataIndex : "hybh", width : 100}, {header : "临时冻结份额", dataIndex : "lsdjfe", width : 100, align:"right"}, {header : "长期冻结份额", dataIndex : "cqdjfe", width : 100, align:"right"}, {header : "组合投资份额", dataIndex : "zhtzfe", width : 100, align:"right"}, {header : "本地冻结份额", dataIndex : "bddjfe", width : 100, align:"right"}, {header : "当前分红方式", dataIndex : "fhfs", width : 100}, {header : "原分红方式", dataIndex : "yfhfs", width : 100}, {header : "红利比例(%)", dataIndex : "fhbl", width : 100}, {header : "昨日总份额", dataIndex : "zrzfe", width : 100, align:"right"}, {header : "份额所属机构", dataIndex : "fejg", width : 100}, {header : "客户类别", dataIndex : "khlb", width : 100}, {header : "追加投资标志", dataIndex : "zjtzbz", width : 100}, {header : "本期收益", dataIndex : "bqsy", width : 100, align:"right"}, {header : "收益客户比例(%)", dataIndex : "sybl", width : 100}, {header : "买入成本", dataIndex : "mrcb", width : 100, align:"right"}, {header : "累计收入", dataIndex : "ljsr", width : 100, align:"right"}, {header : "未付收益", dataIndex : "wfsy", width : 100, align:"right"}, {header : "冻结的未付收益", dataIndex : "wfsydj", width : 100, align:"right"}, {header : "当天新分配收益", dataIndex : "dtsy", width : 100, align:"right"}, {header : "管理费折扣率(%)", dataIndex : "glfzkl", width : 100}, {header : "管理费总额", dataIndex : "glfje", width : 100, align:"right"}, {header : "当前管理费", dataIndex : "dqglf", width : 100, align:"right"}, {header : "管理费计算日期", dataIndex : "glfrq", width : 100}, {header : "更新日期", dataIndex : "gxrq", width : 100}]; var colQd = new Ext.grid.ColumnModel(colMArray); // GRID定义 var gridCpye = new Ext.grid.GridPanel({ id : 'cpye_grid', title:'[产品余额]查询', height : 800, stripeRows : true, bodyStyle : 'width:100%', disableSelection : true, cm : colQd, viewConfig : { forceFit : false }, store : storeCpye, iconCls : 'details', animCollapse : true, trackMouseOver : false, loadMask : { msg : '正在加载[产品余额]信息,请稍侯……' }, //selModel : smQd, selModel : new Ext.grid.RowSelectionModel({singleSelect:true}), tbar : ['-',new Ext.form.Label({ text : '产品代码:' }),new Ext.form.TextField({ id : 'cpdm', name : 'cpdm', width : 130 }),'-',new Ext.form.Label({ text : '代销机构代码:' }), new Ext.form.TextField({ id : 'dxjgdm', name : 'dxjgdm', width : 130 }), '-', { pressed : true, text : ' 查 询 ', iconCls : 'yes', handler : selinfo },'-',new Ext.Toolbar.Fill(),'-',new Ext.form.Label({ text : ' 查询方式: ' }),new Ext.form.Radio({ id:"cpdm_radio", name : "select_method", inputValue : "cpdm desc,dxjgdm desc", checked : true, boxLabel : " 产 品 "//, //listeners : { //check : radiochange //} }), new Ext.form.Radio({ id:"dxjgdm_radio", name : "select_method", inputValue : "dxjgdm desc,cpdm desc", boxLabel : "代销机构 "//, //listeners : { //check : radiochange //} }),'-' ], bbar : new Ext.PagingToolbar({ pageSize : 20, store : storeCpye, displayInfo : true, emptyMsg : '没有记录' }) });
private void list() throws HsException { String cpdm = $("cpdm_sel"); String dxjgdm = $("dxjgdm_sel"); String order_by = $("select_method_sel"); String start = $("start"); String limit = $("limit"); int b=0,m=20; if(start!=null && !start.equals("")){ b = new Integer(start); } if(limit!=null && !limit.equals("")){ m = new Integer(limit); } //查询 CpyeDao cpyeDao = new CpyeDao(request, response); String sql = cpyeDao.select(cpdm,dxjgdm,order_by); List<HashMap> list1 = null; try { list1 = this.findSql(new String(sql.getBytes("iso8859-1"),"UTF-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } List<HashMap> list = new ArrayList(); for(int i = b; i < b + m && i<list1.size(); i++ ){ list.add(list1.get(i)); } //把list转化成Json // StringBuffer s = new StringBuffer("{results:"+list1.size()+",result:["); // for( int i=0;i< list.size();i++){ // HashMap hm = list.get(i); // // for(int j=0;j < columns.length; j++){ // if(j==0) s.append("{"); // s.append(columns[j]+":\""+hm.get(columns[j].toUpperCase().toString()).toString()+"\""); // if(j>0 && j<(columns.length-1) ) s.append(","); // if(j==(columns.length-1)) s.append("}"); // } // } // s.append("]}"); // AjaxTools.exAjax("{results:"+list1.size()+",hstamcx:"+JsonTools.agentJdbcLstToJson(list,lpDict,gbismDict)+",\""+paramName+"\":\""+paramValue+"\"}",response); AjaxTools.exAjax("{results:"+list1.size()+",hstamcx:"+JsonTools.agentJdbcLstToJson(list,lpDict,gbismDict)+"}",response); }
public class AjaxTools { public static void exAjax(String ajaxString,HttpServletResponse response)throws HsException{ PrintWriter out = null; try{ response.setContentType("text/html;charset=utf-8"); response.setHeader("Cache-Control", "no-cache"); out=response.getWriter(); out.write(ajaxString); out.flush(); }catch(Exception e){ throw new HsException(HsErrorMsg.ERR_DEFAULT, "AJAX通讯出错!"+e.getMessage()); } finally{ out.close(); } } }