123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <%@ page contentType="text/html;charset=UTF-8" %>
- <%@ include file="/webpage/include/taglib.jsp"%>
- <html>
- <head>
- <title>投票管理</title>
- <meta name="decorator" content="ani"/>
- <script type="text/javascript">
- $(document).ready(function() {
- });
- function save() {
- var isValidate = jp.validateForm('#inputForm');//校验表单
- if(!isValidate){
- return false;
- }else{
- jp.loading();
- jp.post("${ctx}/questionnaire/eduQuestionnaireQuestion/save",$('#inputForm').serialize(),function(data){
- if(data.success){
- jp.getParent().refresh();
- var dialogIndex = parent.layer.getFrameIndex(window.name); // 获取窗口索引
- parent.layer.close(dialogIndex);
- jp.success(data.msg)
- }else{
- jp.error(data.msg);
- }
- })
- }
- }
- function addRow(list, idx, tpl, row){
- $(list).append(Mustache.render(tpl, {
- idx: idx, delBtn: true, row: row
- }));
- $(list+idx).find("select").each(function(){
- $(this).val($(this).attr("data-value"));
- });
- $(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
- var ss = $(this).attr("data-value").split(',');
- for (var i=0; i<ss.length; i++){
- if($(this).val() == ss[i]){
- $(this).attr("checked","checked");
- }
- }
- });
- $(list+idx).find(".form_datetime").each(function(){
- $(this).datetimepicker({
- format: "YYYY-MM-DD HH:mm:ss"
- });
- });
- }
- function delRow(obj, prefix){
- var id = $(prefix+"_id");
- var delFlag = $(prefix+"_delFlag");
- if (id.val() == ""){
- $(obj).parent().parent().remove();
- }else if(delFlag.val() == "0"){
- delFlag.val("1");
- $(obj).html("÷").attr("title", "撤销删除");
- $(obj).parent().parent().addClass("error");
- }else if(delFlag.val() == "1"){
- delFlag.val("0");
- $(obj).html("×").attr("title", "删除");
- $(obj).parent().parent().removeClass("error");
- }
- }
- </script>
- </head>
- <body class="bg-white">
- <form:form id="inputForm" modelAttribute="eduQuestionnaireQuestion" action="${ctx}/questionnaire/eduQuestionnaireQuestion/save" method="post" class="form-horizontal">
- <form:hidden path="id"/>
- <form:hidden path="questionnaire.id"/>
- <table class="table table-bordered">
- <tbody>
- <tr>
- <td class="width-15 active"><label class="pull-right"><font color="red">*</font>题号:</label></td>
- <td class="width-35">
- <form:input path="num" htmlEscape="false" class="form-control "/>
- </td>
- <td class="width-15 active"><label class="pull-right" ><font color="red">*</font>题目类型:</label></td>
- <td class="width-35">
- <form:select path="types" class="form-control required">
- <form:option value="1" label="单选题"/>
- <form:option value="2" label="多选题"/>
- </form:select>
- </td>
- </tr>
- <tr>
- <td class="width-15 active"><label class="pull-right"><font color="red">*</font>题目内容:</label></td>
- <td class="width-35" colspan="3">
- <form:input path="title" htmlEscape="false" class="form-control required"/>
- </td>
- </tr>
- <%--<tr>
- <td class="width-15 active"><label class="pull-right"><font color="red">*</font>是否必答:</label></td>
- <td class="width-35">
- <form:radiobuttons path="mustAnswer" items="${fns:getDictList('yes_no')}" itemLabel="label" itemValue="value" htmlEscape="false" class="required i-checks "/>
- </td>
- </tr>--%>
- </tbody>
- </table>
- <div class="tabs-container">
- <ul class="nav nav-tabs">
- <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">投票:</a>
- </li>
- </ul>
- <div class="tab-content">
- <div id="tab-1" class="tab-pane fade in active">
- <a class="btn btn-white btn-sm" onclick="addRow('#eduQuestionnaireOptionList', eduQuestionnaireOptionRowIdx, eduQuestionnaireOptionTpl);eduQuestionnaireOptionRowIdx = eduQuestionnaireOptionRowIdx + 1;" title="新增"><i class="fa fa-plus"></i> 新增</a>
- <table class="table table-striped table-bordered table-condensed">
- <thead>
- <tr>
- <th class="hide"></th>
- <th><font color="red">*</font>选项内容</th>
- <th>排序</th>
- <th width="10"> </th>
- </tr>
- </thead>
- <tbody id="eduQuestionnaireOptionList">
- </tbody>
- </table>
- <script type="text/template" id="eduQuestionnaireOptionTpl">//<!--
- <tr id="eduQuestionnaireOptionList{{idx}}">
- <td class="hide">
- <input id="eduQuestionnaireOptionList{{idx}}_id" name="eduQuestionnaireOptionList[{{idx}}].id" type="hidden" value="{{row.id}}"/>
- <input id="eduQuestionnaireOptionList{{idx}}_delFlag" name="eduQuestionnaireOptionList[{{idx}}].delFlag" type="hidden" value="0"/>
- </td>
-
- <td>
- <input id="eduQuestionnaireOptionList{{idx}}_title" name="eduQuestionnaireOptionList[{{idx}}].title" type="text" value="{{row.title}}" class="form-control required"/>
- </td>
-
-
- <td>
- <input id="eduQuestionnaireOptionList{{idx}}_seq" name="eduQuestionnaireOptionList[{{idx}}].seq" type="text" value="{{row.seq}}" class="form-control digits"/>
- </td>
-
- <td class="text-center" width="10">
- {{#delBtn}}<span class="close" onclick="delRow(this, '#eduQuestionnaireOptionList{{idx}}')" title="删除">×</span>{{/delBtn}}
- </td>
- </tr>//-->
- </script>
- <script type="text/javascript">
- var eduQuestionnaireOptionRowIdx = 0, eduQuestionnaireOptionTpl = $("#eduQuestionnaireOptionTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
- $(document).ready(function() {
- var data = ${fns:toJson(eduQuestionnaireQuestion.eduQuestionnaireOptionList)};
- for (var i=0; i<data.length; i++){
- addRow('#eduQuestionnaireOptionList', eduQuestionnaireOptionRowIdx, eduQuestionnaireOptionTpl, data[i]);
- eduQuestionnaireOptionRowIdx = eduQuestionnaireOptionRowIdx + 1;
- }
- });
- </script>
- </div>
- </div>
- </div>
- </form:form>
- </body>
- </html>
|