mirror of https://gitee.com/stylefeng/guns
Merge remote-tracking branch 'origin/group5-dictTag'
commit
236670e72a
|
@ -68,6 +68,7 @@ public class BeetlConfiguration {
|
|||
Properties properties = new Properties();
|
||||
properties.setProperty("DELIMITER_STATEMENT_START", BeetlConfigExpander.getDelimiterStatementStart());
|
||||
properties.setProperty("DELIMITER_STATEMENT_END", BeetlConfigExpander.getDelimiterStatementEnd());
|
||||
properties.setProperty("HTML_TAG_FLAG", BeetlConfigExpander.getHtmlTagFlag());
|
||||
properties.setProperty("RESOURCE.tagRoot", BeetlConfigExpander.getResourceTagRoot());
|
||||
properties.setProperty("RESOURCE.tagSuffix", BeetlConfigExpander.getResourceTagSuffix());
|
||||
properties.setProperty("RESOURCE.autoCheck", BeetlConfigExpander.getResourceAutoCheck());
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package cn.stylefeng.guns.core.beetl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.stylefeng.guns.core.beetl.tag.SysDictCheckBoxTag;
|
||||
import cn.stylefeng.guns.core.beetl.tag.SysDictRadioTag;
|
||||
import cn.stylefeng.guns.core.beetl.tag.SysDictSelectTag;
|
||||
import cn.stylefeng.roses.kernel.auth.api.LoginUserApi;
|
||||
import cn.stylefeng.roses.kernel.system.expander.SystemConfigExpander;
|
||||
import org.beetl.ext.spring.BeetlGroupUtilConfiguration;
|
||||
|
@ -31,6 +34,13 @@ public class CustomBeetlGroupUtilConfiguration extends BeetlGroupUtilConfigurati
|
|||
// 获取基本信息的工具
|
||||
groupTemplate.registerFunctionPackage("constants", SystemConfigExpander.class);
|
||||
|
||||
// 下拉选字典
|
||||
groupTemplate.registerTag("dict_select", SysDictSelectTag.class);
|
||||
// 单选字典
|
||||
groupTemplate.registerTag("dict_radio", SysDictRadioTag.class);
|
||||
// 多选字典
|
||||
groupTemplate.registerTag("dict_checkbox", SysDictCheckBoxTag.class);
|
||||
|
||||
// todo 多语言
|
||||
// groupTemplate.registerFunctionPackage("lang", new UserTranslationContext());
|
||||
}
|
||||
|
|
|
@ -37,4 +37,10 @@ public interface BeetlConstants {
|
|||
*/
|
||||
String DEFAULT_RESOURCE_AUTO_CHECK = "false";
|
||||
|
||||
/**
|
||||
* 默认beetl 支持HTML标签
|
||||
* <p>
|
||||
* beetl默认的是 '#'
|
||||
*/
|
||||
String DEFAULT_HTML_TAG_FLAG = "tag:";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
package cn.stylefeng.guns.core.beetl.consts;
|
||||
|
||||
/**
|
||||
* 字典html属性常量
|
||||
*
|
||||
* @author liuhanqing
|
||||
* @date 2021/1/16 21:06
|
||||
*/
|
||||
|
||||
public interface DictTagConstants {
|
||||
|
||||
/**
|
||||
* html组件 id
|
||||
*/
|
||||
String ID = "id";
|
||||
|
||||
/**
|
||||
* html组件 name
|
||||
*/
|
||||
String NAME = "name";
|
||||
|
||||
/**
|
||||
* html组件 type
|
||||
*/
|
||||
String TYPE = "type";
|
||||
|
||||
/**
|
||||
* 字典类型编码
|
||||
*/
|
||||
String DICT_TYPE_CODE = "dictTypeCode";
|
||||
|
||||
/**
|
||||
* layui元素的风格
|
||||
*/
|
||||
String LAY_SKIN = "laySkin";
|
||||
|
||||
/**
|
||||
* layui事件过滤器
|
||||
*/
|
||||
String LAY_FILTER = "layFilter";
|
||||
|
||||
/**
|
||||
* layui校验
|
||||
*/
|
||||
String LAY_VERIFY = "layVerify";
|
||||
|
||||
/**
|
||||
* select控件提示name
|
||||
*/
|
||||
String HEAD_NAME = "headName";
|
||||
|
||||
/**
|
||||
* select控件提示value
|
||||
*/
|
||||
String HEAD_VALUE = "headValue";
|
||||
|
||||
/**
|
||||
* select控件提示类型::1-全部,2-请选择
|
||||
*/
|
||||
String HEAD_TYPE = "headType";
|
||||
|
||||
/**
|
||||
* 默认值
|
||||
*/
|
||||
String DEFAULT_VALUE = "defaultValue";
|
||||
|
||||
/**
|
||||
* 工作流相关
|
||||
*/
|
||||
String WORKFLOW_FORM = "workflowForm";
|
||||
|
||||
/**
|
||||
* 工作流相关
|
||||
*/
|
||||
String ITEM_NAME = "itemName";
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package cn.stylefeng.guns.core.beetl.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 字典下拉选头类型
|
||||
*
|
||||
* @author liuhanqing
|
||||
* @date 2021/1/16 20:36
|
||||
*/
|
||||
@Getter
|
||||
public enum SelectTagHeadTypeEnum {
|
||||
|
||||
/**
|
||||
* 全部
|
||||
*/
|
||||
ALL("1", "全部"),
|
||||
|
||||
/**
|
||||
* 请选择
|
||||
*/
|
||||
SELECT("2", "请选择");
|
||||
|
||||
private final String code;
|
||||
|
||||
private final String name;
|
||||
|
||||
SelectTagHeadTypeEnum(String code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取枚举
|
||||
*
|
||||
* @author liuhanqing
|
||||
* @date 2021/1/16 20:36
|
||||
*/
|
||||
public static SelectTagHeadTypeEnum codeToEnum(String code) {
|
||||
if (null != code) {
|
||||
for (SelectTagHeadTypeEnum e : SelectTagHeadTypeEnum.values()) {
|
||||
if (e.getCode().equals(code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编码转化成中文含义
|
||||
*
|
||||
* @author liuhanqing
|
||||
* @date 2021/1/16 20:36
|
||||
*/
|
||||
public static String codeToName(String code) {
|
||||
if (null != code) {
|
||||
for (SelectTagHeadTypeEnum e : SelectTagHeadTypeEnum.values()) {
|
||||
if (e.getCode().equals(code)) {
|
||||
return e.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
return "未知";
|
||||
}
|
||||
|
||||
}
|
|
@ -60,5 +60,14 @@ public class BeetlConfigExpander {
|
|||
public static String getResourceAutoCheck() {
|
||||
return ConfigContext.me().getSysConfigValueWithDefault("RESOURCE_AUTO_CHECK", String.class, BeetlConstants.DEFAULT_RESOURCE_AUTO_CHECK);
|
||||
}
|
||||
/**
|
||||
* 自定义支持HTML标签
|
||||
*
|
||||
* @author liuhanqing
|
||||
* @date 2021/1/16 21:06
|
||||
*/
|
||||
public static String getHtmlTagFlag() {
|
||||
return ConfigContext.me().getSysConfigValueWithDefault("HTML_TAG_FLAG", String.class, BeetlConstants.DEFAULT_HTML_TAG_FLAG);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,165 @@
|
|||
package cn.stylefeng.guns.core.beetl.tag;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.stylefeng.guns.core.beetl.consts.DictTagConstants;
|
||||
import cn.stylefeng.roses.kernel.dict.modular.entity.SysDict;
|
||||
import cn.stylefeng.roses.kernel.dict.modular.entity.SysDictType;
|
||||
import cn.stylefeng.roses.kernel.dict.modular.service.DictService;
|
||||
import cn.stylefeng.roses.kernel.dict.modular.service.DictTypeService;
|
||||
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.Data;
|
||||
import org.beetl.core.tag.GeneralVarTagBinding;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* beetl字典标签基类
|
||||
*
|
||||
* @author liuhanqing
|
||||
* @date 2021/1/16 18:45
|
||||
*/
|
||||
@Data
|
||||
public class SysDictBaseTag extends GeneralVarTagBinding {
|
||||
public DictService dictService = SpringUtil.getBean(DictService.class);
|
||||
public DictTypeService dictTypeService = SpringUtil.getBean(DictTypeService.class);
|
||||
/**
|
||||
* html组件 id
|
||||
*/
|
||||
public String id;
|
||||
/**
|
||||
* html组件 name
|
||||
*/
|
||||
public String name;
|
||||
/**
|
||||
* html组件 type
|
||||
*/
|
||||
public String type;
|
||||
/**
|
||||
* 字典类型编码
|
||||
*/
|
||||
public String dictTypeCode;
|
||||
/**
|
||||
* layui元素的风格
|
||||
*/
|
||||
public String laySkin;
|
||||
/**
|
||||
* layui事件过滤器
|
||||
*/
|
||||
public String layFilter;
|
||||
/**
|
||||
* layui校验
|
||||
*/
|
||||
public String layVerify;
|
||||
/**
|
||||
* select控件提示name
|
||||
*/
|
||||
public String headName;
|
||||
/**
|
||||
* select控件提示value
|
||||
*/
|
||||
public String headValue;
|
||||
/**
|
||||
* select控件提示类型::1-全部,2-请选择
|
||||
*/
|
||||
public String headType;
|
||||
/**
|
||||
* 默认值
|
||||
*/
|
||||
public String defaultValue;
|
||||
/**
|
||||
* 工作流相关
|
||||
*/
|
||||
public String workflowForm;
|
||||
/**
|
||||
* 工作流相关
|
||||
*/
|
||||
public String itemName;
|
||||
|
||||
/**
|
||||
* 初始化绑定属性
|
||||
*
|
||||
* @author liuhanqing
|
||||
* @date 2021/1/16 23:49
|
||||
*/
|
||||
public void initAttr() {
|
||||
Map<String, Object> attrs = this.getAttributes();
|
||||
if (attrs.size() > 0) {
|
||||
if (ObjectUtil.isNotNull(attrs.get(DictTagConstants.ID))) {
|
||||
this.setId(attrs.get(DictTagConstants.ID).toString());
|
||||
}
|
||||
if (ObjectUtil.isNotNull(attrs.get(DictTagConstants.NAME))) {
|
||||
this.setName(attrs.get(DictTagConstants.NAME).toString());
|
||||
}
|
||||
if (ObjectUtil.isNotNull(attrs.get(DictTagConstants.TYPE))) {
|
||||
this.setType(attrs.get(DictTagConstants.TYPE).toString());
|
||||
}
|
||||
if (ObjectUtil.isNotNull(attrs.get(DictTagConstants.DICT_TYPE_CODE))) {
|
||||
this.setDictTypeCode(attrs.get(DictTagConstants.DICT_TYPE_CODE).toString());
|
||||
}
|
||||
if (ObjectUtil.isNotNull(attrs.get(DictTagConstants.LAY_SKIN))) {
|
||||
this.setLaySkin(attrs.get(DictTagConstants.LAY_SKIN).toString());
|
||||
}
|
||||
if (ObjectUtil.isNotNull(attrs.get(DictTagConstants.LAY_FILTER))) {
|
||||
this.setLayFilter(attrs.get(DictTagConstants.LAY_FILTER).toString());
|
||||
}
|
||||
if (ObjectUtil.isNotNull(attrs.get(DictTagConstants.LAY_VERIFY))) {
|
||||
this.setLayVerify(attrs.get(DictTagConstants.LAY_VERIFY).toString());
|
||||
}
|
||||
if (ObjectUtil.isNotNull(attrs.get(DictTagConstants.HEAD_NAME))) {
|
||||
this.setHeadName(attrs.get(DictTagConstants.HEAD_NAME).toString());
|
||||
}
|
||||
if (ObjectUtil.isNotNull(attrs.get(DictTagConstants.HEAD_VALUE))) {
|
||||
this.setHeadValue(attrs.get(DictTagConstants.HEAD_VALUE).toString());
|
||||
}
|
||||
if (ObjectUtil.isNotNull(attrs.get(DictTagConstants.HEAD_TYPE))) {
|
||||
this.setHeadType(attrs.get(DictTagConstants.HEAD_TYPE).toString());
|
||||
}
|
||||
if (ObjectUtil.isNotNull(attrs.get(DictTagConstants.DEFAULT_VALUE))) {
|
||||
this.setDefaultValue(attrs.get(DictTagConstants.DEFAULT_VALUE).toString());
|
||||
}
|
||||
if (ObjectUtil.isNotNull(attrs.get(DictTagConstants.WORKFLOW_FORM))) {
|
||||
this.setWorkflowForm(attrs.get(DictTagConstants.WORKFLOW_FORM).toString());
|
||||
}
|
||||
if (ObjectUtil.isNotNull(attrs.get(DictTagConstants.ITEM_NAME))) {
|
||||
this.setItemName(attrs.get(DictTagConstants.ITEM_NAME).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典类型
|
||||
* @return 字典类型
|
||||
* @author liuhanqing
|
||||
* @date 2021/1/16 23:46
|
||||
*/
|
||||
public SysDictType getDictType(){
|
||||
// 根据字典类型编码去查询字典类型
|
||||
LambdaQueryWrapper<SysDictType> dictTypeQueryWrapper = new LambdaQueryWrapper<>();
|
||||
dictTypeQueryWrapper.eq(SysDictType::getDictTypeCode, this.getDictTypeCode());
|
||||
dictTypeQueryWrapper.ne(SysDictType::getDelFlag, YesOrNotEnum.Y.getCode());
|
||||
return dictTypeService.getOne(dictTypeQueryWrapper);
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return 根据字典类型返回字典集合
|
||||
* @author liuhanqing
|
||||
* @date 2021/1/16 23:46
|
||||
*/
|
||||
public List<SysDict> getDictList(){
|
||||
// 查询字典列表
|
||||
LambdaQueryWrapper<SysDict> dictQueryWrapper = new LambdaQueryWrapper<>();
|
||||
dictQueryWrapper.eq(SysDict::getDictTypeCode, this.getDictTypeCode());
|
||||
dictQueryWrapper.ne(SysDict::getDelFlag, YesOrNotEnum.Y.getCode());
|
||||
dictQueryWrapper.orderByAsc(SysDict::getDictSort);
|
||||
return dictService.list(dictQueryWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package cn.stylefeng.guns.core.beetl.tag;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.stylefeng.roses.kernel.dict.modular.entity.SysDict;
|
||||
import cn.stylefeng.roses.kernel.dict.modular.entity.SysDictType;
|
||||
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* checkbox字典组件
|
||||
*
|
||||
* @author liuhanqing
|
||||
* @date 2021/1/16 19:06
|
||||
*/
|
||||
@Slf4j
|
||||
public class SysDictCheckBoxTag extends SysDictBaseTag {
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
// 初始属性
|
||||
initAttr();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// 当字典类型编码不为空
|
||||
if (StrUtil.isNotBlank(this.getDictTypeCode())) {
|
||||
// 根据字典类型编码去查询字典类型
|
||||
SysDictType dictType = getDictType();
|
||||
// 判断字典类型不为空
|
||||
if (dictType != null) {
|
||||
List<SysDict> lst = getDictList();
|
||||
// 默认选中值
|
||||
String defaultValue = this.getDefaultValue();
|
||||
// 循环字典列表
|
||||
for (SysDict option : lst) {
|
||||
// 生成input的id
|
||||
String id = this.getType() + "_" + this.getName() + "_" + option.getDictCode();
|
||||
// 拼接html
|
||||
sb.append(" <input type='checkbox' name='").append(this.getName())
|
||||
.append("' id='").append(id)
|
||||
.append("' title='").append(option.getDictName())
|
||||
.append("' value='").append(option.getDictCode())
|
||||
.append("'");
|
||||
// layui 元素的风格
|
||||
if (StrUtil.isNotBlank(this.getLaySkin())) {
|
||||
sb.append(" lay-skin='").append(this.getLaySkin()).append("'");
|
||||
}
|
||||
// layui 事件过滤器
|
||||
if (StrUtil.isNotBlank(this.getLayFilter())) {
|
||||
sb.append(" lay-filter='").append(this.getLayFilter()).append("'");
|
||||
}
|
||||
// layui 表单验证
|
||||
if (StrUtil.isNotBlank(this.getLayVerify())) {
|
||||
sb.append(" lay-verify='").append(this.getLayVerify()).append("'");
|
||||
}
|
||||
// 默认选中值
|
||||
if (StrUtil.isNotBlank(defaultValue) && defaultValue.equals(option.getDictCode())) {
|
||||
sb.append(" checked ");
|
||||
}
|
||||
sb.append(" /> ");
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
this.ctx.byteWriter.writeString(sb.toString());
|
||||
} catch (IOException e) {
|
||||
log.error("checkbox字典初始化异常:",e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package cn.stylefeng.guns.core.beetl.tag;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.stylefeng.roses.kernel.dict.modular.entity.SysDict;
|
||||
import cn.stylefeng.roses.kernel.dict.modular.entity.SysDictType;
|
||||
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* radio字典组件
|
||||
*
|
||||
* @author liuhanqing
|
||||
* @date 2021/1/16 19:59
|
||||
*/
|
||||
@Slf4j
|
||||
public class SysDictRadioTag extends SysDictBaseTag {
|
||||
@Override
|
||||
public void render() {
|
||||
// 初始属性
|
||||
initAttr();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// 当字典类型编码不为空
|
||||
if (StrUtil.isNotBlank(this.getDictTypeCode())) {
|
||||
// 根据字典类型编码去查询字典类型
|
||||
SysDictType dictType = getDictType();
|
||||
// 判断字典类型不为空
|
||||
if (dictType != null) {
|
||||
List<SysDict> lst = getDictList();
|
||||
// 默认选中值
|
||||
String defaultValue = this.getDefaultValue();
|
||||
int index = 0;
|
||||
for (SysDict option : lst) {
|
||||
// 生成input的id
|
||||
String id = this.getType() + "_" + this.getName() + "_" + option.getDictCode();
|
||||
// 拼接html
|
||||
sb.append(" <input type='radio' name='").append(this.getName())
|
||||
.append("' id='").append(id)
|
||||
.append("' title='").append(option.getDictName())
|
||||
.append("' value='").append(option.getDictCode())
|
||||
.append("'");
|
||||
|
||||
// layui 元素的风格
|
||||
if (StrUtil.isNotBlank(this.getLaySkin())) {
|
||||
sb.append(" lay-skin='").append(this.getLaySkin()).append("'");
|
||||
}
|
||||
// layui 事件过滤器
|
||||
if (StrUtil.isNotBlank(this.getLayFilter())) {
|
||||
sb.append(" lay-filter='").append(this.getLayFilter()).append("'");
|
||||
}
|
||||
// layui 表单验证
|
||||
if (StrUtil.isNotBlank(this.getLayVerify())) {
|
||||
sb.append(" lay-verify='").append(this.getLayVerify()).append("'");
|
||||
}
|
||||
// 默认选中值
|
||||
if (StrUtil.isNotBlank(defaultValue) && defaultValue.equals(option.getDictCode())) {
|
||||
sb.append(" checked ");
|
||||
} else {
|
||||
// 无默认值选中第一个(忘了为什么设计先保留逻辑)
|
||||
if (index == 0) {
|
||||
sb.append(" checked ");
|
||||
}
|
||||
}
|
||||
|
||||
sb.append(" /> ");
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
this.ctx.byteWriter.writeString(sb.toString());
|
||||
} catch (IOException e) {
|
||||
log.error("select字典初始化异常:", e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package cn.stylefeng.guns.core.beetl.tag;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.stylefeng.guns.core.beetl.enums.SelectTagHeadTypeEnum;
|
||||
import cn.stylefeng.roses.kernel.dict.modular.entity.SysDict;
|
||||
import cn.stylefeng.roses.kernel.dict.modular.entity.SysDictType;
|
||||
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* select字典组件
|
||||
*
|
||||
* @author liuhanqing
|
||||
* @date 2021/1/16 19:37
|
||||
*/
|
||||
@Slf4j
|
||||
public class SysDictSelectTag extends SysDictBaseTag {
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
// 初始属性
|
||||
initAttr();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// 当字典类型编码不为空
|
||||
if (StrUtil.isNotBlank(this.getDictTypeCode())) {
|
||||
sb.append("<select name='").append(this.getName())
|
||||
.append("' id='").append(this.getId())
|
||||
.append("'");
|
||||
|
||||
// layui 事件过滤器
|
||||
if (StrUtil.isNotBlank(this.getLayFilter())) {
|
||||
sb.append(" lay-filter='").append(this.getLayFilter()).append("' ");
|
||||
}
|
||||
// layui 表单验证
|
||||
if (StrUtil.isNotBlank(this.getLayVerify())) {
|
||||
sb.append(" lay-verify='").append(this.getLayVerify()).append("' ");
|
||||
}
|
||||
// 原有工作流用到
|
||||
if (StrUtil.isNotBlank(this.getWorkflowForm())) {
|
||||
sb.append(" workFlowForm='").append(this.getWorkflowForm()).append("' ");
|
||||
}
|
||||
if (StrUtil.isNotBlank(this.getItemName())) {
|
||||
sb.append(" itemName='").append(this.getItemName()).append("' ");
|
||||
}
|
||||
sb.append(" >");
|
||||
|
||||
if (StrUtil.isNotBlank(this.getHeadName())) {
|
||||
sb.append("<option value='").append(this.getHeadValue()).append("' selected>")
|
||||
.append(this.getHeadName()).append("</option>");
|
||||
} else {
|
||||
if (StrUtil.isNotBlank(this.getHeadType())) {
|
||||
if (SelectTagHeadTypeEnum.ALL.getCode().equals(this.getHeadType())) {
|
||||
sb.append("<option value='").append(this.getHeadValue()).append("' selected>")
|
||||
.append(" - 全部 - ").append("</option>");
|
||||
}
|
||||
if (SelectTagHeadTypeEnum.SELECT.getCode().equals(this.getHeadType())) {
|
||||
sb.append("<option value='").append(this.getHeadValue()).append("' selected>")
|
||||
.append(" - 请选择 - ").append("</option>");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 根据字典类型编码去查询字典类型
|
||||
SysDictType dictType = getDictType();
|
||||
// 判断字典类型不为空
|
||||
if (dictType != null) {
|
||||
List<SysDict> lst = getDictList();
|
||||
// 默认选中值
|
||||
String defaultValue = this.getDefaultValue();
|
||||
// 循环字典列表,添加下拉选项
|
||||
int index = 0;
|
||||
for (SysDict option : lst) {
|
||||
sb.append("<option value='").append(option.getDictCode()).append("'");
|
||||
// 设置默认选中值
|
||||
if (StrUtil.isNotBlank(defaultValue) && defaultValue.equals(option.getDictCode())) {
|
||||
sb.append(" selected ");
|
||||
} else {
|
||||
// 未设置headName和headType 默认选中第一个
|
||||
if (index == 0 && StrUtil.isNotBlank(this.getHeadName()) && StrUtil.isNotBlank(this.getHeadType())) {
|
||||
sb.append(" selected ");
|
||||
}
|
||||
}
|
||||
sb.append(">").append(option.getDictName()).append("</option>");
|
||||
index++;
|
||||
}
|
||||
}
|
||||
sb.append("</select>");
|
||||
}
|
||||
try {
|
||||
this.ctx.byteWriter.writeString(sb.toString());
|
||||
} catch (IOException e) {
|
||||
log.error("select字典初始化异常:",e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,6 +21,9 @@ spring:
|
|||
serialization:
|
||||
indent_output: false
|
||||
|
||||
beetl:
|
||||
html-tag-flag: 'tag:'
|
||||
|
||||
scanner:
|
||||
open: true
|
||||
|
||||
|
|
|
@ -40,11 +40,12 @@ layui.use(['layer', 'form', 'admin', 'laydate', 'HttpRequest', 'xmSelect'], func
|
|||
plugins: 'code print preview fullscreen paste searchreplace save autosave link autolink image imagetools media table codesample lists advlist hr charmap emoticons anchor directionality pagebreak quickbars nonbreaking visualblocks visualchars wordcount',
|
||||
toolbar: 'fullscreen preview code | undo redo | forecolor backcolor | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | formatselect fontselect fontsizeselect | link image media emoticons charmap anchor pagebreak codesample | ltr rtl',
|
||||
toolbar_drawer: 'sliding',
|
||||
images_upload_url: '../../../json/tinymce-upload-ok.json',
|
||||
file_picker_types: 'media',
|
||||
file_picker_callback: function (callback, value, meta) {
|
||||
layer.msg('演示环境不允许上传', {anim: 6});
|
||||
},
|
||||
images_upload_url: Feng.ctxPath + '/sysFileInfo/tinymceUpload',
|
||||
images_upload_base_path: Feng.ctxPath,
|
||||
file_picker_types: 'file image media',
|
||||
// file_picker_callback: function (callback, value, meta) {
|
||||
// layer.msg('演示环境不允许上传', {anim: 6});
|
||||
// },
|
||||
init_instance_callback: function (editor) {
|
||||
console.log(editor);
|
||||
}
|
||||
|
|
|
@ -19,11 +19,12 @@ layui.use(['layer', 'form', 'admin', 'laydate', 'HttpRequest', 'xmSelect'], func
|
|||
plugins: 'code print preview fullscreen paste searchreplace save autosave link autolink image imagetools media table codesample lists advlist hr charmap emoticons anchor directionality pagebreak quickbars nonbreaking visualblocks visualchars wordcount',
|
||||
toolbar: 'fullscreen preview code | undo redo | forecolor backcolor | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | formatselect fontselect fontsizeselect | link image media emoticons charmap anchor pagebreak codesample | ltr rtl',
|
||||
toolbar_drawer: 'sliding',
|
||||
images_upload_url: '../../../json/tinymce-upload-ok.json',
|
||||
file_picker_types: 'media',
|
||||
file_picker_callback: function (callback, value, meta) {
|
||||
layer.msg('演示环境不允许上传', {anim: 6});
|
||||
},
|
||||
images_upload_url: Feng.ctxPath + '/sysFileInfo/tinymceUpload',
|
||||
images_upload_base_path: Feng.ctxPath,
|
||||
file_picker_types: 'file image media',
|
||||
// file_picker_callback: function (callback, value, meta) {
|
||||
// layer.msg('演示环境不允许上传', {anim: 6});
|
||||
// },
|
||||
init_instance_callback: function (editor) {
|
||||
tinymce.get('noticeContent').setContent(data.noticeContent);
|
||||
}
|
||||
|
@ -128,9 +129,11 @@ layui.use(['layer', 'form', 'admin', 'laydate', 'HttpRequest', 'xmSelect'], func
|
|||
Feng.error("修改失败!" + data.message);
|
||||
});
|
||||
data.field.noticeContent = tinymce.get('noticeContent').getContent();
|
||||
console.log(data.field.noticeContent)
|
||||
if (data.field.noticeScope !== "all") {
|
||||
data.field.noticeScope = userSelect.getValue('valueStr');
|
||||
}
|
||||
// request.setContentType("multipart/form-data");
|
||||
request.set(data.field);
|
||||
request.start(true);
|
||||
//添加 return false 可成功跳转页面
|
||||
|
|
|
@ -22,12 +22,15 @@
|
|||
<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">优先级<span style="color: red;">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<select id="priorityLevel" name="priorityLevel" lay-filter="">
|
||||
|
||||
<tag:dict_select id="priorityLevel" name="priorityLevel" type="select" head-type="2" head-name="" head-value="" default-value="" dict-type-code="priority_level" lay-verify="required" >
|
||||
</tag:dict_select>
|
||||
<!-- <select id="priorityLevel" name="priorityLevel" lay-filter="">
|
||||
<option value="">请选择通知优先级</option>
|
||||
<option value="low">低</option>
|
||||
<option value="middle">中</option>
|
||||
<option value="high">高</option>
|
||||
</select>
|
||||
</select>-->
|
||||
<!-- <input name="priorityLevel" placeholder="请输入通知优先级" type="text" class="layui-input" lay-verify="required" required autocomplete="off"/>-->
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -22,13 +22,8 @@
|
|||
<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">优先级<span style="color: red;">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<select id="priorityLevel" name="priorityLevel" lay-filter="">
|
||||
<option value="">请选择通知优先级</option>
|
||||
<option value="low">低</option>
|
||||
<option value="middle">中</option>
|
||||
<option value="high">高</option>
|
||||
</select>
|
||||
<!-- <input name="priorityLevel" placeholder="请输入通知优先级" type="text" class="layui-input" lay-verify="required" required autocomplete="off"/>-->
|
||||
<tag:dict_select id="priorityLevel" name="priorityLevel" type="select" head-type="2" head-name="" head-value="" default-value="" dict-type-code="priority_level" lay-verify="required" >
|
||||
</tag:dict_select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline layui-col-md12">
|
||||
|
|
Loading…
Reference in New Issue