Commit d029379a7a8519290757f25d35fd21de23dfd2d4
1 parent
a1975f10
1、增加模板列表页和详情页
Showing
4 changed files
with
126 additions
and
5 deletions
WebRoot/WEB-INF/jsp/sunvote/admin/admin_main.jsp
... | ... | @@ -269,7 +269,7 @@ |
269 | 269 | window.top.loading.show(); |
270 | 270 | } |
271 | 271 | function pagetemplate(school_id){ |
272 | - var path = "../pagetemplate/listcs.do"; | |
272 | + var path = "../pagetemplate/listcs.do?school_id=" + school_id ; | |
273 | 273 | $("#mainFrame").attr('src',path); |
274 | 274 | window.top.loading.show(); |
275 | 275 | } | ... | ... |
WebRoot/WEB-INF/jsp/sunvote/grade/grade_list2.jsp
... | ... | @@ -64,8 +64,8 @@ |
64 | 64 | <tr> |
65 | 65 | <td><input type="checkbox" name='ids' id="ids" |
66 | 66 | value="${var.ID}" />${vs.index+1}</td> |
67 | - <td class='center'>${var.CNAME}</td> | |
68 | - <td class='center'>${var.ENAME}</td> | |
67 | + <td class='center'>${var.NAME}</td> | |
68 | + <td class='center'>${var.DESC}</td> | |
69 | 69 | <td class='center'></td> |
70 | 70 | |
71 | 71 | </tr> |
... | ... | @@ -82,10 +82,10 @@ |
82 | 82 | </table> |
83 | 83 | <div class="footer" style="width:auto"> |
84 | 84 | <div class="creat"> |
85 | - <input type="button" value="添加年级" /> | |
85 | + <input type="button" onclick="add()" value="添加年级" /> | |
86 | 86 | </div> |
87 | 87 | <div class="removeAll"> |
88 | - <input type="button" onclick="deleteAll()" value="移除年级" /> | |
88 | + <input type="button" onclick="del()" value="移除年级" /> | |
89 | 89 | </div> |
90 | 90 | <div class="page_box"> |
91 | 91 | |
... | ... | @@ -115,6 +115,61 @@ |
115 | 115 | $(document).ready(function(){ |
116 | 116 | window.top.loading.remove(); |
117 | 117 | }); |
118 | + | |
119 | + function add(){ | |
120 | + window.top.modal.init({ | |
121 | + 'title':'添加班级', | |
122 | + 'url':'<%=basePath%>grade/goAdd2.do', | |
123 | + func:function() { | |
124 | + tosearch(); | |
125 | + } | |
126 | + }); | |
127 | + window.top.modal.show(); | |
128 | + } | |
129 | + | |
130 | + $('#ids').on('click', function(){ | |
131 | + var th_checked = $("#ids").prop('checked');//checkbox inside "TH" table header | |
132 | + | |
133 | + $(".table_box .table").find('tbody > tr').each(function(){ | |
134 | + var row = this; | |
135 | + if(th_checked) $(row).find('input[type=checkbox]').eq(0).prop('checked', true); | |
136 | + else $(row).find('input[type=checkbox]').eq(0).prop('checked', false); | |
137 | + }); | |
138 | + }); | |
139 | + | |
140 | + function del(Id){ | |
141 | + window.top.remove.init({"title":"删除","func":function(success){ | |
142 | + if(success){ | |
143 | + var str = ''; | |
144 | + for(var i=0;i < document.getElementsByName('ids').length;i++){ | |
145 | + if(document.getElementsByName('ids')[i].checked){ | |
146 | + if(str=='') str += document.getElementsByName('ids')[i].value; | |
147 | + else str += ',' + document.getElementsByName('ids')[i].value; | |
148 | + } | |
149 | + } | |
150 | + if(str==''){ | |
151 | + | |
152 | + }else{ | |
153 | + $.ajax({ | |
154 | + type: "POST", | |
155 | + url: '<%=basePath%>grade/deleteAll.do?tm='+new Date().getTime(), | |
156 | + data: {DATA_IDS:str}, | |
157 | + dataType:'json', | |
158 | + //beforeSend: validateData, | |
159 | + cache: false, | |
160 | + success: function(data){ | |
161 | + tosearch(); | |
162 | + } | |
163 | + }); | |
164 | + } | |
165 | + } | |
166 | + else{ | |
167 | + console.log("false"); | |
168 | + } | |
169 | + }}); | |
170 | + window.top.remove.show(); | |
171 | + } | |
172 | + | |
118 | 173 | </script> |
119 | 174 | |
120 | 175 | ... | ... |
src/com/fh/controller/sunvote/grade/GradeController.java
... | ... | @@ -153,6 +153,20 @@ public class GradeController extends BaseController { |
153 | 153 | mv.addObject("pd", pd); |
154 | 154 | return mv; |
155 | 155 | } |
156 | + /**去新增页面 | |
157 | + * @param | |
158 | + * @throws Exception | |
159 | + */ | |
160 | + @RequestMapping(value="/goAdd2") | |
161 | + public ModelAndView goAdd2()throws Exception{ | |
162 | + ModelAndView mv = this.getModelAndView(); | |
163 | + PageData pd = new PageData(); | |
164 | + pd = this.getPageData(); | |
165 | + mv.setViewName("sunvote/grade/grade_edit2"); | |
166 | + mv.addObject("msg", "save"); | |
167 | + mv.addObject("pd", pd); | |
168 | + return mv; | |
169 | + } | |
156 | 170 | |
157 | 171 | /**去修改页面 |
158 | 172 | * @param | ... | ... |
src/com/fh/controller/sunvote/pagetemplate/PageTemplateController.java
... | ... | @@ -11,6 +11,7 @@ import java.util.Map; |
11 | 11 | |
12 | 12 | import javax.annotation.Resource; |
13 | 13 | |
14 | +import org.apache.shiro.session.Session; | |
14 | 15 | import org.springframework.beans.propertyeditors.CustomDateEditor; |
15 | 16 | import org.springframework.stereotype.Controller; |
16 | 17 | import org.springframework.web.bind.WebDataBinder; |
... | ... | @@ -19,9 +20,13 @@ import org.springframework.web.bind.annotation.RequestMapping; |
19 | 20 | import org.springframework.web.bind.annotation.ResponseBody; |
20 | 21 | import org.springframework.web.servlet.ModelAndView; |
21 | 22 | |
23 | +import com.fh.bean.Paper; | |
24 | +import com.fh.bean.Question; | |
22 | 25 | import com.fh.controller.base.BaseController; |
23 | 26 | import com.fh.entity.Page; |
27 | +import com.fh.entity.system.User; | |
24 | 28 | import com.fh.util.AppUtil; |
29 | +import com.fh.util.Const; | |
25 | 30 | import com.fh.util.ObjectExcelView; |
26 | 31 | import com.fh.util.PageData; |
27 | 32 | import com.fh.util.Jurisdiction; |
... | ... | @@ -251,6 +256,53 @@ public class PageTemplateController extends BaseController { |
251 | 256 | return mv; |
252 | 257 | } |
253 | 258 | |
259 | + @RequestMapping(value="/npaper") | |
260 | + public ModelAndView newpaper() throws Exception{ | |
261 | + logBefore(logger, Jurisdiction.getUsername()+"Paper详细信息"); | |
262 | + ModelAndView mv = this.getModelAndView(); | |
263 | + PageData pd = new PageData(); | |
264 | + pd = this.getPageData(); | |
265 | + String paperType = pd.getString("PAPER_TYPE") ; | |
266 | + Paper paper = new Paper(); | |
267 | + paper.setTitle(pd.getString("NAME")); | |
268 | + paper.setExam_time(pd.getString("TIME")); | |
269 | + Session session = Jurisdiction.getSession(); | |
270 | + User user = (User)session.getAttribute(Const.SESSION_USER); | |
271 | + paper.setUser_id(user.getUSER_ID()); | |
272 | + paper.setPaper_type(paperType == null || "".equals(paperType.trim()) ? "1" :paperType); | |
273 | + String subjectId = pd.getString("SUBJECT_ID"); | |
274 | + paper.setSubject_id(subjectId == null || "".equals(subjectId.trim())? getSubjectId():subjectId); | |
275 | + String gradeId = pd.getString("GRADE_ID"); | |
276 | + paper.setGrade_id( gradeId== null || "".equals(gradeId.trim())? getGradeID() : gradeId); | |
277 | + String schoolId = pd.getString("SCHOOL_ID") ; | |
278 | + paper.setSchool_id(schoolId == null || "".equals(schoolId.trim())? getSchoolID() : schoolId); | |
279 | + paper.setQuestions(new ArrayList<Question>()); | |
280 | + | |
281 | + pd.put("JSON", paper.toJson()); | |
282 | + logger.info(paper.toJson()); | |
283 | + | |
284 | + String TEMPLATE_ID = pd.getString("TEMPLATE_ID"); | |
285 | + if(TEMPLATE_ID != null && !"".equals(TEMPLATE_ID)){ | |
286 | + pd.put("PAGETEMPLATE_ID", TEMPLATE_ID); | |
287 | + PageData template = pagetemplateService.findById(pd); | |
288 | + mv.addObject("TEMPLEATE", template); | |
289 | + } | |
290 | + | |
291 | + if(isChineseLanguageClient()){ | |
292 | + mv.setViewName("sunvote/teacher/creat_template"); | |
293 | + }else{ | |
294 | + mv.setViewName("sunvote/teacher/en_creat_question"); | |
295 | + } | |
296 | + mv.addObject("pd", pd); | |
297 | + if(paperType != null && "2".equals(paperType)){ | |
298 | + mv.addObject("JUMP_URL", "/main/admin"); | |
299 | + }else{ | |
300 | + mv.addObject("JUMP_URL", "/main/teacher"); | |
301 | + } | |
302 | + mv.addObject("QX",Jurisdiction.getHC()); //按钮权限 | |
303 | + return mv; | |
304 | + } | |
305 | + | |
254 | 306 | @InitBinder |
255 | 307 | public void initBinder(WebDataBinder binder){ |
256 | 308 | DateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | ... | ... |