| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851 |
- <#setting number_format="0.#####################">
- <!DOCTYPE html>
- <html>
- <head>
- <base href="${basePath}/"/>
- <title></title>
- ${config_iframe}
- <link rel="stylesheet" href="${basePath}/plug-in/easyui/themes/metrole/icon.css" type="text/css">
- <script src="${basePath}/plug-in/layer/layer.js"></script>
- <script type="text/javascript">
- function btn_ok(){
- $('#btn_sub').trigger('click');
- }
- </script>
- </head>
- <body>
- <#--update-start--Author:luobaoli Date:20150614 for:表单单表属性中增加了扩展参数 ${po.extend_json?if_exists}-->
- <form id="formobj" action="cgFormBuildController.do?saveOrUpdate" name="formobj" method="post">
- <input type="hidden" id="btn_sub" class="btn_sub"/>
- <input type="hidden" name="tableName" value="${tableName?if_exists?html}" >
- <input type="hidden" name="id" value="${id?if_exists?html}" >
- <#list columnhidden as po>
- <input type="hidden" id="${po.field_name}" name="${po.field_name}" value="${data['${tableName}']['${po.field_name}']?if_exists?html}" >
- </#list>
- <table cellpadding="0" cellspacing="1" class="formtable">
- <#list columns as po>
- <#if (columns?size>10)>
- <#if po_index%2==0>
- <tr>
- </#if>
- <#else>
- <tr>
- </#if>
- <td align="right" >
- <label class="Validform_label">
- ${po.content}:
- </label>
- </td>
- <td class="value">
- <#--update-begin--Author:钟世云 Date:20150610 for:online支持树配置-->
- <#if head.isTree=='Y' && head.treeParentIdFieldName==po.field_name>
- <!--如果为树形菜单,父id输入框设置为select-->
- <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="text"
- style="width: 150px" class="inputxt easyui-combotree" value="${data['${tableName}']['${po.field_name}']?if_exists?html}"
- <#if po.operationCodesReadOnly?exists> readonly = "readonly"</#if>
- <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#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>
- <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#if po.field_valid_type?if_exists?html != ''>
- datatype="${po.field_valid_type?if_exists?html}"
- <#else>
- <#if po.type == 'int'>
- datatype="n" <#if po.is_null == 'Y'>ignore="ignore" </#if>
- <#elseif po.type=='double'>
- datatype="/^(-?\d+)(\.\d+)?$/" <#if po.is_null == 'Y'>ignore="ignore" </#if>
- <#else>
- <#if po.is_null != 'Y'>datatype="*"</#if>
- </#if>
- </#if>
- data-options="
- panelHeight:'220',
- url: 'cgAutoListController.do?datagrid&configId=${tableName?if_exists?html}&field=id,${head.treeFieldname}',
- loadFilter: function(data) {
- var rows = data.rows || data;
- var win = frameElement.api.opener;
- var listRows = win.getDataGrid().treegrid('getData');
- joinTreeChildren(rows, listRows);
- convertTreeData(rows, '${head.treeFieldname}');
- return rows;
- },
- onLoadSuccess: function() {
- var win = frameElement.api.opener;
- var currRow = win.getDataGrid().treegrid('getSelected');
- if(!'${id?if_exists?html}') {
- //增加时,选择当前父菜单
- if(currRow) {
- $('#${po.field_name}').combotree('setValue', currRow.id);
- }
- }else {
- //编辑时,选择当前父菜单
- if(currRow) {
- $('#${po.field_name}').combotree('setValue', currRow._parentId);
- }
- }
- }
- ">
- <#--update-end--Author:钟世云 Date:20150610 for:online支持树配置-->
- <#elseif po.show_type=='text'>
- <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="text"
- style="width: 150px" class="inputxt" value="${data['${tableName}']['${po.field_name}']?if_exists?html}"
- <#if po.operationCodesReadOnly?exists> readonly = "readonly"</#if>
- <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#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>
- <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#if po.field_valid_type?if_exists?html != ''>
- datatype="${po.field_valid_type?if_exists?html}"
- <#else>
- <#if po.type == 'int'>
- datatype="n" <#if po.is_null == 'Y'>ignore="ignore" </#if>
- <#elseif po.type=='double'>
- datatype="/^(-?\d+)(\.\d+)?$/" <#if po.is_null == 'Y'>ignore="ignore" </#if>
- <#else>
- <#if po.is_null != 'Y'>datatype="*"</#if>
- </#if>
- </#if>>
- <#elseif po.show_type=='password'>
- <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="password"
- style="width: 150px" class="inputxt" value="${data['${tableName}']['${po.field_name}']?if_exists?html}"
- <#if po.operationCodesReadOnly?if_exists> readonly = "readonly"</#if>
- <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#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>
- <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#if po.field_valid_type?if_exists?html != ''>
- datatype="${po.field_valid_type?if_exists?html}"
- <#else>
- <#if po.is_null != 'Y'>datatype="*"</#if>
- </#if>>
-
- <#elseif po.show_type=='radio'>
- <@DictData name="${po.dict_field?if_exists?html}" text="${po.dict_text?if_exists?html}" tablename="${po.dict_table?if_exists?html}" var="dataList">
- <#list dataList as dictdata>
- <input value="${dictdata.typecode?if_exists?html}" ${po.extend_json?if_exists} name="${po.field_name}" type="radio"
- <#if dictdata_index==0&&po.is_null != 'Y'>datatype="*"</#if>
- <#if po.operationCodesReadOnly?if_exists>onclick="return false;"</#if>
- <#if dictdata.typecode?if_exists?html=="${data['${tableName}']['${po.field_name}']?if_exists?html}"> checked="true" </#if>>
- ${dictdata.typename?if_exists?html}
- </#list>
- </@DictData>
-
- <#elseif po.show_type=='checkbox'>
- <#assign checkboxstr>${data['${tableName}']['${po.field_name}']?if_exists?html}</#assign>
- <#assign checkboxlist=checkboxstr?split(",")>
- <@DictData name="${po.dict_field?if_exists?html}" text="${po.dict_text?if_exists?html}" tablename="${po.dict_table?if_exists?html}" var="dataList">
- <#list dataList as dictdata>
- <input value="${dictdata.typecode?if_exists?html}" ${po.extend_json?if_exists} name="${po.field_name}" type="checkbox"
- <#if po.operationCodesReadOnly?if_exists>onclick="return false;"</#if>
- <#if dictdata_index==0&&po.is_null != 'Y'>datatype="*"</#if>
- <#list checkboxlist as x >
- <#if dictdata.typecode?if_exists?html=="${x?if_exists?html}"> checked="true" </#if></#list>>
- ${dictdata.typename?if_exists?html}
- </#list>
- </@DictData>
-
- <#elseif po.show_type=='list'>
- <@DictData name="${po.dict_field?if_exists?html}" text="${po.dict_text?if_exists?html}" tablename="${po.dict_table?if_exists?html}" var="dataList">
- <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>
- <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#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>
- <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#if po.is_null != 'Y'>datatype="*"</#if> >
- <#list dataList as dictdata>
- <option value="${dictdata.typecode?if_exists?html}"
- <#if dictdata.typecode?if_exists?html=="${data['${tableName}']['${po.field_name}']?if_exists?html}"> selected="selected" </#if>>
- ${dictdata.typename?if_exists?html}
- </option>
- </#list>
- </select>
- </@DictData>
-
- <#elseif po.show_type=='date'>
- <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="text"
- style="width: 150px" value="<#if data['${tableName}']['${po.field_name}']??>${data['${tableName}']['${po.field_name}']?if_exists?string("yyyy-MM-dd")}</#if>"
- class="Wdate" onClick="WdatePicker({<#if po.operationCodesReadOnly?if_exists> readonly = true</#if>})"
- <#if po.operationCodesReadOnly?exists> readonly = "readonly"</#if>
- <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#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>
- <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#if po.field_valid_type?if_exists?html != ''>
- datatype="${po.field_valid_type?if_exists?html}"
- <#else>
- <#if po.is_null != 'Y'>datatype="*"</#if>
- </#if>>
-
- <#elseif po.show_type=='datetime'>
- <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="text"
- 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>"
- class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'<#if po.operationCodesReadOnly?if_exists> ,readonly = true</#if>})"
- <#if po.operationCodesReadOnly?exists> readonly = "readonly"</#if>
- <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#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>
- <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#if po.field_valid_type?if_exists?html != ''>
- datatype="${po.field_valid_type?if_exists?html}"
- <#else>
- <#if po.is_null != 'Y'>datatype="*"</#if>
- </#if>>
-
- <#elseif po.show_type=='popup'>
- <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="text"
- style="width: 150px" class="searchbox-inputtext"
- onClick="inputClick(this,'${po.dict_text?if_exists?html}','${po.dict_table?if_exists?html}');"
- value="${data['${tableName}']['${po.field_name}']?if_exists?html}"
- <#if po.operationCodesReadOnly?if_exists> readonly = "readonly"</#if>
- <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#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>
- <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#if po.field_valid_type?if_exists?html != ''>
- datatype="${po.field_valid_type?if_exists?html}"
- <#else>
- <#if po.is_null != 'Y'>datatype="*"</#if>
- </#if>>
-
- <#elseif po.show_type=='file'>
- <table>
- <#list imageList as imageB>
- <#if imageB['field'] == po.field_name>
- <tr style="height:34px;">
- <td>${imageB['title']}</td>
- <td><a href="${basePath}/commonController.do?viewFile&fileid=${fileB['fileKey']}&subclassname=org.jeecgframework.web.cgform.entity.upload.CgUploadEntity" title="下载">下载</a></td>
- <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>
- <td><a href="javascript:void(0)" class="jeecgDetail" onclick="del('${basePath}/cgUploadController.do?delFile&id=${fileB['fileKey']}',this)">删除</a></td>
- </tr>
- </#if>
- </#list>
- </table>
- <#if !(po.operationCodesReadOnly ??)>
- <div class="form jeecgDetail">
- <script type="text/javascript">
- var serverMsg="";
- var m = new Map();
- $(function(){$('#${po.field_name}').uploadify(
- {buttonText:'添加文件',
- auto:false,
- progressData:'speed',
- multi:true,
- height:25,
- overrideEvents:['onDialogClose'],
- fileTypeDesc:'文件格式:',
- queueID:'filediv_${po.field_name}',
- <#-- fileTypeExts:'*.rar;*.zip;*.doc;*.docx;*.txt;*.ppt;*.xls;*.xlsx;*.html;*.htm;*.pdf;*.jpg;*.gif;*.png', 页面弹出很慢解决 20170317 scott -->
- fileSizeLimit:'15MB',swf:'plug-in/uploadify/uploadify.swf',
- uploader:'cgUploadController.do?saveFiles&jsessionid='+$("#sessionUID").val()+'',
- onUploadStart : function(file) {
- var cgFormId=$("input[name='id']").val();
- $('#${po.field_name}').uploadify("settings", "formData", {'cgFormId':cgFormId,'cgFormName':'${tableName?if_exists?html}','cgFormField':'${po.field_name}'});} ,
- onQueueComplete : function(queueData) {
- var win = frameElement.api.opener;
- win.reloadTable();
- win.tip(serverMsg);
- frameElement.api.close();},
- 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;}},
- onUploadProgress : function(file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal) { }});});
-
- </script><span id="file_uploadspan"><input type="file" name="${po.field_name}" id="${po.field_name}" /></span>
- </div>
- <div class="form" id="filediv_${po.field_name}"> </div>
- </#if>
- <#--update-start--Author: jg_huangxg Date:20160113 for:TASK #824 【online开发】控件类型扩展增加一个图片类型 image -->
- <#elseif po.show_type=='image'>
- <table>
- <#list filesList as fileB>
- <#if fileB['field'] == po.field_name>
- <tr style="height:34px;">
- <td>${fileB['title']}</td>
- <td><a href="${basePath}/commonController.do?viewFile&fileid=${fileB['fileKey']}&subclassname=org.jeecgframework.web.cgform.entity.upload.CgUploadEntity" title="下载">下载</a></td>
- <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>
- <td><a href="javascript:void(0)" class="jeecgDetail" onclick="del('${basePath}/cgUploadController.do?delFile&id=${fileB['fileKey']}',this)">删除</a></td>
- </tr>
- </#if>
- </#list>
- </table>
- <#if !(po.operationCodesReadOnly ??)>
- <div class="form jeecgDetail">
- <script type="text/javascript">
- var serverMsg="";
- var m = new Map();
- $(function(){$('#${po.field_name}').uploadify(
- {buttonText:'添加图片',
- auto:false,
- progressData:'speed',
- multi:true,
- height:25,
- overrideEvents:['onDialogClose'],
- fileTypeDesc:'图片格式:',
- queueID:'imagediv_${po.field_name}',
- fileTypeExts:'*.jpg;*.jpeg;*.gif;*.png;*.bmp',
- fileSizeLimit:'15MB',swf:'plug-in/uploadify/uploadify.swf',
- uploader:'cgUploadController.do?saveFiles&jsessionid='+$("#sessionUID").val()+'',
- onUploadStart : function(file) {
- var cgFormId=$("input[name='id']").val();
- $('#${po.field_name}').uploadify("settings", "formData", {'cgFormId':cgFormId,'cgFormName':'${tableName?if_exists?html}','cgFormField':'${po.field_name}'});} ,
- onQueueComplete : function(queueData) {
- var win = frameElement.api.opener;
- win.reloadTable();
- win.tip(serverMsg);
- frameElement.api.close();},
- 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;}},
- onUploadProgress : function(file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal) { }});});
-
- </script><span id="image_uploadspan"><input type="file" name="${po.field_name}" id="${po.field_name}" /></span>
- </div>
- <div class="form" id="imagediv_${po.field_name}"> </div>
- </#if>
- <#--update-end--Author: jg_huangxg Date:20160113 for:TASK #824 【online开发】控件类型扩展增加一个图片类型 image -->
-
- <#--update-start--Author: jg_huangxg Date:20160505 for:TASK #1027 【online】代码生成器模板不支持UE编辑器 -->
- <#elseif po.show_type=='umeditor'>
- <script id="content" type="text/plain" style="width:99%;"></script>
-
- <script type="text/javascript" charset="utf-8" src="${basePath}/plug-in/ueditor/ueditor.config.js"></script>
- <script type="text/javascript" charset="utf-8" src="${basePath}/plug-in/ueditor/ueditor.all.min.js"></script>
- <script type="text/javascript">
- var leipiEditor = UE.getEditor('content',{
- //allowDivTransToP: false,//阻止转换div 为p
- toolleipi:true,//是否显示,设计器的 toolbars
- textarea: 'design_content',
- //这里可以选择自己需要的工具按钮名称,此处仅选择如下五个 /*
- toolbars: [[
- 'fullscreen', 'source', '|', 'undo', 'redo', '|',//'date', 'time',
- 'fontfamily', 'fontsize', '|', 'indent', '|',
- //'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
- //'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
- //'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
- //'directionalityltr', 'directionalityrtl', 'indent', '|',
- 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', //'touppercase', 'tolowercase', '|',
- //'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
- //'simpleupload', 'insertimage', 'emotion', 'scrawl', 'insertvideo', 'music', 'attachment', 'map', 'insertframe', 'insertcode', 'webapp', 'pagebreak', 'template', 'background', '|',
- //'horizontal', 'spechars', 'snapscreen', 'wordimage', '|',
- 'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', '|',
- //'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', '|',//'charts', '|',
- //'print', 'preview', 'searchreplace', 'help', 'drafts'
- ]],
- wordCount:false,
- elementPathEnabled:false,
- initialFrameHeight:400
- });
-
- var leipiFormDesign = {
- exec : function (method) {
- leipiEditor.execCommand(method);
- },
- parse_form:function(template,fields)
- {
- //正则 radios|checkboxs|select 匹配的边界 |--| 因为当使用 {} 时js报错 (plugins|fieldname|fieldflow)
- var preg = /(\|-<span(((?!<span).)*plugins=\"(radios|checkboxs|select)\".*?)>(.*?)<\/span>-\||<(img|input|textarea|select).*?(<\/select>|<\/textarea>|\/>))/gi,preg_attr =/(\w+)=\"(.?|.+?)\"/gi,preg_group =/<input.*?\/>/gi;
- if(!fields) fields = 0;
-
- var template_parse = template,template_data = new Array(),add_fields=new Object(),checkboxs=0;
-
- var pno = 0;
- template.replace(preg, function(plugin,p1,p2,p3,p4,p5,p6){
- var parse_attr = new Array(),attr_arr_all = new Object(),name = '', select_dot = '' , is_new=false;
- var p0 = plugin;
- var tag = p6 ? p6 : p4;
- //alert(tag + " \n- t1 - "+p1 +" \n-2- " +p2+" \n-3- " +p3+" \n-4- " +p4+" \n-5- " +p5+" \n-6- " +p6);
-
- if(tag == 'radios' || tag == 'checkboxs')
- {
- plugin = p2;
- }else if(tag == 'select')
- {
- plugin = plugin.replace('|-','');
- plugin = plugin.replace('-|','');
- }
- plugin.replace(preg_attr, function(str0,attr,val) {
- if(attr=='name')
- {
- if(val=='NEWFIELD')
- {
- is_new=true;
- fields++;
- val = 'data_'+fields;
- }
- name = val;
- }
-
- if(tag=='select' && attr=='value')
- {
- if(!attr_arr_all[attr]) attr_arr_all[attr] = '';
- attr_arr_all[attr] += select_dot + val;
- select_dot = ',';
- }else
- {
- attr_arr_all[attr] = val;
- }
- var oField = new Object();
- oField[attr] = val;
- parse_attr.push(oField);
- })
- /*alert(JSON.stringify(parse_attr));return;*/
- if(tag =='checkboxs') /*复选组 多个字段 */
- {
- plugin = p0;
- plugin = plugin.replace('|-','');
- plugin = plugin.replace('-|','');
- var name = 'checkboxs_'+checkboxs;
- attr_arr_all['parse_name'] = name;
- attr_arr_all['name'] = '';
- attr_arr_all['value'] = '';
-
- attr_arr_all['content'] = '<span leipiplugins="checkboxs" selector="'+attr_arr_all['selector']+'" autofield="'+attr_arr_all['autofield']+'" title="'+attr_arr_all['title']+'">';
- var dot_name ='', dot_value = '';
- p5.replace(preg_group, function(parse_group) {
- var is_new=false,option = new Object();
- parse_group.replace(preg_attr, function(str0,k,val) {
- if(k=='name')
- {
- if(val=='NEWFIELD')
- {
- is_new=true;
- fields++;
- val = 'data_'+fields;
- }
-
- attr_arr_all['name'] += dot_name + val;
- dot_name = ',';
-
- }
- else if(k=='value')
- {
- attr_arr_all['value'] += dot_value + val;
- dot_value = ',';
-
- }
- option[k] = val;
- });
-
- if(!attr_arr_all['options']) attr_arr_all['options'] = new Array();
- attr_arr_all['options'].push(option);
- if(!option['checked']) option['checked'] = '';
- var checked = option['checked'] ? 'checked="checked"' : '';
- var checkedtext=option['checkedtext'] ? option['checkedtext'] :option['value'];
- 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+' ';
-
- if(is_new)
- {
- var arr = new Object();
- arr['name'] = option['name'];
- arr['plugins'] = attr_arr_all['plugins'];
- arr['fieldname'] = attr_arr_all['fieldname'] + option['fieldname'];
- arr['fieldflow'] = attr_arr_all['fieldflow'];
- add_fields[option['name']] = arr;
- }
-
- });
- attr_arr_all['content'] += '</span>';
-
- //parse
- template = template.replace(plugin,attr_arr_all['content']);
- template_parse = template_parse.replace(plugin,'{'+name+'}');
- template_parse = template_parse.replace('{|-','');
- template_parse = template_parse.replace('-|}','');
- template_data[pno] = attr_arr_all;
- checkboxs++;
-
- }else if(name)
- {
- if(tag =='radios') /*单选组 一个字段*/
- {
- plugin = p0;
- plugin = plugin.replace('|-','');
- plugin = plugin.replace('-|','');
- attr_arr_all['value'] = '';
- 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']+'">';
- var dot='';
- p5.replace(preg_group, function(parse_group) {
- var option = new Object();
- parse_group.replace(preg_attr, function(str0,k,val) {
- if(k=='value')
- {
- attr_arr_all['value'] += dot + val;
- dot = ',';
- }
- option[k] = val;
- });
- option['name'] = attr_arr_all['name'];
- if(!attr_arr_all['options']) attr_arr_all['options'] = new Array();
- attr_arr_all['options'].push(option);
- if(!option['checked']) option['checked'] = '';
- var checked = option['checked'] ? 'checked="checked"' : '';
- var checkedtext=option['checkedtext'] ? option['checkedtext'] :option['value'];
- attr_arr_all['content'] +='<input type="radio" name="'+attr_arr_all['name']+'" checkedtext="'+checkedtext+'" value="'+option['value']+'" '+checked+'/>'+checkedtext+' ';
-
- });
- attr_arr_all['content'] += '</span>';
-
- }else
- {
- attr_arr_all['content'] = is_new ? plugin.replace(/NEWFIELD/,name) : plugin;
- }
- //attr_arr_all['itemid'] = fields;
- //attr_arr_all['tag'] = tag;
- template = template.replace(plugin,attr_arr_all['content']);
- template_parse = template_parse.replace(plugin,'{'+name+'}');
- template_parse = template_parse.replace('{|-','');
- template_parse = template_parse.replace('-|}','');
- if(is_new)
- {
- var arr = new Object();
- arr['name'] = name;
- arr['plugins'] = attr_arr_all['plugins'];
- arr['title'] = attr_arr_all['title'];
- arr['orgtype'] = attr_arr_all['orgtype'];
- arr['fieldname'] = attr_arr_all['fieldname'];
- arr['fieldflow'] = attr_arr_all['fieldflow'];
- add_fields[arr['name']] = arr;
- }
- template_data[pno] = attr_arr_all;
-
-
- }
- pno++;
- })
- var view = template.replace(/{\|-/g,'');
- view = view.replace(/-\|}/g,'');
- var parse_form = new Object({
- 'fields':fields,//总字段数
- 'template':template,//完整html
- 'parse':view,
- 'data':template_data,//控件属性
- 'add_fields':add_fields//新增控件
- });
- return JSON.stringify(parse_form);
- },
- /*type = save 保存设计 versions 保存版本 close关闭 */
- fnCheckForm : function ( type ) {
- if(formEditor.queryCommandState( 'source' ))
- formEditor.execCommand('source');//切换到编辑模式才提交,否则有bug
-
- if(formEditor.hasContents()){
- formEditor.sync();/*同步内容*/
-
- //--------------以下仅参考-----------------------------------------------------------------------------------------------------
- var type_value='',formid=0,fields=$("#fields").val(),formeditor='';
-
- if( typeof type!=='undefined' ){
- type_value = type;
- }
- //获取表单设计器里的内容
- formeditor=formEditor.getContent();
- //解析表单设计器控件
- var parse_form = this.parse_form(formeditor,fields);
- //alert(parse_form);
- //异步提交数据
- $.ajax({
- type: 'POST',
- url : '${ctx}/config/form/processor',
- //dataType : 'json',
- data : {'type' : type_value,'formid':'${form.id}','parse_form':parse_form},
- success : function(data){
- if(data == true) {
- alert('表单保存成功');
- window.location.href='${ctx}/config/form';
- } else {
- alert('表单保存失败');
- }
- }
- });
-
- } else {
- alert('表单内容不能为空!')
- $('#submitbtn').button('reset');
- return false;
- }
- } ,
- // 预览表单
- fnReview : function (){
- if(leipiEditor.queryCommandState( 'source' ))
- leipiEditor.execCommand('source');
-
- if(leipiEditor.hasContents()){
- leipiEditor.sync();
-
- var parse_form = this.parse_form(leipiEditor.getContent());
- $("#formContent").val(parse_form);
-
- document.formobj.target="mywin";
- 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) + "\"");
-
- document.formobj.action="autoFormController.do?review";
- document.formobj.submit(); //提交表单
-
- } else {
- alert('表单内容不能为空!');
- return false;
- }
- }
- };
- function setContent(){
- if(leipiEditor.queryCommandState( 'source' ))
- leipiEditor.execCommand('source');//切换到编辑模式才提交,否则有bug
-
- if(leipiEditor.hasContents()){
- leipiEditor.sync();
- $("#formContent").val(leipiEditor.getContent());
- }
- }
- </script>
- <#--update-end--Author: jg_huangxg Date:20160505 for:TASK #1027 【online】代码生成器模板不支持UE编辑器 -->
- <#else>
- <input id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}" type="text"
- style="width: 150px" class="inputxt" value="${data['${tableName}']['${po.field_name}']?if_exists?html}"
- <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#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>
- <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#if po.field_valid_type?if_exists?html != ''>
- datatype="${po.field_valid_type?if_exists?html}"
- <#else>
- <#if po.type == 'int'>
- datatype="n"
- <#elseif po.type=='double'>
- datatype="/^(-?\d+)(\.\d+)?$/"
- <#else>
- <#if po.is_null != 'Y'>datatype="*"</#if>
- </#if>
- </#if>>
- </#if>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">${po.content?if_exists?html}</label>
- </td>
- <#if (columns?size>10)>
- <#if (po_index%2==0)&&(!po_has_next)>
- <td align="right">
- <label class="Validform_label">
- </label>
- </td>
- <td class="value">
- </td>
- </#if>
- <#if (po_index%2!=0)||(!po_has_next)>
- </tr>
- </#if>
- <#else>
- </tr>
- </#if>
- </#list>
-
- <#list columnsarea as po>
- <#if (columns?size>10)>
- <tr>
- <td align="right">
- <label class="Validform_label">
- ${po.content}:
- </label>
- </td>
- <td class="value" colspan="3">
- <textarea id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}"
- style="width: 600px" class="inputxt" rows="6"
- <#if po.operationCodesReadOnly?if_exists> readonly = "readonly"</#if>
- <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#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>
- <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#if po.field_valid_type?if_exists?html != ''>
- datatype="${po.field_valid_type?if_exists?html}"
- <#else>
- <#if po.is_null != 'Y'>datatype="*"</#if>
- </#if>>${data['${tableName}']['${po.field_name}']?if_exists?html}</textarea>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">${po.content?if_exists?html}</label>
- <#if po.show_type=='umeditor'>
- <script type="text/javascript">
- //实例化编辑器
- var ${po.field_name}_ue = UE.getEditor('${po.field_name}',{initialFrameWidth:${po.field_length}}).setHeight(260);
- </script>
- </#if>
- </td>
- </tr>
- <#else>
- <tr>
- <td align="right">
- <label class="Validform_label">
- ${po.content}:
- </label>
- </td>
- <td class="value">
- <textarea id="${po.field_name}" ${po.extend_json?if_exists} name="${po.field_name}"
- class="inputxt" rows="7"
- <#if po.operationCodesReadOnly?if_exists> readonly = "readonly"</#if>
- <#-- update--begin--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#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>
- <#-- update--end--author:zhangjiaqiang Date:20170417 for:增加校验必填项 -->
- <#if po.field_valid_type?if_exists?html != ''>
- datatype="${po.field_valid_type?if_exists?html}"
- <#else>
- <#if po.is_null != 'Y'>datatype="*"</#if>
- </#if>>${data['${tableName}']['${po.field_name}']?if_exists?html}</textarea>
- <span class="Validform_checktip"></span>
- <label class="Validform_label" style="display: none;">${po.content?if_exists?html}</label>
- <#if po.show_type=='umeditor'>
- <script type="text/javascript">
- //实例化编辑器
- var ${po.field_name}_ue = UE.getEditor('${po.field_name}',{initialFrameWidth:${po.field_length}}).setHeight(260);
- </script>
- </#if>
- </td>
- </tr>
- </#if>
- </#list>
- <tr>
- <td height="50px" align="center" colspan="2">
- <a style="margin-left:80px" href="#" class="easyui-linkbutton l-btn" plain="true" iconcls="icon-le-back" onclick="history.go(-1)"> 返 回 </a>
- <a id="btn_ok" href="javascript:void(0)" class="easyui-linkbutton l-btn" plain="true" iconcls="icon-le-ok" onclick="btn_ok()"> 提 交 </a>
- </td>
- </tr>
-
- </table>
- <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);
- layer.alert(data.msg, function(index){
- window.location.href='${basePath}/cgAutoListController.do?list&id=${tableName?if_exists?html}';
- layer.close(index); })
-
- }
- else{
- if(data.responseText==''||data.responseText==undefined){
- $.messager.alert('错误', data.msg);
- $.Hidemsg();
- }else{
- try{
- var emsg = data.responseText.substring(data.responseText.indexOf('错误描述'),data.responseText.indexOf('错误信息'));
- $.messager.alert('错误',emsg);
- $.Hidemsg();
- }catch(ex){
- $.messager.alert('错误',data.responseText+'');
- }}
- return false;
- }
- }});});</script>
- </form>
- <#--update-end--Author:luobaoli Date:20150614 for:表单单表属性中增加了扩展参数 ${po.extend_json?if_exists}-->
- <script type="text/javascript">
- $(function(){
- //查看模式情况下,删除和上传附件功能禁止使用
- if(location.href.indexOf("goDetail.do")!=-1){
- $(".jeecgDetail").hide();
- }
-
- if(location.href.indexOf("goDetail.do")!=-1){
- //查看模式控件禁用
- $("#formobj").find(":input").attr("disabled","disabled");
- }
- if(location.href.indexOf("goAddButton.do")!=-1||location.href.indexOf("goUpdateButton.do")!=-1){
- //其他模式显示提交按钮
- $("#sub_tr").show();
- }
- });
- function upload() {
- <#list columns as po>
- <#if po.show_type=='file'>
- $('#${po.field_name}').uploadify('upload', '*');
- </#if>
- <#if po.show_type=='image'>
- $('#${po.field_name}').uploadify('upload', '*');
- </#if>
- </#list>
- }
- function cancel() {
- <#list columns as po>
- <#if po.show_type=='file'>
- $('#${po.field_name}').uploadify('cancel', '*');
- </#if>
- <#if po.show_type=='image'>
- $('#${po.field_name}').uploadify('cancel', '*');
- </#if>
- </#list>
- }
- function uploadFile(data){
- if(!$("input[name='id']").val()){
- if(data.obj!=null && data.obj!='undefined'){
- $("input[name='id']").val(data.obj.id);
- }
- }
- if($(".uploadify-queue-item").length>0){
- upload();
- }else{
- /*var win = frameElement.api.opener;
- win.reloadTable();
- win.tip(data.msg);
- frameElement.api.close();*/
- }
- }
- $.dialog.setting.zIndex =1990;
- function del(url,obj){
- $.dialog.confirm("确认删除该条记录?", function(){
- $.ajax({
- async : false,
- cache : false,
- type : 'POST',
- url : url,// 请求的action路径
- error : function() {// 请求失败处理函数
- },
- success : function(data) {
- var d = $.parseJSON(data);
- if (d.success) {
- var msg = d.msg;
- tip(msg);
- $(obj).closest("tr").hide("slow");
- }
- }
- });
- }, function(){
- });
- }
- <#--add-start--Author:钟世云 Date:20150614 for:online支持树配置-->
- /**树形列表数据转换**/
- function convertTreeData(rows, textField) {
- for(var i = 0; i < rows.length; i++) {
- var row = rows[i];
- row.text = row[textField];
- if(row.children) {
- row.state = "open";
- convertTreeData(row.children, textField);
- }
- }
- }
- /**树形列表加入子元素**/
- function joinTreeChildren(arr1, arr2) {
- for(var i = 0; i < arr1.length; i++) {
- var row1 = arr1[i];
- for(var j = 0; j < arr2.length; j++) {
- if(row1.id == arr2[j].id) {
- var children = arr2[j].children;
- if(children) {
- row1.children = children;
- }
-
- }
- }
- }
- }
- <#--add-end--Author:钟世云 Date:20150614 for:online支持树配置-->
- </script>
- <script type="text/javascript">${js_plug_in?if_exists}</script>
- </body>
- </html>
|