easyui combobox 下拉框后台列表查询

action 类:

     public String findContractNo() {
        DataResponse dataResponse = new DataResponse();
        List<Map<String, Object>> list = contractInvoiceService
                .findContractNo();
        if (list == null) {
            list = new ArrayList<Map<String, Object>>();
        }
        List<Map<String, Object>> listCombox = new ArrayList<Map<String, Object>>();
        if (list.size() > 0) {
            for (int i = 0; i < list.size(); i++) {
                Map<String, Object> map = list.get(i);
                map.put("contractNo", map.get("contractNo"));
                listCombox.add(map);
            }
        }
        dataResponse.setRows(listCombox);
        setJsonString(dataResponse.toString());
        return SUCCESS;
    }

js:

$('#cont').combobox({
        url : base+"/desktop/cs/contract-invoice/findContractNo.action?t=" + new Date().getTime(),
        mode : 'remote',
        panelHeight:"auto",
        valueField:"id",
        textField:"contractNo",
        loadFilter : function(data) {
            return data.rows;
        },
        onSelect:function(rec){
             var tr_id = $('#cont').combobox('getValue');

             var val = $('#cont').combobox('getText');
             var split = val.split("-");
                 for(var i = 0;i<split.length;i++){
                     $('#'+contrNo).val(split[0]);
                     $('#'+res_id).val(split[1]);
                     $('#'+hisp_id).val(split[2]);
                     $('#'+doctor).val(split[3]);
                     $('#'+depment_id).val(split[4]);
                     $('#'+emplyee_id).val(split[5]);
                 };
           }
      });

jsp:   


 <td align="right" style="width:2400px" ><label><b>添加合同号</b></label></td>
                        <td colspan='14' align="left"><input type="text" id="cont" name="cont" style="width:600px;height:20px;border: 1px solid #a4bed4"/></td>
                    </tr>

sql:

SELECT con.id,CONCAT(con.contract_no,'-',con.name,'-',ch.name,'-',cdr.name,'-',cd.name,'-',ie.name) as contractNo
        from contract con
        LEFT JOIN crm_department cd
        on con.dept_id = cd.id
         LEFT JOIN crm_hospital ch
        on ch.id = cd.hospital_id
        left join crm_doctor cdr
           on con.customer_id = cdr.id
            left join  id_employee ie
        on con.employee_id =ie.id


阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010964869/article/details/49942841
个人分类: easyui 编程技术
上一篇jquery 中获取table里tr的属性值
下一篇struts2 + freemark + itext 导出pdf(基于模板方式)
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭