jform.ftl 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <#setting number_format="0.#####################">
  2. <!DOCTYPE html>
  3. <htmlclass="not-ie" lang="en">
  4. <head>
  5. <base href="${basePath}/"/>
  6. <meta charset="utf-8">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  8. <title>编辑</title>
  9. <link href="${basePath}/online/template/${this_olstylecode}/css/bootstrap.min.css" rel="stylesheet">
  10. <link href="${basePath}/online/template/${this_olstylecode}/css/scojs.css" rel="stylesheet">
  11. <link href="${basePath}/online/template/${this_olstylecode}/css/sco.message.css" rel="stylesheet">
  12. <link href="${basePath}/online/template/${this_olstylecode}/css/style.css" rel="stylesheet">
  13. <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  14. <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  15. <!--[if lt IE 9]>
  16. <script src="${basePath}/plug-in/Formdesign/js/html5shiv.min.js"></script>
  17. <script src="${basePath}/plug-in/Formdesign/js/respond.min.js"></script>
  18. <![endif]-->
  19. <script type="text/javascript" src="${basePath}/online/template/${this_olstylecode}/js/jquery-1.9.1.js"></script>
  20. <script type="text/javascript" src="${basePath}/online/template/${this_olstylecode}/js/respond.min.js"></script>
  21. <script type="text/javascript" src="${basePath}/online/template/${this_olstylecode}/js/bootstrap.js"></script>
  22. <script type="text/javascript" src="${basePath}/online/template/${this_olstylecode}/js/sco.message.js"></script>
  23. <script type="text/javascript" src="${basePath}/plug-in/tools/curdtools_zh-cn.js"></script>
  24. <script type="text/javascript" src="${basePath}/plug-in/tools/dataformat.js"></script>
  25. <script type="text/javascript" src="${basePath}/plug-in/My97DatePicker/WdatePicker.js"></script>
  26. <link rel="stylesheet" href="${basePath}/plug-in/Validform/css/style.css" type="text/css"></link>
  27. <link rel="stylesheet" href="${basePath}/plug-in/uploadify/css/uploadify.css" type="text/css"></link>
  28. <script type="text/javascript" src="${basePath}/plug-in/uploadify/jquery.uploadify-3.1.js"></script>
  29. <script type="text/javascript" src="${basePath}/plug-in/tools/Map.js"></script>
  30. <script type="text/javascript" src="${basePath}/plug-in/Validform/js/Validform_v5.3.1_min_zh-cn.js"></script>
  31. <script type="text/javascript" src="${basePath}/plug-in/Validform/js/Validform_Datatype_zh-cn.js"></script>
  32. <script type="text/javascript" src="${basePath}/plug-in/Validform/js/datatype_zh-cn.js"></script>
  33. <script type="text/javascript" src="${basePath}/plug-in/Validform/plugin/passwordStrength/passwordStrength-min.js"></script>
  34. </head>
  35. <body>
  36. <script type="text/javascript">
  37. jQuery(function(){
  38. //查看模式情况下,删除和上传附件功能禁止使用
  39. if(location.href.indexOf("goDetail.do")!=-1){
  40. $(".jeecgDetail").hide();
  41. }
  42. if(location.href.indexOf("goDetail.do")!=-1){
  43. //查看模式控件禁用
  44. $("#formobj").find(":input").attr("disabled","disabled");
  45. $("#closeButton").removeAttr("disabled");
  46. }
  47. if(location.href.indexOf("goAddButton.do")!=-1||location.href.indexOf("goUpdateButton.do")!=-1){
  48. //其他模式显示提交按钮
  49. $("#sub_tr").show();
  50. }
  51. });
  52. function upload() {
  53. <#list columns as po>
  54. <#if po.show_type=='file'>
  55. $('#${po.field_name}').uploadify('upload', '*');
  56. </#if>
  57. </#list>
  58. }
  59. var neibuClickFlag = false;
  60. function neibuClick() {
  61. neibuClickFlag = true;
  62. $('#btn_sub').trigger('click');
  63. }
  64. function cancel() {
  65. <#list columns as po>
  66. <#if po.show_type=='file'>
  67. $('#${po.field_name}').uploadify('cancel', '*');
  68. </#if>
  69. </#list>
  70. }
  71. function uploadFile(data){
  72. if(!$("input[name='id']").val()){
  73. <#--update-start--Author:luobaoli Date:20150614 for:需要判断data.obj存在,才能取id值-->
  74. if(data.obj!=null && data.obj!='undefined'){
  75. $("input[name='id']").val(data.obj.id);
  76. }
  77. <#--update-end--Author:luobaoli Date:20150614 for:需要判断data.obj存在,才能取id值-->
  78. }
  79. if($(".uploadify-queue-item").length>0){
  80. upload();
  81. }else{
  82. if (neibuClickFlag){
  83. alert(data.msg);
  84. neibuClickFlag = false;
  85. }else {
  86. var win = frameElement.api.opener;
  87. win.reloadTable();
  88. win.tip(data.msg);
  89. frameElement.api.close();
  90. }
  91. }
  92. }
  93. function openwindow(title, url,name, width, height){
  94. $("#modal-url").attr("src",url);
  95. $('#myModal').modal("show");
  96. }
  97. function del(url,obj){
  98. $.ajax({
  99. async : false,
  100. cache : false,
  101. type : 'POST',
  102. url : url,// 请求的action路径
  103. error : function() {// 请求失败处理函数
  104. },
  105. success : function(data) {
  106. var d = $.parseJSON(data);
  107. if (d.success) {
  108. var msg = d.msg;
  109. $.scojs_message("操作成功!",$.scojs_message.TYPE_OK)
  110. $(obj).closest("tr").hide("slow");
  111. }
  112. }
  113. });
  114. }
  115. </script>
  116. <div class="container bs-docs-container" >
  117. <form class="form-horizontal" role="form" action="${basePath}/cgFormBuildController.do?saveOrUpdateMore" name="formobj" method="post" id="formobj">
  118. <div class="form-group mno">
  119. <div class="col-xs-4 col-sm-4 col-md-4 col-xs-offset-4 col-sm-offset-4 col-md-offset-4">
  120. <h3 >${head.content}</h3>
  121. </div>
  122. </div>
  123. <input type="hidden" id="btn_sub" class="btn_sub"/>
  124. <input type="hidden" name="tableName" value="${tableName?if_exists?html}" >
  125. <input type="hidden" name="id" value="${id?if_exists?html}" >
  126. <#list columnhidden as po>
  127. <input type="hidden" id="${po.field_name}" name="${po.field_name}" value="${data['${tableName}']['${po.field_name}']?if_exists?html}" >
  128. </#list>
  129. <#list columns as po>
  130. <div class="form-group mno">
  131. <label class="col-xs-2 col-sm-2 col-md-2 col-xs-offset-2 col-sm-offset-2 col-md-offset-2 control-label Validform_label" >${po.content}:</label>
  132. <div class=" col-xs-6 col-sm-6 col-md-6">
  133. <#if po.show_type=='text'>
  134. <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="text"
  135. class="form-control" value="${data['${tableName}']['${po.field_name}']?if_exists?html}"
  136. <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  137. <#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>
  138. <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  139. <#if po.field_valid_type?if_exists?html != ''>
  140. datatype="${po.field_valid_type?if_exists?html}"
  141. <#else>
  142. <#if po.type == 'int'>
  143. datatype="n"
  144. <#elseif po.type=='double'>
  145. datatype="/^(-?\d+)(\.\d+)?$/"
  146. <#else>
  147. <#if po.is_null != 'Y'>datatype="*"</#if>
  148. </#if></#if> />
  149. <#elseif po.show_type=='password'>
  150. <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="password"
  151. class="form-control" value="${data['${tableName}']['${po.field_name}']?if_exists?html}"
  152. <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  153. <#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>
  154. <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  155. <#if po.field_valid_type?if_exists?html != ''>
  156. datatype="${po.field_valid_type?if_exists?html}"
  157. <#else>
  158. <#if po.is_null != 'Y'>datatype="*"</#if>
  159. </#if>>
  160. <#elseif po.show_type=='radio'>
  161. <@DictData name="${po.dict_field?if_exists?html}" text="${po.dict_text?if_exists?html}" tablename="${po.dict_table?if_exists?html}" var="dataList">
  162. <#list dataList as dictdata>
  163. <label class="radio-inline">
  164. <input value="${dictdata.typecode?if_exists?html}" ${po.extend_json?if_exists} name="${po.field_name}" type="radio"
  165. <#if dictdata_index==0&&po.is_null != 'Y'>datatype="*"</#if>
  166. <#if dictdata.typecode?if_exists?html=="${data['${tableName}']['${po.field_name}']?if_exists?html}"> checked="true" </#if>>
  167. ${dictdata.typename?if_exists?html}
  168. </label>
  169. </#list>
  170. </@DictData>
  171. <#elseif po.show_type=='checkbox'>
  172. <#assign checkboxstr>${data['${tableName}']['${po.field_name}']?if_exists?html}</#assign>
  173. <#assign checkboxlist=checkboxstr?split(",")>
  174. <@DictData name="${po.dict_field?if_exists?html}" text="${po.dict_text?if_exists?html}" tablename="${po.dict_table?if_exists?html}" var="dataList">
  175. <#list dataList as dictdata>
  176. <label class="checkbox-inline">
  177. <input value="${dictdata.typecode?if_exists?html}" ${po.extend_json?if_exists} name="${po.field_name}" type="checkbox"
  178. <#if dictdata_index==0&&po.is_null != 'Y'>datatype="*"</#if>
  179. <#list checkboxlist as x >
  180. <#if dictdata.typecode?if_exists?html=="${x?if_exists?html}"> checked="true" </#if></#list>>
  181. ${dictdata.typename?if_exists?html}
  182. </label>
  183. </#list>
  184. </@DictData>
  185. <#elseif po.show_type=='list'>
  186. <@DictData name="${po.dict_field?if_exists?html}" text="${po.dict_text?if_exists?html}" tablename="${po.dict_table?if_exists?html}" var="dataList">
  187. <select id="${po.field_name}" class="form-control" ${po.extend_json?if_exists} name="${po.field_name}"
  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.is_null != 'Y'>datatype="*"</#if>>
  192. <#list dataList as dictdata>
  193. <option value="${dictdata.typecode?if_exists?html}"
  194. <#if dictdata.typecode?if_exists?html=="${data['${tableName}']['${po.field_name}']?if_exists?html}"> selected="selected" </#if>>
  195. ${dictdata.typename?if_exists?html}
  196. </option>
  197. </#list>
  198. </select>
  199. </@DictData>
  200. <#elseif po.show_type=='date'>
  201. <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="text" class="form-control"
  202. value="<#if data['${tableName}']['${po.field_name}']??>${data['${tableName}']['${po.field_name}']?if_exists?string("yyyy-MM-dd")}</#if>"
  203. class="form-control Wdate" onClick="WdatePicker()"
  204. <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  205. <#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>
  206. <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  207. <#if po.field_valid_type?if_exists?html != ''>
  208. datatype="${po.field_valid_type?if_exists?html}"
  209. <#else>
  210. <#if po.is_null != 'Y'>datatype="*"</#if>
  211. </#if>>
  212. <#elseif po.show_type=='datetime'>
  213. <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="text" class="form-control"
  214. value="<#if data['${tableName}']['${po.field_name}']??>${data['${tableName}']['${po.field_name}']?if_exists?string("yyyy-MM-dd HH:mm:ss")}</#if>"
  215. class="form-control Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
  216. <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  217. <#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>
  218. <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  219. <#if po.field_valid_type?if_exists?html != ''>
  220. datatype="${po.field_valid_type?if_exists?html}"
  221. <#else>
  222. <#if po.is_null != 'Y'>datatype="*"</#if>
  223. </#if>>
  224. <#elseif po.show_type=='popup'>
  225. <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="text"
  226. class="searchbox-inputtext form-control"
  227. onClick="inputClick(this,'${po.dict_text?if_exists?html}','${po.dict_table?if_exists?html}');"
  228. value="${data['${tableName}']['${po.field_name}']?if_exists?html}"
  229. <#if po.field_valid_type?if_exists?html != ''>
  230. datatype="${po.field_valid_type?if_exists?html}"
  231. <#else>
  232. <#if po.is_null != 'Y'>datatype="*"</#if>
  233. </#if>>
  234. <#elseif po.show_type=='file'>
  235. <table class="table">
  236. <#list filesList as fileB>
  237. <#if fileB['field'] == po.field_name>
  238. <tr style="height:34px;">
  239. <td>${fileB['title']}</td>
  240. <td><a href="${basePath}/commonController.do?viewFile&fileid=${fileB['fileKey']}&subclassname=org.jeecgframework.web.cgform.entity.upload.CgUploadEntity" title="下载">下载</a></td>
  241. <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>
  242. <td><a href="javascript:void(0)" class="jeecgDetail" onclick="del('${basePath}/cgUploadController.do?delFile&id=${fileB['fileKey']}',this)">删除</a></td>
  243. </tr>
  244. </#if>
  245. </#list>
  246. </table>
  247. <div class="form jeecgDetail">
  248. <script type="text/javascript">
  249. var serverMsg="";
  250. var m = new Map();
  251. $(function(){$('#${po.field_name}').uploadify(
  252. {buttonText:'添加文件',
  253. auto:false,
  254. progressData:'speed',
  255. multi:true,
  256. height:25,
  257. overrideEvents:['onDialogClose'],
  258. fileTypeDesc:'文件格式:',
  259. queueID:'filediv_${po.field_name}',
  260. <#-- fileTypeExts:'*.rar;*.zip;*.doc;*.docx;*.txt;*.ppt;*.xls;*.xlsx;*.html;*.htm;*.pdf;*.jpg;*.gif;*.png', 页面弹出很慢解决 20170317 scott -->
  261. fileSizeLimit:'15MB',swf:'${basePath}/plug-in/uploadify/uploadify.swf',
  262. uploader:'${basePath}/cgUploadController.do?saveFiles&jsessionid='+$("#sessionUID").val()+'',
  263. onUploadStart : function(file) {
  264. var cgFormId=$("input[name='id']").val();
  265. $('#${po.field_name}').uploadify("settings", "formData", {'cgFormId':cgFormId,'cgFormName':'${tableName?if_exists?html}','cgFormField':'${po.field_name}'});} ,
  266. onQueueComplete : function(queueData) {
  267. var win = frameElement.api.opener;
  268. win.reloadTable();
  269. win.tip(serverMsg);
  270. frameElement.api.close();},
  271. 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;}},
  272. onUploadProgress : function(file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal) { }});});
  273. </script><span id="file_uploadspan"><input type="file" name="${po.field_name}" id="${po.field_name}" /></span>
  274. </div>
  275. <div class="form" id="filediv_${po.field_name}"> </div>
  276. <#else>
  277. <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="text"
  278. class="form-control" value="${data['${tableName}']['${po.field_name}']?if_exists?html}"
  279. <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  280. <#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>
  281. <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  282. <#if po.field_valid_type?if_exists?html != ''>
  283. datatype="${po.field_valid_type?if_exists?html}"
  284. <#else>
  285. <#if po.type == 'int'>
  286. datatype="n"
  287. <#elseif po.type=='double'>
  288. datatype="/^(-?\d+)(\.\d+)?$/"
  289. <#else>
  290. <#if po.is_null != 'Y'>datatype="*"</#if>
  291. </#if></#if>>
  292. </#if>
  293. <span class="Validform_checktip"></span>
  294. <label class="Validform_label" style="display: none;">${po.content?if_exists?html}</label>
  295. </div>
  296. </div>
  297. </#list>
  298. <#list columnsarea as po>
  299. <div class="form-group mno">
  300. <label class="col-xs-2 col-sm-2 col-md-2 col-xs-offset-2 col-sm-offset-2 col-md-offset-2 control-label Validform_label" >${po.content}:</label>
  301. <div class="col-xs-6 col-sm-6 col-md-6">
  302. <textarea id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}"
  303. class="form-control inputxt" rows="5"
  304. <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  305. <#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>
  306. <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
  307. <#if po.field_valid_type?if_exists?html != ''>
  308. datatype="${po.field_valid_type?if_exists?html}"
  309. <#else>
  310. <#if po.is_null != 'Y'>datatype="*"</#if>
  311. </#if>>${data['${tableName}']['${po.field_name}']?if_exists?html}</textarea>
  312. <span class="Validform_checktip"></span>
  313. <label class="Validform_label" style="display: none;">${po.content?if_exists?html}</label>
  314. </div>
  315. </div>
  316. </#list>
  317. <script type="text/javascript">$(function(){$("#formobj").Validform({tiptype:1,btnSubmit:"#btn_sub",btnReset:"#btn_reset",ajaxPost:true,usePlugin:{passwordstrength:{minLen:6,maxLen:18,trigger:function(obj,error){if(error){obj.parent().next().find(".Validform_checktip").show();obj.find(".passwordStrength").hide();}else{$(".passwordStrength").show();obj.parent().next().find(".Validform_checktip").hide();}}}},callback:function(data){if(data.success==true){uploadFile(data);}else{if(data.responseText==''||data.responseText==undefined){$.scojs_message( data.msg,$.scojs_message.TYPE_ERROR);$.Hidemsg();}else{try{var emsg = data.responseText.substring(data.responseText.indexOf('错误描述'),data.responseText.indexOf('错误信息')); $.scojs_message( emsg,$.scojs_message.TYPE_ERROR);;$.Hidemsg();}catch(ex){$.scojs_message( data.responseText+'',$.scojs_message.TYPE_ERROR);}} return false;}if(!neibuClickFlag){var win = frameElement.api.opener; win.reloadTable();}}});});</script>
  318. </form>
  319. </div>
  320. <!-- 模态框(Modal) -->
  321. <div class="modal fade" id="myModal" tabindex="-1" role="dialog"
  322. aria-labelledby="myModalLabel" aria-hidden="true">
  323. <div class="modal-dialog">
  324. <div class="modal-content">
  325. <div class="modal-header">
  326. <button id="closeButton" class="close" data-dismiss="modal"
  327. aria-hidden="true">×
  328. </button>
  329. <h4 class="modal-title" id="myModalLabel">
  330. 预览
  331. </h4>
  332. </div>
  333. <div class="modal-body" style="width: 700px;height: 500px;">
  334. <iframe src="" id="modal-url" style="width: 80%;height: 80%;"/>
  335. </div>
  336. </div><!-- /.modal-content -->
  337. </div><!-- /.modal-dialog -->
  338. </div><!-- /.modal -->
  339. </body>
  340. </html>