Commit 1d841c31df728bd60245cc4d2c8e3b0859317917
1 parent
b980d59d
添加对试卷类型管理
Showing
6 changed files
with
924 additions
and
0 deletions
WebRoot/WEB-INF/jsp/sunvote/papertype/papertype_edit.jsp
0 → 100644
1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> | ||
2 | +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> | ||
3 | +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> | ||
4 | +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> | ||
5 | +<% | ||
6 | + String path = request.getContextPath(); | ||
7 | + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; | ||
8 | +%> | ||
9 | +<!DOCTYPE html> | ||
10 | +<html lang="en"> | ||
11 | + <head> | ||
12 | + <base href="<%=basePath%>"> | ||
13 | + <!-- 下拉框 --> | ||
14 | + <link rel="stylesheet" href="static/ace/css/chosen.css" /> | ||
15 | + <!-- jsp文件头和头部 --> | ||
16 | + <%@ include file="../../system/index/top.jsp"%> | ||
17 | + <!-- 日期框 --> | ||
18 | + <link rel="stylesheet" href="static/ace/css/datepicker.css" /> | ||
19 | +</head> | ||
20 | +<body class="no-skin"> | ||
21 | +<!-- /section:basics/navbar.layout --> | ||
22 | +<div class="main-container" id="main-container"> | ||
23 | + <!-- /section:basics/sidebar --> | ||
24 | + <div class="main-content"> | ||
25 | + <div class="main-content-inner"> | ||
26 | + <div class="page-content"> | ||
27 | + <div class="row"> | ||
28 | + <div class="col-xs-12"> | ||
29 | + | ||
30 | + <form action="papertype/${msg }.do" name="Form" id="Form" method="post"> | ||
31 | + <input type="hidden" name="PAPERTYPE_ID" id="PAPERTYPE_ID" value="${pd.PAPERTYPE_ID}"/> | ||
32 | + <div id="zhongxin" style="padding-top: 13px;"> | ||
33 | + <table id="table_report" class="table table-striped table-bordered table-hover"> | ||
34 | + <tr> | ||
35 | + <td style="width:75px;text-align: right;padding-top: 13px;">名称:</td> | ||
36 | + <td><input type="text" name="NAME" id="NAME" value="${pd.NAME}" maxlength="255" placeholder="这里输入名称" title="名称" style="width:98%;"/></td> | ||
37 | + </tr> | ||
38 | + <tr> | ||
39 | + <td style="width:75px;text-align: right;padding-top: 13px;">备注:</td> | ||
40 | + <td><input type="text" name="REMARK" id="REMARK" value="${pd.REMARK}" maxlength="255" placeholder="这里输入备注" title="备注" style="width:98%;"/></td> | ||
41 | + </tr> | ||
42 | + <tr> | ||
43 | + <td style="text-align: center;" colspan="10"> | ||
44 | + <a class="btn btn-mini btn-primary" onclick="save();">保存</a> | ||
45 | + <a class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a> | ||
46 | + </td> | ||
47 | + </tr> | ||
48 | + </table> | ||
49 | + </div> | ||
50 | + <div id="zhongxin2" class="center" style="display:none"><br/><br/><br/><br/><br/><img src="static/images/jiazai.gif" /><br/><h4 class="lighter block green">提交中...</h4></div> | ||
51 | + </form> | ||
52 | + </div> | ||
53 | + <!-- /.col --> | ||
54 | + </div> | ||
55 | + <!-- /.row --> | ||
56 | + </div> | ||
57 | + <!-- /.page-content --> | ||
58 | + </div> | ||
59 | + </div> | ||
60 | + <!-- /.main-content --> | ||
61 | +</div> | ||
62 | +<!-- /.main-container --> | ||
63 | + | ||
64 | + | ||
65 | + <!-- 页面底部js¨ --> | ||
66 | + <%@ include file="../../system/index/foot.jsp"%> | ||
67 | + <!-- 下拉框 --> | ||
68 | + <script src="static/ace/js/chosen.jquery.js"></script> | ||
69 | + <!-- 日期框 --> | ||
70 | + <script src="static/ace/js/date-time/bootstrap-datepicker.js"></script> | ||
71 | + <!--提示框--> | ||
72 | + <script type="text/javascript" src="static/js/jquery.tips.js"></script> | ||
73 | + <script type="text/javascript"> | ||
74 | + $(top.hangge()); | ||
75 | + //保存 | ||
76 | + function save(){ | ||
77 | + if($("#NAME").val()==""){ | ||
78 | + $("#NAME").tips({ | ||
79 | + side:3, | ||
80 | + msg:'请输入名称', | ||
81 | + bg:'#AE81FF', | ||
82 | + time:2 | ||
83 | + }); | ||
84 | + $("#NAME").focus(); | ||
85 | + return false; | ||
86 | + } | ||
87 | + if($("#REMARK").val()==""){ | ||
88 | + $("#REMARK").tips({ | ||
89 | + side:3, | ||
90 | + msg:'请输入备注', | ||
91 | + bg:'#AE81FF', | ||
92 | + time:2 | ||
93 | + }); | ||
94 | + $("#REMARK").focus(); | ||
95 | + return false; | ||
96 | + } | ||
97 | + $("#Form").submit(); | ||
98 | + $("#zhongxin").hide(); | ||
99 | + $("#zhongxin2").show(); | ||
100 | + } | ||
101 | + | ||
102 | + $(function() { | ||
103 | + //日期框 | ||
104 | + $('.date-picker').datepicker({autoclose: true,todayHighlight: true}); | ||
105 | + }); | ||
106 | + </script> | ||
107 | +</body> | ||
108 | +</html> | ||
0 | \ No newline at end of file | 109 | \ No newline at end of file |
WebRoot/WEB-INF/jsp/sunvote/papertype/papertype_list.jsp
0 → 100644
1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> | ||
2 | +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> | ||
3 | +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> | ||
4 | +<% | ||
5 | + String path = request.getContextPath(); | ||
6 | + String basePath = request.getScheme() + "://" | ||
7 | + + request.getServerName() + ":" + request.getServerPort() | ||
8 | + + path + "/"; | ||
9 | +%> | ||
10 | +<!DOCTYPE html> | ||
11 | +<html lang="en"> | ||
12 | +<head> | ||
13 | +<base href="<%=basePath%>"> | ||
14 | +<!-- 下拉框 --> | ||
15 | +<link rel="stylesheet" href="static/ace/css/chosen.css" /> | ||
16 | +<!-- jsp文件头和头部 --> | ||
17 | +<%@ include file="../../system/index/top.jsp"%> | ||
18 | +<!-- 日期框 --> | ||
19 | +<link rel="stylesheet" href="static/ace/css/datepicker.css" /> | ||
20 | +</head> | ||
21 | +<body class="no-skin"> | ||
22 | + | ||
23 | + <!-- /section:basics/navbar.layout --> | ||
24 | + <div class="main-container" id="main-container"> | ||
25 | + <!-- /section:basics/sidebar --> | ||
26 | + <div class="main-content"> | ||
27 | + <div class="main-content-inner"> | ||
28 | + <div class="page-content"> | ||
29 | + <div class="row"> | ||
30 | + <div class="col-xs-12"> | ||
31 | + | ||
32 | + <!-- 检索 --> | ||
33 | + <form action="papertype/list.do" method="post" name="Form" id="Form"> | ||
34 | + <table style="margin-top:5px;"> | ||
35 | + <tr> | ||
36 | + <td> | ||
37 | + <div class="nav-search"> | ||
38 | + <span class="input-icon"> | ||
39 | + <input type="text" placeholder="这里输入关键词" class="nav-search-input" id="nav-search-input" autocomplete="off" name="keywords" value="${pd.keywords }" placeholder="这里输入关键词"/> | ||
40 | + <i class="ace-icon fa fa-search nav-search-icon"></i> | ||
41 | + </span> | ||
42 | + </div> | ||
43 | + </td> | ||
44 | + <td style="padding-left:2px;"><input class="span10 date-picker" name="lastStart" id="lastStart" value="" type="text" data-date-format="yyyy-mm-dd" readonly="readonly" style="width:88px;" placeholder="开始日期" title="开始日期"/></td> | ||
45 | + <td style="padding-left:2px;"><input class="span10 date-picker" name="lastEnd" name="lastEnd" value="" type="text" data-date-format="yyyy-mm-dd" readonly="readonly" style="width:88px;" placeholder="结束日期" title="结束日期"/></td> | ||
46 | + <td style="vertical-align:top;padding-left:2px;"> | ||
47 | + <select class="chosen-select form-control" name="name" id="id" data-placeholder="请选择" style="vertical-align:top;width: 120px;"> | ||
48 | + <option value=""></option> | ||
49 | + <option value="">全部</option> | ||
50 | + <option value="">1</option> | ||
51 | + <option value="">2</option> | ||
52 | + </select> | ||
53 | + </td> | ||
54 | + <c:if test="${QX.cha == 1 }"> | ||
55 | + <td style="vertical-align:top;padding-left:2px"><a class="btn btn-light btn-xs" onclick="tosearch();" title="检索"><i id="nav-search-icon" class="ace-icon fa fa-search bigger-110 nav-search-icon blue"></i></a></td> | ||
56 | + </c:if> | ||
57 | + <c:if test="${QX.toExcel == 1 }"><td style="vertical-align:top;padding-left:2px;"><a class="btn btn-light btn-xs" onclick="toExcel();" title="导出到EXCEL"><i id="nav-search-icon" class="ace-icon fa fa-download bigger-110 nav-search-icon blue"></i></a></td></c:if> | ||
58 | + </tr> | ||
59 | + </table> | ||
60 | + <!-- 检索 --> | ||
61 | + | ||
62 | + <table id="simple-table" class="table table-striped table-bordered table-hover" style="margin-top:5px;"> | ||
63 | + <thead> | ||
64 | + <tr> | ||
65 | + <th class="center" style="width:35px;"> | ||
66 | + <label class="pos-rel"><input type="checkbox" class="ace" id="zcheckbox" /><span class="lbl"></span></label> | ||
67 | + </th> | ||
68 | + <th class="center" style="width:50px;">序号</th> | ||
69 | + <th class="center">名称</th> | ||
70 | + <th class="center">备注</th> | ||
71 | + <th class="center">操作</th> | ||
72 | + </tr> | ||
73 | + </thead> | ||
74 | + | ||
75 | + <tbody> | ||
76 | + <!-- 开始循环 --> | ||
77 | + <c:choose> | ||
78 | + <c:when test="${not empty varList}"> | ||
79 | + <c:if test="${QX.cha == 1 }"> | ||
80 | + <c:forEach items="${varList}" var="var" varStatus="vs"> | ||
81 | + <tr> | ||
82 | + <td class='center'> | ||
83 | + <label class="pos-rel"><input type='checkbox' name='ids' value="${var.PAPERTYPE_ID}" class="ace" /><span class="lbl"></span></label> | ||
84 | + </td> | ||
85 | + <td class='center' style="width: 30px;">${vs.index+1}</td> | ||
86 | + <td class='center'>${var.NAME}</td> | ||
87 | + <td class='center'>${var.REMARK}</td> | ||
88 | + <td class="center"> | ||
89 | + <c:if test="${QX.edit != 1 && QX.del != 1 }"> | ||
90 | + <span class="label label-large label-grey arrowed-in-right arrowed-in"><i class="ace-icon fa fa-lock" title="无权限"></i></span> | ||
91 | + </c:if> | ||
92 | + <div class="hidden-sm hidden-xs btn-group"> | ||
93 | + <c:if test="${QX.edit == 1 }"> | ||
94 | + <a class="btn btn-xs btn-success" title="编辑" onclick="edit('${var.PAPERTYPE_ID}');"> | ||
95 | + <i class="ace-icon fa fa-pencil-square-o bigger-120" title="编辑"></i> | ||
96 | + </a> | ||
97 | + </c:if> | ||
98 | + <c:if test="${QX.del == 1 }"> | ||
99 | + <a class="btn btn-xs btn-danger" onclick="del('${var.PAPERTYPE_ID}');"> | ||
100 | + <i class="ace-icon fa fa-trash-o bigger-120" title="删除"></i> | ||
101 | + </a> | ||
102 | + </c:if> | ||
103 | + </div> | ||
104 | + <div class="hidden-md hidden-lg"> | ||
105 | + <div class="inline pos-rel"> | ||
106 | + <button class="btn btn-minier btn-primary dropdown-toggle" data-toggle="dropdown" data-position="auto"> | ||
107 | + <i class="ace-icon fa fa-cog icon-only bigger-110"></i> | ||
108 | + </button> | ||
109 | + | ||
110 | + <ul class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close"> | ||
111 | + <c:if test="${QX.edit == 1 }"> | ||
112 | + <li> | ||
113 | + <a style="cursor:pointer;" onclick="edit('${var.PAPERTYPE_ID}');" class="tooltip-success" data-rel="tooltip" title="修改"> | ||
114 | + <span class="green"> | ||
115 | + <i class="ace-icon fa fa-pencil-square-o bigger-120"></i> | ||
116 | + </span> | ||
117 | + </a> | ||
118 | + </li> | ||
119 | + </c:if> | ||
120 | + <c:if test="${QX.del == 1 }"> | ||
121 | + <li> | ||
122 | + <a style="cursor:pointer;" onclick="del('${var.PAPERTYPE_ID}');" class="tooltip-error" data-rel="tooltip" title="删除"> | ||
123 | + <span class="red"> | ||
124 | + <i class="ace-icon fa fa-trash-o bigger-120"></i> | ||
125 | + </span> | ||
126 | + </a> | ||
127 | + </li> | ||
128 | + </c:if> | ||
129 | + </ul> | ||
130 | + </div> | ||
131 | + </div> | ||
132 | + </td> | ||
133 | + </tr> | ||
134 | + | ||
135 | + </c:forEach> | ||
136 | + </c:if> | ||
137 | + <c:if test="${QX.cha == 0 }"> | ||
138 | + <tr> | ||
139 | + <td colspan="100" class="center">您无权查看</td> | ||
140 | + </tr> | ||
141 | + </c:if> | ||
142 | + </c:when> | ||
143 | + <c:otherwise> | ||
144 | + <tr class="main_info"> | ||
145 | + <td colspan="100" class="center" >没有相关数据</td> | ||
146 | + </tr> | ||
147 | + </c:otherwise> | ||
148 | + </c:choose> | ||
149 | + </tbody> | ||
150 | + </table> | ||
151 | + <div class="page-header position-relative"> | ||
152 | + <table style="width:100%;"> | ||
153 | + <tr> | ||
154 | + <td style="vertical-align:top;"> | ||
155 | + <c:if test="${QX.add == 1 }"> | ||
156 | + <a class="btn btn-mini btn-success" onclick="add();">新增</a> | ||
157 | + </c:if> | ||
158 | + <c:if test="${QX.del == 1 }"> | ||
159 | + <a class="btn btn-mini btn-danger" onclick="makeAll('确定要删除选中的数据吗?');" title="批量删除" ><i class='ace-icon fa fa-trash-o bigger-120'></i></a> | ||
160 | + </c:if> | ||
161 | + </td> | ||
162 | + <td style="vertical-align:top;"><div class="pagination" style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div></td> | ||
163 | + </tr> | ||
164 | + </table> | ||
165 | + </div> | ||
166 | + </form> | ||
167 | + | ||
168 | + </div> | ||
169 | + <!-- /.col --> | ||
170 | + </div> | ||
171 | + <!-- /.row --> | ||
172 | + </div> | ||
173 | + <!-- /.page-content --> | ||
174 | + </div> | ||
175 | + </div> | ||
176 | + <!-- /.main-content --> | ||
177 | + | ||
178 | + <!-- 返回顶部 --> | ||
179 | + <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse"> | ||
180 | + <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i> | ||
181 | + </a> | ||
182 | + | ||
183 | + </div> | ||
184 | + <!-- /.main-container --> | ||
185 | + | ||
186 | + <!-- basic scripts --> | ||
187 | + <!-- 页面底部js¨ --> | ||
188 | + <%@ include file="../../system/index/foot.jsp"%> | ||
189 | + <!-- 删除时确认窗口 --> | ||
190 | + <script src="static/ace/js/bootbox.js"></script> | ||
191 | + <!-- ace scripts --> | ||
192 | + <script src="static/ace/js/ace/ace.js"></script> | ||
193 | + <!-- 下拉框 --> | ||
194 | + <script src="static/ace/js/chosen.jquery.js"></script> | ||
195 | + <!-- 日期框 --> | ||
196 | + <script src="static/ace/js/date-time/bootstrap-datepicker.js"></script> | ||
197 | + <!--提示框--> | ||
198 | + <script type="text/javascript" src="static/js/jquery.tips.js"></script> | ||
199 | + <script type="text/javascript"> | ||
200 | + $(top.hangge());//关闭加载状态 | ||
201 | + //检索 | ||
202 | + function tosearch(){ | ||
203 | + top.jzts(); | ||
204 | + $("#Form").submit(); | ||
205 | + } | ||
206 | + $(function() { | ||
207 | + | ||
208 | + //日期框 | ||
209 | + $('.date-picker').datepicker({ | ||
210 | + autoclose: true, | ||
211 | + todayHighlight: true | ||
212 | + }); | ||
213 | + | ||
214 | + //下拉框 | ||
215 | + if(!ace.vars['touch']) { | ||
216 | + $('.chosen-select').chosen({allow_single_deselect:true}); | ||
217 | + $(window) | ||
218 | + .off('resize.chosen') | ||
219 | + .on('resize.chosen', function() { | ||
220 | + $('.chosen-select').each(function() { | ||
221 | + var $this = $(this); | ||
222 | + $this.next().css({'width': $this.parent().width()}); | ||
223 | + }); | ||
224 | + }).trigger('resize.chosen'); | ||
225 | + $(document).on('settings.ace.chosen', function(e, event_name, event_val) { | ||
226 | + if(event_name != 'sidebar_collapsed') return; | ||
227 | + $('.chosen-select').each(function() { | ||
228 | + var $this = $(this); | ||
229 | + $this.next().css({'width': $this.parent().width()}); | ||
230 | + }); | ||
231 | + }); | ||
232 | + $('#chosen-multiple-style .btn').on('click', function(e){ | ||
233 | + var target = $(this).find('input[type=radio]'); | ||
234 | + var which = parseInt(target.val()); | ||
235 | + if(which == 2) $('#form-field-select-4').addClass('tag-input-style'); | ||
236 | + else $('#form-field-select-4').removeClass('tag-input-style'); | ||
237 | + }); | ||
238 | + } | ||
239 | + | ||
240 | + | ||
241 | + //复选框全选控制 | ||
242 | + var active_class = 'active'; | ||
243 | + $('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function(){ | ||
244 | + var th_checked = this.checked;//checkbox inside "TH" table header | ||
245 | + $(this).closest('table').find('tbody > tr').each(function(){ | ||
246 | + var row = this; | ||
247 | + if(th_checked) $(row).addClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', true); | ||
248 | + else $(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', false); | ||
249 | + }); | ||
250 | + }); | ||
251 | + }); | ||
252 | + | ||
253 | + //新增 | ||
254 | + function add(){ | ||
255 | + top.jzts(); | ||
256 | + var diag = new top.Dialog(); | ||
257 | + diag.Drag=true; | ||
258 | + diag.Title ="新增"; | ||
259 | + diag.URL = '<%=basePath%>papertype/goAdd.do'; | ||
260 | + diag.Width = 450; | ||
261 | + diag.Height = 355; | ||
262 | + diag.Modal = true; //有无遮罩窗口 | ||
263 | + diag. ShowMaxButton = true; //最大化按钮 | ||
264 | + diag.ShowMinButton = true; //最小化按钮 | ||
265 | + diag.CancelEvent = function(){ //关闭事件 | ||
266 | + if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){ | ||
267 | + if('${page.currentPage}' == '0'){ | ||
268 | + tosearch(); | ||
269 | + }else{ | ||
270 | + tosearch(); | ||
271 | + } | ||
272 | + } | ||
273 | + diag.close(); | ||
274 | + }; | ||
275 | + diag.show(); | ||
276 | + } | ||
277 | + | ||
278 | + //删除 | ||
279 | + function del(Id){ | ||
280 | + bootbox.confirm("确定要删除吗?", function(result) { | ||
281 | + if(result) { | ||
282 | + top.jzts(); | ||
283 | + var url = "<%=basePath%>papertype/delete.do?PAPERTYPE_ID="+Id+"&tm="+new Date().getTime(); | ||
284 | + $.get(url,function(data){ | ||
285 | + tosearch(); | ||
286 | + }); | ||
287 | + } | ||
288 | + }); | ||
289 | + } | ||
290 | + | ||
291 | + //修改 | ||
292 | + function edit(Id){ | ||
293 | + top.jzts(); | ||
294 | + var diag = new top.Dialog(); | ||
295 | + diag.Drag=true; | ||
296 | + diag.Title ="编辑"; | ||
297 | + diag.URL = '<%=basePath%>papertype/goEdit.do?PAPERTYPE_ID='+Id; | ||
298 | + diag.Width = 450; | ||
299 | + diag.Height = 355; | ||
300 | + diag.Modal = true; //有无遮罩窗口 | ||
301 | + diag. ShowMaxButton = true; //最大化按钮 | ||
302 | + diag.ShowMinButton = true; //最小化按钮 | ||
303 | + diag.CancelEvent = function(){ //关闭事件 | ||
304 | + if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){ | ||
305 | + tosearch(); | ||
306 | + } | ||
307 | + diag.close(); | ||
308 | + }; | ||
309 | + diag.show(); | ||
310 | + } | ||
311 | + | ||
312 | + //批量操作 | ||
313 | + function makeAll(msg){ | ||
314 | + bootbox.confirm(msg, function(result) { | ||
315 | + if(result) { | ||
316 | + var str = ''; | ||
317 | + for(var i=0;i < document.getElementsByName('ids').length;i++){ | ||
318 | + if(document.getElementsByName('ids')[i].checked){ | ||
319 | + if(str=='') str += document.getElementsByName('ids')[i].value; | ||
320 | + else str += ',' + document.getElementsByName('ids')[i].value; | ||
321 | + } | ||
322 | + } | ||
323 | + if(str==''){ | ||
324 | + bootbox.dialog({ | ||
325 | + message: "<span class='bigger-110'>您没有选择任何内容!</span>", | ||
326 | + buttons: | ||
327 | + { "button":{ "label":"确定", "className":"btn-sm btn-success"}} | ||
328 | + }); | ||
329 | + $("#zcheckbox").tips({ | ||
330 | + side:1, | ||
331 | + msg:'点这里全选', | ||
332 | + bg:'#AE81FF', | ||
333 | + time:8 | ||
334 | + }); | ||
335 | + return; | ||
336 | + }else{ | ||
337 | + if(msg == '确定要删除选中的数据吗?'){ | ||
338 | + top.jzts(); | ||
339 | + $.ajax({ | ||
340 | + type: "POST", | ||
341 | + url: '<%=basePath%>papertype/deleteAll.do?tm='+new Date().getTime(), | ||
342 | + data: {DATA_IDS:str}, | ||
343 | + dataType:'json', | ||
344 | + //beforeSend: validateData, | ||
345 | + cache: false, | ||
346 | + success: function(data){ | ||
347 | + $.each(data.list, function(i, list){ | ||
348 | + tosearch(); | ||
349 | + }); | ||
350 | + } | ||
351 | + }); | ||
352 | + } | ||
353 | + } | ||
354 | + } | ||
355 | + }); | ||
356 | + }; | ||
357 | + | ||
358 | + //导出excel | ||
359 | + function toExcel(){ | ||
360 | + window.location.href='<%=basePath%>papertype/excel.do'; | ||
361 | + } | ||
362 | + </script> | ||
363 | + | ||
364 | + | ||
365 | +</body> | ||
366 | +</html> | ||
0 | \ No newline at end of file | 367 | \ No newline at end of file |
resources/mybatis1/sunvote/PaperTypeMapper.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="PaperTypeMapper"> | ||
4 | + | ||
5 | + <!--表名 --> | ||
6 | + <sql id="tableName"> | ||
7 | + SV_PAPERTYPE | ||
8 | + </sql> | ||
9 | + | ||
10 | + <!-- 字段 --> | ||
11 | + <sql id="Field"> | ||
12 | + NAME, | ||
13 | + REMARK, | ||
14 | + $ID | ||
15 | + </sql> | ||
16 | + | ||
17 | + <!-- 字段值 --> | ||
18 | + <sql id="FieldValue"> | ||
19 | + #{NAME}, | ||
20 | + #{REMARK}, | ||
21 | + #{$ID} | ||
22 | + </sql> | ||
23 | + | ||
24 | + <!-- 新增--> | ||
25 | + <insert id="save" parameterType="pd"> | ||
26 | + insert into | ||
27 | + <include refid="tableName"></include> | ||
28 | + ( | ||
29 | + <include refid="Field"></include> | ||
30 | + ) values ( | ||
31 | + <include refid="FieldValue"></include> | ||
32 | + ) | ||
33 | + </insert> | ||
34 | + | ||
35 | + <!-- 删除--> | ||
36 | + <delete id="delete" parameterType="pd"> | ||
37 | + delete from | ||
38 | + <include refid="tableName"></include> | ||
39 | + where | ||
40 | + $ID = #{$ID} | ||
41 | + </delete> | ||
42 | + | ||
43 | + <!-- 修改 --> | ||
44 | + <update id="edit" parameterType="pd"> | ||
45 | + update | ||
46 | + <include refid="tableName"></include> | ||
47 | + set | ||
48 | + NAME = #{NAME}, | ||
49 | + REMARK = #{REMARK}, | ||
50 | + $ID = $ID | ||
51 | + where | ||
52 | + $ID = #{$ID} | ||
53 | + </update> | ||
54 | + | ||
55 | + <!-- 通过ID获取数据 --> | ||
56 | + <select id="findById" parameterType="pd" resultType="pd"> | ||
57 | + select | ||
58 | + <include refid="Field"></include> | ||
59 | + from | ||
60 | + <include refid="tableName"></include> | ||
61 | + where | ||
62 | + $ID = #{$ID} | ||
63 | + </select> | ||
64 | + | ||
65 | + <!-- 列表 --> | ||
66 | + <select id="datalistPage" parameterType="page" resultType="pd"> | ||
67 | + select | ||
68 | + <include refid="Field"></include> | ||
69 | + from | ||
70 | + <include refid="tableName"></include> | ||
71 | + where 1=1 | ||
72 | + <if test="pd.keywords!= null and pd.keywords != ''"><!-- 关键词检索 --> | ||
73 | + and | ||
74 | + ( | ||
75 | + <!-- 根据需求自己加检索条件 | ||
76 | + 字段1 LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%') | ||
77 | + or | ||
78 | + 字段2 LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%') | ||
79 | + --> | ||
80 | + ) | ||
81 | + </if> | ||
82 | + </select> | ||
83 | + | ||
84 | + <!-- 列表(全部) --> | ||
85 | + <select id="listAll" parameterType="pd" resultType="pd"> | ||
86 | + select | ||
87 | + <include refid="Field"></include> | ||
88 | + from | ||
89 | + <include refid="tableName"></include> | ||
90 | + </select> | ||
91 | + | ||
92 | + <!-- 批量删除 --> | ||
93 | + <delete id="deleteAll" parameterType="String"> | ||
94 | + delete from | ||
95 | + <include refid="tableName"></include> | ||
96 | + where | ||
97 | + $ID in | ||
98 | + <foreach item="item" index="index" collection="array" open="(" separator="," close=")"> | ||
99 | + #{item} | ||
100 | + </foreach> | ||
101 | + </delete> | ||
102 | + | ||
103 | + <!-- fh313596790qq(青苔) --> | ||
104 | +</mapper> | ||
0 | \ No newline at end of file | 105 | \ No newline at end of file |
src/com/fh/controller/sunvote/papertype/PaperTypeController.java
0 → 100644
1 | +package com.fh.controller.sunvote.papertype; | ||
2 | + | ||
3 | +import java.io.PrintWriter; | ||
4 | +import java.text.DateFormat; | ||
5 | +import java.text.SimpleDateFormat; | ||
6 | +import java.util.ArrayList; | ||
7 | +import java.util.Date; | ||
8 | +import java.util.HashMap; | ||
9 | +import java.util.List; | ||
10 | +import java.util.Map; | ||
11 | +import javax.annotation.Resource; | ||
12 | +import org.springframework.beans.propertyeditors.CustomDateEditor; | ||
13 | +import org.springframework.stereotype.Controller; | ||
14 | +import org.springframework.web.bind.WebDataBinder; | ||
15 | +import org.springframework.web.bind.annotation.InitBinder; | ||
16 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
17 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
18 | +import org.springframework.web.servlet.ModelAndView; | ||
19 | +import com.fh.controller.base.BaseController; | ||
20 | +import com.fh.entity.Page; | ||
21 | +import com.fh.util.AppUtil; | ||
22 | +import com.fh.util.ObjectExcelView; | ||
23 | +import com.fh.util.PageData; | ||
24 | +import com.fh.util.Jurisdiction; | ||
25 | +import com.fh.util.Tools; | ||
26 | +import com.fh.service.sunvote.papertype.PaperTypeManager; | ||
27 | + | ||
28 | +/** | ||
29 | + * 说明:试卷类型管理 | ||
30 | + * 创建人:Elvis | ||
31 | + * 创建时间:2018-04-20 | ||
32 | + */ | ||
33 | +@Controller | ||
34 | +@RequestMapping(value="/papertype") | ||
35 | +public class PaperTypeController extends BaseController { | ||
36 | + | ||
37 | + String menuUrl = "papertype/list.do"; //菜单地址(权限用) | ||
38 | + @Resource(name="papertypeService") | ||
39 | + private PaperTypeManager papertypeService; | ||
40 | + | ||
41 | + /**保存 | ||
42 | + * @param | ||
43 | + * @throws Exception | ||
44 | + */ | ||
45 | + @RequestMapping(value="/save") | ||
46 | + public ModelAndView save() throws Exception{ | ||
47 | + logBefore(logger, Jurisdiction.getUsername()+"新增PaperType"); | ||
48 | + if(!Jurisdiction.buttonJurisdiction(menuUrl, "add")){return null;} //校验权限 | ||
49 | + ModelAndView mv = this.getModelAndView(); | ||
50 | + PageData pd = new PageData(); | ||
51 | + pd = this.getPageData(); | ||
52 | + papertypeService.save(pd); | ||
53 | + mv.addObject("msg","success"); | ||
54 | + mv.setViewName("save_result"); | ||
55 | + return mv; | ||
56 | + } | ||
57 | + | ||
58 | + /**删除 | ||
59 | + * @param out | ||
60 | + * @throws Exception | ||
61 | + */ | ||
62 | + @RequestMapping(value="/delete") | ||
63 | + public void delete(PrintWriter out) throws Exception{ | ||
64 | + logBefore(logger, Jurisdiction.getUsername()+"删除PaperType"); | ||
65 | + if(!Jurisdiction.buttonJurisdiction(menuUrl, "del")){return;} //校验权限 | ||
66 | + PageData pd = new PageData(); | ||
67 | + pd = this.getPageData(); | ||
68 | + papertypeService.delete(pd); | ||
69 | + out.write("success"); | ||
70 | + out.close(); | ||
71 | + } | ||
72 | + | ||
73 | + /**修改 | ||
74 | + * @param | ||
75 | + * @throws Exception | ||
76 | + */ | ||
77 | + @RequestMapping(value="/edit") | ||
78 | + public ModelAndView edit() throws Exception{ | ||
79 | + logBefore(logger, Jurisdiction.getUsername()+"修改PaperType"); | ||
80 | + if(!Jurisdiction.buttonJurisdiction(menuUrl, "edit")){return null;} //校验权限 | ||
81 | + ModelAndView mv = this.getModelAndView(); | ||
82 | + PageData pd = new PageData(); | ||
83 | + pd = this.getPageData(); | ||
84 | + papertypeService.edit(pd); | ||
85 | + mv.addObject("msg","success"); | ||
86 | + mv.setViewName("save_result"); | ||
87 | + return mv; | ||
88 | + } | ||
89 | + | ||
90 | + /**列表 | ||
91 | + * @param page | ||
92 | + * @throws Exception | ||
93 | + */ | ||
94 | + @RequestMapping(value="/list") | ||
95 | + public ModelAndView list(Page page) throws Exception{ | ||
96 | + logBefore(logger, Jurisdiction.getUsername()+"列表PaperType"); | ||
97 | + //if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;} //校验权限(无权查看时页面会有提示,如果不注释掉这句代码就无法进入列表页面,所以根据情况是否加入本句代码) | ||
98 | + ModelAndView mv = this.getModelAndView(); | ||
99 | + PageData pd = new PageData(); | ||
100 | + pd = this.getPageData(); | ||
101 | + String keywords = pd.getString("keywords"); //关键词检索条件 | ||
102 | + if(null != keywords && !"".equals(keywords)){ | ||
103 | + pd.put("keywords", keywords.trim()); | ||
104 | + } | ||
105 | + page.setPd(pd); | ||
106 | + List<PageData> varList = papertypeService.list(page); //列出PaperType列表 | ||
107 | + mv.setViewName("sunvote/papertype/papertype_list"); | ||
108 | + mv.addObject("varList", varList); | ||
109 | + mv.addObject("pd", pd); | ||
110 | + mv.addObject("QX",Jurisdiction.getHC()); //按钮权限 | ||
111 | + return mv; | ||
112 | + } | ||
113 | + | ||
114 | + /**去新增页面 | ||
115 | + * @param | ||
116 | + * @throws Exception | ||
117 | + */ | ||
118 | + @RequestMapping(value="/goAdd") | ||
119 | + public ModelAndView goAdd()throws Exception{ | ||
120 | + ModelAndView mv = this.getModelAndView(); | ||
121 | + PageData pd = new PageData(); | ||
122 | + pd = this.getPageData(); | ||
123 | + mv.setViewName("sunvote/papertype/papertype_edit"); | ||
124 | + mv.addObject("msg", "save"); | ||
125 | + mv.addObject("pd", pd); | ||
126 | + return mv; | ||
127 | + } | ||
128 | + | ||
129 | + /**去修改页面 | ||
130 | + * @param | ||
131 | + * @throws Exception | ||
132 | + */ | ||
133 | + @RequestMapping(value="/goEdit") | ||
134 | + public ModelAndView goEdit()throws Exception{ | ||
135 | + ModelAndView mv = this.getModelAndView(); | ||
136 | + PageData pd = new PageData(); | ||
137 | + pd = this.getPageData(); | ||
138 | + pd = papertypeService.findById(pd); //根据ID读取 | ||
139 | + mv.setViewName("sunvote/papertype/papertype_edit"); | ||
140 | + mv.addObject("msg", "edit"); | ||
141 | + mv.addObject("pd", pd); | ||
142 | + return mv; | ||
143 | + } | ||
144 | + | ||
145 | + /**批量删除 | ||
146 | + * @param | ||
147 | + * @throws Exception | ||
148 | + */ | ||
149 | + @RequestMapping(value="/deleteAll") | ||
150 | + @ResponseBody | ||
151 | + public Object deleteAll() throws Exception{ | ||
152 | + logBefore(logger, Jurisdiction.getUsername()+"批量删除PaperType"); | ||
153 | + if(!Jurisdiction.buttonJurisdiction(menuUrl, "del")){return null;} //校验权限 | ||
154 | + PageData pd = new PageData(); | ||
155 | + Map<String,Object> map = new HashMap<String,Object>(); | ||
156 | + pd = this.getPageData(); | ||
157 | + List<PageData> pdList = new ArrayList<PageData>(); | ||
158 | + String DATA_IDS = pd.getString("DATA_IDS"); | ||
159 | + if(null != DATA_IDS && !"".equals(DATA_IDS)){ | ||
160 | + String ArrayDATA_IDS[] = DATA_IDS.split(","); | ||
161 | + papertypeService.deleteAll(ArrayDATA_IDS); | ||
162 | + pd.put("msg", "ok"); | ||
163 | + }else{ | ||
164 | + pd.put("msg", "no"); | ||
165 | + } | ||
166 | + pdList.add(pd); | ||
167 | + map.put("list", pdList); | ||
168 | + return AppUtil.returnObject(pd, map); | ||
169 | + } | ||
170 | + | ||
171 | + /**导出到excel | ||
172 | + * @param | ||
173 | + * @throws Exception | ||
174 | + */ | ||
175 | + @RequestMapping(value="/excel") | ||
176 | + public ModelAndView exportExcel() throws Exception{ | ||
177 | + logBefore(logger, Jurisdiction.getUsername()+"导出PaperType到excel"); | ||
178 | + if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;} | ||
179 | + ModelAndView mv = new ModelAndView(); | ||
180 | + PageData pd = new PageData(); | ||
181 | + pd = this.getPageData(); | ||
182 | + Map<String,Object> dataMap = new HashMap<String,Object>(); | ||
183 | + List<String> titles = new ArrayList<String>(); | ||
184 | + titles.add("名称"); //1 | ||
185 | + titles.add("备注"); //2 | ||
186 | + dataMap.put("titles", titles); | ||
187 | + List<PageData> varOList = papertypeService.listAll(pd); | ||
188 | + List<PageData> varList = new ArrayList<PageData>(); | ||
189 | + for(int i=0;i<varOList.size();i++){ | ||
190 | + PageData vpd = new PageData(); | ||
191 | + vpd.put("var1", varOList.get(i).getString("NAME")); //1 | ||
192 | + vpd.put("var2", varOList.get(i).getString("REMARK")); //2 | ||
193 | + varList.add(vpd); | ||
194 | + } | ||
195 | + dataMap.put("varList", varList); | ||
196 | + ObjectExcelView erv = new ObjectExcelView(); | ||
197 | + mv = new ModelAndView(erv,dataMap); | ||
198 | + return mv; | ||
199 | + } | ||
200 | + | ||
201 | + @InitBinder | ||
202 | + public void initBinder(WebDataBinder binder){ | ||
203 | + DateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | ||
204 | + binder.registerCustomEditor(Date.class, new CustomDateEditor(format,true)); | ||
205 | + } | ||
206 | +} |
src/com/fh/service/sunvote/papertype/PaperTypeManager.java
0 → 100644
1 | +package com.fh.service.sunvote.papertype; | ||
2 | + | ||
3 | +import java.util.List; | ||
4 | +import com.fh.entity.Page; | ||
5 | +import com.fh.util.PageData; | ||
6 | + | ||
7 | +/** | ||
8 | + * 说明: 试卷类型管理接口 | ||
9 | + * 创建人:Elvis | ||
10 | + * 创建时间:2018-04-20 | ||
11 | + * @version | ||
12 | + */ | ||
13 | +public interface PaperTypeManager{ | ||
14 | + | ||
15 | + /**新增 | ||
16 | + * @param pd | ||
17 | + * @throws Exception | ||
18 | + */ | ||
19 | + public void save(PageData pd)throws Exception; | ||
20 | + | ||
21 | + /**删除 | ||
22 | + * @param pd | ||
23 | + * @throws Exception | ||
24 | + */ | ||
25 | + public void delete(PageData pd)throws Exception; | ||
26 | + | ||
27 | + /**修改 | ||
28 | + * @param pd | ||
29 | + * @throws Exception | ||
30 | + */ | ||
31 | + public void edit(PageData pd)throws Exception; | ||
32 | + | ||
33 | + /**列表 | ||
34 | + * @param page | ||
35 | + * @throws Exception | ||
36 | + */ | ||
37 | + public List<PageData> list(Page page)throws Exception; | ||
38 | + | ||
39 | + /**列表(全部) | ||
40 | + * @param pd | ||
41 | + * @throws Exception | ||
42 | + */ | ||
43 | + public List<PageData> listAll(PageData pd)throws Exception; | ||
44 | + | ||
45 | + /**通过id获取数据 | ||
46 | + * @param pd | ||
47 | + * @throws Exception | ||
48 | + */ | ||
49 | + public PageData findById(PageData pd)throws Exception; | ||
50 | + | ||
51 | + /**批量删除 | ||
52 | + * @param ArrayDATA_IDS | ||
53 | + * @throws Exception | ||
54 | + */ | ||
55 | + public void deleteAll(String[] ArrayDATA_IDS)throws Exception; | ||
56 | + | ||
57 | +} | ||
58 | + |
src/com/fh/service/sunvote/papertype/impl/PaperTypeService.java
0 → 100644
1 | +package com.fh.service.sunvote.papertype.impl; | ||
2 | + | ||
3 | +import java.util.List; | ||
4 | +import javax.annotation.Resource; | ||
5 | +import org.springframework.stereotype.Service; | ||
6 | +import com.fh.dao.DaoSupport; | ||
7 | +import com.fh.entity.Page; | ||
8 | +import com.fh.util.PageData; | ||
9 | +import com.fh.service.sunvote.papertype.PaperTypeManager; | ||
10 | + | ||
11 | +/** | ||
12 | + * 说明: 试卷类型管理 | ||
13 | + * 创建人:FH Q313596790 | ||
14 | + * 创建时间:2018-04-20 | ||
15 | + * @version | ||
16 | + */ | ||
17 | +@Service("papertypeService") | ||
18 | +public class PaperTypeService implements PaperTypeManager{ | ||
19 | + | ||
20 | + @Resource(name = "daoSupport") | ||
21 | + private DaoSupport dao; | ||
22 | + | ||
23 | + /**新增 | ||
24 | + * @param pd | ||
25 | + * @throws Exception | ||
26 | + */ | ||
27 | + public void save(PageData pd)throws Exception{ | ||
28 | + dao.save("PaperTypeMapper.save", pd); | ||
29 | + } | ||
30 | + | ||
31 | + /**删除 | ||
32 | + * @param pd | ||
33 | + * @throws Exception | ||
34 | + */ | ||
35 | + public void delete(PageData pd)throws Exception{ | ||
36 | + dao.delete("PaperTypeMapper.delete", pd); | ||
37 | + } | ||
38 | + | ||
39 | + /**修改 | ||
40 | + * @param pd | ||
41 | + * @throws Exception | ||
42 | + */ | ||
43 | + public void edit(PageData pd)throws Exception{ | ||
44 | + dao.update("PaperTypeMapper.edit", pd); | ||
45 | + } | ||
46 | + | ||
47 | + /**列表 | ||
48 | + * @param page | ||
49 | + * @throws Exception | ||
50 | + */ | ||
51 | + @SuppressWarnings("unchecked") | ||
52 | + public List<PageData> list(Page page)throws Exception{ | ||
53 | + return (List<PageData>)dao.findForList("PaperTypeMapper.datalistPage", page); | ||
54 | + } | ||
55 | + | ||
56 | + /**列表(全部) | ||
57 | + * @param pd | ||
58 | + * @throws Exception | ||
59 | + */ | ||
60 | + @SuppressWarnings("unchecked") | ||
61 | + public List<PageData> listAll(PageData pd)throws Exception{ | ||
62 | + return (List<PageData>)dao.findForList("PaperTypeMapper.listAll", pd); | ||
63 | + } | ||
64 | + | ||
65 | + /**通过id获取数据 | ||
66 | + * @param pd | ||
67 | + * @throws Exception | ||
68 | + */ | ||
69 | + public PageData findById(PageData pd)throws Exception{ | ||
70 | + return (PageData)dao.findForObject("PaperTypeMapper.findById", pd); | ||
71 | + } | ||
72 | + | ||
73 | + /**批量删除 | ||
74 | + * @param ArrayDATA_IDS | ||
75 | + * @throws Exception | ||
76 | + */ | ||
77 | + public void deleteAll(String[] ArrayDATA_IDS)throws Exception{ | ||
78 | + dao.delete("PaperTypeMapper.deleteAll", ArrayDATA_IDS); | ||
79 | + } | ||
80 | + | ||
81 | +} | ||
82 | + |