From 7e3a55a578eb6eed95cbbb85d2ee871315082ef4 Mon Sep 17 00:00:00 2001 From: thinkgem Date: Mon, 22 Jul 2024 15:42:51 +0800 Subject: [PATCH] =?UTF-8?q?open=20beetl=20<#form:xxx=20=E6=8E=A7=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/htmltags/form/checkbox.html | 95 +++++++ .../resources/views/htmltags/form/extend.html | 254 +++++++++++++++++ .../views/htmltags/form/fileupload.html | 205 ++++++++++++++ .../resources/views/htmltags/form/form.html | 27 ++ .../resources/views/htmltags/form/hidden.html | 29 ++ .../views/htmltags/form/iconselect.html | 63 +++++ .../views/htmltags/form/imageclip.html | 77 ++++++ .../resources/views/htmltags/form/input.html | 67 +++++ .../views/htmltags/form/listselect.html | 258 ++++++++++++++++++ .../resources/views/htmltags/form/radio.html | 77 ++++++ .../resources/views/htmltags/form/select.html | 124 +++++++++ .../views/htmltags/form/textarea.html | 29 ++ .../views/htmltags/form/treeselect.html | 250 +++++++++++++++++ .../views/htmltags/form/ueditor.html | 174 ++++++++++++ .../views/htmltags/form/validcode.html | 66 +++++ 15 files changed, 1795 insertions(+) create mode 100644 modules/core/src/main/resources/views/htmltags/form/checkbox.html create mode 100644 modules/core/src/main/resources/views/htmltags/form/extend.html create mode 100644 modules/core/src/main/resources/views/htmltags/form/fileupload.html create mode 100644 modules/core/src/main/resources/views/htmltags/form/form.html create mode 100644 modules/core/src/main/resources/views/htmltags/form/hidden.html create mode 100644 modules/core/src/main/resources/views/htmltags/form/iconselect.html create mode 100644 modules/core/src/main/resources/views/htmltags/form/imageclip.html create mode 100644 modules/core/src/main/resources/views/htmltags/form/input.html create mode 100644 modules/core/src/main/resources/views/htmltags/form/listselect.html create mode 100644 modules/core/src/main/resources/views/htmltags/form/radio.html create mode 100644 modules/core/src/main/resources/views/htmltags/form/select.html create mode 100644 modules/core/src/main/resources/views/htmltags/form/textarea.html create mode 100644 modules/core/src/main/resources/views/htmltags/form/treeselect.html create mode 100644 modules/core/src/main/resources/views/htmltags/form/ueditor.html create mode 100644 modules/core/src/main/resources/views/htmltags/form/validcode.html diff --git a/modules/core/src/main/resources/views/htmltags/form/checkbox.html b/modules/core/src/main/resources/views/htmltags/form/checkbox.html new file mode 100644 index 00000000..8dae2974 --- /dev/null +++ b/modules/core/src/main/resources/views/htmltags/form/checkbox.html @@ -0,0 +1,95 @@ +<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. + * No deletion without permission, or be held responsible to law. */ + +/** + * 表单控件:单选按钮 + * @author ThinkGem + * @version 2017-3-5 + */ +var p = { + + // 标签参数 + id: id!, // 元素ID,如果不填写,则与name相同 + path: path!, // 绑定form上model中属性的值 + name: name!, // 元素名称,不填写 + value: value!, // 元素值 + defaultValue: defaultValue!,// 默认值 v4.1.5 + + dictType: dictType!'', // 字典类型,从字典里获取,自动设置items、itemLabel、itemValue + + items: items!([]), // 列表数据,可接受对象集合,如:List + itemLabel: itemLabel!'', // 指定列表数据中的什么属性名作为option的标签名 + itemValue: itemValue!'', // 指定列表数据中的什么属性名作为option的value值 + + label: label!, // 只有一个复选按钮的情况下设置(开关) + + readonly: toBoolean(readonly!false), // 是否只读模式 v4.2.0 + + // 内置参数 + thisTag: thisTag, + exclAttrs: ['id', 'path', 'name', 'value', 'defaultValue', 'dictType', + 'items', 'itemLabel', 'itemValue', 'label'] +}; + +// 编译绑定参数 +form.path(p); + +// 编译属性参数 +form.attrs(p); + +// 编译集合参数 +form.items(p); + +// 只有一个复选按钮的情况下 +if (isNotBlank(p.label)){ + p.items = [{label:p.label,value:'1'}]; + p.itemLabel = 'label'; + p.itemValue = 'value'; +} + +// 如果不是字符串,则转换为字符串 +if (type.name(p.value) != 'String'){ + p.value = @ObjectUtils.toString(p.value); +} + +// 转换为字符串数组 +if (type.name(p.value) == 'String'){ + p.value = @StringUtils.split(p.value, ','); +} + +// 如果只读模式,则禁用,并加默认值为value +if (p.readonly){ + p.attrs = p.attrs + ' disabled="true"'; +} + +// 输出选项 +var body = { + var checked,title; + for (var item in p.items){ + checked = (@StringUtils.inString(item[p.itemValue], p.value) ? ' checked' : ''); + if (type.name(item) == 'DictData' && isNotBlank(item['description'])){ + title = ' title="' + item['description'] + '"'; + } + %> ${item[p.itemLabel]}<% + } + /** + * 1.若复选框不被选中时,服务端将不能接受这个参数,也就得不到选择的状态。 + * 2.如果有一个复选框参数前加“_”时,这个不被选中的参数,将被设置为null。 + * 3.如果有一个复选框参数前加“!”时,这个不被选中的参数,将被设置为该值,作为默认值。 + * 4.详见org.springframework.web.bind.WebDataBinder类的Prefix注释。 + */ + if (isNotBlank(p.name)){ + if (p.readonly){ + for(var val in p.value){ + %><% + } + }else{ + %><% + } + } +}; + +%> + +${body} diff --git a/modules/core/src/main/resources/views/htmltags/form/extend.html b/modules/core/src/main/resources/views/htmltags/form/extend.html new file mode 100644 index 00000000..aecccbef --- /dev/null +++ b/modules/core/src/main/resources/views/htmltags/form/extend.html @@ -0,0 +1,254 @@ +<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. + * No deletion without permission, or be held responsible to law. */ + +/** + * 表单控件:扩展控件组 + * @author ThinkGem + * @version 2017-3-5 + */ +var p = { + + // 标签参数 + collapsed: toBoolean(collapsed!true), // 初始状态是否折叠 + + title: text('扩展字段'), // 显示标题、折叠标题,v4.2.3 版本以后版本生效 + + extendS1: extendS1!text('String 1'), // extendS1 及以下属性的标签名 v4.2.3 版本以后版本生效 + extendS2: extendS2!text('String 2'), + extendS3: extendS3!text('String 3'), + extendS4: extendS4!text('String 4'), + extendS5: extendS5!text('String 5'), + extendS6: extendS6!text('String 6'), + extendS7: extendS7!text('String 7'), + extendS8: extendS8!text('String 8'), + extendI1: extendI1!text('Integer 1'), + extendI2: extendI2!text('Integer 2'), + extendI3: extendI3!text('Integer 3'), + extendI4: extendI4!text('Integer 4'), + extendF1: extendF1!text('Float 1'), + extendF2: extendF2!text('Float 2'), + extendF3: extendF3!text('Float 3'), + extendF4: extendF4!text('Float 4'), + extendD1: extendD1!text('Date 1'), + extendD2: extendD2!text('Date 2'), + extendD3: extendD3!text('Date 3'), + extendD4: extendD4!text('Date 4'), + + pathPrefix: (isBlank(pathPrefix!) ? '' : pathPrefix + '.') + 'extend', + + // 内置参数 + thisTag: thisTag +}; + +%> +
+
${p.title} + +
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendS1" maxlength="500" class="form-control "/> +
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendS2" maxlength="500" class="form-control "/> +
+
+
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendS3" maxlength="500" class="form-control "/> +
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendS4" maxlength="500" class="form-control "/> +
+
+
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendS5" maxlength="500" class="form-control "/> +
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendS6" maxlength="500" class="form-control "/> +
+
+
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendS7" maxlength="500" class="form-control "/> +
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendS8" maxlength="500" class="form-control "/> +
+
+
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendI1" maxlength="19" class="form-control digits"/> +
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendI2" maxlength="19" class="form-control digits"/> +
+
+
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendI3" maxlength="19" class="form-control digits"/> +
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendI4" maxlength="19" class="form-control digits"/> +
+
+
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendF1" class="form-control number"/> +
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendF2" class="form-control number"/> +
+
+
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendF3" class="form-control number"/> +
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendF4" class="form-control number"/> +
+
+
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendD1" readonly="readonly" maxlength="20" class="form-control laydate " + dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/> +
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendD2" readonly="readonly" maxlength="20" class="form-control laydate " + dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/> +
+
+
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendD3" readonly="readonly" maxlength="20" class="form-control laydate " + dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss"/> +
+
+
+
+
+ +
+ <#form:input path="${p.pathPrefix}.extendD4" readonly="readonly" maxlength="20" class="form-control laydate " + dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss"/> +
+
+
+
+
+
\ No newline at end of file diff --git a/modules/core/src/main/resources/views/htmltags/form/fileupload.html b/modules/core/src/main/resources/views/htmltags/form/fileupload.html new file mode 100644 index 00000000..3e27b6f4 --- /dev/null +++ b/modules/core/src/main/resources/views/htmltags/form/fileupload.html @@ -0,0 +1,205 @@ +<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. + * No deletion without permission, or be held responsible to law. */ + +/** + * 表单控件:文件上传 + * @author ThinkGem + * @version 2017-3-5 + */ +var p = { + + // 标签参数 + id: id!, // 元素ID + + bizKey: bizKey!, // 业务表的主键值(与附件关联的业务数据) + bizType: bizType!, // 业务表的上传类型(全网唯一,推荐格式:实体名_上传类型,例如,文章图片:article_photo) + + dataMap: toBoolean(dataMap!false), // 后台接受的 fileUploadIds 是否从 dataMap 中获取(Cloud环境下使用) + + returnPath: toBoolean(returnPath!false), // 是否是返回文件路径到输入框(默认false),可将路径直接保存到某个字段里 + filePathInputId: filePathInputId!, // 设置文件URL存放的输入框的ID,当returnPath为true的时候,返回文件URL到这个输入框 + fileNameInputId: fileNameInputId!, // 设置文件名称存放的输入框的ID,当returnPath为true的时候,返回文件名称到这个输入框 + + uploadType: uploadType!'', // 上传文件类型:all、file、image、media,若不设置,则自动根据上传文件后缀获取 + + class: class!'', // 标签框的CSS类名,设置 required 加入必填验证 + readonly: readonly!'false', // 是否只读模式,只读模式下为查看模式,只允许下载 + dataMsgRequired: thisTag.attrs['data-msg-required'], // 必填错误提示信息 v4.2.1 + + allowSuffixes: allowSuffixes!'', // 允许上传的后缀,前台的限制,不能超越file.*AllowSuffixes的设置,例如:.jpg,.png, + maxFileSize: maxFileSize!'', // 当前控件的文件上传大小设置(500*1024*1024)单位字节,不可超过配置文件设置的文件大小 + maxUploadNum: @ObjectUtils.toInteger(maxUploadNum!300), // 多文件下允许最多上传几个,默认300个,设置-1代表不限制 + + cueWords: cueWords!'', // 提示语,默认:或将照片(文件)拖到这里,最多可选 maxUploadNum 张(个) v4.1.5 + + imageMaxWidth: imageMaxWidth!'', // 图片压缩,最大宽度(uploadType为image生效),设置-1代表不做任何处理 + imageMaxHeight: imageMaxHeight!'', // 图片压缩,最大宽度(uploadType为image生效),设置-1代表不做任何处理 + imageThumbName: imageThumbName!'', // 如果开启了图片缩略图,这里可以指定缩略图名称,例如:150x150.jpg v5.4.2 + + serviceUpload: serviceUpload!(ctxAdmin+'/file/upload'), // 上传文件后台服务 v4.1.5 + serviceDownload: serviceDownload!(ctxAdmin+'/file/download'), // 下载文件后台服务 v4.1.5 + serviceFileList: serviceFileList!(ctxAdmin+'/file/fileList'), // 查询文件后台服务 v4.1.5 + + extendParams: extendParams!'', // 提交的上传扩展参数,例如:n1:'v1',n2:'v2',后台接受:fileEntity.getFileUploadParams().getExtend() v4.1.3 + + isLazy: toBoolean(isLazy!false), // 设置为ture需要点击上传按钮才上传文件,否则选择后就直接上传 + + isMini: toBoolean(isMini!false), // 是否是精简上传窗口,无边距,无边框 + + preview: preview!'', // 是否显示预览按钮,接受参数:v4.2.0 之前版本为 weboffice,之后版本为 true,可根据需要扩展预览引擎 + + callbackFuncName: callbackFuncName!'fileuploadCallback', // 可自定义回调方法的函数名 v4.2.0 + + // 内置参数 + thisTag: thisTag +}; + +// 编译绑定参数 +form.path(p); + +// 标题自动生成 +if (isBlank(p.dataMsgRequired)){ + var title = text('文件'); + if(p.uploadType=='file'){ + title = text('文档'); + }else if(p.uploadType=='image'){ + title = text('图片'); + }else if(p.uploadType=='media'){ + title = text('音频或视频'); + } + p.dataMsgRequired = text('请上传') + title; +} + +// 生成参数名 +p.name = p.bizType; +p.nameDel = p.bizType + '__del'; +if (p.dataMap){ + p.name = 'dataMap['+p.name+']'; + p.nameDel = 'dataMap['+p.nameDel+']'; +} + +%> +
+ <% if(isNotBlank(p.bizType)){ %> + + + <% } %> +
+ <% if(p.uploadType == 'image'){ %> +
+ +
+
    +
    +
    + <% if(isNotBlank(p.cueWords)){ %> +

    ${p.cueWords}

    + <% }else if(!p.isMini){ %> +

    ${text('或将照片拖到这里,最多可选 {0\} 张', p.maxUploadNum)}

    + <% } %> +
    +
    +
    + <% }else{ %> +
    + +
    +
    + + +
    +
    +
    +
    + <% if(isNotBlank(p.cueWords)){ %> +

    ${p.cueWords}

    + <% }else{ %> +

    ${text('或将文件拖到这里,最多可选 {0\} 个', p.maxUploadNum)}

    + <% } %> +
    +
    +
    + <% } %> +
    +
    + \ No newline at end of file diff --git a/modules/core/src/main/resources/views/htmltags/form/form.html b/modules/core/src/main/resources/views/htmltags/form/form.html new file mode 100644 index 00000000..3f3ada4d --- /dev/null +++ b/modules/core/src/main/resources/views/htmltags/form/form.html @@ -0,0 +1,27 @@ +<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. + * No deletion without permission, or be held responsible to law. */ + +/** + * 表单控件:表单标签 + * @author ThinkGem + * @version 2017-3-5 + */ +var p = { + + // 标签参数 + id: id!, // 表单ID + model: model!, // 绑定Model对象,例如:${user!} + action: action!, // 表单请求地址 + method: method!, // 请求方法,默认 post + enctype: enctype!, // 发送之前进行数据编码,上传文件时指定:multipart/form-data + + // 内置参数 + thisTag: thisTag, + exclAttrs: ['id', 'model', 'action', 'method'] +}; + +// 编译属性参数 +form.attrs(p); + +%>
    +${tagBody}
    diff --git a/modules/core/src/main/resources/views/htmltags/form/hidden.html b/modules/core/src/main/resources/views/htmltags/form/hidden.html new file mode 100644 index 00000000..1a4fc64a --- /dev/null +++ b/modules/core/src/main/resources/views/htmltags/form/hidden.html @@ -0,0 +1,29 @@ +<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. + * No deletion without permission, or be held responsible to law. */ + +/** + * 表单控件:隐藏域 + * @author ThinkGem + * @version 2017-3-5 + */ +var p = { + + // 标签参数 + id: id!, // 元素ID,如果不填写,则与name相同 + path: path!, // 绑定form上model中属性的值 + name: name!, // 元素名称,不填写 + value: value!, // 元素值 + defaultValue: defaultValue!,// 默认值 v4.1.5 + + // 内置参数 + thisTag: thisTag, + exclAttrs: ['id', 'path', 'name', 'value', 'defaultValue', 'type'] +}; + +// 编译绑定参数 +form.path(p); + +// 编译属性参数 +form.attrs(p); + +%> diff --git a/modules/core/src/main/resources/views/htmltags/form/iconselect.html b/modules/core/src/main/resources/views/htmltags/form/iconselect.html new file mode 100644 index 00000000..6b2befbc --- /dev/null +++ b/modules/core/src/main/resources/views/htmltags/form/iconselect.html @@ -0,0 +1,63 @@ +<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. + * No deletion without permission, or be held responsible to law. */ + +/** + * 表单控件:图标选择控件 + * @author ThinkGem + * @version 2017-3-5 + */ +var p = { + + // 标签参数 + id: id!, // 元素ID,如果不填写,则与name相同 + path: path!, // 绑定form上model中属性的值 + name: name!, // 元素名称,不填写 + value: value!, // 元素值 + defaultValue: defaultValue!,// 默认值 v4.1.5 + + class: class!'', // 隐藏域和标签框的CSS类名 + + // 内置参数 + thisTag: thisTag +}; + +// 编译绑定参数 +form.path(p); + +%> +
    + + + +
    + \ No newline at end of file diff --git a/modules/core/src/main/resources/views/htmltags/form/imageclip.html b/modules/core/src/main/resources/views/htmltags/form/imageclip.html new file mode 100644 index 00000000..67aa366e --- /dev/null +++ b/modules/core/src/main/resources/views/htmltags/form/imageclip.html @@ -0,0 +1,77 @@ +<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. + * No deletion without permission, or be held responsible to law. */ + +/** + * 表单控件:图片裁剪,返回image/base64 + * @author ThinkGem + * @version 2017-12-16 + */ +var p = { + + // 标签参数 + id: id!, // 元素ID,如果不填写,则与name相同 + path: path!, // 绑定form上model中属性的值 + name: name!, // 元素名称,不填写 + value: value!, // 元素值 + defaultValue: defaultValue!,// 默认值 v4.1.5 + + class: class!'', // 隐藏域的CSS类名 + + btnText: btnText!text('选择图片'), // 按钮的名字 + btnClass: btnClass!'', // 按钮的CSS类名 + + imageId: imageId!'', // 裁剪后base64返回到img的id + imageDefaultSrc: imageDefaultSrc!'', // 图片默认地址,清除后使用地址 + + ratio: ratio!'1/1', // 图片裁剪比例 v4.1.7 + circle: circle!'false', // 是否圆形图片 + + maxWidth: maxWidth!'', // 裁剪图片后返回的最大宽度 v4.2.1 + maxHeight: maxHeight!'', // 裁剪图片后返回的最大高度 v4.2.1 + + // 内置参数 + thisTag: thisTag +}; + +// 编译绑定参数 +form.path(p); + +%> + +${p.btnText} + \ No newline at end of file diff --git a/modules/core/src/main/resources/views/htmltags/form/input.html b/modules/core/src/main/resources/views/htmltags/form/input.html new file mode 100644 index 00000000..b38153b3 --- /dev/null +++ b/modules/core/src/main/resources/views/htmltags/form/input.html @@ -0,0 +1,67 @@ +<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. + * No deletion without permission, or be held responsible to law. */ + +/** + * 表单控件:输入框 + * @author ThinkGem + * @version 2017-3-5 + */ +var p = { + + // 标签参数 + id: id!, // 元素ID,如果不填写,则与name相同 + path: path!, // 绑定form上model中属性的值 + name: name!, // 元素名称,不填写 + value: value!, // 元素值 + defaultValue: defaultValue!,// 默认值 v4.1.5 + + type: type!'text', // 元素的类型,默认text + + dataFormat: dataFormat!'', // 数据格式化,支持如下值: + // date: 日期;默认值设置:defaultValue="${date()}" + // yyyy: 年;默认值设置:defaultValue="${date('2019','yyyy')}" + // yyyy-MM: 年月;默认值设置:defaultValue="${date('2019-11','yyyy-MM')}" + // datetime: 日期时间 yyyy-MM-dd HH:mm 格式化 + // datetime2: 日期时间,带秒 yyyy-MM-dd HH:mm:ss 格式化 + // 自定义日期 path 改为 name 加 value="${@DateUtils.formatDate(model.field,'yyyyMMdd')}}" + // number: 数值类型 #.## 格式化,默认值设置:defaultValue="${0}" + // number2: 数值类型 0.00 格式化,默认值设置:defaultValue="${0}" v4.1.8 + // 自定义数值 path 改为 name 加 value="${@NumberUtils.formatNumber(model.field,'0.0')}}" + + // 内置参数 + thisTag: thisTag, + exclAttrs: ['id', 'path', 'name', 'value', 'defaultValue', 'type', 'dataFormat'] +}; + +// 编译绑定参数 +form.path(p); + +var df = ''; +// 日期类型格式化(后台实体属性必须是 Date 类型的属性) +if (p.dataFormat == 'date'){ + df = {%> value="${p.value,dateFormat='yyyy-MM-dd'}"<%}; +}else if (p.dataFormat == 'yyyy'){ + df = {%> value="${p.value,dateFormat='yyyy'}"<%}; +}else if (p.dataFormat == 'yyyy-MM'){ + df = {%> value="${p.value,dateFormat='yyyy-MM'}"<%}; +}else if (p.dataFormat == 'MM-dd'){ + df = {%> value="${p.value,dateFormat='MM-dd'}"<%}; +}else if (p.dataFormat == 'datetime'){ + df = {%> value="${p.value,dateFormat='yyyy-MM-dd HH:mm'}"<%}; +}else if (p.dataFormat == 'datetime2'){ + df = {%> value="${p.value,dateFormat='yyyy-MM-dd HH:mm:ss'}"<%}; +} +// 数值类型格式化(后台实体属性必须是 数值 类型的属性) +else if (p.dataFormat == 'number'){ + df = {%> value="${p.value,numberFormat='#.##'}"<%}; +}else if (p.dataFormat == 'number2'){ + df = {%> value="${p.value,numberFormat='0.00'}"<%}; +}else{ + df = {%> value="${p.value}"<%}; +} +p.attrs = p.attrs!'' + df; + +// 编译属性参数 +form.attrs(p); + +%> diff --git a/modules/core/src/main/resources/views/htmltags/form/listselect.html b/modules/core/src/main/resources/views/htmltags/form/listselect.html new file mode 100644 index 00000000..8fd98d4a --- /dev/null +++ b/modules/core/src/main/resources/views/htmltags/form/listselect.html @@ -0,0 +1,258 @@ +<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. + * No deletion without permission, or be held responsible to law. */ + +/** + * 表单控件:列表选择组件 + * @author ThinkGem + * @version 2017-3-5 + */ +var p = { + + // 标签参数 + id: id!, // 元素ID + path: path!, // 绑定form上model中属性的值 + name: name!, // 隐藏域名称 + value: value!, // 隐藏域值 + defaultValue: defaultValue!,// 隐藏域默认值 v4.1.5 + + labelPath: labelPath!, // 绑定form上model中属性的值 + labelName: labelName!, // 标签框名称 + labelValue: labelValue!, // 标签框值 + defaultLabel: defaultLabel!,// 标签框默认值 v4.1.5 + + class: class!'', // 标签框的CSS类名 + placeholder: placeholder!, // 标签框的预期值的提示信息 + dataMsgRequired: thisTag.attrs['data-msg-required'], // 必填错误提示信息 + + btnClass: btnClass!, // 标签框后面的按钮CSS类名 + + title: title!text('选项选择'), // 对话框标题 + boxWidth: boxWidth!'$(js.window).width() - 100', // 对话框宽度 + boxHeight: boxHeight!'$(js.window).height() - 100', // 对话框高度 + + url: url!, // 列表地址,参考EmpUserController的empUserSelect方法 + + readonly: readonly!'false', // 是否只读模式 + + allowInput: toBoolean(allowInput!false), // 是否允许label框输入 + allowClear: toBoolean(allowClear!true), // 是否允许清空选择内容 + + checkbox: toBoolean(checkbox!false), // 是否显示复选框,是否支持多选,如果设置canSelectParent=true则返回父节点数据 + + itemCode: itemCode!, // 选择后结果集中的Code属性名,返回到隐藏域的值 + itemName: itemName!, // 选择后结果集中的Name属性名,返回到输入框的值 + + getSelectDataFuncName: getSelectDataFuncName!'listselectGetSelectData', // 选择页面,获取已经选择的数据,回显到选择页面 v4.1.5 + setSelectDataFuncName: setSelectDataFuncName!'listselectSetSelectData', // 选择之后,点击确定,将选择数据设置到业务表单 v4.2.0 + + openFuncName: openFuncName!'listselectOpen', // 可自定义弹窗前调用的函数名 v4.2.0 + checkFuncName: checkFuncName!'listselectCheck', // 可自定义验证方法的函数名 v4.2.0 + callbackFuncName: callbackFuncName!'listselectCallback', // 可自定义回调方法的函数名 v4.1.5 + + // 内置参数 + thisTag: thisTag +}; + +// 编译绑定参数 +form.path(p); + +// 标签属性编译 +p.labelAttrs = ''; +if (!p.allowInput){ + p.labelAttrs = p.labelAttrs + ' readonly="readonly"'; +} +if (isNotBlank(p.dataMsgRequired)){ + p.labelAttrs = p.labelAttrs + ' data-msg-required="' + p.dataMsgRequired + '"'; +} +if (isNotBlank(p.placeholder)){ + p.labelAttrs = p.labelAttrs + ' placeholder="' + p.placeholder + '"'; +} + +// 如果没有设置是否显示“清除”按钮开关,则根据class判断是否为必须字段。 +if (allowClear == null && @StringUtils.contains(p.class, 'required')){ + allowClear = false; +} + +%>
    + + +
    + \ No newline at end of file diff --git a/modules/core/src/main/resources/views/htmltags/form/radio.html b/modules/core/src/main/resources/views/htmltags/form/radio.html new file mode 100644 index 00000000..8a9f31f8 --- /dev/null +++ b/modules/core/src/main/resources/views/htmltags/form/radio.html @@ -0,0 +1,77 @@ +<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. + * No deletion without permission, or be held responsible to law. */ + +/** + * 表单控件:单选按钮 + * @author ThinkGem + * @version 2017-3-5 + */ +var p = { + + // 标签参数 + id: id!, // 元素ID,如果不填写,则与name相同 + path: path!, // 绑定form上model中属性的值 + name: name!, // 元素名称,不填写 + value: value!, // 元素值 + defaultValue: defaultValue!,// 默认值 v4.1.5 + + dictType: dictType!, // 字典类型,从字典里获取,自动设置items、itemLabel、itemValue + + items: items!([]), // 列表数据,可接受对象集合,如:List + itemLabel: itemLabel!'', // 指定列表数据中的什么属性名作为option的标签名 + itemValue: itemValue!'', // 指定列表数据中的什么属性名作为option的value值 + + readonly: toBoolean(readonly!false), // 是否只读模式 v4.2.0 + + blankOption: toBoolean(blankOption!false), // 是否默认有个空白选择项目 v4.2.0 + blankOptionValue: blankOptionValue!'', // 给空白选择项目设置一个值,默认:空字符串 v4.2.0 + blankOptionLabel: blankOptionLabel!'全部', // 给空白选择项目设置一个标签,如:请选择、全部 v4.2.0 + + // 内置参数 + thisTag: thisTag, + exclAttrs: ['id', 'path', 'name', 'value', 'defaultValue', 'dictType', + 'items', 'itemLabel', 'itemValue'] +}; + +// 编译绑定参数 +form.path(p); + +// 编译属性参数 +form.attrs(p); + +// 编译集合参数 +form.items(p); + +// 如果只读模式,则禁用,并加默认值为value +if (p.readonly){ + p.attrs = p.attrs + ' disabled="true"'; + %><% +}else{ + %><% +} + +// 输出选项 +var body = { + if (p.blankOption){ + %><% + } + var checked, title; + for (var item in p.items){ + checked = (@ObjectUtils.toString(p.value) == item[p.itemValue] ? ' checked' : ''); + if (type.name(item) == 'DictData'){ + if (!item['isRoot']) { + continue; + } + if (isNotBlank(item['description'])){ + title = ' title="' + item['description'] + '"'; + } + } + %> ${item[p.itemLabel]}<% + } +}; + +%> + +${body} diff --git a/modules/core/src/main/resources/views/htmltags/form/select.html b/modules/core/src/main/resources/views/htmltags/form/select.html new file mode 100644 index 00000000..6f0e469c --- /dev/null +++ b/modules/core/src/main/resources/views/htmltags/form/select.html @@ -0,0 +1,124 @@ +<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. + * No deletion without permission, or be held responsible to law. */ + +/** + * 表单控件:下拉选择框 + * @author ThinkGem + * @version 2017-3-5 + */ +var p = { + + // 标签参数 + id: id!, // 元素ID,如果不填写,则与name相同 + path: path!, // 绑定form上model中属性的值 + name: name!, // 元素名称,不填写 + value: value!, // 元素值 + defaultValue: defaultValue!,// 默认值 v4.1.5 + + dictType: dictType!, // 字典类型,从字典里获取,自动设置items、itemLabel、itemValue + // 字典类型加 __all(双下划线+all) 后缀,则显示停用的字典 v4.2.0 + dictIcon: toBoolean(dictIcon!true), // 是否加载字典里设置的样式,默认true v4.3.3 + dictStyle: toBoolean(dictStyle!false), // 是否加载字典里设置的样式,默认false v4.3.3 + + items: items![], // 列表数据,可接受对象集合,如:List + itemLabel: itemLabel!'', // 指定列表数据中的什么属性名作为option的标签名 + itemValue: itemValue!'', // 指定列表数据中的什么属性名作为option的value值 + itemStatus: itemStatus!'', // option 的 disabled,如果是字符串类型(0正常,!0禁用)v4.2.0 + + multiple: multiple!'false', // 是否为多选框 + + readonly: toBoolean(readonly!false), // 是否只读模式 v4.1.7 + + blankOption: toBoolean(blankOption!false), // 是否默认有个空白选择项目 + blankOptionValue: blankOptionValue!'', // 给空白选择项目设置一个值,默认:空字符串 v4.2.0 + blankOptionLabel: blankOptionLabel!' ', // 给空白选择项目设置一个标签,如:请选择、全部 + // data-placeholder: '请选择人员信息', // 下拉选择框的提示信息 + + // 内置参数 + thisTag: thisTag, + exclAttrs: ['id', 'path', 'name', 'value', 'defaultValue', 'dictType', + 'items', 'itemLabel', 'itemValue', 'multiple', 'blankOption'] +}; + +// 编译绑定参数 +form.path(p); + +// 编译属性参数 +form.attrs(p); + +// 编译集合参数 +form.items(p); + +// 是否是多选下拉框 +if (toBoolean(p.multiple)){ + p.attrs = p.attrs + ' multiple="true" data-close-on-select="false"'; +} + +// 转换为字符串数组 +if (p.multiple == 'true' && type.name(p.value) == 'String'){ + // p.value = @ObjectUtils.toString(p.value); 一定是字符串,无需转换 + p.value = @StringUtils.split(p.value, ','); +} + +// 加一个 type="hidden" 当不选择任何东西的时候,使用该默认值,否则发送null则不会被执行update +if (p.multiple == 'true' || p.readonly){ + // 如果只读模式,则禁用,并加默认值为value + if (p.readonly){ + p.attrs = p.attrs + ' disabled="true"'; + if (p.multiple == 'true'){ + for (var val in p.value!){ + %><% + }elsefor{ + %><% + } + }else{ + %><% + } + }else{ + %><% + } +} + +// 输出下拉选项 +var body = { + if (p.blankOption && p.multiple != 'true'){ + %><% + } + for (var item in p.items){ + var iv = @ObjectUtils.toString(@ReflectUtils.invokeGetter(item, p.itemValue)); + var il = @ObjectUtils.toString(@ReflectUtils.invokeGetter(item, p.itemLabel)); + var attr = ''; + if (p.multiple == 'true'){ + attr = attr + (@StringUtils.inString(iv, p.value) ? ' selected' : ''); + }else{ + attr = attr + (@ObjectUtils.toString(p.value) == iv ? ' selected' : ''); + } + if (type.name(item) == 'DictData'){ + if (!item['isRoot']) { + continue; + } + if (isNotBlank(item['description'])){ + attr = attr + ' title="' + item['description'] + '"'; + } + if (p.dictIcon && isNotBlank(item['dictIcon'])){ + attr = attr + ' data-icon="' + item.dictIcon + '"'; + } + if (p.dictStyle && isNotBlank(item['cssStyle'])){ + attr = attr + ' style="' + item.cssStyle + '"'; + } + if (p.dictStyle && isNotBlank(item['cssClass'])){ + attr = attr + ' class="' + item.cssClass + '"'; + } + if (isBlank(p.itemStatus)){ + p.itemStatus = 'status'; + } + } + if (isNotBlank(p.itemStatus) && isNotBlank(item[p.itemStatus])){ + attr = attr + (@ObjectUtils.toString(item[p.itemStatus]) != '0' ? ' disabled' : ''); + } + %><% + } +}; +%> + \ No newline at end of file diff --git a/modules/core/src/main/resources/views/htmltags/form/textarea.html b/modules/core/src/main/resources/views/htmltags/form/textarea.html new file mode 100644 index 00000000..66ade9d5 --- /dev/null +++ b/modules/core/src/main/resources/views/htmltags/form/textarea.html @@ -0,0 +1,29 @@ +<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. + * No deletion without permission, or be held responsible to law. */ + +/** + * 表单控件:文本域 + * @author ThinkGem + * @version 2017-3-5 + */ +var p = { + + // 标签参数 + id: id!, // 元素ID,如果不填写,则与name相同 + path: path!, // 绑定form上model中属性的值 + name: name!, // 元素名称,不填写 + value: value!, // 元素值 + defaultValue: defaultValue!,// 默认值 v4.1.5 + + // 内置参数 + thisTag: thisTag, + exclAttrs: ['id', 'path', 'name', 'value', 'defaultValue', 'type'] +}; + +// 编译绑定参数 +form.path(p); + +// 编译属性参数 +form.attrs(p); + +%> diff --git a/modules/core/src/main/resources/views/htmltags/form/treeselect.html b/modules/core/src/main/resources/views/htmltags/form/treeselect.html new file mode 100644 index 00000000..9cac5b84 --- /dev/null +++ b/modules/core/src/main/resources/views/htmltags/form/treeselect.html @@ -0,0 +1,250 @@ +<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. + * No deletion without permission, or be held responsible to law. */ + +/** + * 表单控件:树结构选择框 + * @author ThinkGem + * @version 2017-3-5 + */ +var p = { + + // 标签参数 + id: id!, // 元素ID + path: path!, // 绑定form上model中属性的值 + name: name!, // 隐藏域名称 + value: value!, // 隐藏域值 + defaultValue: defaultValue!,// 隐藏域默认值 v4.1.5 + + labelPath: labelPath!, // 绑定form上model中属性的值 + labelName: labelName!, // 标签框名称 + labelValue: labelValue!, // 标签框值 + defaultLabel: defaultLabel!,// 标签框默认值 v4.1.5 + + class: class!'', // 标签框的CSS类名 + placeholder: placeholder!, // 标签框的预期值的提示信息 + dataMsgRequired: thisTag.attrs['data-msg-required'], // 必填错误提示信息 + + btnClass: btnClass!, // 标签框后面的按钮CSS类名 + + title: title!text('选项选择'), // 对话框标题 + boxWidth: boxWidth!300, // 对话框宽度,默认300像素 + boxHeight: boxHeight!400, // 对话框高度,默认400像素 + + url: url!, // 树结构,数据源地址 [{id, pid, name}] + + readonly: readonly!'false', // 是否只读模式 + + allowInput: toBoolean(allowInput!false), // 是否允许label框输入 + allowClear: toBoolean(allowClear!true), // 是否允许清空选择内容 + + checkbox: toBoolean(checkbox!false), // 是否显示复选框,是否支持多选,如果设置canSelectParent=true则返回父节点数据 + chkboxType: chkboxType!'', // 复选框级联选择规则 v4.0.6,默认:{'Y':'ps','N':'ps'} + expandLevel: @ObjectUtils.toInteger(expandLevel!(-1)), // 默认展开层次级别(默认:如果有1个根节点,则展开一级节点,否则不展开) + + canSelectRoot: toBoolean(canSelectRoot!false), // 可以选择跟节点 + canSelectParent: toBoolean(canSelectParent!false), // 可以选择父级节点 + + isReturnValue: isReturnValue!'false', // 是否返回树结构的value值,而不是返回id(默认id) + + returnFullName: toBoolean(returnFullName!false), // 是否返回全路径,包含所有上级信息,以 returnFullNameSplit 参数分隔 + returnFullNameSplit: returnFullNameSplit!'/', // 是否返回全路径,的分隔符,默认“/” + + fastSearch: toBoolean(allowClear!true), // 快速查询,查询框输入后接着进行查询,关闭后,点击查询按钮或回车再查询 v4.5.0 v5.0.2 + + openFuncName: openFuncName!'treeselectOpen', // 可自定义弹窗前调用的函数名 v4.2.0 + checkFuncName: checkFuncName!'treeselectCheck', // 可自定义验证方法的函数名 v4.1.5 + callbackFuncName: callbackFuncName!'treeselectCallback', // 可自定义回调方法的函数名 v4.1.0 + + // 内置参数 + thisTag: thisTag +}; + +// 编译绑定参数 +form.path(p); + +// 标签属性编译 +p.labelAttrs = ''; +if (!p.allowInput){ + p.labelAttrs = p.labelAttrs + ' readonly="readonly"'; +} +if (isNotBlank(p.dataMsgRequired)){ + p.labelAttrs = p.labelAttrs + ' data-msg-required="' + p.dataMsgRequired + '"'; +} +if (isNotBlank(p.placeholder)){ + p.labelAttrs = p.labelAttrs + ' placeholder="' + p.placeholder + '"'; +} + +// 如果没有设置是否显示“清除”按钮开关,则根据class判断是否为必须字段。 +if (allowClear! == null && @StringUtils.contains(p.class, 'required')){ + p.allowClear = false; +} + +%>
    + + +
    + \ No newline at end of file diff --git a/modules/core/src/main/resources/views/htmltags/form/ueditor.html b/modules/core/src/main/resources/views/htmltags/form/ueditor.html new file mode 100644 index 00000000..08584f72 --- /dev/null +++ b/modules/core/src/main/resources/views/htmltags/form/ueditor.html @@ -0,0 +1,174 @@ +<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. + * No deletion without permission, or be held responsible to law. */ + +/** + * 表单控件:输入框 + * @author ThinkGem + * @version 2017-3-5 + */ +var p = { + + // 标签参数 + id: id!, // 元素ID,如果不填写,则与name相同 + path: path!, // 绑定form上model中属性的值 + name: name!, // 元素名称,不填写 + value: value!, // 元素值 + defaultValue: defaultValue!,// 默认值 v4.1.5 + + class: class!'', // 标签框的CSS类名,设置 required 加入必填验证 + + maxlength: maxlength!'', // 编辑器最大输入字数,为空代表无限制 + height: height!'200', // 编辑器的高度,默认200 + maxHeight: maxHeight!, // 编辑器的最大高度 + + simpleToolbars: toBoolean(simpleToolbars!false), // 是否是简单的工具条 + + readonly: toBoolean(readonly!false), // 是否只读模式 + + outline: toBoolean(outline!false), // 大纲视图 + + options: options!'', // UE附加选项,逗号隔开。 + + // 内置参数 + thisTag: thisTag +}; + +// 编译绑定参数 +form.path(p); + +%> +<% if(p.outline){ %> +
    +
    + + +
    +
     
    +
    +
    +
    ${text('目录标题')}:
    +
    +
    +
    +
    +
    +<% }else{ %> + + +<% } %> + \ No newline at end of file diff --git a/modules/core/src/main/resources/views/htmltags/form/validcode.html b/modules/core/src/main/resources/views/htmltags/form/validcode.html new file mode 100644 index 00000000..0d1141a9 --- /dev/null +++ b/modules/core/src/main/resources/views/htmltags/form/validcode.html @@ -0,0 +1,66 @@ +<%/* Copyright (c) 2013-Now http://jeesite.com All rights reserved. + * No deletion without permission, or be held responsible to law. */ + +/** + * 表单控件:验证码输入框 + * @author ThinkGem + * @version 2017-3-5 + */ +var p = { + + id: id!name, // 验证码输入框ID + name: name!, // 验证码输入框名称(必填) + + isRequired: toBoolean(isRequired!true), // 是否必填,默认必填 + dataMsgRequired: thisTag.attrs['data-msg-required'], // 必填错误提示信息 + + isRemote: toBoolean(isRemote!true), // 是否支持实时远程验证 + dataMsgRemote: thisTag.attrs['data-msg-remote'], // 必填错误提示信息 + + isLazy: toBoolean(isLazy!false), // 是否懒加载验证码图片,原noRefresh参数 + + label: label!text('验证码'), // 控件的标签(V4.2.2) + isShowLabel: toBoolean(isShowLabel!true), // 是否显示“验证码”标签,默认true(V4.0.5) + + // 内置参数 + thisTag: thisTag +}; + +// 必填属性HTML +var require = { + if (p.isRequired){ + %> required="true" data-msg-required="${p.dataMsgRequired!text('请填写验证码')}"<% + } +}; + +// 远程验证HTML +var remote = { + if (p.isRemote){ + %> remote="${ctxPath}/validCode" data-msg-remote="${p.dataMsgRemote!text('验证码不正确.')}"<% + } +}; + +%> +
    + <% if (p.isShowLabel){ %>${p.label}:<% } %> + + + ${text('验证码')} + + +
    +