记录如何新增企业列表页面

上一篇 / 下一篇  2020-03-25 15:47:28

1:在controller类中增加前端映射代码,如下
@AUTH("2020")
@RequestMapping("/reviewlist")
public String reviewlist(Model model) {
return "/company/reviewlist";
}

@RequestMapping("/review/jsonlist1")
public @ResponseBody Pager<CompanyModel> getreviewList1(Pager<CompanyModel> pager, CompanyModel item){
if (pager == null)
pager = new Pager<CompanyModel>();
try {
this.companyService.reviewlist1(pager);
} catch (Exception e) {
log.error(e);
}
return pager;

2:在service类中增加接口,如下
void reviewlist1(Pager<CompanyModel> pager);
3:在service实现类中实现service接口,如下
@Override
public void reviewlist1(Pager<CompanyModel> pager) {
StringBuffer jpql=new StringBuffer();
jpql.append("select cm from CompanyModel cm where cm.status=2");
List<CompanyModel> list = companydao.find(jpql.toString(), pager.getPage(), pager.getPagerow());
for (CompanyModel companyModel : list) {
if(companyModel.getRegion()!=null){
SysRegion regionModel = (SysRegion)regionDao.findOne("from SysRegion sr where sr.id=?1",companyModel.getRegion());
companyModel.setRegionName(regionModel.getFullName()+companyModel.getAddress());
}
}
pager.setRows(list);
pager.setTotalrows(this.companydao.count("cm.id",jpql.toString()));
}
4:增加企业列表页面的jsp页面
<%-- @author Tairong --%>
<%
response.setHeader("Cache-Control", "no-store");
response.setHeader("Pragma", "no-cache");
response.setDateHeader("Expires", 0);
%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ include file="/includes/taglibs.jsp"%>
<style>
.modal-dialog{
width:1020px;
}
</style>
<head>
<title>企业列表</title>
<page_tips>可以对企业进行查看及关闭操作。</page_tips>
<page_nav>
<li>企业管理</li>
</page_nav>
</head>
<div id="gp-filter">
<input type="hidden" name="years" id="years" />
<input type="hidden" name="status" id="status" />
<input type="hidden" name="serviceId" id="serviceId" />
<input type="hidden" name="sRegionId" id="sRegionId">
<input type="hidden" name="plotName" id="plotName" />
<input type="hidden" name="IdCord" id="IdCord" />
<input type="hidden" name="certificationNo" id="certificationNo" />
</div>
<div id="dynamic-table_wrapper"
class="dataTables_wrapper form-inline no-footer">
<div class="row">
<div class="col-xs-11">
<!--<div id="dynamic-table_filter" class="dataTables_filter"> -->
<!--<button class="btn btn-sm" nclick="search();">查询</button> -->
<!--</div> -->
</div>
</div>
<table id="gp-table">

</table>
<div class="row" id="gp-pager"></div>
</div>
<script. src="<c:url value="/scripts/"/>nestsoft/gptable2.js"></script>

<script. type="text/javascript">
$().ready(function() {
var table1 = $("#gp-table").gptable({
url : "${ctx}/company/review/jsonlist1",
pager : "gp-pager",
filter : "gp-filter",
pageRows : 10,
rowName : "企业",
cols : [{
property : 'name',  
sorting : false,
title : '企业名称',
width : '20%'
}, {
property : 'types',  
sorting : false,
title : '企业类型',
width : '8%',
align :"center",
options:{"1":"供应方","2":"需求方"}
}, {
property : 'idType',  
sorting : false,
title : '证件类型',
width : '8%',
//align :"center",
options:{"1":"营业执照","2":"身份证"}
}, {
property : 'regionName',  
sorting : false,
title : '地址',
width : '15%',
//align :"center"
},{
property : 'contact',  
sorting : false,
title : '联系人',
width : '8%',
},{
property : 'tel',  
sorting : false,
title : '联系电话',
width : '10%',
align :"center"
},{
property : 'idNo',
sorting : false,
title : '证件号',
width : '15%',
//align :"center"
}],
rowBtn:{
align: "right",
width : '2%',
title: "操作",
btns: [
{type:'show', clazz:'bigger-130', title:'查看', handle:"javascript.:show(#id)" },
//{type:'pass', clazz:'bigger-130', title:'审核通过', handle:"javascript.:pass(#id)"},
//{type:'delete', clazz:'bigger-130', title:'审核拒绝', handle:"javascript.:refuse(#id)"},
]
}
});
});
</script>


<script. type="text/javascript">
function show(id){
MD.show('企业详情', '${ctx}/company/review/show/' + id,450,990);
}
function refuse(id){
MD.show('审核拒绝', '${ctx}/company/review/showRefuse/' + id,200);
}
function pass(id){
   bootbox.confirm("确定要审核通过吗?", function(result) {  
        if (result) {  
       jQuery.ajax({
type: "get",
            dataType: "json",
            async:false, 
            url: "${ctx}/company/review/pass/"+id,
            success: function(result){
     if(result.code == 200){
           $("#gp-table").trigger("refresh");//刷新列表
     MSG.success(result.message);
     }else{
     MSG.error(result.message);
     }
           
            },
//            error: function(XMLHttpRequest, textStatus, errorThrown){
//           $("#gp-table").trigger("refresh");//刷新列表
//            }
});
        }  
    });  
}
function initRegion(){
$("#serviceregion").serviceregion({
selection:regionjson,
url:"${ctx}/loadregion",
initValue:regionId
});
}
function refresh() {
$("#gp-table").trigger("refresh");
}
</script>


TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2020-04-05  
   1234
567891011
12131415161718
19202122232425
2627282930  

我的存档

数据统计

  • 访问量: 173
  • 日志数: 1
  • 建立时间: 2020-03-19
  • 更新时间: 2020-03-25

RSS订阅

Open Toolbar