jeecg bootstrap修改单列模版

时间:2023-12-24 08:33:01
在作者原来的模版上增强单列模版

<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<#assign callbackFlag = false />
<#assign fileName = "" />
<#list pageColumns as callBackTestPo>
<#if callBackTestPo.showType=='file'>
<#assign callbackFlag = true />
</#if>
</#list>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>${ftl_description}</title>
<hp:base type="hplusCss"></hp:base>
<style type="text/css">
.wrapper {
float: none;
}
</style>
</head> <body class="gray-bg">
<div class="wrapper wrapper-content animated fadeIn">
<hp:formvalid formid="formobj" styleClass="form-horizontal" dialog="true" usePlugin="password" layout="table"
action="${entityName?uncap_first}Controller.do?doAdd"
tiptype="1" ${callbackFlag?string("callback=\"jeecgFormFileCallBack@Override\"", "")}>
<input type="hidden" id="btn_sub" class="btn_sub"/>
<input type="hidden" id="id" name="id"/>
<div class="tab-wrapper">
<!-- tab -->
<ul class="nav nav-tabs">
<li role="presentation" class="active"><a href="javascript:void(0);">${ftl_description}</a></li>
</ul>
<!-- tab内容 --> <div class="form-group">
<#list pageColumns as po>
<#if (pageColumns?size>10)>
<#if po_index%2==0>
<div class="form-group">
</#if>
<#else>
<div class="form-group">
</#if>
<label class="col-sm-2 control-label">${po.content}:</label>
<div class="col-sm-10"> <#if po.showType=='text'>
<input id="${po.fieldName}" name="${po.fieldName}" type="text"
class="form-control" <#if po.fieldValidType?if_exists?html != ''>
datatype="${po.fieldValidType?if_exists?html}"<#else><#if po.type == 'int'>
datatype="n"<#elseif po.type=='double'>
datatype="/^(-?\d+)(\.\d+)?$/"<#else><#if po.isNull != 'Y'>datatype="*"</#if></#if></#if>>
<#elseif po.showType=='popup'>
<input id="${po.fieldName}" name="${po.fieldName}" type="text"
class="form-control" <#if po.fieldValidType?if_exists?html != ''>
datatype="${po.fieldValidType?if_exists?html}"<#else><#if po.type == 'int'>
datatype="n"<#elseif po.type=='double'>
datatype="/^(-?\d+)(\.\d+)?$/"<#else><#if po.isNull != 'Y'>datatype="*"</#if></#if></#if><#if po.dictTable?if_exists?html!="">
onclick="inputClick(this,'${po.dictField}','${po.dictTable}')"</#if>>
<#elseif po.showType=='textarea'>
<textarea id="${po.fieldName}" class="form-control" rows="6"
name="${po.fieldName}"></textarea>
<#elseif po.showType=='password'>
<input id="${po.fieldName}" name="${po.fieldName}" type="password"
class="form-control" <#if po.fieldValidType?if_exists?html != ''>
datatype="${po.fieldValidType?if_exists?html}"<#else><#if po.type == 'int'>
datatype="n"<#elseif po.type=='double'>
datatype="/^(-?\d+)(\.\d+)?$/"<#else><#if po.isNull != 'Y'>datatype="*"</#if></#if></#if>>
<#elseif po.showType=='radio' || po.showType=='select' || po.showType=='checkbox' || po.showType=='list'>
<t:dictSelect field="${po.fieldName}" type="${po.showType?if_exists?html}"
extendJson="{class:'form-control'}"
<#if po.dictTable?if_exists?html != ''>dictTable="${po.dictTable?if_exists?html}"
dictField="${po.dictField?if_exists?html}"
dictText="${po.dictText?if_exists?html}"
<#else>typeGroupCode="${po.dictField}"</#if> hasLabel="false"
title="${po.content}"></t:dictSelect>
<#elseif po.showType=='date'>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" style="width: 150px"
class="form-control"
onClick="WdatePicker()"<#if po.fieldValidType?if_exists?html != ''>
datatype="${po.fieldValidType?if_exists?html}"<#else><#if po.isNull != 'Y'>datatype="*"</#if></#if>
type="date" pattern="yyyy-MM-dd"/>
<#elseif po.showType=='datetime'>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" style="width: 150px"
class="form-control"
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"<#if po.fieldValidType?if_exists?html != ''>
datatype="${po.fieldValidType?if_exists?html}"<#else><#if po.isNull != 'Y'>datatype="*"</#if></#if>
type="date" pattern="yyyy-MM-dd hh:mm:ss"/>
<#elseif po.showType=='file'>
<#assign fileName = "${po.fieldName}" />
<table></table>
<div class="form jeecgDetail">
<script type="text/javascript">
var serverMsg = "";
$(function () {
$('#${po.fieldName}').uploadify({
buttonText: '添加文件',
auto: false,
progressData: 'speed',
multi: true,
height: 25,
overrideEvents: ['onDialogClose'],
fileTypeDesc: '文件格式:',
queueID: 'filediv_file',
fileTypeExts: '*.rar;*.zip;*.doc;*.docx;*.txt;*.ppt;*.xls;*.xlsx;*.html;*.htm;*.pdf;*.jpg;*.gif;*.png',
fileSizeLimit: '15MB',
swf: 'plug-in/uploadify/uploadify.swf',
uploader: 'cgUploadController.do?saveFiles&jsessionid=' + $("#sessionUID").val() + '',
onUploadStart: function (file) {
var cgFormId = $("input[name='id']").val();
$('#${po.fieldName}').uploadify("settings", "formData", {
'cgFormId': cgFormId,
'cgFormName': '${tableName}',
'cgFormField': '${fieldMeta[po.fieldName]}'
});
},
onQueueComplete: function (queueData) {
var win = frameElement.api.opener;
win.reloadTable();
win.tip(serverMsg);
frameElement.api.close();
},
onUploadSuccess: function (file, data, response) {
var d = $.parseJSON(data);
if (d.success) {
var win = frameElement.api.opener;
serverMsg = d.msg;
}
},
onFallback: function () {
tip("您未安装FLASH控件,无法上传图片!请安装FLASH控件后再试")
},
onSelectError: function (file, errorCode, errorMsg) {
switch (errorCode) {
case -100 :
tip("上传的文件数量已经超出系统限制的" + $('#file').uploadify('settings', 'queueSizeLimit') + "个文件!");
break;
case -110 :
tip("文件 [" + file.name + "] 大小超出系统限制的" + $('#file').uploadify('settings', 'fileSizeLimit') + "大小!");
break;
case -120 :
tip("文件 [" + file.name + "] 大小异常!");
break;
case -130 :
tip("文件 [" + file.name + "] 类型不正确!");
break;
}
},
onUploadProgress: function (file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal) {
}
});
});
</script>
<span id="file_uploadspan"><input type="file" name="${po.fieldName}"
id="${po.fieldName}"/></span>
</div>
<div class="form" id="filediv_file"></div>
<#--update-start--Author: jg_huangxg Date:20160421 for:TASK #1027 【online】代码生成器模板不支持UE编辑器 -->
<#elseif po.showType='umeditor'>
<script type="text/javascript" charset="utf-8"
src="plug-in/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8"
src="plug-in/ueditor/ueditor.all.min.js"></script>
<textarea name="${po.fieldName}" id="${po.fieldName}"
style="width: 650px;height:300px"></textarea>
<script type="text/javascript">
var editor = UE.getEditor('${po.fieldName}');
</script>
<#--update-end--Author: jg_huangxg Date:20160421 for:TASK #1027 【online】代码生成器模板不支持UE编辑器 -->
<#else>
<input id="${po.fieldName}" name="${po.fieldName}" type="text" style="width: 150px"
class="form-control" <#if po.fieldValidType?if_exists?html != ''>
datatype="${po.fieldValidType?if_exists?html}"<#else><#if po.type == 'int'>
datatype="n"<#elseif po.type=='double'>
datatype="/^(-?\d+)(\.\d+)?$/"<#else><#if po.isNull != 'Y'>datatype="*"</#if></#if></#if>>
</#if>
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">${po.content?if_exists?html}</label>
</div>
<#if (pageColumns?size>10)>
<#if (po_index%2==0)&&(!po_has_next)>
<div class="col-xs-2 text-center"><b></b></div>
<div class="col-xs-4"></div>
</#if>
<#if (po_index%2!=0)||(!po_has_next)>
</div>
</#if>
<#else>
</div>
</#if> </#list> <div class="row" id="sub_tr" style="display: none;">
<div class="col-xs-12 layout-header">
<div class="col-xs-6"></div>
<div class="col-xs-6">
<button type="button" onclick="neibuClick();" class="btn btn-default">提交</button>
</div>
</div>
</div>
</div>
</div> <div class="con-wrapper" id="con-wrapper2" style="display: block;"></div>
</div>
</hp:formvalid>
<#if callbackFlag == true>
<script type="text/javascript">
function jeecgFormFileCallBack(data) {
if (data.success == true) {
uploadFile(data);
} else {
if (data.responseText == '' || data.responseText == undefined) {
$.messager.alert('错误', data.msg);
$.Hidemsg();
} else {
try {
var emsg = data.responseText.substring(data.responseText.indexOf('错误描述'), data.responseText.indexOf('错误信息'));
$.messager.alert('错误', emsg);
$.Hidemsg();
} catch (ex) {
$.messager.alert('错误', data.responseText + '');
}
}
return false;
}
if (!neibuClickFlag) {
var win = frameElement.api.opener;
win.reloadTable();
}
}
function upload() {
$('#${fileName}').uploadify('upload', '*');
} var neibuClickFlag = false;
function neibuClick() {
neibuClickFlag = true;
$('#btn_sub').trigger('click');
}
function cancel() {
$('#${fileName}').uploadify('cancel', '*');
}
function uploadFile(data) {
if (!$("input[name='id']").val()) {
if (data.obj != null && data.obj != 'undefined') {
$("input[name='id']").val(data.obj.id);
}
}
if ($(".uploadify-queue-item").length > 0) {
upload();
} else {
if (neibuClickFlag) {
alert(data.msg);
neibuClickFlag = false;
} else {
var win = frameElement.api.opener;
win.reloadTable();
win.tip(data.msg);
frameElement.api.close();
}
}
}
</script>
</#if> <script type="text/javascript">
$(function () {
//查看模式情况下,删除和上传附件功能禁止使用
if (location.href.indexOf("load=detail") != -1) {
$(".jeecgDetail").hide();
} if (location.href.indexOf("mode=read") != -1) {
//查看模式控件禁用
$("#formobj").find(":input").attr("disabled", "disabled");
}
if (location.href.indexOf("mode=onbutton") != -1) {
//其他模式显示提交按钮
$("#sub_tr").show();
}
}); var neibuClickFlag = false;
function neibuClick() {
neibuClickFlag = true;
$('#btn_sub').trigger('click');
} </script>
</body>
<script src="webpage/${bussiPackage?replace('.','/')}/${entityPackage}/${entityName?uncap_first}.js"></script>
</html>