cgform_jspTemplate_add.ftl 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  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?doAdd" ${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!''}" />/>
  84. <#-- update--end--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>/>
  88. <#-- update--end--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!''}" />></textarea>
  92. <#-- update--end--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!''}" />/>
  96. <#-- update--end--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--end--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" class="Wdate" onClick="WdatePicker()" <@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/> />
  104. <#-- update--end--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" class="Wdate" 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}"/> />
  108. <#-- update--end--author:zhangjiaqiangDate: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--begin--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:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  202. <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!''}" />/>
  203. <#-- update--end--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  204. </#if>
  205. <span class="Validform_checktip"></span>
  206. <label class="Validform_label" style="display: none;">${po.content?if_exists?html}</label>
  207. </td>
  208. <#if (po_index+1)%2==0>
  209. </tr>
  210. <#else>
  211. <#if !po_has_next>
  212. </tr>
  213. </#if>
  214. </#if>
  215. </#list>
  216. <#-- update--begin--author:zhoujf Date:20170523 for:TASK #1961 【代码生成器】一对多富文本编辑器,生成代码格式问题 -->
  217. <#list pageAreatextColumns as po>
  218. <tr>
  219. <td align="right">
  220. <label class="Validform_label">${po.content}:</label>
  221. </td>
  222. <td class="value" colspan="3">
  223. <#if po.showType=='textarea'>
  224. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  225. <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!''}" />></textarea>
  226. <#-- update--end--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  227. <#elseif po.showType='umeditor'>
  228. <#-- update--begin--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  229. <#assign ue_widget_count = ue_widget_count + 1>
  230. <#if ue_widget_count == 1>
  231. <script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.config.js"></script>
  232. <script type="text/javascript" charset="utf-8" src="plug-in/ueditor/ueditor.all.min.js"></script>
  233. </#if>
  234. <#-- update--end--author:zhangjiaqiang date:20170522 for:ueditor配置文件只加载一次 -->
  235. <textarea name="${po.fieldName}" id="${po.fieldName}" style="width: 650px;height:300px"></textarea>
  236. <script type="text/javascript">
  237. <#-- update--begin--author:zhangjiaqiang date:20170522 for:editor编辑器变量唯一 -->
  238. var ${po.fieldName}_editor = UE.getEditor('${po.fieldName}');
  239. <#-- update--begin--author:zhangjiaqiang date:20170522 for:editor编辑器变量唯一 -->
  240. </script>
  241. </#if>
  242. <span class="Validform_checktip"></span>
  243. <label class="Validform_label" style="display: none;">${po.content?if_exists?html}</label>
  244. </td>
  245. </tr>
  246. </#list>
  247. <#-- update--end--author:zhoujf Date:20170523 for:TASK #1961 【代码生成器】一对多富文本编辑器,生成代码格式问题 -->
  248. </table>
  249. <div style="width: auto;height: 200px;">
  250. <%-- 增加一个div,用于调节页面大小,否则默认太小 --%>
  251. <div style="width:800px;height:1px;"></div>
  252. <t:tabs id="tt" iframe="false" tabPosition="top" fit="false">
  253. <#list subTab as sub>
  254. <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>
  255. </#list>
  256. </t:tabs>
  257. </div>
  258. </t:formvalid>
  259. <!-- 添加 附表明细 模版 -->
  260. <table style="display:none">
  261. <#list subTab as sub>
  262. <tbody id="add_${sub.entityName?uncap_first}_table_template">
  263. <tr>
  264. <td align="center"><div style="width: 25px;" name="xh"></div></td>
  265. <td align="center"><input style="width:20px;" type="checkbox" name="ck"/></td>
  266. <#list subPageColumnsMap[sub.tableName] as po>
  267. <#assign check = 0 >
  268. <#list sub.foreignKeys as key>
  269. <#if subFieldMeta[po.fieldName]==key?uncap_first>
  270. <#assign check = 1 >
  271. <#break>
  272. </#if>
  273. </#list>
  274. <#if check==0>
  275. <td align="left">
  276. <#if po.showType == "text">
  277. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  278. <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!''}" />/>
  279. <#-- update--end--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  280. <#elseif po.showType=='password'>
  281. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  282. <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!''}" />/>
  283. <#-- update--end--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  284. <#elseif po.showType=='radio' || po.showType=='select' || po.showType=='checkbox' || po.showType=='list'>
  285. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  286. <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>
  287. <#-- update--end--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  288. <#elseif po.showType=='date'>
  289. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  290. <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}"/>/>
  291. <#-- update--end--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  292. <#elseif po.showType=='datetime'>
  293. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  294. <input name="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" maxlength="${po.length?c}" type="text" class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" style="width:120px;"<@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/>/>
  295. <#-- update--end--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  296. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  297. <#elseif po.showType=='file' || po.showType == 'image'>
  298. <#-- update--end--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  299. <input type="hidden" id="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" name="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" />
  300. <a target="_blank" id="${sub.entityName?uncap_first}List[#index#].${po.fieldName}_href">未上传</a>
  301. <br>
  302. <input class="ui-button" type="button" value="上传附件"
  303. onclick="commonUpload(commonUploadDefaultCallBack,'${sub.entityName?uncap_first}List\\[#index#\\]\\.${po.fieldName}')"/>
  304. <#else>
  305. <#-- update--begin--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  306. <input name="${sub.entityName?uncap_first}List[#index#].${po.fieldName}" maxlength="${po.length?c}" type="text" class="inputxt" style="width:120px;"<@datatype showType="2" validType="${po.fieldValidType!''}" isNull="${po.isNull}" type="${po.type}" mustInput="${po.fieldMustInput!''}" isNull="${po.isNull}"/>/>
  307. <#-- update--end--author:zhangjiaqiangDate:20170509 for:修订生成代码不美观 -->
  308. </#if>
  309. <label class="Validform_label" style="display: none;">${po.content?if_exists?html}</label>
  310. </td>
  311. </#if>
  312. </#list>
  313. </tr>
  314. </tbody>
  315. </#list>
  316. </table>
  317. </body>
  318. <script src = "webpage/${bussiPackage?replace('.','/')}/${entityPackage}/${entityName?uncap_first}.js"></script>
  319. <#if callbackFlag == true>
  320. <script type="text/javascript">
  321. function jeecgFormFileCallBack(data){
  322. if (data.success == true) {
  323. uploadFile(data);
  324. } else {
  325. if (data.responseText == '' || data.responseText == undefined) {
  326. $.messager.alert('错误', data.msg);
  327. $.Hidemsg();
  328. } else {
  329. try {
  330. var emsg = data.responseText.substring(data.responseText.indexOf('错误描述'), data.responseText.indexOf('错误信息'));
  331. $.messager.alert('错误', emsg);
  332. $.Hidemsg();
  333. } catch(ex) {
  334. $.messager.alert('错误', data.responseText + '');
  335. }
  336. }
  337. return false;
  338. }
  339. if (!neibuClickFlag) {
  340. var win = frameElement.api.opener;
  341. win.reloadTable();
  342. }
  343. }
  344. function upload() {
  345. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  346. <#assign subFileName = fileName?substring(0,fileName?length - 1) />
  347. <#list subFileName?split(",") as name>
  348. $('#${name}').uploadify('upload', '*');
  349. </#list>
  350. <#-- update--end--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  351. }
  352. var neibuClickFlag = false;
  353. function neibuClick() {
  354. neibuClickFlag = true;
  355. $('#btn_sub').trigger('click');
  356. }
  357. function cancel() {
  358. <#-- update--begin--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  359. <#assign subFileName = fileName?substring(0,fileName?length - 1) />
  360. <#list subFileName?split(",") as name>
  361. $('#${name}').uploadify('cancel', '*');
  362. </#list>
  363. <#-- update--end--author:zhangjiaqiang date:20170531 for:增加图片和文件的支持 -->
  364. }
  365. function uploadFile(data){
  366. if(!$("input[name='id']").val()){
  367. if(data.obj!=null && data.obj!='undefined'){
  368. $("input[name='id']").val(data.obj.id);
  369. }
  370. }
  371. if($(".uploadify-queue-item").length>0){
  372. upload();
  373. }else{
  374. if (neibuClickFlag){
  375. alert(data.msg);
  376. neibuClickFlag = false;
  377. }else {
  378. var win = frameElement.api.opener;
  379. win.reloadTable();
  380. win.tip(data.msg);
  381. frameElement.api.close();
  382. }
  383. }
  384. }
  385. </script>
  386. </#if>