jeecg增加选择模块

jeecg增加选择模块

需求如下

  1. 弹框选择用户,支持多选和单选,修改复选框是否显示即可。
  2. 编辑用户名回显,因为存放的是id。
  3. 弹框模糊查询实现,回显选中。

效果

QQ20200514-154241@2x

代码如下

编辑页面

 <%--<input id="customerId" name="customerId" type="text" style="width: 100%" class="inputxt"  datatype="*"  ignore="checked"  value='${mdSysParaPage.customerId}'/>--%>

                                <%--客户id--%>
                            <input id="customerId" name="customerId" type="hidden" value="${mdSysParaPage.customerId}"/>
                                <%--客户名字--%>
                            <input name="name" id="name" class="inputxt" value="${mdSysParaPage.clientName}" readonly="readonly" datatype="*" />
                            <t:choose hiddenName="customerId" hiddenid="id" textname="name" url="mdCustomerController.do?getClient" name="roleList" icon="icon-search" title="客户名称" isclear="true" isInit="true"></t:choose>

实体类

增加@Transient,不在数据库判断。

/**返回查询名称*/
	private java.lang.String clientName ;

@Transient
	public String getClientName() {
		return clientName;
	}

	public void setClientName(String clientName) {
		this.clientName = clientName;
	}

跳转弹框页面

 /**
     * 获取客户页面
     *
     * @return
     */
    @RequestMapping(params = "getClient")
    public ModelAndView getClient(HttpServletRequest request) {
        ModelAndView mv = new ModelAndView("com/md/customer/information/getClient");
        String ids = oConvertUtils.getString(request.getParameter("ids"));
        mv.addObject("ids", ids);
        return mv;
    }

弹框页面如下

调用客户页面查询,判断条件。

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html >
<html>
<head>
<title>选择客户</title>
<t:base type="jquery,easyui,tools"></t:base>
</head>
<body style="overflow-y: hidden" scroll="no">
<t:datagrid  pagination="true" pageSize="5"  name="roleList" title="选择客户"  actionUrl="mdCustomerController.do?datagrid" idField="id" checkbox="false" showRefresh="false"  fit="true"  queryMode="group" onLoadSuccess="initCheck">
	<t:dgCol title="id" field="id" hidden="true"></t:dgCol>
	<t:dgCol title="customer.category" field="customerCategory" queryMode="single" dictionary="custom" width="50"></t:dgCol>
	<t:dgCol title="client" field="name" width="50" query="true" ></t:dgCol>
</t:datagrid>
</body>
</html>
<script type="text/javascript">
function initCheck(data){
	var ids = "${ids}";
	var idArr = ids.split(",");
	for(var i=0;i<idArr.length;i++){
		if(idArr[i]!=""){
			$("#roleList").datagrid("selectRecord",idArr[i]);
		}
	}
}
</script>

返回编辑页面

回显客户名称

/**
	 * 客户系统参数编辑页面跳转
	 * 
	 * @return
	 */
	@RequestMapping(params = "goUpdate")
	public ModelAndView goUpdate(MdSysParaEntity mdSysPara, HttpServletRequest req) {
		if (StringUtil.isNotEmpty(mdSysPara.getId())) {
			mdSysPara = mdSysParaService.getEntity(MdSysParaEntity.class, mdSysPara.getId());
			//增加客户名称回显
			MdCustomerEntity mdCustomer = mdCustomerService.getEntity(MdCustomerEntity.class, mdSysPara.getCustomerId());
			mdSysPara.setClientName(mdCustomer.getName());
			req.setAttribute("mdSysParaPage", mdSysPara);
		}
		return new ModelAndView("com/md/sys/para/mdSysParaEdit");
	}