jform.ftl 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851
  1. <#setting number_format="0.#####################">
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <base href="${basePath}/"/>
  6. <title></title>
  7. ${config_iframe}
  8. <link rel="stylesheet" href="${basePath}/plug-in/easyui/themes/metrole/icon.css" type="text/css">
  9. <script src="${basePath}/plug-in/layer/layer.js"></script>
  10. <script type="text/javascript">
  11. function btn_ok(){
  12. $('#btn_sub').trigger('click');
  13. }
  14. </script>
  15. </head>
  16. <body>
  17. <#--update-start--Author:luobaoli Date:20150614 for:表单单表属性中增加了扩展参数 ${po.extend_json?if_exists}-->
  18. <form id="formobj" action="cgFormBuildController.do?saveOrUpdate" name="formobj" method="post">
  19. <input type="hidden" id="btn_sub" class="btn_sub"/>
  20. <input type="hidden" name="tableName" value="${tableName?if_exists?html}" >
  21. <input type="hidden" name="id" value="${id?if_exists?html}" >
  22. <#list columnhidden as po>
  23. <input type="hidden" id="${po.field_name}" name="${po.field_name}" value="${data['${tableName}']['${po.field_name}']?if_exists?html}" >
  24. </#list>
  25. <table cellpadding="0" cellspacing="1" class="formtable">
  26. <#list columns as po>
  27. <#if (columns?size>10)>
  28. <#if po_index%2==0>
  29. <tr>
  30. </#if>
  31. <#else>
  32. <tr>
  33. </#if>
  34. <td align="right" >
  35. <label class="Validform_label">
  36. ${po.content}:
  37. </label>
  38. </td>
  39. <td class="value">
  40. <#--update-begin--Author:钟世云 Date:20150610 for:online支持树配置-->
  41. <#if head.isTree=='Y' && head.treeParentIdFieldName==po.field_name>
  42. <!--如果为树形菜单,父id输入框设置为select-->
  43. <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="text"
  44. style="width: 150px" class="inputxt easyui-combotree" value="${data['${tableName}']['${po.field_name}']?if_exists?html}"
  45. <#if po.operationCodesReadOnly?exists> readonly = "readonly"</#if>
  46. <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  47. <#if po.field_must_input??><#if po.field_must_input == 'Y' || po.is_null != 'Y'>ignore="checked"<#else>ignore="ignore"</#if><#elseif po.is_null != "Y">ignore="checked"<#else>ignore="ignore"</#if>
  48. <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  49. <#if po.field_valid_type?if_exists?html != ''>
  50. datatype="${po.field_valid_type?if_exists?html}"
  51. <#else>
  52. <#if po.type == 'int'>
  53. datatype="n" <#if po.is_null == 'Y'>ignore="ignore" </#if>
  54. <#elseif po.type=='double'>
  55. datatype="/^(-?\d+)(\.\d+)?$/" <#if po.is_null == 'Y'>ignore="ignore" </#if>
  56. <#else>
  57. <#if po.is_null != 'Y'>datatype="*"</#if>
  58. </#if>
  59. </#if>
  60. data-options="
  61. panelHeight:'220',
  62. url: 'cgAutoListController.do?datagrid&configId=${tableName?if_exists?html}&field=id,${head.treeFieldname}',
  63. loadFilter: function(data) {
  64. var rows = data.rows || data;
  65. var win = frameElement.api.opener;
  66. var listRows = win.getDataGrid().treegrid('getData');
  67. joinTreeChildren(rows, listRows);
  68. convertTreeData(rows, '${head.treeFieldname}');
  69. return rows;
  70. },
  71. onLoadSuccess: function() {
  72. var win = frameElement.api.opener;
  73. var currRow = win.getDataGrid().treegrid('getSelected');
  74. if(!'${id?if_exists?html}') {
  75. //增加时,选择当前父菜单
  76. if(currRow) {
  77. $('#${po.field_name}').combotree('setValue', currRow.id);
  78. }
  79. }else {
  80. //编辑时,选择当前父菜单
  81. if(currRow) {
  82. $('#${po.field_name}').combotree('setValue', currRow._parentId);
  83. }
  84. }
  85. }
  86. ">
  87. <#--update-end--Author:钟世云 Date:20150610 for:online支持树配置-->
  88. <#elseif po.show_type=='text'>
  89. <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="text"
  90. style="width: 150px" class="inputxt" value="${data['${tableName}']['${po.field_name}']?if_exists?html}"
  91. <#if po.operationCodesReadOnly?exists> readonly = "readonly"</#if>
  92. <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  93. <#if po.field_must_input??><#if po.field_must_input == 'Y' || po.is_null != 'Y'>ignore="checked"<#else>ignore="ignore"</#if><#elseif po.is_null != "Y">ignore="checked"<#else>ignore="ignore"</#if>
  94. <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  95. <#if po.field_valid_type?if_exists?html != ''>
  96. datatype="${po.field_valid_type?if_exists?html}"
  97. <#else>
  98. <#if po.type == 'int'>
  99. datatype="n" <#if po.is_null == 'Y'>ignore="ignore" </#if>
  100. <#elseif po.type=='double'>
  101. datatype="/^(-?\d+)(\.\d+)?$/" <#if po.is_null == 'Y'>ignore="ignore" </#if>
  102. <#else>
  103. <#if po.is_null != 'Y'>datatype="*"</#if>
  104. </#if>
  105. </#if>>
  106. <#elseif po.show_type=='password'>
  107. <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="password"
  108. style="width: 150px" class="inputxt" value="${data['${tableName}']['${po.field_name}']?if_exists?html}"
  109. <#if po.operationCodesReadOnly?if_exists> readonly = "readonly"</#if>
  110. <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  111. <#if po.field_must_input??><#if po.field_must_input == 'Y' || po.is_null != 'Y'>ignore="checked"<#else>ignore="ignore"</#if><#elseif po.is_null != "Y">ignore="checked"<#else>ignore="ignore"</#if>
  112. <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  113. <#if po.field_valid_type?if_exists?html != ''>
  114. datatype="${po.field_valid_type?if_exists?html}"
  115. <#else>
  116. <#if po.is_null != 'Y'>datatype="*"</#if>
  117. </#if>>
  118. <#elseif po.show_type=='radio'>
  119. <@DictData name="${po.dict_field?if_exists?html}" text="${po.dict_text?if_exists?html}" tablename="${po.dict_table?if_exists?html}" var="dataList">
  120. <#list dataList as dictdata>
  121. <input value="${dictdata.typecode?if_exists?html}" ${po.extend_json?if_exists} name="${po.field_name}" type="radio"
  122. <#if dictdata_index==0&&po.is_null != 'Y'>datatype="*"</#if>
  123. <#if po.operationCodesReadOnly?if_exists>onclick="return false;"</#if>
  124. <#if dictdata.typecode?if_exists?html=="${data['${tableName}']['${po.field_name}']?if_exists?html}"> checked="true" </#if>>
  125. ${dictdata.typename?if_exists?html}
  126. </#list>
  127. </@DictData>
  128. <#elseif po.show_type=='checkbox'>
  129. <#assign checkboxstr>${data['${tableName}']['${po.field_name}']?if_exists?html}</#assign>
  130. <#assign checkboxlist=checkboxstr?split(",")>
  131. <@DictData name="${po.dict_field?if_exists?html}" text="${po.dict_text?if_exists?html}" tablename="${po.dict_table?if_exists?html}" var="dataList">
  132. <#list dataList as dictdata>
  133. <input value="${dictdata.typecode?if_exists?html}" ${po.extend_json?if_exists} name="${po.field_name}" type="checkbox"
  134. <#if po.operationCodesReadOnly?if_exists>onclick="return false;"</#if>
  135. <#if dictdata_index==0&&po.is_null != 'Y'>datatype="*"</#if>
  136. <#list checkboxlist as x >
  137. <#if dictdata.typecode?if_exists?html=="${x?if_exists?html}"> checked="true" </#if></#list>>
  138. ${dictdata.typename?if_exists?html}
  139. </#list>
  140. </@DictData>
  141. <#elseif po.show_type=='list'>
  142. <@DictData name="${po.dict_field?if_exists?html}" text="${po.dict_text?if_exists?html}" tablename="${po.dict_table?if_exists?html}" var="dataList">
  143. <select id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" <#if po.operationCodesReadOnly?if_exists>onfocus="this.defOpt=this.selectedIndex" onchange="this.selectedIndex=this.defOpt;"</#if>
  144. <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  145. <#if po.field_must_input??><#if po.field_must_input == 'Y' || po.is_null != 'Y'>ignore="checked"<#else>ignore="ignore"</#if><#elseif po.is_null != "Y">ignore="checked"<#else>ignore="ignore"</#if>
  146. <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  147. <#if po.is_null != 'Y'>datatype="*"</#if> >
  148. <#list dataList as dictdata>
  149. <option value="${dictdata.typecode?if_exists?html}"
  150. <#if dictdata.typecode?if_exists?html=="${data['${tableName}']['${po.field_name}']?if_exists?html}"> selected="selected" </#if>>
  151. ${dictdata.typename?if_exists?html}
  152. </option>
  153. </#list>
  154. </select>
  155. </@DictData>
  156. <#elseif po.show_type=='date'>
  157. <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="text"
  158. style="width: 150px" value="<#if data['${tableName}']['${po.field_name}']??>${data['${tableName}']['${po.field_name}']?if_exists?string("yyyy-MM-dd")}</#if>"
  159. class="Wdate" onClick="WdatePicker({<#if po.operationCodesReadOnly?if_exists> readonly = true</#if>})"
  160. <#if po.operationCodesReadOnly?exists> readonly = "readonly"</#if>
  161. <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  162. <#if po.field_must_input??><#if po.field_must_input == 'Y' || po.is_null != 'Y'>ignore="checked"<#else>ignore="ignore"</#if><#elseif po.is_null != "Y">ignore="checked"<#else>ignore="ignore"</#if>
  163. <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  164. <#if po.field_valid_type?if_exists?html != ''>
  165. datatype="${po.field_valid_type?if_exists?html}"
  166. <#else>
  167. <#if po.is_null != 'Y'>datatype="*"</#if>
  168. </#if>>
  169. <#elseif po.show_type=='datetime'>
  170. <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="text"
  171. style="width: 150px" value="<#if data['${tableName}']['${po.field_name}']??>${data['${tableName}']['${po.field_name}']?if_exists?string("yyyy-MM-dd HH:mm:ss")}</#if>"
  172. class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'<#if po.operationCodesReadOnly?if_exists> ,readonly = true</#if>})"
  173. <#if po.operationCodesReadOnly?exists> readonly = "readonly"</#if>
  174. <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  175. <#if po.field_must_input??><#if po.field_must_input == 'Y' || po.is_null != 'Y'>ignore="checked"<#else>ignore="ignore"</#if><#elseif po.is_null != "Y">ignore="checked"<#else>ignore="ignore"</#if>
  176. <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  177. <#if po.field_valid_type?if_exists?html != ''>
  178. datatype="${po.field_valid_type?if_exists?html}"
  179. <#else>
  180. <#if po.is_null != 'Y'>datatype="*"</#if>
  181. </#if>>
  182. <#elseif po.show_type=='popup'>
  183. <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="text"
  184. style="width: 150px" class="searchbox-inputtext"
  185. onClick="inputClick(this,'${po.dict_text?if_exists?html}','${po.dict_table?if_exists?html}');"
  186. value="${data['${tableName}']['${po.field_name}']?if_exists?html}"
  187. <#if po.operationCodesReadOnly?if_exists> readonly = "readonly"</#if>
  188. <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  189. <#if po.field_must_input??><#if po.field_must_input == 'Y' || po.is_null != 'Y'>ignore="checked"<#else>ignore="ignore"</#if><#elseif po.is_null != "Y">ignore="checked"<#else>ignore="ignore"</#if>
  190. <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  191. <#if po.field_valid_type?if_exists?html != ''>
  192. datatype="${po.field_valid_type?if_exists?html}"
  193. <#else>
  194. <#if po.is_null != 'Y'>datatype="*"</#if>
  195. </#if>>
  196. <#elseif po.show_type=='file'>
  197. <table>
  198. <#list imageList as imageB>
  199. <#if imageB['field'] == po.field_name>
  200. <tr style="height:34px;">
  201. <td>${imageB['title']}</td>
  202. <td><a href="${basePath}/commonController.do?viewFile&fileid=${fileB['fileKey']}&subclassname=org.jeecgframework.web.cgform.entity.upload.CgUploadEntity" title="下载">下载</a></td>
  203. <td><a href="javascript:void(0);" onclick="openwindow('预览','${basePath}/commonController.do?openViewFile&fileid=${fileB['fileKey']}&subclassname=org.jeecgframework.web.cgform.entity.upload.CgUploadEntity','fList',700,500)">预览</a></td>
  204. <td><a href="javascript:void(0)" class="jeecgDetail" onclick="del('${basePath}/cgUploadController.do?delFile&id=${fileB['fileKey']}',this)">删除</a></td>
  205. </tr>
  206. </#if>
  207. </#list>
  208. </table>
  209. <#if !(po.operationCodesReadOnly ??)>
  210. <div class="form jeecgDetail">
  211. <script type="text/javascript">
  212. var serverMsg="";
  213. var m = new Map();
  214. $(function(){$('#${po.field_name}').uploadify(
  215. {buttonText:'添加文件',
  216. auto:false,
  217. progressData:'speed',
  218. multi:true,
  219. height:25,
  220. overrideEvents:['onDialogClose'],
  221. fileTypeDesc:'文件格式:',
  222. queueID:'filediv_${po.field_name}',
  223. <#-- fileTypeExts:'*.rar;*.zip;*.doc;*.docx;*.txt;*.ppt;*.xls;*.xlsx;*.html;*.htm;*.pdf;*.jpg;*.gif;*.png', 页面弹出很慢解决 20170317 scott -->
  224. fileSizeLimit:'15MB',swf:'plug-in/uploadify/uploadify.swf',
  225. uploader:'cgUploadController.do?saveFiles&jsessionid='+$("#sessionUID").val()+'',
  226. onUploadStart : function(file) {
  227. var cgFormId=$("input[name='id']").val();
  228. $('#${po.field_name}').uploadify("settings", "formData", {'cgFormId':cgFormId,'cgFormName':'${tableName?if_exists?html}','cgFormField':'${po.field_name}'});} ,
  229. onQueueComplete : function(queueData) {
  230. var win = frameElement.api.opener;
  231. win.reloadTable();
  232. win.tip(serverMsg);
  233. frameElement.api.close();},
  234. onUploadSuccess : function(file, data, response) {var d=$.parseJSON(data);if(d.success){var win = frameElement.api.opener;serverMsg = d.msg;}},onFallback : function(){tip("您未安装FLASH控件,无法上传图片!请安装FLASH控件后再试")},onSelectError : function(file, errorCode, errorMsg){switch(errorCode) {case -100:tip("上传的文件数量已经超出系统限制的"+$('#${po.field_name}').uploadify('settings','queueSizeLimit')+"个文件!");break;case -110:tip("文件 ["+file.name+"] 大小超出系统限制的"+$('#${po.field_name}').uploadify('settings','fileSizeLimit')+"大小!");break;case -120:tip("文件 ["+file.name+"] 大小异常!");break;case -130:tip("文件 ["+file.name+"] 类型不正确!");break;}},
  235. onUploadProgress : function(file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal) { }});});
  236. </script><span id="file_uploadspan"><input type="file" name="${po.field_name}" id="${po.field_name}" /></span>
  237. </div>
  238. <div class="form" id="filediv_${po.field_name}"> </div>
  239. </#if>
  240. <#--update-start--Author: jg_huangxg Date:20160113 for:TASK #824 【online开发】控件类型扩展增加一个图片类型 image -->
  241. <#elseif po.show_type=='image'>
  242. <table>
  243. <#list filesList as fileB>
  244. <#if fileB['field'] == po.field_name>
  245. <tr style="height:34px;">
  246. <td>${fileB['title']}</td>
  247. <td><a href="${basePath}/commonController.do?viewFile&fileid=${fileB['fileKey']}&subclassname=org.jeecgframework.web.cgform.entity.upload.CgUploadEntity" title="下载">下载</a></td>
  248. <td><a href="javascript:void(0);" onclick="openwindow('预览','${basePath}/commonController.do?openViewFile&fileid=${fileB['fileKey']}&subclassname=org.jeecgframework.web.cgform.entity.upload.CgUploadEntity','fList',700,500)">预览</a></td>
  249. <td><a href="javascript:void(0)" class="jeecgDetail" onclick="del('${basePath}/cgUploadController.do?delFile&id=${fileB['fileKey']}',this)">删除</a></td>
  250. </tr>
  251. </#if>
  252. </#list>
  253. </table>
  254. <#if !(po.operationCodesReadOnly ??)>
  255. <div class="form jeecgDetail">
  256. <script type="text/javascript">
  257. var serverMsg="";
  258. var m = new Map();
  259. $(function(){$('#${po.field_name}').uploadify(
  260. {buttonText:'添加图片',
  261. auto:false,
  262. progressData:'speed',
  263. multi:true,
  264. height:25,
  265. overrideEvents:['onDialogClose'],
  266. fileTypeDesc:'图片格式:',
  267. queueID:'imagediv_${po.field_name}',
  268. fileTypeExts:'*.jpg;*.jpeg;*.gif;*.png;*.bmp',
  269. fileSizeLimit:'15MB',swf:'plug-in/uploadify/uploadify.swf',
  270. uploader:'cgUploadController.do?saveFiles&jsessionid='+$("#sessionUID").val()+'',
  271. onUploadStart : function(file) {
  272. var cgFormId=$("input[name='id']").val();
  273. $('#${po.field_name}').uploadify("settings", "formData", {'cgFormId':cgFormId,'cgFormName':'${tableName?if_exists?html}','cgFormField':'${po.field_name}'});} ,
  274. onQueueComplete : function(queueData) {
  275. var win = frameElement.api.opener;
  276. win.reloadTable();
  277. win.tip(serverMsg);
  278. frameElement.api.close();},
  279. onUploadSuccess : function(file, data, response) {var d=$.parseJSON(data);if(d.success){var win = frameElement.api.opener;serverMsg = d.msg;}},onFallback : function(){tip("您未安装FLASH控件,无法上传图片!请安装FLASH控件后再试")},onSelectError : function(file, errorCode, errorMsg){switch(errorCode) {case -100:tip("上传的文件数量已经超出系统限制的"+$('#${po.field_name}').uploadify('settings','queueSizeLimit')+"个文件!");break;case -110:tip("文件 ["+file.name+"] 大小超出系统限制的"+$('#${po.field_name}').uploadify('settings','fileSizeLimit')+"大小!");break;case -120:tip("文件 ["+file.name+"] 大小异常!");break;case -130:tip("文件 ["+file.name+"] 类型不正确!");break;}},
  280. onUploadProgress : function(file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal) { }});});
  281. </script><span id="image_uploadspan"><input type="file" name="${po.field_name}" id="${po.field_name}" /></span>
  282. </div>
  283. <div class="form" id="imagediv_${po.field_name}"> </div>
  284. </#if>
  285. <#--update-end--Author: jg_huangxg Date:20160113 for:TASK #824 【online开发】控件类型扩展增加一个图片类型 image -->
  286. <#--update-start--Author: jg_huangxg Date:20160505 for:TASK #1027 【online】代码生成器模板不支持UE编辑器 -->
  287. <#elseif po.show_type=='umeditor'>
  288. <script id="content" type="text/plain" style="width:99%;"></script>
  289. <script type="text/javascript" charset="utf-8" src="${basePath}/plug-in/ueditor/ueditor.config.js"></script>
  290. <script type="text/javascript" charset="utf-8" src="${basePath}/plug-in/ueditor/ueditor.all.min.js"></script>
  291. <script type="text/javascript">
  292. var leipiEditor = UE.getEditor('content',{
  293. //allowDivTransToP: false,//阻止转换div 为p
  294. toolleipi:true,//是否显示,设计器的 toolbars
  295. textarea: 'design_content',
  296. //这里可以选择自己需要的工具按钮名称,此处仅选择如下五个 /*
  297. toolbars: [[
  298. 'fullscreen', 'source', '|', 'undo', 'redo', '|',//'date', 'time',
  299. 'fontfamily', 'fontsize', '|', 'indent', '|',
  300. //'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
  301. //'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
  302. //'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
  303. //'directionalityltr', 'directionalityrtl', 'indent', '|',
  304. 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', //'touppercase', 'tolowercase', '|',
  305. //'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
  306. //'simpleupload', 'insertimage', 'emotion', 'scrawl', 'insertvideo', 'music', 'attachment', 'map', 'insertframe', 'insertcode', 'webapp', 'pagebreak', 'template', 'background', '|',
  307. //'horizontal', 'spechars', 'snapscreen', 'wordimage', '|',
  308. 'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', '|',
  309. //'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', '|',//'charts', '|',
  310. //'print', 'preview', 'searchreplace', 'help', 'drafts'
  311. ]],
  312. wordCount:false,
  313. elementPathEnabled:false,
  314. initialFrameHeight:400
  315. });
  316. var leipiFormDesign = {
  317. exec : function (method) {
  318. leipiEditor.execCommand(method);
  319. },
  320. parse_form:function(template,fields)
  321. {
  322. //正则 radios|checkboxs|select 匹配的边界 |--| 因为当使用 {} 时js报错 (plugins|fieldname|fieldflow)
  323. var preg = /(\|-<span(((?!<span).)*plugins=\"(radios|checkboxs|select)\".*?)>(.*?)<\/span>-\||<(img|input|textarea|select).*?(<\/select>|<\/textarea>|\/>))/gi,preg_attr =/(\w+)=\"(.?|.+?)\"/gi,preg_group =/<input.*?\/>/gi;
  324. if(!fields) fields = 0;
  325. var template_parse = template,template_data = new Array(),add_fields=new Object(),checkboxs=0;
  326. var pno = 0;
  327. template.replace(preg, function(plugin,p1,p2,p3,p4,p5,p6){
  328. var parse_attr = new Array(),attr_arr_all = new Object(),name = '', select_dot = '' , is_new=false;
  329. var p0 = plugin;
  330. var tag = p6 ? p6 : p4;
  331. //alert(tag + " \n- t1 - "+p1 +" \n-2- " +p2+" \n-3- " +p3+" \n-4- " +p4+" \n-5- " +p5+" \n-6- " +p6);
  332. if(tag == 'radios' || tag == 'checkboxs')
  333. {
  334. plugin = p2;
  335. }else if(tag == 'select')
  336. {
  337. plugin = plugin.replace('|-','');
  338. plugin = plugin.replace('-|','');
  339. }
  340. plugin.replace(preg_attr, function(str0,attr,val) {
  341. if(attr=='name')
  342. {
  343. if(val=='NEWFIELD')
  344. {
  345. is_new=true;
  346. fields++;
  347. val = 'data_'+fields;
  348. }
  349. name = val;
  350. }
  351. if(tag=='select' && attr=='value')
  352. {
  353. if(!attr_arr_all[attr]) attr_arr_all[attr] = '';
  354. attr_arr_all[attr] += select_dot + val;
  355. select_dot = ',';
  356. }else
  357. {
  358. attr_arr_all[attr] = val;
  359. }
  360. var oField = new Object();
  361. oField[attr] = val;
  362. parse_attr.push(oField);
  363. })
  364. /*alert(JSON.stringify(parse_attr));return;*/
  365. if(tag =='checkboxs') /*复选组 多个字段 */
  366. {
  367. plugin = p0;
  368. plugin = plugin.replace('|-','');
  369. plugin = plugin.replace('-|','');
  370. var name = 'checkboxs_'+checkboxs;
  371. attr_arr_all['parse_name'] = name;
  372. attr_arr_all['name'] = '';
  373. attr_arr_all['value'] = '';
  374. attr_arr_all['content'] = '<span leipiplugins="checkboxs" selector="'+attr_arr_all['selector']+'" autofield="'+attr_arr_all['autofield']+'" title="'+attr_arr_all['title']+'">';
  375. var dot_name ='', dot_value = '';
  376. p5.replace(preg_group, function(parse_group) {
  377. var is_new=false,option = new Object();
  378. parse_group.replace(preg_attr, function(str0,k,val) {
  379. if(k=='name')
  380. {
  381. if(val=='NEWFIELD')
  382. {
  383. is_new=true;
  384. fields++;
  385. val = 'data_'+fields;
  386. }
  387. attr_arr_all['name'] += dot_name + val;
  388. dot_name = ',';
  389. }
  390. else if(k=='value')
  391. {
  392. attr_arr_all['value'] += dot_value + val;
  393. dot_value = ',';
  394. }
  395. option[k] = val;
  396. });
  397. if(!attr_arr_all['options']) attr_arr_all['options'] = new Array();
  398. attr_arr_all['options'].push(option);
  399. if(!option['checked']) option['checked'] = '';
  400. var checked = option['checked'] ? 'checked="checked"' : '';
  401. var checkedtext=option['checkedtext'] ? option['checkedtext'] :option['value'];
  402. attr_arr_all['content'] +='<input type="checkbox" name="'+option['name']+'" checkedtext="'+checkedtext+'" value="'+option['value']+'" fieldname="' + attr_arr_all['fieldname'] + option['fieldname'] + '" fieldflow="' + attr_arr_all['fieldflow'] + '" '+checked+'/>'+checkedtext+'&nbsp;';
  403. if(is_new)
  404. {
  405. var arr = new Object();
  406. arr['name'] = option['name'];
  407. arr['plugins'] = attr_arr_all['plugins'];
  408. arr['fieldname'] = attr_arr_all['fieldname'] + option['fieldname'];
  409. arr['fieldflow'] = attr_arr_all['fieldflow'];
  410. add_fields[option['name']] = arr;
  411. }
  412. });
  413. attr_arr_all['content'] += '</span>';
  414. //parse
  415. template = template.replace(plugin,attr_arr_all['content']);
  416. template_parse = template_parse.replace(plugin,'{'+name+'}');
  417. template_parse = template_parse.replace('{|-','');
  418. template_parse = template_parse.replace('-|}','');
  419. template_data[pno] = attr_arr_all;
  420. checkboxs++;
  421. }else if(name)
  422. {
  423. if(tag =='radios') /*单选组 一个字段*/
  424. {
  425. plugin = p0;
  426. plugin = plugin.replace('|-','');
  427. plugin = plugin.replace('-|','');
  428. attr_arr_all['value'] = '';
  429. attr_arr_all['content'] = '<span leipiplugins="radios" selector="'+attr_arr_all['selector']+'" name="'+attr_arr_all['name']+'" autofield="'+attr_arr_all['autofield']+'" title="'+attr_arr_all['title']+'">';
  430. var dot='';
  431. p5.replace(preg_group, function(parse_group) {
  432. var option = new Object();
  433. parse_group.replace(preg_attr, function(str0,k,val) {
  434. if(k=='value')
  435. {
  436. attr_arr_all['value'] += dot + val;
  437. dot = ',';
  438. }
  439. option[k] = val;
  440. });
  441. option['name'] = attr_arr_all['name'];
  442. if(!attr_arr_all['options']) attr_arr_all['options'] = new Array();
  443. attr_arr_all['options'].push(option);
  444. if(!option['checked']) option['checked'] = '';
  445. var checked = option['checked'] ? 'checked="checked"' : '';
  446. var checkedtext=option['checkedtext'] ? option['checkedtext'] :option['value'];
  447. attr_arr_all['content'] +='<input type="radio" name="'+attr_arr_all['name']+'" checkedtext="'+checkedtext+'" value="'+option['value']+'" '+checked+'/>'+checkedtext+'&nbsp;';
  448. });
  449. attr_arr_all['content'] += '</span>';
  450. }else
  451. {
  452. attr_arr_all['content'] = is_new ? plugin.replace(/NEWFIELD/,name) : plugin;
  453. }
  454. //attr_arr_all['itemid'] = fields;
  455. //attr_arr_all['tag'] = tag;
  456. template = template.replace(plugin,attr_arr_all['content']);
  457. template_parse = template_parse.replace(plugin,'{'+name+'}');
  458. template_parse = template_parse.replace('{|-','');
  459. template_parse = template_parse.replace('-|}','');
  460. if(is_new)
  461. {
  462. var arr = new Object();
  463. arr['name'] = name;
  464. arr['plugins'] = attr_arr_all['plugins'];
  465. arr['title'] = attr_arr_all['title'];
  466. arr['orgtype'] = attr_arr_all['orgtype'];
  467. arr['fieldname'] = attr_arr_all['fieldname'];
  468. arr['fieldflow'] = attr_arr_all['fieldflow'];
  469. add_fields[arr['name']] = arr;
  470. }
  471. template_data[pno] = attr_arr_all;
  472. }
  473. pno++;
  474. })
  475. var view = template.replace(/{\|-/g,'');
  476. view = view.replace(/-\|}/g,'');
  477. var parse_form = new Object({
  478. 'fields':fields,//总字段数
  479. 'template':template,//完整html
  480. 'parse':view,
  481. 'data':template_data,//控件属性
  482. 'add_fields':add_fields//新增控件
  483. });
  484. return JSON.stringify(parse_form);
  485. },
  486. /*type = save 保存设计 versions 保存版本 close关闭 */
  487. fnCheckForm : function ( type ) {
  488. if(formEditor.queryCommandState( 'source' ))
  489. formEditor.execCommand('source');//切换到编辑模式才提交,否则有bug
  490. if(formEditor.hasContents()){
  491. formEditor.sync();/*同步内容*/
  492. //--------------以下仅参考-----------------------------------------------------------------------------------------------------
  493. var type_value='',formid=0,fields=$("#fields").val(),formeditor='';
  494. if( typeof type!=='undefined' ){
  495. type_value = type;
  496. }
  497. //获取表单设计器里的内容
  498. formeditor=formEditor.getContent();
  499. //解析表单设计器控件
  500. var parse_form = this.parse_form(formeditor,fields);
  501. //alert(parse_form);
  502. //异步提交数据
  503. $.ajax({
  504. type: 'POST',
  505. url : '${ctx}/config/form/processor',
  506. //dataType : 'json',
  507. data : {'type' : type_value,'formid':'${form.id}','parse_form':parse_form},
  508. success : function(data){
  509. if(data == true) {
  510. alert('表单保存成功');
  511. window.location.href='${ctx}/config/form';
  512. } else {
  513. alert('表单保存失败');
  514. }
  515. }
  516. });
  517. } else {
  518. alert('表单内容不能为空!')
  519. $('#submitbtn').button('reset');
  520. return false;
  521. }
  522. } ,
  523. // 预览表单
  524. fnReview : function (){
  525. if(leipiEditor.queryCommandState( 'source' ))
  526. leipiEditor.execCommand('source');
  527. if(leipiEditor.hasContents()){
  528. leipiEditor.sync();
  529. var parse_form = this.parse_form(leipiEditor.getContent());
  530. $("#formContent").val(parse_form);
  531. document.formobj.target="mywin";
  532. window.open('','mywin',"menubar=0,toolbar=0,status=0,resizable=1,left=0,top=0,scrollbars=1,width=" +(screen.availWidth-10) + ",height=" + (screen.availHeight-50) + "\"");
  533. document.formobj.action="autoFormController.do?review";
  534. document.formobj.submit(); //提交表单
  535. } else {
  536. alert('表单内容不能为空!');
  537. return false;
  538. }
  539. }
  540. };
  541. function setContent(){
  542. if(leipiEditor.queryCommandState( 'source' ))
  543. leipiEditor.execCommand('source');//切换到编辑模式才提交,否则有bug
  544. if(leipiEditor.hasContents()){
  545. leipiEditor.sync();
  546. $("#formContent").val(leipiEditor.getContent());
  547. }
  548. }
  549. </script>
  550. <#--update-end--Author: jg_huangxg Date:20160505 for:TASK #1027 【online】代码生成器模板不支持UE编辑器 -->
  551. <#else>
  552. <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="text"
  553. style="width: 150px" class="inputxt" value="${data['${tableName}']['${po.field_name}']?if_exists?html}"
  554. <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  555. <#if po.field_must_input??><#if po.field_must_input == 'Y' || po.is_null != 'Y'>ignore="checked"<#else>ignore="ignore"</#if><#elseif po.is_null != "Y">ignore="checked"<#else>ignore="ignore"</#if>
  556. <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  557. <#if po.field_valid_type?if_exists?html != ''>
  558. datatype="${po.field_valid_type?if_exists?html}"
  559. <#else>
  560. <#if po.type == 'int'>
  561. datatype="n"
  562. <#elseif po.type=='double'>
  563. datatype="/^(-?\d+)(\.\d+)?$/"
  564. <#else>
  565. <#if po.is_null != 'Y'>datatype="*"</#if>
  566. </#if>
  567. </#if>>
  568. </#if>
  569. <span class="Validform_checktip"></span>
  570. <label class="Validform_label" style="display: none;">${po.content?if_exists?html}</label>
  571. </td>
  572. <#if (columns?size>10)>
  573. <#if (po_index%2==0)&&(!po_has_next)>
  574. <td align="right">
  575. <label class="Validform_label">
  576. </label>
  577. </td>
  578. <td class="value">
  579. </td>
  580. </#if>
  581. <#if (po_index%2!=0)||(!po_has_next)>
  582. </tr>
  583. </#if>
  584. <#else>
  585. </tr>
  586. </#if>
  587. </#list>
  588. <#list columnsarea as po>
  589. <#if (columns?size>10)>
  590. <tr>
  591. <td align="right">
  592. <label class="Validform_label">
  593. ${po.content}:
  594. </label>
  595. </td>
  596. <td class="value" colspan="3">
  597. <textarea id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}"
  598. style="width: 600px" class="inputxt" rows="6"
  599. <#if po.operationCodesReadOnly?if_exists> readonly = "readonly"</#if>
  600. <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  601. <#if po.field_must_input??><#if po.field_must_input == 'Y' || po.is_null != 'Y'>ignore="checked"<#else>ignore="ignore"</#if><#elseif po.is_null != "Y">ignore="checked"<#else>ignore="ignore"</#if>
  602. <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  603. <#if po.field_valid_type?if_exists?html != ''>
  604. datatype="${po.field_valid_type?if_exists?html}"
  605. <#else>
  606. <#if po.is_null != 'Y'>datatype="*"</#if>
  607. </#if>>${data['${tableName}']['${po.field_name}']?if_exists?html}</textarea>
  608. <span class="Validform_checktip"></span>
  609. <label class="Validform_label" style="display: none;">${po.content?if_exists?html}</label>
  610. <#if po.show_type=='umeditor'>
  611. <script type="text/javascript">
  612. //实例化编辑器
  613. var ${po.field_name}_ue = UE.getEditor('${po.field_name}',{initialFrameWidth:${po.field_length}}).setHeight(260);
  614. </script>
  615. </#if>
  616. </td>
  617. </tr>
  618. <#else>
  619. <tr>
  620. <td align="right">
  621. <label class="Validform_label">
  622. ${po.content}:
  623. </label>
  624. </td>
  625. <td class="value">
  626. <textarea id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}"
  627. class="inputxt" rows="7"
  628. <#if po.operationCodesReadOnly?if_exists> readonly = "readonly"</#if>
  629. <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  630. <#if po.field_must_input??><#if po.field_must_input == 'Y' || po.is_null != 'Y'>ignore="checked"<#else>ignore="ignore"</#if><#elseif po.is_null != "Y">ignore="checked"<#else>ignore="ignore"</#if>
  631. <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  632. <#if po.field_valid_type?if_exists?html != ''>
  633. datatype="${po.field_valid_type?if_exists?html}"
  634. <#else>
  635. <#if po.is_null != 'Y'>datatype="*"</#if>
  636. </#if>>${data['${tableName}']['${po.field_name}']?if_exists?html}</textarea>
  637. <span class="Validform_checktip"></span>
  638. <label class="Validform_label" style="display: none;">${po.content?if_exists?html}</label>
  639. <#if po.show_type=='umeditor'>
  640. <script type="text/javascript">
  641. //实例化编辑器
  642. var ${po.field_name}_ue = UE.getEditor('${po.field_name}',{initialFrameWidth:${po.field_length}}).setHeight(260);
  643. </script>
  644. </#if>
  645. </td>
  646. </tr>
  647. </#if>
  648. </#list>
  649. <tr>
  650. <td height="50px" align="center" colspan="2">
  651. <a style="margin-left:80px" href="#" class="easyui-linkbutton l-btn" plain="true" iconcls="icon-le-back" onclick="history.go(-1)"> 返 回&nbsp; </a>
  652. <a id="btn_ok" href="javascript:void(0)" class="easyui-linkbutton l-btn" plain="true" iconcls="icon-le-ok" onclick="btn_ok()"> 提 交 &nbsp;</a>
  653. </td>
  654. </tr>
  655. </table>
  656. <script type="text/javascript">
  657. $(function(){
  658. $("#formobj").Validform(
  659. {
  660. tiptype:1,
  661. btnSubmit:"#btn_sub",
  662. btnReset:"#btn_reset",
  663. ajaxPost:true,
  664. usePlugin:{
  665. passwordstrength:{
  666. minLen:6,
  667. maxLen:18,
  668. trigger:function(obj,error){
  669. if(error){
  670. obj.parent().next().find(".Validform_checktip").show();
  671. obj.find(".passwordStrength").hide();
  672. }else{
  673. $(".passwordStrength").show();
  674. obj.parent().next().find(".Validform_checktip").hide();
  675. }
  676. }
  677. }
  678. },
  679. callback:function(data){
  680. if(data.success==true){
  681. uploadFile(data);
  682. layer.alert(data.msg, function(index){
  683. window.location.href='${basePath}/cgAutoListController.do?list&id=${tableName?if_exists?html}';
  684. layer.close(index); })
  685. }
  686. else{
  687. if(data.responseText==''||data.responseText==undefined){
  688. $.messager.alert('错误', data.msg);
  689. $.Hidemsg();
  690. }else{
  691. try{
  692. var emsg = data.responseText.substring(data.responseText.indexOf('错误描述'),data.responseText.indexOf('错误信息'));
  693. $.messager.alert('错误',emsg);
  694. $.Hidemsg();
  695. }catch(ex){
  696. $.messager.alert('错误',data.responseText+'');
  697. }}
  698. return false;
  699. }
  700. }});});</script>
  701. </form>
  702. <#--update-end--Author:luobaoli Date:20150614 for:表单单表属性中增加了扩展参数 ${po.extend_json?if_exists}-->
  703. <script type="text/javascript">
  704. $(function(){
  705. //查看模式情况下,删除和上传附件功能禁止使用
  706. if(location.href.indexOf("goDetail.do")!=-1){
  707. $(".jeecgDetail").hide();
  708. }
  709. if(location.href.indexOf("goDetail.do")!=-1){
  710. //查看模式控件禁用
  711. $("#formobj").find(":input").attr("disabled","disabled");
  712. }
  713. if(location.href.indexOf("goAddButton.do")!=-1||location.href.indexOf("goUpdateButton.do")!=-1){
  714. //其他模式显示提交按钮
  715. $("#sub_tr").show();
  716. }
  717. });
  718. function upload() {
  719. <#list columns as po>
  720. <#if po.show_type=='file'>
  721. $('#${po.field_name}').uploadify('upload', '*');
  722. </#if>
  723. <#if po.show_type=='image'>
  724. $('#${po.field_name}').uploadify('upload', '*');
  725. </#if>
  726. </#list>
  727. }
  728. function cancel() {
  729. <#list columns as po>
  730. <#if po.show_type=='file'>
  731. $('#${po.field_name}').uploadify('cancel', '*');
  732. </#if>
  733. <#if po.show_type=='image'>
  734. $('#${po.field_name}').uploadify('cancel', '*');
  735. </#if>
  736. </#list>
  737. }
  738. function uploadFile(data){
  739. if(!$("input[name='id']").val()){
  740. if(data.obj!=null && data.obj!='undefined'){
  741. $("input[name='id']").val(data.obj.id);
  742. }
  743. }
  744. if($(".uploadify-queue-item").length>0){
  745. upload();
  746. }else{
  747. /*var win = frameElement.api.opener;
  748. win.reloadTable();
  749. win.tip(data.msg);
  750. frameElement.api.close();*/
  751. }
  752. }
  753. $.dialog.setting.zIndex =1990;
  754. function del(url,obj){
  755. $.dialog.confirm("确认删除该条记录?", function(){
  756. $.ajax({
  757. async : false,
  758. cache : false,
  759. type : 'POST',
  760. url : url,// 请求的action路径
  761. error : function() {// 请求失败处理函数
  762. },
  763. success : function(data) {
  764. var d = $.parseJSON(data);
  765. if (d.success) {
  766. var msg = d.msg;
  767. tip(msg);
  768. $(obj).closest("tr").hide("slow");
  769. }
  770. }
  771. });
  772. }, function(){
  773. });
  774. }
  775. <#--add-start--Author:钟世云 Date:20150614 for:online支持树配置-->
  776. /**树形列表数据转换**/
  777. function convertTreeData(rows, textField) {
  778. for(var i = 0; i < rows.length; i++) {
  779. var row = rows[i];
  780. row.text = row[textField];
  781. if(row.children) {
  782. row.state = "open";
  783. convertTreeData(row.children, textField);
  784. }
  785. }
  786. }
  787. /**树形列表加入子元素**/
  788. function joinTreeChildren(arr1, arr2) {
  789. for(var i = 0; i < arr1.length; i++) {
  790. var row1 = arr1[i];
  791. for(var j = 0; j < arr2.length; j++) {
  792. if(row1.id == arr2[j].id) {
  793. var children = arr2[j].children;
  794. if(children) {
  795. row1.children = children;
  796. }
  797. }
  798. }
  799. }
  800. }
  801. <#--add-end--Author:钟世云 Date:20150614 for:online支持树配置-->
  802. </script>
  803. <script type="text/javascript">${js_plug_in?if_exists}</script>
  804. </body>
  805. </html>