cgform_jspTemplate_update.ftl 26 KB

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