参考以下代码:
/**
* 查询审核列表
*
* @return
*/
@RequestMapping(params = "method=findCheckList")
public String findCheckList(HttpServletRequest request,
ModelMap modelMap,
AssetsDeleteQuery assetsDeleteQuery,String page, String pagesize,String assetsTypeIdtxt,HttpServletResponse response) throws Exception {
findApply(request, modelMap, assetsDeleteQuery);
User user = (User) request.getSession().getAttribute("user");
if (pagesize != null && !"".equals(pagesize)) {
len = Integer.parseInt(pagesize);
//存入cookie
Cookie cookie = new Cookie(user.getId(), pagesize);
response.addCookie(cookie);
} else {
//用cookie得到用户名
Cookie[] cookies = request.getCookies();
if (cookies != null && cookies.length > 0) {
for (Cookie c : cookies) {
if (c.getName().equals(user.getId())) {
len = Integer.parseInt(c.getValue());
}
}
}
}
if (page != null && !"".equals(page)) {
pageNum = Integer.parseInt(page);
} else {
pageNum = 1;
}
// 下级
List<BaseCode> xiaJi = new ArrayList();
// 下级的下级
List<BaseCode> xiaJiNextJi = new ArrayList();
// 合并
List<BaseCode> allZCLB = new ArrayList<>();
String zclbId = assetsDeleteQuery.getAssetsTypeId();
if (!"".equals(zclbId) && null != zclbId) {
// 查询出所有的资产类别(经营性资产类别,非经营性资产)
List<BaseCode> baseCodeList = baseCodeService.findBaseCodeByType2("ZCLBJYX", "ZCLBFJYX");
// 根据页面传过来的资产类型Id查询到下级
for (int i = 0; i < baseCodeList.size(); i++) {
// parent不为空的情况下
if (!"".equals(baseCodeList.get(i).getParentId()) && null != baseCodeList.get(i).getParentId()) {
// 页面传过来的id与资产类别的parent对比,如果相等,就是他的下级,否则没有下级
if (zclbId.equals(baseCodeList.get(i).getParentId().getId())) {
xiaJi.add(baseCodeList.get(i));
}
}
}
// 如果nextJi.size()>0 表示他有下级
if (xiaJi.size() > 0) {
// 通过下级的id继续查询下级的下级
for (int i = 0; i < xiaJi.size(); i++) {
for (int j = 0; j < baseCodeList.size(); j++) {
if (!"".equals(baseCodeList.get(j).getParentId()) && null != baseCodeList.get(j).getParentId()) {
if (xiaJi.get(i).getId().equals(baseCodeList.get(j).getParentId().getId())) {
xiaJiNextJi.add(baseCodeList.get(j));
}
}
}
}
}
if (xiaJi.size() > 0) {
allZCLB.addAll(xiaJi);
}
if (xiaJiNextJi.size() > 0) {
allZCLB.addAll(xiaJiNextJi);
}
assetsDeleteQuery.setBaseCodeList(allZCLB);
}
if (assetsDeleteQuery.getUnitid() != null && !"".equals(assetsDeleteQuery.getUnitid())) {
assetsDeleteQuery.setUnitId(assetsDeleteQuery.getUnitid());
}
assetsDeleteQuery.setNeedFindZu(Constant.YES);
unitService.getQueryUnit(assetsDeleteQuery, request);
CommonTreeDto commonTreeDto=assetsDeleteQuery.getCommonTreeDto();
if(commonTreeDto==null){
commonTreeDto=new CommonTreeDto();
Dept dept = user.getDept();
Unit areaId = dept.getAreaId();
commonTreeDto.setUnitId(areaId.getId());
commonTreeDto.setAllpath(areaId.getAllPath());
commonTreeDto.setLevel(areaId.getLevel()+"");
commonTreeDto.setType("dq");
commonTreeDto.setName(areaId.getAreaName());
}
commonTreeDto.setDataDeptId("");
commonTreeDto.setUser(user);
assetsDeleteQuery.setCommonTreeDto(commonTreeDto);
String unitList=commonTreeService.buildCurrentUserTree(request,null);
PageControl applyList = assetsDeleteService.findCheckListNew(pageNum, len,assetsDeleteQuery);
String zcTypeList = baseCodeService.findBaseCodeJson2("ZCLBJYX", "ZCLBFJYX");
List<BaseCode> QCFSList = baseCodeService.findBaseCodeByType("ZCJSFS");
modelMap.addAttribute("QCFSList", QCFSList);
modelMap.addAttribute("zcTypeList", zcTypeList);
modelMap.addAttribute("pc", applyList);
modelMap.addAttribute("unitList", unitList);
modelMap.addAttribute("query",assetsDeleteQuery);
return "sanzgl/zichanggl/zcbd/check_list";
}
,在以下代码中添加功能代码:
/**
* 资产购入审核-列表
* @param request
* @param modelMap
* @param assetsPurchaseQuery
* @return
* @throws Exception
*/
@RequestMapping(params = "method=findCheck")
public String findCheck(HttpServletRequest request, ModelMap modelMap,
AssetsPurchaseQuery assetsPurchaseQuery,
String page, String pagesize,
String assetsTypeIdtxt, HttpServletResponse response) throws Exception {
User user = (User) request.getSession().getAttribute("user");
if(user == null){
return "login";
}
//待办事项处理,列表自动选择待办事项中点击的地区
HttpSession s = request.getSession();
String dbsx_unitId= (String) s.getAttribute("dbsx_unitId");
String dbsx_unitName= (String) s.getAttribute("dbsx_unitName");
String dbsx_allPath= (String) s.getAttribute("dbsx_allPath");
boolean useDb=false;
if(Util.n(assetsPurchaseQuery.getUnitid())&&!Util.n(dbsx_allPath)){
useDb=true;
s.removeAttribute("dbsx_unitId");
s.removeAttribute("dbsx_unitName");
s.removeAttribute("dbsx_allPath");
}
assetsPurchaseQuery.setNeedFindZu(Constant.YES);
CommonTreeDto commonTreeDto = assetsPurchaseQuery.getCommonTreeDto();
if(commonTreeDto==null){
commonTreeDto=new CommonTreeDto();
Dept dept = user.getDept();
Unit areaId = dept.getAreaId();
commonTreeDto.setUnitId(areaId.getId());
commonTreeDto.setAllpath(areaId.getAllPath());
commonTreeDto.setLevel(areaId.getLevel()+"");
commonTreeDto.setType("dq");
commonTreeDto.setName(areaId.getAreaName());
}
commonTreeDto.setDataDeptId("");
commonTreeDto.setUser(user);
assetsPurchaseQuery.setCommonTreeDto(commonTreeDto);
String unitList = commonTreeService.buildCurrentUserTree(request,null);
formatParam(assetsPurchaseQuery);
modelMap.addAttribute("unitList", unitList);
if(useDb){
assetsPurchaseQuery.setAllpathList(Arrays.asList(dbsx_allPath));
assetsPurchaseQuery.setUnitName(dbsx_unitName);
assetsPurchaseQuery.setUnitid(dbsx_unitId);
}
modelMap.addAttribute("pc", assetsPurchaseService.findCheck(assetsPurchaseQuery));
modelMap.addAttribute("query", assetsPurchaseQuery);
modelMap.addAttribute("user", user);
return "sanzgl/zichanggl/zcgz/find_check";
}
,其中,
接口上增加 HttpServletRequest request,方法内通过以下获取选中的内容:
String [] strs=request.getParameterValues();
不应该是发前端页面?
此为前端页面
<!--留白div,不能用margin padding控制!-->
<div style="height: 14px"></div>
<!--数据展示区域外框,用于周边留空padding不可删除-->
<div class="pd-zy20">
<div class="btn-bt">
<a href="#" onclick="auditAll('','')">批量审核</a>
</div>
<!--查询 按钮容器!-->
<div class="cx-bt">
<!--查询div!-->
<div class="search">
<span id="search"><i class="fa fa-search pd-r08"></i>查 询<i class="fa fa-angle-double-down pd-l08"></i></span>
<!--查询条件隐藏!-->
<div class="search-hide">
<form id="Frm" style="font-size: 12px;" action="assetsPurchase.do?method=findCheck" method="post">
<input type="hidden" id="page" name="page" value=""/>
<input type="hidden" id="pagesize" name="pageSize" value="">
<ul>
<li><p>地区组织</p> <input type="text" name="unitName" id="zylbName1" readonly onclick="showZylb1()"
value="${query.commonTreeDto.name}" style="width: 188px">
<input type="hidden" id="zylbId1" name="unitId" value="${query.unitId}">
<input type="hidden" id="setUnitId" name="commonTreeDto.unitId" value="${query.commonTreeDto.unitId}">
<input type="hidden" id="setAllpath" name="commonTreeDto.allpath" value="${query.commonTreeDto.allpath}">
<input type="hidden" id="setLevel" name="commonTreeDto.level" value="${query.commonTreeDto.level}">
<input type="hidden" id="setType" name="commonTreeDto.type" value="${query.commonTreeDto.type}">
<input type="hidden" id="setName" name="commonTreeDto.name" value="${query.commonTreeDto.name}">
<div id="zylbContent1" class="zylbContent" style="display: none; z-index: 9999; position: absolute; background: #FFF">
<ul id="treeZylb1" class="ztree" style="margin-top: 0; width: 270px; height: 330px; overflow: auto;">
</ul>
</div>
</li>
<li><p>申请日期</p> <input id="dp1" type="text" name="startTime" style="width: 83px;"
onclick="WdatePicker({maxDate:'#F{$dp.$D(\'dp2\');}'})" value="${query.startTime }"
readonly="readonly"> ~ <input id="dp2" type="text" name="endTime" style="width: 83px;"
onclick="WdatePicker({minDate:'#F{$dp.$D(\'dp1\');}'})"
value="${query.endTime }" readonly="readonly"></li>
<li><p>状态</p> <select id="statusOrType" name="statusOrType" style="width: 194px">
<option value="">全部</option>
<option value="12" <c:if test="${query.statusOrType eq 12 }">selected</c:if>>审核通过</option>
<option value="13" <c:if test="${query.statusOrType eq 13 }">selected</c:if>>审核拒绝</option>
<!-- <option value="21" <c:if test="${query.statusOrType eq 21 }">selected</c:if>>镇级农经部门备案</option>
<option value="22" <c:if test="${query.statusOrType eq 22}">selected</c:if>>村党组织(或村委会)会议提议</option>
<option value="23" <c:if test="${query.statusOrType eq 23 }">selected</c:if>>村两委会商议</option>
<option value="24" <c:if test="${query.statusOrType eq 24 }">selected</c:if>>村党员大会审议</option>
<option value="25" <c:if test="${query.statusOrType eq 25 }">selected</c:if>>村民代表大会</option> -->
<option value="26" <c:if test="${query.statusOrType eq 26 }">selected</c:if>>待审核</option>
</select></li>
<li style="text-align: center">
<a href="#" onclick="PageControl('1')" class="dailog-bt">查 询</a>
<a href="#" id="close-s" class="dailog-bt">关 闭</a>
</li>
</ul>
</ul>
</form>
</div>
</div>
</div>
<div class="data_rq">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="ss_table" style="margin-top: 8px;">
<tr>
<th width="50">序号</th>
<th width="150">申请单编号</th>
<th width="100">所属地区</th>
<th width="150" style="text-align: left">所属组织</th>
<th width="150" style="text-align: left">资产名称</th>
<th width="80" style="text-align: right">总金额(元)</th>
<th width="120">申请时间</th>
<th width="80">状态</th>
<th width="90">操作</th>
</tr>
<c:forEach var="item" items="${pc.list }" varStatus="index">
<tr <c:if test="${index.index%2==1 }">class="ol"</c:if>>
<td>${index.count + (pc.cpage - 1) * pc.pagesize }</td>
<td>
<c:if test="${item.type eq 1}"><a href="#" onclick="applyCheck('${item.apaId }')"><font
color="#0098ff"> ${item.apaCode }</font></a></c:if>
<c:if test="${item.type ne 1}"><a href="#" onclick="showDetail('${item.apaId }')"><font
color="#0098ff"> ${item.apaCode }</font></a></c:if>
<%-- <font color="#0000EE"><a href="#" title="点击查看详情" onclick="showDetail('${item.apaId }')">${item[1] }</a></font> --%>
</td>
<td><c:set var="userLevel" value="${user.dept.areaId.level}"/>
<c:set var="dataLevel" value="${item.dept.areaId.level}"/>
<c:if test="${userLevel=='5'}">
<c:set var="dataUnitName" value="${user.dept.areaId.areaName}"></c:set>
</c:if><c:if test="${userLevel==dataLevel}">
<c:set var="dataUnitName" value="${user.dept.areaId.areaName}"></c:set>
</c:if>
<c:set var="dataLevel" value="${dataLevel-1}"/>
<c:set var="dataLevel" value="${dataLevel<0?userLevel:dataLevel}"/>
<c:forEach begin="${ userLevel}" end="${ dataLevel}" step="1" var="jb">
<c:choose>
<c:when test="${jb==userLevel}">
<c:set var="dataUnit" value="${item.dept.areaId}"></c:set>
<c:set var="dataUnitName" value="${dataUnit.areaName}"></c:set>
</c:when>
<c:otherwise>
<c:set var="dataUnit" value="${dataUnit.parentId}"></c:set>
<c:set var="dataUnitName" value="${dataUnit.areaName}/${dataUnitName}"></c:set>
</c:otherwise>
</c:choose>
</c:forEach>
${dataUnitName}
</td>
<td style="text-align: left">${item.dept.deptName }</td>
<td style="text-align: left">${item.apName }</td>
<td style="text-align: right"><span class="format"><fmt:formatNumber value="${item.totalMoney }" pattern="0.00"/></span></td>
<td><fmt:formatDate value="${item.time }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
<td>
<c:if test="${item.status eq -1}"><span class="table_ts_boll_red"></span><span>已撤销</span> </c:if>
<c:if test="${item.status eq 0}"><span class="table_ts_boll_orange"></span><span>未提交</span></c:if>
<c:if test="${item.status eq 1}">
<!-- <c:if test="${item.type eq 1}">镇级农经部门备案</c:if>
<c:if test="${item.type eq 2}"><span class="table_ts_boll_blue"></span><span>村党组织(或村委会)会议提议</span></c:if>
<c:if test="${item.type eq 3}"><span class="table_ts_boll_blue"></span>村两委会商议</c:if>
<c:if test="${item.type eq 4}"><span class="table_ts_boll_blue"></span>村党员大会审议</c:if>
<c:if test="${item.type eq 5}"><span class="table_ts_boll_blue"></span>村民代表大会决议核</c:if> -->
<c:if test="${item.type eq 6}"><span class="table_ts_boll_blue"></span><span>镇级审核</span></c:if>
</c:if>
<c:if test="${item.status eq 2}"><span class="table_ts_boll_success"></span><span>审核通过</span></c:if>
<c:if test="${item.status eq 3}"><span class="table_ts_boll_red"></span><span>审核拒绝</span></c:if>
</td>
<td class="cz-a">
<c:if test="${item.status eq 1}"><a href="#" onclick="applyCheck('${item.apaId }')">审核</a></c:if>
<c:if test="${item.status ne 1}"><a href="#" onclick="showDetail('${item.apaId }')">查看详情</a></c:if>
</td>
</tr>
</c:forEach>
</table>
</div>
</div>