cgform_jspTemplate_update.ftl 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  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>
  17. <head>
  18. <title>${ftl_description}</title>
  19. <style>
  20. .ui-button {
  21. display: inline-block;
  22. padding: 2px 2px;
  23. margin-bottom: 0;
  24. font-size: 8px;
  25. font-weight: normal;
  26. line-height: 1.42857143;
  27. text-align: center;
  28. white-space: nowrap;
  29. vertical-align: middle;
  30. -ms-touch-action: manipulation;
  31. touch-action: manipulation;
  32. cursor: pointer;
  33. -webkit-user-select: none;
  34. -moz-user-select: none;
  35. -ms-user-select: none;
  36. user-select: none;
  37. background-image: none;
  38. border: 1px solid transparent;
  39. border-radius: 4px;
  40. }
  41. </style>
  42. <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  43. <#if callbackFlag == true>
  44. <link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css" />
  45. <script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.js"></script>
  46. </#if>
  47. <script type="text/javascript">
  48. $(document).ready(function(){
  49. $('#tt').tabs({
  50. onSelect:function(title){
  51. $('#tt .panel-body').css('width','auto');
  52. }
  53. });
  54. $(".tabs-wrap").css('width','100%');
  55. });
  56. </script>
  57. </head>
  58. <body style="overflow-x: hidden;">
  59. <#-- update--begin--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  60. <#assign ue_widget_count = 0>
  61. <#-- update--end--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  62. <t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" tiptype="1" action="${entityName?uncap_first}Controller.do?doUpdate" ${callbackFlag?string("callback=\"jeecgFormFileCallBack@Override\"", "")}>
  63. <#list columns as po>
  64. <#if po.isShow == 'N'>
  65. <#-- update--begin--author:zhoujf date:20170622 for:TASK #1967 【代码生成器优化】online生成代码,无用太多,简化代码(1. 系统标准字段,表单页面,添加和修改页面,不生成隐藏字段) -->
  66. <#if po.fieldName == 'id'>
  67. <input id="${po.fieldName}" name="${po.fieldName}" type="hidden" value="${'$'}{${entityName?uncap_first}Page.${po.fieldName} }"/>
  68. </#if>
  69. <#-- update--end--author:zhoujf date:20170622 for:TASK #1967 【代码生成器优化】online生成代码,无用太多,简化代码(1. 系统标准字段,表单页面,添加和修改页面,不生成隐藏字段) -->
  70. </#if>
  71. </#list>
  72. <table cellpadding="0" cellspacing="1" class="formtable">
  73. <#list pageColumns as po>
  74. <#if po_index%2==0>
  75. <tr>
  76. </#if>
  77. <td align="right">
  78. <label class="Validform_label">${po.content}:</label>
  79. </td>
  80. <td class="value">
  81. <#if po.showType=='text'>
  82. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  83. <input id="${po.fieldName}" name="${po.fieldName}" type="text" style="width: 150px" class="inputxt" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" /> value='${'$'}{${entityName?uncap_first}Page.${po.fieldName}}'/>
  84. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  85. <#elseif po.showType=='popup'>
  86. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  87. <input id="${po.fieldName}" name="${po.fieldName}" type="text" style="width: 150px" class="searchbox-inputtext" <@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}}'/>
  88. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  89. <#elseif po.showType=='textarea'>
  90. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  91. <textarea id="${po.fieldName}" style="width:600px;" class="inputxt" 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>
  92. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  93. <#elseif po.showType=='password'>
  94. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  95. <input id="${po.fieldName}" name="${po.fieldName}" type="password" style="width: 150px" class="inputxt" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" /> value='${'$'}{${entityName?uncap_first}Page.${po.fieldName}}'/>
  96. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  97. <#elseif po.showType=='radio' || po.showType=='select' || po.showType=='checkbox' || po.showType=='list'>
  98. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  99. <t:dictSelect field="${po.fieldName}" type="${po.showType?if_exists?html}" <@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>
  100. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  101. <#elseif po.showType=='date'>
  102. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  103. <input id="${po.fieldName}" name="${po.fieldName}" type="text" style="width: 150px" <@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"/>'/>
  104. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  105. <#elseif po.showType=='datetime'>
  106. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  107. <input id="${po.fieldName}" name="${po.fieldName}" type="text" style="width: 150px" <@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"/>'/>
  108. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  109. <#elseif po.showType=='file' || po.showType == 'image'>
  110. <#-- update--begin--author:zhangjiaqiang date:20170531 for:数据回显表格ID区分 -->
  111. <table id="${fieldMeta[po.fieldName]?lower_case}_fileTable"></table>
  112. <#-- update--end--author:zhangjiaqiang date:20170531 for:数据回显表格ID区分 -->
  113. <#if !(po.operationCodesReadOnly ??)>
  114. <#assign fileName = fileName + "${po.fieldName}," />
  115. <table></table>
  116. <script type="text/javascript">
  117. var serverMsg="";
  118. $(function(){
  119. $('#${po.fieldName}').uploadify({
  120. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  121. <#if po.showType == 'image'>
  122. buttonText:'添加图片',
  123. <#else>
  124. buttonText:'添加文件',
  125. </#if>
  126. <#-- update--end--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  127. auto:false,
  128. progressData:'speed',
  129. multi:true,
  130. height:25,
  131. overrideEvents:['onDialogClose'],
  132. fileTypeDesc:'文件格式:',
  133. queueID:'filediv_${po.fieldName}',
  134. <#-- fileTypeExts:'*.rar;*.zip;*.doc;*.docx;*.txt;*.ppt;*.xls;*.xlsx;*.html;*.htm;*.pdf;*.jpg;*.gif;*.png', 页面弹出很慢解决 20170317 scott -->
  135. fileSizeLimit:'15MB',
  136. swf:'plug-in/uploadify/uploadify.swf',
  137. uploader:'cgUploadController.do?saveFiles&jsessionid='+$("#sessionUID").val()+'',
  138. onUploadStart : function(file) {
  139. var cgFormId=$("input[name='id']").val();
  140. $('#${po.fieldName}').uploadify("settings", "formData", {
  141. 'cgFormId':cgFormId,
  142. 'cgFormName':'${tableName}',
  143. 'cgFormField':'${fieldMeta[po.fieldName]}'
  144. });
  145. } ,
  146. onQueueComplete : function(queueData) {
  147. var win = frameElement.api.opener;
  148. win.reloadTable();
  149. win.tip(serverMsg);
  150. frameElement.api.close();
  151. },
  152. onUploadSuccess : function(file, data, response) {
  153. var d=$.parseJSON(data);
  154. if(d.success){
  155. var win = frameElement.api.opener;
  156. serverMsg = d.msg;
  157. }
  158. },
  159. onFallback: function() {
  160. tip("您未安装FLASH控件,无法上传图片!请安装FLASH控件后再试")
  161. },
  162. onSelectError: function(file, errorCode, errorMsg) {
  163. switch (errorCode) {
  164. case - 100 : tip("上传的文件数量已经超出系统限制的" + $('#file').uploadify('settings', 'queueSizeLimit') + "个文件!");
  165. break;
  166. case - 110 : tip("文件 [" + file.name + "] 大小超出系统限制的" + $('#file').uploadify('settings', 'fileSizeLimit') + "大小!");
  167. break;
  168. case - 120 : tip("文件 [" + file.name + "] 大小异常!");
  169. break;
  170. case - 130 : tip("文件 [" + file.name + "] 类型不正确!");
  171. break;
  172. }
  173. },
  174. onUploadProgress: function(file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal) {}
  175. });
  176. });
  177. </script>
  178. <span id="file_uploadspan"><input type="file" name="${po.fieldName}" id="${po.fieldName}" /></span>
  179. <div class="form" id="filediv_${po.fieldName}"></div>
  180. </#if>
  181. <#--update-start--Author: jg_huangxg Date:20160421 for:TASK #1027 【online】代码生成器模板不支持UE编辑器 -->
  182. <#elseif po.showType='umeditor'>
  183. <#-- update--begin--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  184. <#assign ue_widget_count = ue_widget_count + 1>
  185. <#if ue_widget_count == 1>
  186. <script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.config.js"></script>
  187. <script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.all.min.js"></script>
  188. </#if>
  189. <#-- update--end--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  190. <#--update-start--Author: dangzhenghui Date:20170510 for:TASK #1899 【代码生成器bug】控件类型为UE编辑器 ,编辑页面内容显示为空-->
  191. <textarea name="${po.fieldName}" id="${po.fieldName}" style="width: 650px;height:300px">${'$'}{${entityName?uncap_first}Page.${po.fieldName} }</textarea>
  192. <#--update-end--Author: dangzhenghui Date:20170510 for:TASK #1899 【代码生成器bug】控件类型为UE编辑器 ,编辑页面内容显示为空-->
  193. <script type="text/javascript">
  194. <#-- update--begin--author:zhangjiaqiang date:20170522 for:editor编辑器变量唯一 -->
  195. var ${po.fieldName}_editor = UE.getEditor('${po.fieldName}');
  196. <#-- update--begin--author:zhangjiaqiang date:20170522 for:editor编辑器变量唯一 -->
  197. </script>
  198. <#--update-end--Author: jg_huangxg Date:20160421 for:TASK #1027 【online】代码生成器模板不支持UE编辑器 -->
  199. <#else>
  200. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  201. <input id="${po.fieldName}" name="${po.fieldName}" type="text" style="width: 150px" class="inputxt" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> value='${'$'}{${entityName?uncap_first}Page.${po.fieldName}}'/>
  202. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  203. </#if>
  204. <span class="Validform_checktip"></span>
  205. <label class="Validform_label" style="display: none;">${po.content?if_exists?html}</label>
  206. </td>
  207. <#if (po_index+1)%2==0>
  208. </tr>
  209. <#else>
  210. <#if !po_has_next>
  211. </tr>
  212. </#if>
  213. </#if>
  214. </#list>
  215. <#-- update--begin--author:zhoujf Date:20170523 for:TASK #1961 【代码生成器】一对多富文本编辑器,生成代码格式问题 -->
  216. <#list pageAreatextColumns as po>
  217. <tr>
  218. <td align="right">
  219. <label class="Validform_label">${po.content}:</label>
  220. </td>
  221. <td class="value" colspan="3">
  222. <#if po.showType=='textarea'>
  223. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  224. <textarea id="${po.fieldName}" style="width:600px;" class="inputxt" 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>
  225. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  226. <#elseif po.showType='umeditor'>
  227. <#-- update--begin--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  228. <#assign ue_widget_count = ue_widget_count + 1>
  229. <#if ue_widget_count == 1>
  230. <script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.config.js"></script>
  231. <script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.all.min.js"></script>
  232. </#if>
  233. <#-- update--end--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  234. <#--update-start--Author: dangzhenghui Date:20170510 for:TASK #1899 【代码生成器bug】控件类型为UE编辑器 ,编辑页面内容显示为空-->
  235. <textarea name="${po.fieldName}" id="${po.fieldName}" style="width: 650px;height:300px">${'$'}{${entityName?uncap_first}Page.${po.fieldName} }</textarea>
  236. <#--update-end--Author: dangzhenghui Date:20170510 for:TASK #1899 【代码生成器bug】控件类型为UE编辑器 ,编辑页面内容显示为空-->
  237. <script type="text/javascript">
  238. <#-- update--begin--author:zhangjiaqiang date:20170522 for:editor编辑器变量唯一 -->
  239. var ${po.fieldName}_editor = UE.getEditor('${po.fieldName}');
  240. <#-- update--begin--author:zhangjiaqiang date:20170522 for:editor编辑器变量唯一 -->
  241. </script>
  242. </#if>
  243. <span class="Validform_checktip"></span>
  244. <label class="Validform_label" style="display: none;">${po.content?if_exists?html}</label>
  245. </td>
  246. </tr>
  247. </#list>
  248. <#-- update--end--author:zhoujf Date:20170523 for:TASK #1961 【代码生成器】一对多富文本编辑器,生成代码格式问题 -->
  249. </table>
  250. <div style="width: auto;height: 200px;">
  251. <%-- 增加一个div,用于调节页面大小,否则默认太小 --%>
  252. <div style="width:800px;height:1px;"></div>
  253. <t:tabs id="tt" iframe="false" tabPosition="top" fit="false">
  254. <#list subTab as sub>
  255. <t:tab href="${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>" icon="icon-search" title="${sub.ftlDescription}" id="${sub.entityName?uncap_first}"></t:tab>
  256. </#list>
  257. </t:tabs>
  258. </div>
  259. </t:formvalid>
  260. <!-- 添加 附表明细 模版 -->
  261. <table style="display:none">
  262. <#list subTab as sub>
  263. <tbody id="add_${sub.entityName?uncap_first}_table_template">
  264. <tr>
  265. <td align="center"><div style="width: 25px;" name="xh"></div></td>
  266. <td align="center"><input style="width:20px;" type="checkbox" name="ck"/></td>
  267. <#list subPageColumnsMap[sub.tableName] as po>
  268. <#assign check = 0 >
  269. <#list sub.foreignKeys as key>
  270. <#if subFieldMeta[po.fieldName]==key?uncap_first>
  271. <#assign check = 1 >
  272. <#break>
  273. </#if>
  274. </#list>
  275. <#if check==0>
  276. <td align="left">
  277. <#if po.showType == "text">
  278. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  279. <input name="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" maxlength="${po.length?c}" type="text" class="inputxt" style="width:120px;" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" />/>
  280. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  281. <#elseif po.showType=='password'>
  282. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  283. <input name="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" maxlength="${po.length?c}" type="password" class="inputxt" style="width:120px;"<@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" />/>
  284. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  285. <#elseif po.showType=='radio' || po.showType=='select' || po.showType=='checkbox' || po.showType=='list'>
  286. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  287. <t:dictSelect field="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" type="${po.showType?if_exists?html}" <@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="" hasLabel="false" title="${po.content}"></t:dictSelect>
  288. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  289. <#elseif po.showType=='date'>
  290. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  291. <input name="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" maxlength="${po.length?c}" type="text" class="Wdate" onClick="WdatePicker()" style="width:120px;" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/>/>
  292. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  293. <#elseif po.showType=='datetime'>
  294. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  295. <input name="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" maxlength="${po.length?c}" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> type="text" class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" style="width:120px;" />
  296. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  297. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  298. <#elseif po.showType=='file' || po.showType == 'image'>
  299. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  300. <input type="hidden" id="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" name="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" />
  301. <a target="_blank" id="${sub.entityName?uncap_first}List[#index#].${po.fieldName}_href">未上传</a>
  302. <br>
  303. <input class="ui-button" type="button" value="上传附件"
  304. onclick="commonUpload(commonUploadDefaultCallBack,'${sub.entityName?uncap_first}List\\[#index#\\]\\.${po.fieldName}')"/>
  305. <#else>
  306. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  307. <input name="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" maxlength="${po.length?c}" type="text" class="inputxt" style="width:120px;" <@datatype validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/>/>
  308. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  309. </#if>
  310. <label class="Validform_label" style="display: none;">${po.content?if_exists?html}</label>
  311. </td>
  312. </#if>
  313. </#list>
  314. </tr>
  315. </tbody>
  316. </#list>
  317. </table>
  318. </body>
  319. <script src = "webpage/${bussiPackage?replace('.','/')}/${entityPackage}/${entityName?uncap_first}.js"></script>
  320. <#if callbackFlag == true>
  321. <script type="text/javascript">
  322. //加载 已存在的 文件
  323. $(function(){
  324. var cgFormId=$("input[name='id']").val();
  325. $.ajax({
  326. type: "post",
  327. url: "${entityName?uncap_first}Controller.do?getFiles&id=" + cgFormId,
  328. success: function(data){
  329. var arrayFileObj = jQuery.parseJSON(data).obj;
  330. $.each(arrayFileObj,function(n,file){
  331. <#-- update--begin--author:zhangjiaqiang date:20170531 for:多个附件的数据显示 -->
  332. var fieldName = file.field.toLowerCase();
  333. var table = $("#"+fieldName+"_fileTable");
  334. <#-- update--end--author:zhangjiaqiang date:20170531 for:多个附件的数据显示 -->
  335. var tr = $("<tr style=\"height:34px;\"></tr>");
  336. <#-- update--begin--author:zhangjiaqiang date:20170614 for:文件名称太长显示问题 -->
  337. var title = file.title;
  338. if(title.length > 15){
  339. title = title.substring(0,12) + "...";
  340. }
  341. var td_title = $("<td>" + title + "</td>");
  342. <#-- update--end--author:zhangjiaqiang date:20170614 for:文件名称太长显示问题 -->
  343. <#-- update--begin--author:zhangjiaqiang date:20170614 for:操作按钮之间增加间隔 -->
  344. 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>")
  345. 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>");
  346. 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>");
  347. <#-- update--end--author:zhangjiaqiang date:20170614 for:操作按钮之间增加间隔 -->
  348. tr.appendTo(table);
  349. td_title.appendTo(tr);
  350. td_download.appendTo(tr);
  351. td_view.appendTo(tr);
  352. td_del.appendTo(tr);
  353. });
  354. }
  355. });
  356. })
  357. <#-- update--begin--author:zhangjiaqiang date:20170531 for:附件资源删除处理 -->
  358. /**
  359. * 删除图片数据资源
  360. */
  361. function del(url,obj){
  362. var content = "请问是否要删除该资源";
  363. var navigatorName = "Microsoft Internet Explorer";
  364. if( navigator.appName == navigatorName ){
  365. $.dialog.confirm(content, function(){
  366. submit(url,obj);
  367. }, function(){
  368. });
  369. }else{
  370. layer.open({
  371. title:"提示",
  372. content:content,
  373. icon:7,
  374. yes:function(index){
  375. submit(url,obj);
  376. },
  377. btn:['确定','取消'],
  378. btn2:function(index){
  379. layer.close(index);
  380. }
  381. });
  382. }
  383. }
  384. function submit(url,obj){
  385. $.ajax({
  386. async : false,
  387. cache : false,
  388. type : 'POST',
  389. url : url,// 请求的action路径
  390. error : function() {// 请求失败处理函数
  391. },
  392. success : function(data) {
  393. var d = $.parseJSON(data);
  394. if (d.success) {
  395. var msg = d.msg;
  396. tip(msg);
  397. obj.parentNode.parentNode.parentNode.deleteRow(obj.parentNode.parentNode);
  398. } else {
  399. tip(d.msg);
  400. }
  401. }
  402. });
  403. }
  404. <#-- update--end--author:zhangjiaqiang date:20170531 for:附件资源删除处理 -->
  405. function jeecgFormFileCallBack(data){
  406. if (data.success == true) {
  407. uploadFile(data);
  408. } else {
  409. if (data.responseText == '' || data.responseText == undefined) {
  410. $.messager.alert('错误', data.msg);
  411. $.Hidemsg();
  412. } else {
  413. try {
  414. var emsg = data.responseText.substring(data.responseText.indexOf('错误描述'), data.responseText.indexOf('错误信息'));
  415. $.messager.alert('错误', emsg);
  416. $.Hidemsg();
  417. } catch(ex) {
  418. $.messager.alert('错误', data.responseText + '');
  419. }
  420. }
  421. return false;
  422. }
  423. if (!neibuClickFlag) {
  424. var win = frameElement.api.opener;
  425. win.reloadTable();
  426. }
  427. }
  428. function upload() {
  429. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  430. <#assign subFileName = fileName?substring(0,fileName?length - 1) />
  431. <#list subFileName?split(",") as name>
  432. $('#${name}').uploadify('upload', '*');
  433. </#list>
  434. <#-- update--end--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  435. }
  436. var neibuClickFlag = false;
  437. function neibuClick() {
  438. neibuClickFlag = true;
  439. $('#btn_sub').trigger('click');
  440. }
  441. function cancel() {
  442. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  443. <#assign subFileName = fileName?substring(0,fileName?length - 1) />
  444. <#list subFileName?split(",") as name>
  445. $('#${name}').uploadify('cancel', '*');
  446. </#list>
  447. <#-- update--end--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  448. }
  449. function uploadFile(data){
  450. if(!$("input[name='id']").val()){
  451. if(data.obj!=null && data.obj!='undefined'){
  452. $("input[name='id']").val(data.obj.id);
  453. }
  454. }
  455. if($(".uploadify-queue-item").length>0){
  456. upload();
  457. }else{
  458. if (neibuClickFlag){
  459. alert(data.msg);
  460. neibuClickFlag = false;
  461. }else {
  462. var win = frameElement.api.opener;
  463. win.reloadTable();
  464. win.tip(data.msg);
  465. frameElement.api.close();
  466. }
  467. }
  468. }
  469. </script>
  470. </#if>