#--
Copyright (c) 2020-Now http://www.j2eefast.com All rights reserved.
常用表单组件
@author J2eeFAST
@date 2020-05-20
@version v1.0.1
//修改ID适配页面传值特殊符号问题
-->
<#--获取动态传入参数值 -->
<#macro getName value key>
<#list value?keys as attr>
<#if attr == key>
<#t>${value[attr]}<#t>
#if>
#list>
#macro>
<#setting url_escaping_charset='utf-8'>
<#--
// from表单
-->
<#macro form name ="" <#-- 表单的名称-->
id = ""
action = "" <#-- 当提交表单时向何处发送表单数据-->
method = "" <#-- 用于发送 form-data 的 HTTP 方法-->
enctype = "" <#-- 发送表单数据之前如何对其进行编码-->
class = "" <#-- css 样式-->
style = "" <#-- 表单from style 样式-->
>
#macro>
<#--
//form textarea
-->
<#macro textarea name
id = ""
class = "form-control"
value = ""
readonly = false
rows = "5"
required = false
>
#macro>
<#--
//form 图标选择控件
-->
<#macro iconselect name
id=""
placeholder="请输入值"
class = "form-control" <#-- 输入框样式-->
butClass = "fa fa-fw fa-search"
required = false
readonly = false
value = ""
width=""
height=""
type = "text"
isClear = true <#-- 弹出是否出现清除按钮-->
boxTitle = ""
helpTip =""
>
<#local Assname="${id}"/>
<#if name != "">
<#local Assname="${name}"/>
#if>
<#local AssId=""/>
<#if id == "">
<#local AssId="${Assname}"/>
<#else>
<#local AssId="${id}"/>
#if>
${name}<#else>${AssId}#if>" class="${class} iconselect" type="${type}" value="${value}" class="${class}" <#if readonly> readonly = "readonly"#if> placeholder="${placeholder}" <#if required> required#if>>
<#if helpTip!="">${helpTip}#if>
<@compress single_line=true>
@compress>
#macro>
<#--
//多选表组件
tableCallback 回调页面函数
-->
<#macro tableselect name
id = ""
url = "sys/user/list" <#-- 访问数据URL-->
boxTitle = ""
width="1200"
height=""
value=""
labelValue=""
labelName="" <#--标签名称 -->
required=false <#-- 是否必输-->
readonly=false <#-- 是否只读模式-->
class = "form-control" <#-- 输入框样式-->
butClass = "fa fa-fw fa-address-card-o"
isClear = true <#-- 弹出是否出现清除按钮-->
placeholder="请输入值"
checked=true
isorga = true <#-- 是否有机构选择-->
helpTip = "" <#--帮助提示 -->
separator = "," <#--多选参数分隔符 -->
keyId = "id" <#--表示获取数据id字段名称-->
keyName = "name" <#--表示显示名称 -->
template = false <#-- 控件是否做template用-->
tableInfo = "[{field:'username',title:'账号',query:true},{field:'name',title:'姓名'},{field:'compName',title:'归属公司'},
{field:'deptName',title:'归属机构'},{field:'email',title:'邮箱',query:true},{field:'mobile',title:'手机号码',query:true},
{field:'status',title:'状态',dict:'sys_user_show_hide',query:true},{field:'createTime',title:'创建时间'}]" <#-- 显示表格信息-->
>
<#local Assname="${id}"/>
<#if name != "">
<#local Assname="${name}"/>
#if>
<#local AssId=""/>
<#if id == "">
<#local AssId="${Assname}"/>
<#else>
<#local AssId="${id}"/>
#if>
<#if helpTip!="">${helpTip}#if>
<@compress single_line=true>
@compress>
#macro>
<#--
//弹窗树组件
treeCallback 回调页面函数
-->
<#macro treeselect name
id = ""
url = "sys/comp/treeData"
boxTitle = ""
width="380"
height=""
value=""
labelValue=""
labelName="" <#--标签名称 -->
checked=false
radioType="all" <#-- 当checked=false 单选时 控制同级单选互斥还是整个树互斥 all 整个树互斥 level, checked=true 多选此值无效-->
required=false <#-- 是否必输-->
readonly=true <#-- 是否只读模式-->
correlationId="" <#-- 关联ID-->
correlationValue= "-1" <#-- 关联默认值-->
class = "form-control" <#-- 输入框样式-->
butClass = "fa fa-fw fa-search"
expandLevel = false <#--是否展开树 -->
isParentIds = false <#-- 单选是否需要获取树的父节点集合-->
parenName = "parentIds" <#-- 单选父节点集合Name-->
parenIdsValue = "" <#-- 所有父节点集合默认值-->
isSelectParent = false <#-- 是否只能选中叶子节点-->
isInput = false <#-- 是否允许手动label框输入 -->
isClear = true <#-- 弹出是否出现清除按钮-->
template = false <#-- 控件是否做template用-->
keyId = "id" <#--指定获取树数据值 -->
placeholder=""
helpTip = "" <#--帮助提示 -->
ext...>
<#local Assname="${id}"/>
<#if name != "">
<#local Assname="${name}"/>
#if>
<#local AssId=""/>
<#if id == "">
<#local AssId="${Assname}"/>
<#else>
<#local AssId="${id}"/>
#if>
<#if helpTip!="">${helpTip}#if>
<@compress single_line=true>
@compress>
#macro>
<#--
//form hidden 隐藏域标签
-->
<#macro hidden name
id = "" <#-- ID 如果ID 不传则跟name一致-->
value = ""
type = "hidden"
refresh = true <#-- 隐藏域在from 表单中能否被重置按钮清空-->
>
${name}<#else>${id}#if>" name="<#if name != "">${name}<#else>${id}#if>" <#if !refresh> data-refresh="false"#if> type="${type}" value="${value}"/>
#macro>
<#--
//form input 输入框标签
-->
<#macro input name
id = "" <#-- ID 如果ID 不传则跟name一致-->
value = ""
type = "text" <#--多增加 date -->
dataFormat = "" <#-- 时间格式化-->
dataType = "date" <#-- 控件显示-->
required=false <#-- 是否必输-->
class = "form-control" <#-- 输入框样式-->
placeholder=""
butClass = "" <#-- 小按钮class样式-->
butStyle = "" <#-- 小按钮style样式-->
helpTip = "" <#--帮助提示 -->
readonly = false <#-- 不可编辑-->
maxlength = "" <#--输入最大长度 -->
>
<#compress>
<#if butClass!="">
${name}<#else>${id}#if>" name="<#if name != "">${name}<#else>${id}#if>" <#if class != "">class="${class}<#if type == "date"> time-input#if>"#if> <#if dataFormat !="">data-format="${dataFormat}"#if> <#if type == "date" && dataType !="">data-type="${dataType}"#if><#rt>
type="<#if type == "date">text<#else>${type}#if>" <#if type=="password">autocomplete="off"#if> value="${value}" <#if placeholder != "">placeholder="<@ctx.i18n text = "${placeholder}"/>"#if> <#if maxlength !=""> maxlength = "${maxlength}"#if> <#if readonly> readonly = true#if> <#if required> required #if>/>
style="${butStyle}"#if>>
<#if helpTip!="">${helpTip}#if>
<#else>
${name}<#else>${id}#if>" name="<#if name != "">${name}<#else>${id}#if>" <#if class != "">class="${class}<#if type == "date"> time-input#if>"#if> <#if dataFormat !="">data-format="${dataFormat}"#if> <#if type == "date" && dataType !="">data-type="${dataType}"#if><#rt>
type="<#if type == "date">text<#else>${type}#if>" value="${value}" <#if type=="password">autocomplete="off"#if> <#if placeholder != "">placeholder="<@ctx.i18n text = "${placeholder}"/>"#if> <#if maxlength !=""> maxlength = "${maxlength}"#if> <#if readonly> readonly = true#if> <#if required> required #if>/>
<#if helpTip!="">${helpTip}#if>
#if>
#compress>
#macro>
<#--
//form radio 单选按钮
-->
<#macro radio name <#-- 如果name不传则于id一直-->
id = "" <#-- ID 如果ID 不传则跟name一致-->
value = ""
required=false <#-- 是否必输-->
class = "radio-box" <#-- 输入框样式-->
butClass = "" <#-- 是否带提示样式-->
helpTip = "" <#--帮助提示 -->
dictType = "" <#-- 字典类型,从字典里获取 -->
items = "" <#-- 列表数据,可接受对象集合 -->
>
<#if dictType !="">
<#list dict.getType('${dictType}')>
<#items as d>
<#if d.status =='0' >
<#if value == "">
<#else>
#if>
#if>
#items>
#list>
#if>
<#if helpTip!="">${helpTip}#if>
<@compress single_line=true>
@compress>
#macro>
<#--
//form checkbox 复选框
-->
<#macro checkbox name <#-- 如果name不传则于id一直-->
id = "" <#-- ID 如果ID 不传则跟name一致-->
value = ""
required=false <#-- 是否必输-->
class = "check-box" <#-- 输入框样式-->
butClass = "" <#-- 是否带提示样式-->
helpTip = "" <#--帮助提示 -->
dictType = "" <#-- 字典类型,从字典里获取 -->
items = "" <#-- 列表数据,可接受对象集合 -->
itemLabel = "" <#-- 指定列表数据中的什么属性名作为option的标签名 -->
itemValue = "" <#-- 指定列表数据中的什么属性名作为option的value值 -->
selectValue = "flag" <#-- 指定列表数据中选中属性值 -->
status = "status" <#-- 检测状态-->
>
<#if dictType !="">
<#list dict.getType('${dictType}')>
<#items as d>
<#if status == "status">
<#if d.status =='0' >
<#if value == "">
<#else>
<#assign a=0 />
<#list value?split(",") as x>
<#if x == d.dictValue>
<#assign a=1 />
#if>
#list>
#if>
#if>
<#else>
<#if value == "">
<#else>
<#assign a=0 />
<#list value?split(",") as x>
<#if x == d.dictValue>
<#assign a=1 />
#if>
#list>
#if>
#if>
#items>
#list>
<#else>
<#list items>
<#items as d>
<#if status == "status">
<#if d.status =='0' >
<#if value == "">
<#else>
<#assign a=0 />
<#list value?split(",") as x>
<#if x == d['${itemValue}']>
<#assign a=1 />
#if>
#list>
#if>
#if>
<#else>
<#if value == "">
<#else>
<#assign a=0 />
<#list value?split(",") as x>
<#if x == "${d['${itemValue}']}">
<#assign a=1 />
#if>
#list>
#if>
#if>
#items>
#list>
#if>
#macro>
<#--
//form switch 开关组件
-->
<#macro switch name
id = ""
value = "" <#-- 开关组件默认 0 1 值-->
default = true <#-- 默认开-->
judgeValue = "0" <#-- 判断值默认0 开-->
>
<#local Assname="${id}"/>
<#if name != "">
<#local Assname="${name}"/>
#if>
<#local AssId=""/>
<#if id == "">
<#local AssId="${Assname}"/>
<#else>
<#local AssId="${id}"/>
#if>
<@compress single_line=true>
@compress>
#macro>
<#macro ueditor name
id = ""
bizType=""
bizId=""
value = ""
readonly = false <#-- 是否只读模式 -->
maxlength = 10000 <#-- 最大输入长度默认不限-->
height = 300 <#-- 高度-->
toolbars = "all" <#--工具类 默认所有 -->
type = "content" <#--获取数据类型 html (整个html的内容), content (内容), txt(纯文本), plaintxt (带格式的纯文本)-->
>
<#local Assname="${id}"/>
<#if name != "">
<#local Assname="${name}"/>
#if>
<#local AssId=""/>
<#if id == "">
<#local AssId="${Assname}"/>
<#else>
<#local AssId="${id}"/>
#if>
${name}<#else>${AssId}#if>" value="<#if value != "">${value}#if>" type="hidden"/>
<@compress single_line=true>
@compress>
#macro>
<#--
//form select 下拉框标签
-->
<#macro select name <#--如果name不传则于id一直-->
id = "" <#-- ID 如果ID 不传则跟name一致-->
value = ""
required= false <#-- 是否必输-->
class = "form-control" <#-- 输入框样式-->
butClass = "" <#-- 是否带提示样式-->
helpTip = "" <#--帮助提示 -->
dictType = "" <#-- 字典类型,从字典里获取 -->
items = "" <#-- 列表数据,可接受对象集合 -->
itemLabel = "" <#-- 指定列表数据中的什么属性名作为option的标签名 -->
itemValue = "" <#-- 指定列表数据中的什么属性名作为option的value值 -->
status = true <#-- 检测状态-->
multiple= false <#-- 是否为多选框 -->
blankValue = "false" <#-- 是否默认有个空白选择项目 -->
blankLabel = "" <#-- 空白选择默认值 -->
placeholder="请选择值"
readonly = false <#-- 是否只读-->
viewMode =false
viewClass="label label-default"
>
<#local Assname="${id}"/>
<#if name != "">
<#local Assname="${name}"/>
#if>
<#local AssId=""/>
<#if id == "">
<#local AssId="${Assname}"/>
<#else>
<#local AssId="${id}"/>
#if>
<#if viewMode> <#-- view 用法 <@f.select name="roleIdList" multiple = true value="${selectRoles}" items=roles itemLabel="roleName" itemValue="id" required=true view=true /> -->
<#if dictType !=""> <#-- dictType !="" -->
<#list dict.getType('${dictType}') as d>
<#list value?split(",") as k>
<#if k == (d['${dictValue}']?c)>
<@ctx.i18n text = "${d['${dictLabel}']}"/>
#if>
#list>
#list>
<#else> <#-- else <#-- dictType !="" -->
<#list items as d>
<#list value?split(",") as k>
<#if k?string == d['${itemValue}']?string>
<@ctx.i18n text = "${d['${itemLabel}']}"/>
#if>
#list>
#list>
#if> <#-- end dictType !="" -->
<#else> <#-- view else -->
<#if !multiple>
<@compress single_line=true>
@compress>
#if>
<#if multiple>
${name}<#else>${AssId}#if>"/>
<@compress single_line=true>
@compress>
#if>
#if> <#-- view end if -->
<#if helpTip!="">${helpTip}#if>
#macro>
<#--
页面提示框组件
-->
<#macro tip class = "info" <#--样式 默认info -->
icon = "fa fa-info" <#-- 提示语句前的小图标-->
animated = "animated bounceInDown"
>
#macro>
<#--
页面代码格式化组件
参数: codeType 不是必输 默认 html
-->
<#macro code codeType = "html">
<#nested>
#macro>
<#--
文件上传控件
-->
<#macro fileupload
name
id = ""
bizId = "" <#-- 业务ID-->
bizType = "" <#-- 业务类型-->
uploadType = "all" <#-- 上传文件类型-->
uploadUrl = "sys/comm/upload" <#-- 上传路径-->
fileListUrl = "sys/comm/fileList" <#-- 回显查询路径-->
downloadUrl = "sys/comm/download" <#--文件下载路径 -->
isLazy = true <#-- -->
readonly = false
preview = ""
maxUploadNum = "300"
>
${name}<#else>${id}#if>_wup" class="wup_container ">
${name}<#else>${id}#if>" name="<#if bizType == "">${name}<#else>${bizType}#if>" value="" class="wup_input ${uploadType}"
data-msg-required="请上传图片"/>
${name}<#else>${id}#if>__del" name="<#if bizType == "">${name}<#else>${bizType}#if>__del" value="" type="hidden"/>
${name}<#else>${id}#if>_Uploader" class="wup_<#if uploadType=="image">img<#else>file#if>">
0%
${name}<#else>${id}#if>_filePicker2" class="webuploader-container">
开始上传
<#if uploadType=="image">
${name}<#else>${id}#if>_fileLists" class="filelist">
<#else>
${name}<#else>${id}#if>_fileLists">
#if>
${name}<#else>${id}#if>dndArea" class="placeholder">
${name}<#else>${id}#if>_filePicker" class="webuploader-container">
或将<#if uploadType == "image">照片<#else>文件#if>拖到这里,最多可选 ${maxUploadNum} <#if uploadType == "image">张<#else>个#if>
<@compress single_line=true>
@compress>
#macro>
<#macro imageclip
name <#-- 控件表单name-->
id = "" <#-- 控件ID 如果不传则与name一致-->
value =""
imageDefault = "${ctxStatic}/static/img/user2-160x160.jpg" <#-- 默认显示-->
boxTitle = "" <#-- 弹出框 标题-->
tipHelp = "修改图片"
ratio = "1/1" <#-- 图片裁剪比例-->
viewMode = 0 <#-- 显示模式 0 允许图片无限缩小 1不允许图片缩小到图片本身大小以下-->
isClear = true <#-- 是否有清除按钮-->
width = 120 <#-- 图片显示宽度-->
height = 120 <#-- 图片显示高度-->
>
<#local Assname="${id}"/>
<#if name != "">
<#local Assname="${name}"/>
#if>
<#local AssId=""/>
<#if id == "">
<#local AssId="${Assname}"/>
<#else>
<#local AssId="${id}"/>
#if>
${name}<#else>${AssId}#if>_inpt" value="" />
${Assname}<#else>${AssId}#if>_head" >
${Assname}<#else>${AssId}#if>_img" style="width: ${width}px; height: ${height};" class="img-circle" src="<#if value == "" || (value?index_of("avatar") == -1)>${imageDefault}<#else><#rt>
<#if value?index_of("avatar") == -1>
${value}
<#else>
${ctxStatic}/sys/comm/fileAvatarView?filePath=${value?url}
#if>
#if>" onerror="imgUserError();"/>
${Assname}<#else>${AssId}#if>_but"><@ctx.i18n text = "${tipHelp}"/>
<@compress single_line=true>
@compress>
#macro>
<#macro selectLinkage
name <#-- 表单控件Name-->
id = ""
linkNum = 3 <#-- 多级联动联动等级 默认三级 最大5级 最小2级-->
items = ["选择省份","选择市","选择地区"]
url = "sys/area/load" <#--联动数据请求URL -->
split = "," <#--数据分割符-->
readonly = false
value = ""
>
<#local Assname="${id}"/>
<#if name != "">
<#local Assname="${name}"/>
#if>
<#local AssId=""/>
<#if id == "">
<#local AssId="${Assname}"/>
<#else>
<#local AssId="${id}"/>
#if>
${name}<#else>${AssId}#if>" value="<#if value !="">${value}#if>"/>
<#list items as x>
${name}<#else>${AssId}#if>${x?index + 1}" class="form-control" type="text" value="<#if value != ""><#rt>
<#list value?split("${split}") as a>
<#if x?index == a?index>
<#lt>${a}<#rt>
<#lt>#if>
<#lt>#list><#rt>
<#lt>#if>" placeholder="${x}" />
#list>
<@compress single_line=true>
@compress>
#macro>
<#macro wizard
id
selected = 0 <#--初始导向 -->
theme = "arrows" <#--导向样式 default, arrows, dots, progress -->
animation = "slide-horizontal" <#--导向切换样式 , none,fade,slide-vertical,slide-swing,slide-horizontal -->
toolbarButtonPosition = "center" <#-- 导向工具按钮显示位置 left, right, center-->
refresh = "" <#--重置名称默认空 没有, 例如转账 完成之后可以再转一笔 -->
complete = "完成" <#--完成按钮字 -->
isPrev = true <#--是否需要上一步 -->
>
<#nested>
<@compress single_line=true>
@compress>
#macro>