cgform_jspTemplate_update.ftl 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@include file="/context/mytags.jsp"%>
  3. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  4. <#include "../../ui/datatype.ftl"/>
  5. <#include "../../ui/dictInfo.ftl"/>
  6. <#-- update--end--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  7. <!DOCTYPE html>
  8. <#assign callbackFlag = false />
  9. <#assign fileName = "" />
  10. <#list pageColumns as callBackTestPo>
  11. <#if callBackTestPo.showType=='file' || callBackTestPo.showType == 'image'>
  12. <#assign callbackFlag = true />
  13. <#break>
  14. </#if>
  15. </#list>
  16. <html lang="zh-CN">
  17. <head>
  18. <meta charset="utf-8">
  19. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  20. <title>${ftl_description}</title>
  21. <meta name="description" content="">
  22. <meta name="viewport" content="width=device-width, initial-scale=1">
  23. <link rel="stylesheet" href="online/template/ledefault/css/vendor.css">
  24. <link rel="stylesheet" href="online/template/ledefault/css/bootstrap-theme.css">
  25. <link rel="stylesheet" href="online/template/ledefault/css/bootstrap.css">
  26. <link rel="stylesheet" href="online/template/ledefault/css/app.css">
  27. <link rel="stylesheet" href="plug-in/Validform/css/metrole/style.css" type="text/css"/>
  28. <link rel="stylesheet" href="plug-in/Validform/css/metrole/tablefrom.css" type="text/css"/>
  29. <script type="text/javascript" src="plug-in/jquery/jquery-1.9.0.js"></script>
  30. <script type="text/javascript" src="plug-in/tools/dataformat.js"></script>
  31. <script type="text/javascript" src="plug-in/easyui/jquery.easyui.min.1.3.2.js"></script>
  32. <script type="text/javascript" src="plug-in/easyui/locale/zh-cn.js"></script>
  33. <script type="text/javascript" src="plug-in/tools/syUtil.js"></script>
  34. <script type="text/javascript" src="plug-in/My97DatePicker/WdatePicker.js"></script>
  35. <script type="text/javascript" src="plug-in/lhgDialog/lhgdialog.min.js"></script>
  36. <script type="text/javascript" src="plug-in/tools/curdtools_zh-cn.js"></script>
  37. <script type="text/javascript" src="plug-in/tools/easyuiextend.js"></script>
  38. <script type="text/javascript" src="plug-in/Validform/js/Validform_v5.3.1_min_zh-cn.js"></script>
  39. <script type="text/javascript" src="plug-in/Validform/js/Validform_Datatype_zh-cn.js"></script>
  40. <script type="text/javascript" src="plug-in/Validform/js/datatype_zh-cn.js"></script>
  41. <script type="text/javascript" src="plug-in/Validform/plugin/passwordStrength/passwordStrength-min.js"></script>
  42. <#if callbackFlag == true>
  43. <link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css" />
  44. <script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.js"></script>
  45. </#if>
  46. <script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.config.js"></script>
  47. <script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.all.min.js"></script>
  48. </head>
  49. <script type="text/javascript">
  50. $(document).ready(function(){
  51. init();
  52. $("#jform_tab .con-wrapper").hide(); //Hide all tab content
  53. $("#jform_tab li:first").addClass("active").show(); //Activate first tab
  54. $("#jform_tab .con-wrapper:first").show(); //Show first tab content
  55. //On Click Event
  56. $("#jform_tab li").click(function() {
  57. $("#jform_tab li").removeClass("active"); //Remove any "active" class
  58. $(this).addClass("active"); //Add "active" class to selected tab
  59. $("#jform_tab .con-wrapper").hide(); //Hide all tab content
  60. var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
  61. $(activeTab).fadeIn(); //Fade in the active content
  62. //$(""+activeTab).show();
  63. if( $(activeTab).html()!="") {
  64. return false;
  65. }else{
  66. $(activeTab).html('正在加载内容,请稍后...');
  67. var url = $(this).attr("tab-ajax-url");
  68. $.post(url, {}, function(data) {
  69. //$(this).attr("tab-ajax-cached", true);
  70. $(activeTab).html(data);
  71. });
  72. }
  73. return false;
  74. });
  75. });
  76. //初始化下标
  77. function resetTrNum(tableId) {
  78. $tbody = $("#"+tableId+"");
  79. $tbody.find('>tr').each(function(i){
  80. $(':input, select', this).each(function(){
  81. var $this = $(this), name = $this.attr('name'), val = $this.val();
  82. if(name!=null){
  83. if (name.indexOf("#index#") >= 0){
  84. $this.attr("name",name.replace('#index#',i));
  85. }else{
  86. var s = name.indexOf("[");
  87. var e = name.indexOf("]");
  88. var new_name = name.substring(s+1,e);
  89. $this.attr("name",name.replace(new_name,i));
  90. }
  91. }
  92. });
  93. $(this).find('div[name=\'xh\']').html(i+1);
  94. });
  95. }
  96. function init(){
  97. var tabHead =$("#jform_tab li:first");
  98. var tabBox = $("#jform_tab .con-wrapper:first");
  99. var url = tabHead.attr("tab-ajax-url");
  100. tabBox.html('正在加载内容,请稍后...');
  101. $.post(url, {}, function(data) {
  102. tabBox.html(data);
  103. //tabHead.attr("tab-ajax-cached", true);
  104. });
  105. }
  106. </script>
  107. <body>
  108. <#-- update--begin--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  109. <#assign ue_widget_count = 0>
  110. <#-- update--end--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  111. <form id="formobj" action="${entityName?uncap_first}Controller.do?doUpdate" name="formobj" method="post"><input type="hidden" id="btn_sub" class="btn_sub"/>
  112. <input type="hidden" id="btn_sub" class="btn_sub"/>
  113. <input type="hidden" name="id" value='${'$'}{${entityName?uncap_first}Page.id}' >
  114. <div class="tab-wrapper">
  115. <!-- tab -->
  116. <ul class="nav nav-tabs">
  117. <li role="presentation" class="active"><a href="javascript:void(0);">${ftl_description}</a></li>
  118. </ul>
  119. <!-- tab内容 -->
  120. <div class="con-wrapper" style="display: block;">
  121. <div class="row form-wrapper">
  122. <#list pageColumns as po>
  123. <#if (pageColumns?size>1)>
  124. <#if po_index%2==0>
  125. <div class="row show-grid">
  126. </#if>
  127. <#else>
  128. <div class="row show-grid">
  129. </#if>
  130. <div class="col-xs-3 text-center">
  131. <b>${po.content}:</b>
  132. </div>
  133. <div class="col-xs-3">
  134. <#if po.showType=='text'>
  135. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  136. <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!''}" /> value='${'$'}{${entityName?uncap_first}Page.${po.fieldName}}' />
  137. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  138. <#elseif po.showType=='popup'>
  139. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  140. <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> value='${'$'}{${entityName?uncap_first}Page.${po.fieldName}}' />
  141. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  142. <#elseif po.showType=='textarea'>
  143. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  144. <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!''}" />>${'$'}{${entityName?uncap_first}Page.${po.fieldName}}</textarea>
  145. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  146. <#elseif po.showType=='password'>
  147. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  148. <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!''}" /> value='${'$'}{${entityName?uncap_first}Page.${po.fieldName}}' />
  149. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  150. <#elseif po.showType=='radio' || po.showType=='select' || po.showType=='checkbox' || po.showType=='list'>
  151. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  152. <t:dictSelect field="${po.fieldName}" type="${po.showType?if_exists?html}" extendJson="{class:'form-control',style:'width:150px'}" <@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}" /> defaultVal="${'$'}{${entityName?uncap_first}Page.${po.fieldName}}" hasLabel="false" title="${po.content}"></t:dictSelect>
  153. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  154. <#elseif po.showType=='date'>
  155. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  156. <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()" value="<fmt:formatDate value='${'$'}{${entityName?uncap_first}Page.${po.fieldName}}' type='date' pattern='yyyy-MM-dd'/>" />
  157. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  158. <#elseif po.showType=='datetime'>
  159. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  160. <input id="${po.fieldName}" name="${po.fieldName}" type="text" 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'})" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> value="<fmt:formatDate value='${'$'}{${entityName?uncap_first}Page.${po.fieldName}}' type='date' pattern='yyyy-MM-dd hh:mm:ss'/>" />
  161. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  162. <#elseif po.showType=='file' || po.showType == 'image'>
  163. <table id="${fieldMeta[po.fieldName]?lower_case}_fileTable"></table>
  164. <#if !(po.operationCodesReadOnly ??)>
  165. <#assign fileName = fileName + "${po.fieldName}," />
  166. <table></table>
  167. <script type="text/javascript">
  168. var serverMsg="";
  169. $(function(){
  170. $('#${po.fieldName}').uploadify({
  171. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  172. <#if po.showType == 'image'>
  173. buttonText:'添加图片',
  174. <#else>
  175. buttonText:'添加文件',
  176. </#if>
  177. <#-- update--end--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  178. auto:false,
  179. progressData:'speed',
  180. multi:true,
  181. height:25,
  182. overrideEvents:['onDialogClose'],
  183. fileTypeDesc:'文件格式:',
  184. queueID:'filediv_${po.fieldName}',
  185. <#-- fileTypeExts:'*.rar;*.zip;*.doc;*.docx;*.txt;*.ppt;*.xls;*.xlsx;*.html;*.htm;*.pdf;*.jpg;*.gif;*.png', 页面弹出很慢解决 20170317 scott -->
  186. fileSizeLimit:'15MB',
  187. swf:'plug-in/uploadify/uploadify.swf',
  188. uploader:'cgUploadController.do?saveFiles&jsessionid='+$("#sessionUID").val()+'',
  189. onUploadStart : function(file) {
  190. var cgFormId=$("input[name='id']").val();
  191. $('#${po.fieldName}').uploadify("settings", "formData", {
  192. 'cgFormId':cgFormId,
  193. 'cgFormName':'${tableName}',
  194. 'cgFormField':'${fieldMeta[po.fieldName]}'
  195. });
  196. } ,
  197. onQueueComplete : function(queueData) {
  198. var win = frameElement.api.opener;
  199. win.reloadTable();
  200. win.tip(serverMsg);
  201. frameElement.api.close();
  202. },
  203. onUploadSuccess : function(file, data, response) {
  204. var d=$.parseJSON(data);
  205. if(d.success){
  206. var win = frameElement.api.opener;
  207. serverMsg = d.msg;
  208. }
  209. },
  210. onFallback: function() {
  211. tip("您未安装FLASH控件,无法上传图片!请安装FLASH控件后再试")
  212. },
  213. onSelectError: function(file, errorCode, errorMsg) {
  214. switch (errorCode) {
  215. case - 100 : tip("上传的文件数量已经超出系统限制的" + $('#file').uploadify('settings', 'queueSizeLimit') + "个文件!");
  216. break;
  217. case - 110 : tip("文件 [" + file.name + "] 大小超出系统限制的" + $('#file').uploadify('settings', 'fileSizeLimit') + "大小!");
  218. break;
  219. case - 120 : tip("文件 [" + file.name + "] 大小异常!");
  220. break;
  221. case - 130 : tip("文件 [" + file.name + "] 类型不正确!");
  222. break;
  223. }
  224. },
  225. onUploadProgress: function(file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal) {}
  226. });
  227. });
  228. </script>
  229. <span id="file_uploadspan"><input type="file" name="${po.fieldName}" id="${po.fieldName}" /></span>
  230. <div class="form" id="filediv_${po.fieldName}"></div>
  231. </#if>
  232. <#--update-start--Author: jg_huangxg Date:20160421 for:TASK #1027 【online】代码生成器模板不支持UE编辑器 -->
  233. <#elseif po.showType='umeditor'>
  234. <#-- update--begin--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  235. <#assign ue_widget_count = ue_widget_count + 1>
  236. <#if ue_widget_count == 1>
  237. <script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.config.js"></script>
  238. <script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.all.min.js"></script>
  239. </#if>
  240. <#-- update--end--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  241. <#--update-start--Author: dangzhenghui Date:20170510 for:TASK #1899 【代码生成器bug】控件类型为UE编辑器 ,编辑页面内容显示为空-->
  242. <textarea name="${po.fieldName}" id="${po.fieldName}" style="width: 650px;height:300px">${'$'}{${entityName?uncap_first}Page.${po.fieldName} }</textarea>
  243. <#--update-end--Author: dangzhenghui Date:20170510 for:TASK #1899 【代码生成器bug】控件类型为UE编辑器 ,编辑页面内容显示为空-->
  244. <script type="text/javascript">
  245. <#-- update--begin--author:zhangjiaqiang date:20170522 for:editor编辑器变量唯一 -->
  246. var ${po.fieldName}_editor = UE.getEditor('${po.fieldName}');
  247. <#-- update--begin--author:zhangjiaqiang date:20170522 for:editor编辑器变量唯一 -->
  248. </script>
  249. <#--update-end--Author: jg_huangxg Date:20160421 for:TASK #1027 【online】代码生成器模板不支持UE编辑器 -->
  250. <#else>
  251. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  252. <input id="${po.fieldName}" name="${po.fieldName}" type="text" style="width: 150px" class="form-control" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> value='${'$'}{${entityName?uncap_first}Page.${po.fieldName}}'/>
  253. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  254. </#if>
  255. <span class="Validform_checktip" style="float:left;height:0px;"></span>
  256. <label class="Validform_label" style="display: none">${po.content?if_exists?html}</label>
  257. </div>
  258. <#if (pageColumns?size>1)>
  259. <#if (po_index%2==0)&&(!po_has_next)>
  260. <div class="col-xs-2 text-center"><b></b></div>
  261. <div class="col-xs-4"></div>
  262. </#if>
  263. <#if (po_index%2!=0)||(!po_has_next)>
  264. </div>
  265. </#if>
  266. <#else>
  267. </div>
  268. </#if>
  269. </#list>
  270. <#-- update--begin--author:zhoujf Date:20170523 for:TASK #1961 【代码生成器】一对多富文本编辑器,生成代码格式问题 -->
  271. <#list pageAreatextColumns as po>
  272. <div class="row show-grid">
  273. <div class="col-xs-3 text-center">
  274. <b>${po.content}:</b>
  275. </div>
  276. <div class="col-xs-3">
  277. <#if po.showType=='textarea'>
  278. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  279. <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!''}" />>${'$'}{${entityName?uncap_first}Page.${po.fieldName}}</textarea>
  280. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  281. <#elseif po.showType='umeditor'>
  282. <#-- update--begin--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  283. <#assign ue_widget_count = ue_widget_count + 1>
  284. <#if ue_widget_count == 1>
  285. <script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.config.js"></script>
  286. <script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.all.min.js"></script>
  287. </#if>
  288. <#-- update--end--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  289. <#--update-start--Author: dangzhenghui Date:20170510 for:TASK #1899 【代码生成器bug】控件类型为UE编辑器 ,编辑页面内容显示为空-->
  290. <textarea name="${po.fieldName}" id="${po.fieldName}" style="width: 650px;height:300px">${'$'}{${entityName?uncap_first}Page.${po.fieldName} }</textarea>
  291. <#--update-end--Author: dangzhenghui Date:20170510 for:TASK #1899 【代码生成器bug】控件类型为UE编辑器 ,编辑页面内容显示为空-->
  292. <script type="text/javascript">
  293. <#-- update--begin--author:zhangjiaqiang date:20170522 for:editor编辑器变量唯一 -->
  294. var ${po.fieldName}_editor = UE.getEditor('${po.fieldName}');
  295. <#-- update--begin--author:zhangjiaqiang date:20170522 for:editor编辑器变量唯一 -->
  296. </script>
  297. </#if>
  298. <span class="Validform_checktip" style="float:left;height:0px;"></span>
  299. <label class="Validform_label" style="display: none">${po.content?if_exists?html}</label>
  300. </div>
  301. </div>
  302. </#list>
  303. <#-- update--end--author:zhoujf Date:20170523 for:TASK #1961 【代码生成器】一对多富文本编辑器,生成代码格式问题 -->
  304. </div>
  305. </div>
  306. <div class="con-wrapper" style="display: block;"></div>
  307. </div>
  308. <script type="text/javascript">
  309. $(function(){
  310. //查看模式情况下,删除和上传附件功能禁止使用
  311. if(location.href.indexOf("load=detail")!=-1){
  312. $(".jeecgDetail").hide();
  313. }
  314. if(location.href.indexOf("mode=read")!=-1){
  315. //查看模式控件禁用
  316. $("#formobj").find(":input").attr("disabled","disabled");
  317. }
  318. if(location.href.indexOf("mode=onbutton")!=-1){
  319. //其他模式显示提交按钮
  320. $("#sub_tr").show();
  321. }
  322. });
  323. var neibuClickFlag = false;
  324. function neibuClick() {
  325. neibuClickFlag = true;
  326. $('#btn_sub').trigger('click');
  327. }
  328. </script>
  329. <div id="jform_tab" class="tab-wrapper">
  330. <!-- tab -->
  331. <ul class="nav nav-tabs">
  332. <#list subTab as sub>
  333. <li role="presentation" tab-ajax-url="${entityName?uncap_first}Controller.do?${sub.entityName?uncap_first}List<#list sub.foreignKeys as key><#if key?lower_case?index_of("${jeecg_table_id}")!=-1>&${jeecg_table_id}=${"$"}{${entityName?uncap_first}Page.${jeecg_table_id}}<#else>&${key?uncap_first}=${"$"}{${entityName?uncap_first}Page.${key?uncap_first}}</#if></#list>"><a href="#con-wrapper${sub_index}">${sub.ftlDescription}</a></li>
  334. </#list>
  335. </ul>
  336. <#list subTab as sub>
  337. <div class="con-wrapper" id="con-wrapper${sub_index}" style="display: none;"></div>
  338. </#list>
  339. </div>
  340. <div align="center" id = "sub_tr" style="display: none;" > <input type="button" value="提交" onclick="neibuClick();" class="ui_state_highlight"></div>
  341. <script src="plug-in/layer/layer.js"></script>
  342. <script type="text/javascript">
  343. $(function() {
  344. $("#formobj").Validform({
  345. tiptype: function(msg, o, cssctl) {
  346. if (o.type == 3) {
  347. layer.open({
  348. title: '提示信息',
  349. content: msg,
  350. icon: 5,
  351. shift: 6,
  352. btn: false,
  353. shade:false,time:5000,
  354. cancel: function(index) {
  355. o.obj.focus();
  356. layer.close(index);
  357. },
  358. yes: function(index) {
  359. o.obj.focus();
  360. layer.close(index);
  361. },
  362. })
  363. }
  364. },
  365. btnSubmit: "#btn_sub",
  366. btnReset: "#btn_reset",
  367. ajaxPost: true,
  368. beforeSubmit: function(curform) {
  369. var tag = true;
  370. //提交前处理
  371. return tag;
  372. },
  373. usePlugin: {
  374. passwordstrength: {
  375. minLen: 6,
  376. maxLen: 18,
  377. trigger: function(obj, error) {
  378. if (error) {
  379. obj.parent().next().find(".Validform_checktip").show();
  380. obj.find(".passwordStrength").hide();
  381. } else {
  382. $(".passwordStrength").show();
  383. obj.parent().next().find(".Validform_checktip").hide();
  384. }
  385. }
  386. }
  387. },
  388. callback: function(data) {
  389. <#-- update--begin--author:zhangjiaqiang date:20170607 for:修订回调函数的调用方式 -->
  390. <#if callbackFlag == true>
  391. jeecgFormFileCallBack(data);
  392. <#else>
  393. if (data.success == true) {
  394. var win = frameElement.api.opener;
  395. win.reloadTable();
  396. win.tip(data.msg);
  397. frameElement.api.close();
  398. } else {
  399. if (data.responseText == '' || data.responseText == undefined) {
  400. $.messager.alert('错误', data.msg);
  401. $.Hidemsg();
  402. } else {
  403. try {
  404. var emsg = data.responseText.substring(data.responseText.indexOf('错误描述'), data.responseText.indexOf('错误信息'));
  405. $.messager.alert('错误', emsg);
  406. $.Hidemsg();
  407. } catch(ex) {
  408. $.messager.alert('错误', data.responseText + '');
  409. }
  410. }
  411. return false;
  412. }
  413. </#if>
  414. <#-- update--begin--author:zhangjiaqiang date:20170607 for:修订回调函数的调用方式 -->
  415. }
  416. });
  417. });
  418. </script>
  419. </form>
  420. <!-- 添加 产品明细 模版 -->
  421. <table style="display:none">
  422. <#list subTab as sub>
  423. <tbody id="add_${sub.entityName?uncap_first}_table_template">
  424. <tr>
  425. <th scope="row"><div name="xh"></div></th>
  426. <td><input style="width:20px;" type="checkbox" name="ck"/></td>
  427. <#list subPageColumnsMap[sub.tableName] as po>
  428. <#assign check = 0 >
  429. <#list sub.foreignKeys as key>
  430. <#if subFieldMeta[po.fieldName]==key?uncap_first>
  431. <#assign check = 1 >
  432. <#break>
  433. </#if>
  434. </#list>
  435. <#if check==0>
  436. <td align="left">
  437. <#if po.showType == "text">
  438. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  439. <input name="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" maxlength="${po.length?c}" type="text" class="form-control" style="width:120px;" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/>/>
  440. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  441. <#elseif po.showType=='password'>
  442. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  443. <input name="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" maxlength="${po.length?c}" type="password" class="form-control" style="width:120px;"<@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/>/>
  444. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  445. <#elseif po.showType=='radio' || po.showType=='select' || po.showType=='checkbox' || po.showType=='list'>
  446. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  447. <t:dictSelect field="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" type="${po.showType?if_exists?html}" extendJson="{class:'form-control',style:'width:150px'}" <#if po.isNull != 'Y'>datatype="*"</#if><@dictInfo dictTable="${po.dictTable}" dictField="${po.dictField}" dictText="${po.dictText}" />defaultVal="" hasLabel="false" title="${po.content}"></t:dictSelect>
  448. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  449. <#elseif po.showType=='date'>
  450. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  451. <input name="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" maxlength="${po.length?c}"
  452. type="text" class="form-control" onClick="WdatePicker()" style="background: url('plug-in/ace/images/datetime.png') no-repeat scroll right center transparent;width:160px;"<@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/>/>
  453. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  454. <#elseif po.showType=='datetime'>
  455. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  456. <input name="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" maxlength="${po.length?c}"
  457. type="text" class="form-control" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" style="background: url('plug-in/ace/images/datetime.png') no-repeat scroll right center transparent;width:160px;"<@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/>/>
  458. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  459. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  460. <#elseif po.showType=='file' || po.showType == 'image'>
  461. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  462. <input type="hidden" id="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" name="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" />
  463. <a target="_blank" id="${sub.entityName?uncap_first}List[#index#].${po.fieldName}_href">未上传</a>
  464. <#-- update--begin--author:zhangjiaqiang date:20170614 for:修订上传附件按钮的大小 -->
  465. <input class="btn btn-sm btn-success" style="margin-left:10px;" type="button" value="上传附件"
  466. onclick="commonUpload(commonUploadDefaultCallBack,'${sub.entityName?uncap_first}List\\[#index#\\]\\.${po.fieldName}')"/>
  467. <#-- update--begin--author:zhangjiaqiang date:20170614 for:修订上传附件按钮的大小 -->
  468. <#else>
  469. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  470. <input name="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" maxlength="${po.length?c}" type="text" class="form-control" style="width:120px;"<@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/>/>
  471. <#-- update--begin--author:zhangjiaqiang Date:20170509 for:修订生成页面乱 -->
  472. </#if>
  473. <label class="Validform_label" style="display: none;">${po.content?if_exists?html}</label>
  474. </td>
  475. </#if>
  476. </#list>
  477. </tr>
  478. </tbody>
  479. </#list>
  480. </table>
  481. <script src = "webpage/${bussiPackage?replace('.','/')}/${entityPackage}/${entityName?uncap_first}.js"></script>
  482. <#if callbackFlag == true>
  483. <script type="text/javascript">
  484. //加载 已存在的 文件
  485. $(function(){
  486. var cgFormId=$("input[name='id']").val();
  487. $.ajax({
  488. type: "post",
  489. url: "${entityName?uncap_first}Controller.do?getFiles&id=" + cgFormId,
  490. success: function(data){
  491. var arrayFileObj = jQuery.parseJSON(data).obj;
  492. $.each(arrayFileObj,function(n,file){
  493. <#-- update--begin--author:zhangjiaqiang date:20170531 for:多个附件的数据显示 -->
  494. var fieldName = file.field.toLowerCase();
  495. var table = $("#"+fieldName+"_fileTable");
  496. <#-- update--end--author:zhangjiaqiang date:20170531 for:多个附件的数据显示 -->
  497. var tr = $("<tr style=\"height:34px;\"></tr>");
  498. <#-- update--begin--author:zhangjiaqiang date:20170614 for:文件名称太长显示问题 -->
  499. var title = file.title;
  500. if(title.length > 15){
  501. title = title.substring(0,12) + "...";
  502. }
  503. var td_title = $("<td>" + title + "</td>");
  504. <#-- update--end--author:zhangjiaqiang date:20170614 for:文件名称太长显示问题 -->
  505. <#-- update--begin--author:zhangjiaqiang date:20170607 for:增加按钮之间的间隔 -->
  506. var td_download = $("<td><a style=\"margin-left:10px;\" href=\"commonController.do?viewFile&fileid=" + file.fileKey + "&subclassname=org.jeecgframework.web.cgform.entity.upload.CgUploadEntity\" title=\"下载\">下载</a></td>")
  507. var td_view = $("<td><a style=\"margin-left:10px;\" href=\"javascript:void(0);\" onclick=\"openwindow('预览','commonController.do?openViewFile&fileid=" + file.fileKey + "&subclassname=org.jeecgframework.web.cgform.entity.upload.CgUploadEntity','fList',700,500)\">预览</a></td>");
  508. var td_del = $("<td><a style=\"margin-left:10px;\" href=\"javascript:void(0)\" class=\"jeecgDetail\" onclick=\"del('cgUploadController.do?delFile&id=" + file.fileKey + "',this)\">删除</a></td>");
  509. <#-- update--end--author:zhangjiaqiang date:20170607 for:增加按钮之间的间隔 -->
  510. tr.appendTo(table);
  511. td_title.appendTo(tr);
  512. td_download.appendTo(tr);
  513. td_view.appendTo(tr);
  514. td_del.appendTo(tr);
  515. });
  516. }
  517. });
  518. })
  519. <#-- update--begin--author:zhangjiaqiang date:20170531 for:附件资源删除处理 -->
  520. /**
  521. * 删除图片数据资源
  522. */
  523. function del(url,obj){
  524. var content = "请问是否要删除该资源";
  525. var navigatorName = "Microsoft Internet Explorer";
  526. if( navigator.appName == navigatorName ){
  527. $.dialog.confirm(content, function(){
  528. submit(url,obj);
  529. }, function(){
  530. });
  531. }else{
  532. layer.open({
  533. title:"提示",
  534. content:content,
  535. icon:7,
  536. yes:function(index){
  537. submit(url,obj);
  538. },
  539. btn:['确定','取消'],
  540. btn2:function(index){
  541. layer.close(index);
  542. }
  543. });
  544. }
  545. }
  546. function submit(url,obj){
  547. $.ajax({
  548. async : false,
  549. cache : false,
  550. type : 'POST',
  551. url : url,// 请求的action路径
  552. error : function() {// 请求失败处理函数
  553. },
  554. success : function(data) {
  555. var d = $.parseJSON(data);
  556. if (d.success) {
  557. var msg = d.msg;
  558. tip(msg);
  559. obj.parentNode.parentNode.parentNode.deleteRow(obj.parentNode.parentNode);
  560. } else {
  561. tip(d.msg);
  562. }
  563. }
  564. });
  565. }
  566. <#-- update--end--author:zhangjiaqiang date:20170531 for:附件资源删除处理 -->
  567. function jeecgFormFileCallBack(data){
  568. if (data.success == true) {
  569. uploadFile(data);
  570. } else {
  571. if (data.responseText == '' || data.responseText == undefined) {
  572. $.messager.alert('错误', data.msg);
  573. $.Hidemsg();
  574. } else {
  575. try {
  576. var emsg = data.responseText.substring(data.responseText.indexOf('错误描述'), data.responseText.indexOf('错误信息'));
  577. $.messager.alert('错误', emsg);
  578. $.Hidemsg();
  579. } catch(ex) {
  580. $.messager.alert('错误', data.responseText + '');
  581. }
  582. }
  583. return false;
  584. }
  585. if (!neibuClickFlag) {
  586. var win = frameElement.api.opener;
  587. win.reloadTable();
  588. }
  589. }
  590. function upload() {
  591. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  592. <#assign subFileName = fileName?substring(0,fileName?length - 1) />
  593. <#list subFileName?split(",") as name>
  594. $('#${name}').uploadify('upload', '*');
  595. </#list>
  596. <#-- update--end--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  597. }
  598. var neibuClickFlag = false;
  599. function neibuClick() {
  600. neibuClickFlag = true;
  601. $('#btn_sub').trigger('click');
  602. }
  603. function cancel() {
  604. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  605. <#assign subFileName = fileName?substring(0,fileName?length - 1) />
  606. <#list subFileName?split(",") as name>
  607. $('#${name}').uploadify('cancel', '*');
  608. </#list>
  609. <#-- update--end--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  610. }
  611. function uploadFile(data){
  612. if(!$("input[name='id']").val()){
  613. if(data.obj!=null && data.obj!='undefined'){
  614. $("input[name='id']").val(data.obj.id);
  615. }
  616. }
  617. if($(".uploadify-queue-item").length>0){
  618. upload();
  619. }else{
  620. if (neibuClickFlag){
  621. alert(data.msg);
  622. neibuClickFlag = false;
  623. }else {
  624. var win = frameElement.api.opener;
  625. win.reloadTable();
  626. win.tip(data.msg);
  627. frameElement.api.close();
  628. }
  629. }
  630. }
  631. </script>
  632. </#if>
  633. </body>
  634. </html>