cgform_jspTemplate_add.ftl 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@include file="/context/mytags.jsp"%>
  3. <!DOCTYPE html>
  4. <#assign callbackFlag = false />
  5. <#assign fileName = "" />
  6. <#list pageColumns as callBackTestPo>
  7. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  8. <#if callBackTestPo.showType=='file' || callBackTestPo.showType=='image'>
  9. <#assign callbackFlag = true />
  10. <#break>
  11. </#if>
  12. <#-- update--end--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  13. </#list>
  14. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  15. <#include "../../ui/datatype.ftl"/>
  16. <#include "../../ui/dictInfo.ftl"/>
  17. <#-- update--end--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  18. <html lang="zh-CN">
  19. <head>
  20. <meta charset="utf-8">
  21. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  22. <title>${ftl_description}</title>
  23. <meta name="description" content="">
  24. <meta name="viewport" content="width=device-width, initial-scale=1">
  25. <link rel="stylesheet" href="online/template/ledefault/css/vendor.css">
  26. <link rel="stylesheet" href="online/template/ledefault/css/bootstrap-theme.css">
  27. <link rel="stylesheet" href="online/template/ledefault/css/bootstrap.css">
  28. <link rel="stylesheet" href="online/template/ledefault/css/app.css">
  29. <link rel="stylesheet" href="plug-in/Validform/css/metrole/style.css" type="text/css"/>
  30. <link rel="stylesheet" href="plug-in/Validform/css/metrole/tablefrom.css" type="text/css"/>
  31. <script type="text/javascript" src="plug-in/jquery/jquery-1.9.0.js"></script>
  32. <script type="text/javascript" src="plug-in/tools/dataformat.js"></script>
  33. <script type="text/javascript" src="plug-in/easyui/jquery.easyui.min.1.3.2.js"></script>
  34. <script type="text/javascript" src="plug-in/easyui/locale/zh-cn.js"></script>
  35. <script type="text/javascript" src="plug-in/tools/syUtil.js"></script>
  36. <script type="text/javascript" src="plug-in/My97DatePicker/WdatePicker.js"></script>
  37. <script type="text/javascript" src="plug-in/lhgDialog/lhgdialog.min.js"></script>
  38. <script type="text/javascript" src="plug-in/tools/curdtools_zh-cn.js"></script>
  39. <script type="text/javascript" src="plug-in/tools/easyuiextend.js"></script>
  40. <script type="text/javascript" src="plug-in/Validform/js/Validform_v5.3.1_min_zh-cn.js"></script>
  41. <script type="text/javascript" src="plug-in/Validform/js/Validform_Datatype_zh-cn.js"></script>
  42. <script type="text/javascript" src="plug-in/Validform/js/datatype_zh-cn.js"></script>
  43. <script type="text/javascript" src="plug-in/Validform/plugin/passwordStrength/passwordStrength-min.js"></script>
  44. <script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.config.js"></script>
  45. <script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.all.min.js"></script>
  46. <#if callbackFlag == true>
  47. <link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css" />
  48. <script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.js"></script>
  49. </#if>
  50. <script type="text/javascript">
  51. //编写自定义JS代码
  52. </script>
  53. </head>
  54. <body>
  55. <#-- update--begin--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  56. <#assign ue_widget_count = 0>
  57. <#-- update--end--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  58. <t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" action="${entityName?uncap_first}Controller.do?doAdd" tiptype="1" ${callbackFlag?string("callback=\"jeecgFormFileCallBack@Override\"", "")}>
  59. <input type="hidden" id="btn_sub" class="btn_sub"/>
  60. <input type="hidden" id="id" name="id"/>
  61. <div class="tab-wrapper">
  62. <!-- tab -->
  63. <ul class="nav nav-tabs">
  64. <li role="presentation" class="active"><a href="javascript:void(0);">${ftl_description}</a></li>
  65. </ul>
  66. <!-- tab内容 -->
  67. <div class="con-wrapper" id="con-wrapper1" style="display: block;">
  68. <div class="row form-wrapper">
  69. <#list pageColumns as po>
  70. <#if (pageColumns?size>10)>
  71. <#if po_index%2==0>
  72. <div class="row show-grid">
  73. </#if>
  74. <#else>
  75. <div class="row show-grid">
  76. </#if>
  77. <div class="col-xs-3 text-center">
  78. <b>${po.content}:</b>
  79. </div>
  80. <div class="col-xs-3">
  81. <#if po.showType=='text'>
  82. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  83. <input id="${po.fieldName}" name="${po.fieldName}" type="text" class="form-control" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/>/>
  84. <#-- update--end--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  85. <#elseif po.showType=='popup'>
  86. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  87. <input id="${po.fieldName}" name="${po.fieldName}" type="text" class="form-control" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/><#if po.dictTable?if_exists?html!=""> onclick="inputClick(this,'${po.dictField}','${po.dictTable}')"</#if> />
  88. <#-- update--end--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  89. <#elseif po.showType=='textarea'>
  90. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  91. <textarea id="${po.fieldName}" class="form-control" rows="6" name="${po.fieldName}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/>></textarea>
  92. <#-- update--end--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  93. <#elseif po.showType=='password'>
  94. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  95. <input id="${po.fieldName}" name="${po.fieldName}" type="password" class="form-control"<@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/>/>
  96. <#-- update--end--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  97. <#elseif po.showType=='radio' || po.showType=='select' || po.showType=='checkbox' || po.showType=='list'>
  98. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  99. <t:dictSelect field="${po.fieldName}" type="${po.showType?if_exists?html}" extendJson="{class:'form-control'}" <@datatype inputCheck="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> <@dictInfo dictTable="${po.dictTable}" dictField="${po.dictField}" dictText="${po.dictText}" /> hasLabel="false" title="${po.content}"></t:dictSelect>
  100. <#-- update--end--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  101. <#elseif po.showType=='date'>
  102. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  103. <input id="${po.fieldName}" name="${po.fieldName}" type="text"<@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/>style="background: url('plug-in/ace/images/datetime.png') no-repeat scroll right center transparent;" class="form-control" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" />
  104. <#-- update--end--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  105. <#elseif po.showType=='datetime'>
  106. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  107. <input id="${po.fieldName}" name="${po.fieldName}" type="text" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/>style="background: url('plug-in/ace/images/datetime.png') no-repeat scroll right center transparent;" class="form-control" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" />
  108. <#-- update--end--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  109. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  110. <#elseif po.showType=='file' || po.showType == 'image'>
  111. <#assign fileName = fileName + "${po.fieldName}," />
  112. <#-- update--end--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  113. <table></table>
  114. <div class="form jeecgDetail">
  115. <script type="text/javascript">
  116. var serverMsg="";
  117. $(function(){
  118. $('#${po.fieldName}').uploadify({
  119. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  120. <#if po.showType == 'image'>
  121. buttonText:'添加图片',
  122. <#else>
  123. buttonText:'添加文件',
  124. </#if>
  125. <#-- update--end--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  126. auto:false,
  127. progressData:'speed',
  128. multi:true,
  129. height:25,
  130. overrideEvents:['onDialogClose'],
  131. fileTypeDesc:'文件格式:',
  132. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  133. queueID:'filediv_${po.fieldName}',
  134. <#-- update--end--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  135. <#-- fileTypeExts:'*.rar;*.zip;*.doc;*.docx;*.txt;*.ppt;*.xls;*.xlsx;*.html;*.htm;*.pdf;*.jpg;*.gif;*.png', 页面弹出很慢解决 20170317 scott -->
  136. fileSizeLimit:'15MB',
  137. swf:'plug-in/uploadify/uploadify.swf',
  138. uploader:'cgUploadController.do?saveFiles&jsessionid='+$("#sessionUID").val()+'',
  139. onUploadStart : function(file) {
  140. var cgFormId=$("input[name='id']").val();
  141. $('#${po.fieldName}').uploadify("settings", "formData", {
  142. 'cgFormId':cgFormId,
  143. 'cgFormName':'${tableName}',
  144. 'cgFormField':'${fieldMeta[po.fieldName]}'
  145. });
  146. } ,
  147. onQueueComplete : function(queueData) {
  148. var win = frameElement.api.opener;
  149. win.reloadTable();
  150. win.tip(serverMsg);
  151. frameElement.api.close();
  152. },
  153. onUploadSuccess : function(file, data, response) {
  154. var d=$.parseJSON(data);
  155. if(d.success){
  156. var win = frameElement.api.opener;
  157. serverMsg = d.msg;
  158. }
  159. },
  160. onFallback: function() {
  161. tip("您未安装FLASH控件,无法上传图片!请安装FLASH控件后再试")
  162. },
  163. onSelectError: function(file, errorCode, errorMsg) {
  164. switch (errorCode) {
  165. case - 100 : tip("上传的文件数量已经超出系统限制的" + $('#file').uploadify('settings', 'queueSizeLimit') + "个文件!");
  166. break;
  167. case - 110 : tip("文件 [" + file.name + "] 大小超出系统限制的" + $('#file').uploadify('settings', 'fileSizeLimit') + "大小!");
  168. break;
  169. case - 120 : tip("文件 [" + file.name + "] 大小异常!");
  170. break;
  171. case - 130 : tip("文件 [" + file.name + "] 类型不正确!");
  172. break;
  173. }
  174. },
  175. onUploadProgress: function(file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal) {}
  176. });
  177. });
  178. </script>
  179. <span id="file_uploadspan"><input type="file" name="${po.fieldName}" id="${po.fieldName}" /></span>
  180. </div>
  181. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  182. <div class="form" id="filediv_${po.fieldName}"></div>
  183. <#-- update--end--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  184. <#--update-start--Author: jg_huangxg Date:20160421 for:TASK #1027 【online】代码生成器模板不支持UE编辑器 -->
  185. <#elseif po.showType='umeditor'>
  186. <#-- update--begin--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  187. <#assign ue_widget_count = ue_widget_count + 1>
  188. <#if ue_widget_count == 1>
  189. <script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.config.js"></script>
  190. <script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.all.min.js"></script>
  191. </#if>
  192. <#-- update--end--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  193. <textarea name="${po.fieldName}" id="${po.fieldName}" style="width: 650px;height:300px"></textarea>
  194. <script type="text/javascript">
  195. <#-- update--begin--author:zhangjiaqiang date:20170522 for:editor编辑器变量唯一 -->
  196. var ${po.fieldName}_editor = UE.getEditor('${po.fieldName}');
  197. <#-- update--begin--author:zhangjiaqiang date:20170522 for:editor编辑器变量唯一 -->
  198. </script>
  199. <#--update-end--Author: jg_huangxg Date:20160421 for:TASK #1027 【online】代码生成器模板不支持UE编辑器 -->
  200. <#else>
  201. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  202. <input id="${po.fieldName}" name="${po.fieldName}" type="text" style="width: 150px" class="form-control"<@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> >
  203. <#-- update--end--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  204. </#if>
  205. <span class="Validform_checktip" style="float:left;height:0px;"></span>
  206. <label class="Validform_label" style="display: none">${po.content?if_exists?html}</label>
  207. </div>
  208. <#if (pageColumns?size>10)>
  209. <#if (po_index%2==0)&&(!po_has_next)>
  210. <div class="col-xs-2 text-center"><b></b></div>
  211. <div class="col-xs-4"></div>
  212. </#if>
  213. <#if (po_index%2!=0)||(!po_has_next)>
  214. </div>
  215. </#if>
  216. <#else>
  217. </div>
  218. </#if>
  219. </#list>
  220. <#-- update--begin--author:zhoujf Date:20170523 for:TASK #1961 【代码生成器】一对多富文本编辑器,生成代码格式问题 -->
  221. <#list pageAreatextColumns as po>
  222. <div class="row show-grid">
  223. <div class="col-xs-3 text-center">
  224. <b>${po.content}:</b>
  225. </div>
  226. <div class="col-xs-3">
  227. <#if po.showType=='textarea'>
  228. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  229. <textarea id="${po.fieldName}" class="form-control" rows="6" style="width: 600px" name="${po.fieldName}" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}"/>></textarea>
  230. <#-- update--end--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  231. <#elseif po.showType='umeditor'>
  232. <#-- update--begin--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  233. <#assign ue_widget_count = ue_widget_count + 1>
  234. <#if ue_widget_count == 1>
  235. <script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.config.js"></script>
  236. <script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.all.min.js"></script>
  237. </#if>
  238. <#-- update--end--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  239. <textarea name="${po.fieldName}" id="${po.fieldName}" style="width: 650px;height:300px"></textarea>
  240. <script type="text/javascript">
  241. <#-- update--begin--author:zhangjiaqiang date:20170522 for:editor编辑器变量唯一 -->
  242. var ${po.fieldName}_editor = UE.getEditor('${po.fieldName}');
  243. <#-- update--begin--author:zhangjiaqiang date:20170522 for:editor编辑器变量唯一 -->
  244. </script>
  245. </#if>
  246. <span class="Validform_checktip" style="float:left;height:0px;"></span>
  247. <label class="Validform_label" style="display: none">${po.content?if_exists?html}</label>
  248. </div>
  249. </div>
  250. </#list>
  251. <#-- update--end--author:zhoujf Date:20170523 for:TASK #1961 【代码生成器】一对多富文本编辑器,生成代码格式问题 -->
  252. <div class="row" id = "sub_tr" style="display: none;">
  253. <div class="col-xs-12 layout-header">
  254. <div class="col-xs-6"></div>
  255. <div class="col-xs-6"><button type="button" onclick="neibuClick();" class="btn btn-default">提交</button></div>
  256. </div>
  257. </div>
  258. </div>
  259. </div>
  260. <div class="con-wrapper" id="con-wrapper2" style="display: block;"></div>
  261. </div>
  262. </t:formvalid>
  263. <#if callbackFlag == true>
  264. <script type="text/javascript">
  265. function jeecgFormFileCallBack(data){
  266. if (data.success == true) {
  267. uploadFile(data);
  268. } else {
  269. if (data.responseText == '' || data.responseText == undefined) {
  270. $.messager.alert('错误', data.msg);
  271. $.Hidemsg();
  272. } else {
  273. try {
  274. var emsg = data.responseText.substring(data.responseText.indexOf('错误描述'), data.responseText.indexOf('错误信息'));
  275. $.messager.alert('错误', emsg);
  276. $.Hidemsg();
  277. } catch(ex) {
  278. $.messager.alert('错误', data.responseText + '');
  279. }
  280. }
  281. return false;
  282. }
  283. if (!neibuClickFlag) {
  284. var win = frameElement.api.opener;
  285. win.reloadTable();
  286. }
  287. }
  288. function upload() {
  289. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  290. <#assign subFileName = fileName?substring(0,fileName?length - 1) />
  291. <#list subFileName?split(",") as name>
  292. $('#${name}').uploadify('upload', '*');
  293. </#list>
  294. <#-- update--end--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  295. }
  296. var neibuClickFlag = false;
  297. function neibuClick() {
  298. neibuClickFlag = true;
  299. $('#btn_sub').trigger('click');
  300. }
  301. function cancel() {
  302. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  303. <#assign subFileName = fileName?substring(0,fileName?length - 1) />
  304. <#list subFileName?split(",") as name>
  305. $('#${name}').uploadify('cancel', '*');
  306. </#list>
  307. <#-- update--end--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  308. }
  309. function uploadFile(data){
  310. if(!$("input[name='id']").val()){
  311. if(data.obj!=null && data.obj!='undefined'){
  312. $("input[name='id']").val(data.obj.id);
  313. }
  314. }
  315. if($(".uploadify-queue-item").length>0){
  316. upload();
  317. }else{
  318. if (neibuClickFlag){
  319. alert(data.msg);
  320. neibuClickFlag = false;
  321. }else {
  322. var win = frameElement.api.opener;
  323. win.reloadTable();
  324. win.tip(data.msg);
  325. frameElement.api.close();
  326. }
  327. }
  328. }
  329. </script>
  330. </#if>
  331. <script type="text/javascript">
  332. $(function(){
  333. //查看模式情况下,删除和上传附件功能禁止使用
  334. if(location.href.indexOf("load=detail")!=-1){
  335. $(".jeecgDetail").hide();
  336. }
  337. if(location.href.indexOf("mode=read")!=-1){
  338. //查看模式控件禁用
  339. $("#formobj").find(":input").attr("disabled","disabled");
  340. }
  341. if(location.href.indexOf("mode=onbutton")!=-1){
  342. //其他模式显示提交按钮
  343. $("#sub_tr").show();
  344. }
  345. });
  346. var neibuClickFlag = false;
  347. function neibuClick() {
  348. neibuClickFlag = true;
  349. $('#btn_sub').trigger('click');
  350. }
  351. </script>
  352. </body>
  353. <script src = "webpage/${bussiPackage?replace('.','/')}/${entityPackage}/${entityName?uncap_first}.js"></script>
  354. </html>