190 lines
7.7 KiB
Plaintext
190 lines
7.7 KiB
Plaintext
<%@ page contentType="text/html;charset=UTF-8" %>
|
||
<%@ include file="/webpage/include/taglib.jsp"%>
|
||
<html>
|
||
<head>
|
||
<title>模板管理</title>
|
||
<meta name="decorator" content="default"/>
|
||
<!-- <script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script> -->
|
||
<script type="text/javascript">
|
||
var validateForm;
|
||
function doSubmit(){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
|
||
if(validateForm.form()){
|
||
$("input").attr("disabled",false);
|
||
$("#inputForm").submit();
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
$(document).ready(function() {
|
||
/* $("#templatePathFilePath").attr("value","${templatePathPath}");
|
||
$("#templatePathFileName").attr("value","${templatePathNm}");
|
||
$("#templatePathFileNm").attr("value","${templatePathPath}"+"${templatePathNm}"); */
|
||
/* $("#addTable").click(function(){
|
||
var tr = $('#table tr').eq(1).clone();
|
||
|
||
$(tr).find("[id]").each(function() {
|
||
var id = $(this).attr("id");
|
||
//alert(id);
|
||
if(id=="templatePath"){
|
||
alert("OK");
|
||
$(this).attr("id", id+"111");
|
||
alert($(this).attr("id"));
|
||
}
|
||
});
|
||
|
||
$('#table').append(tr);
|
||
|
||
}); */
|
||
validateForm = $("#inputForm").validate({
|
||
submitHandler: function(form){
|
||
loading('正在提交,请稍等...');
|
||
form.submit();
|
||
},
|
||
|
||
errorContainer: "#messageBox",
|
||
errorPlacement: function(error, element) {
|
||
$("#messageBox").text("输入有误,请先更正。");
|
||
if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
|
||
error.appendTo(element.parent().parent());
|
||
} else {
|
||
error.insertAfter(element);
|
||
}
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
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");
|
||
}
|
||
}
|
||
}); */
|
||
}
|
||
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>
|
||
<script>
|
||
function openT(a){
|
||
var index=$(a).parent().parent().index();
|
||
var type=$("select option:selected").eq(index).val();
|
||
if(type==null||type==''){
|
||
layer.alert("请先选择模板类型!");
|
||
}else{
|
||
top.layer.open({
|
||
type: 2,
|
||
area: ['400px','600px'],
|
||
title:"请选择所属节点",
|
||
maxmin: true, //开启最大化最小化按钮
|
||
content: "${ctx}/sys/sysTemplateMag/goTreeNode?magType="+type ,
|
||
btn: ['确定','关闭'],
|
||
yes: function(index, layero){
|
||
var body = top.layer.getChildFrame('body', index);
|
||
var treeId =body.find('#inputForm').find('[id=treeId]').val();
|
||
if(treeId==''||treeId==null){
|
||
alert("您没有选择任何节点");
|
||
return;
|
||
}else{
|
||
var s=treeId.split(",");
|
||
var tid=s[0];
|
||
var tname=s[1];
|
||
$(a).val(tname);
|
||
$(a).next(".treeNode").val(tid);
|
||
}
|
||
|
||
top.layer.close(index);
|
||
},
|
||
cancel: function(index){
|
||
}
|
||
});
|
||
}
|
||
}
|
||
</script>
|
||
</head>
|
||
<body>
|
||
</br>
|
||
<form:form id="inputForm" modelAttribute="sysTemplateMag" action="${ctx}/sys/sysTemplateMag/save" method="post" class="form-horizontal">
|
||
<sys:message content="${message}"/>
|
||
<a class="btn btn-white btn-sm" onclick="templateRowIdx = templateRowIdx + 1;addRow('#templateList', templateRowIdx, templateTpl);alert(templateRowIdx);" title="新增"><i class="fa fa-plus"></i> 新增</a>
|
||
<table id="table" class="table table-bordered table-condensed dataTables-example dataTable no-footer">
|
||
<thead>
|
||
<tr>
|
||
<th>模板名称</th>
|
||
<th>模板类型</th>
|
||
<th>所属节点</th>
|
||
<th>上传者</th>
|
||
<th>所属部门</th>
|
||
<th>电话</th>
|
||
<th>备注</th>
|
||
<th width="250">模板文件</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody id="templateList">
|
||
</tbody>
|
||
</table>
|
||
<script type="text/template" id="templateTpl">//<!--
|
||
<tr id="templateList{{idx}}">
|
||
<td>
|
||
<input type="hidden" id="templateList{{idx}}_id" name="templateList[{{idx}}].id" />
|
||
<input id="templateList{{idx}}_templateNm" name="templateList[{{idx}}].templateNm" htmlEscape="false" class="form-control required" disabled='disabled'/>
|
||
</td><%-- value="{{row.templateNm}}"--%>
|
||
<td >
|
||
<select name="templateList[{{idx}}].templateType" id="templateList{{idx}}_templateType" value="{{row.templateType}}" class="form-control required">
|
||
<option value="" label=""/>
|
||
<c:forEach items="${fns:getDictList('template_type')}" var="tList">
|
||
<option value="${tList.value}">${tList.label}</option>
|
||
</c:forEach>
|
||
</select>
|
||
</td>
|
||
<td width="15%" >
|
||
<input id="templateList{{idx}}_treeNodeName" name="templateList[{{idx}}].treeNodeName" onclick="openT(this);" readonly="true" htmlEscape="false" maxlength="500" class="form-control required " style="width:80%"/><%--<a href="#" onclick="openT(this);" class="btn btn-info btn-xs" ><i class="fa fa-search-plus"></i></a>--%>
|
||
<input id="templateList{{idx}}_treeNode" name="templateList[{{idx}}].treeNode" value="{{row.treeNode}}" class="treeNode" type="hidden"/>
|
||
</td>
|
||
<td>
|
||
<input id="templateList{{idx}}_updateById" name="templateList[{{idx}}].updateBy" value="${name}" htmlEscape="false" class="form-control required"/>
|
||
</td>
|
||
<td>
|
||
<input name="templateList[{{idx}}].office" id="templateList{{idx}}_office" value="${office}" htmlEscape="false" class="form-control"/>
|
||
</td>
|
||
<td>
|
||
<input id="templateList{{idx}}_phone" name="templateList[{{idx}}].phone" value="${phone}" htmlEscape="false" class="form-control"/>
|
||
</td>
|
||
<td>
|
||
<input id="templateList{{idx}}_remarks" name="templateList[{{idx}}].remarks" htmlEscape="false" class="form-control"/>
|
||
</td>
|
||
<td>
|
||
<input type="hidden" id="templatePath{{idx}}" name="templateList[{{idx}}].templatePath" htmlEscape="false" maxlength="2000" class="form-control"/>
|
||
<sys:webuploader prefixid = "templatePath{{idx}}" ctrlid = "templateList{{idx}}_templateNm" inputwidth = "33%" inputDisabled = "" btnUpDisplay = "block" ftpfilepath="sys/sysTemplateMag/"/>
|
||
</td>
|
||
</tr>
|
||
</script>
|
||
<script type="text/javascript">
|
||
var templateRowIdx = 0, templateTpl = $("#templateTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
|
||
</script>
|
||
</form:form>
|
||
</body>
|
||
</html> |