动态表单完善
This commit is contained in:
parent
004fb07d94
commit
6161ed0e8f
@ -6,6 +6,7 @@ import com.cm.common.constants.ISystemConstant;
|
|||||||
import com.cm.common.exception.SearchException;
|
import com.cm.common.exception.SearchException;
|
||||||
import com.cm.common.plugin.pojo.dtos.dynamic.config.form.DynamicConfigFormDTO;
|
import com.cm.common.plugin.pojo.dtos.dynamic.config.form.DynamicConfigFormDTO;
|
||||||
import com.cm.common.plugin.pojo.vos.dynamic.config.form.DynamicConfigFormVO;
|
import com.cm.common.plugin.pojo.vos.dynamic.config.form.DynamicConfigFormVO;
|
||||||
|
import com.cm.common.plugin.pojo.vos.dynamic.config.form.FieldShowVO;
|
||||||
import com.cm.common.plugin.service.dynamic.config.form.IDynamicConfigFormService;
|
import com.cm.common.plugin.service.dynamic.config.form.IDynamicConfigFormService;
|
||||||
import com.cm.common.pojo.ListPage;
|
import com.cm.common.pojo.ListPage;
|
||||||
import com.cm.common.result.ErrorResult;
|
import com.cm.common.result.ErrorResult;
|
||||||
@ -55,7 +56,7 @@ public class DynamicConfigFormController extends AbstractController {
|
|||||||
|
|
||||||
@ApiOperation(value = "表单修改", notes = "表单修改接口")
|
@ApiOperation(value = "表单修改", notes = "表单修改接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "dictionaryId", value = "表单ID", paramType = "path")
|
@ApiImplicitParam(name = "id", value = "表单ID", paramType = "path")
|
||||||
})
|
})
|
||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
@PutMapping("updateform/{id}")
|
@PutMapping("updateform/{id}")
|
||||||
@ -64,6 +65,28 @@ public class DynamicConfigFormController extends AbstractController {
|
|||||||
return dynamicConfigFormService.updateForm(id, dynamicConfigFormVO);
|
return dynamicConfigFormService.updateForm(id, dynamicConfigFormVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "字段列表显示修改", notes = "字段列表显示修改接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "id", value = "表单ID", paramType = "path")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PutMapping("updatefieldlistshow/{id}")
|
||||||
|
@CheckRequestBodyAnnotation
|
||||||
|
public SuccessResult updateFieldListShow(@PathVariable("id") String id, @RequestBody FieldShowVO fieldShowVO) {
|
||||||
|
return dynamicConfigFormService.updateFieldListShow(id, fieldShowVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "字段表单显示修改", notes = "字段表单显示修改接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "id", value = "表单ID", paramType = "path")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PutMapping("updatefieldformshow/{id}")
|
||||||
|
@CheckRequestBodyAnnotation
|
||||||
|
public SuccessResult updateFieldFormShow(@PathVariable("id") String id, @RequestBody FieldShowVO fieldShowVO) {
|
||||||
|
return dynamicConfigFormService.updateFieldFormShow(id, fieldShowVO);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "表单详情(ID查询)", notes = "表单详情(ID查询)接口")
|
@ApiOperation(value = "表单详情(ID查询)", notes = "表单详情(ID查询)接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "dictionaryId", value = "表单ID", paramType = "path")
|
@ApiImplicitParam(name = "dictionaryId", value = "表单ID", paramType = "path")
|
||||||
|
@ -32,6 +32,8 @@ public class DynamicConfigFormDTO {
|
|||||||
private String fieldDefault;
|
private String fieldDefault;
|
||||||
@ApiModelProperty(name = "dictionaryId", value = "字典ID")
|
@ApiModelProperty(name = "dictionaryId", value = "字典ID")
|
||||||
private String dictionaryId;
|
private String dictionaryId;
|
||||||
|
@ApiModelProperty(name = "dictionaryName", value = "字典名称")
|
||||||
|
private String dictionaryName;
|
||||||
@ApiModelProperty(name = "verifyType", value = "校验类型")
|
@ApiModelProperty(name = "verifyType", value = "校验类型")
|
||||||
private String verifyType;
|
private String verifyType;
|
||||||
@ApiModelProperty(name = "verifyRegular", value = "校验正则")
|
@ApiModelProperty(name = "verifyRegular", value = "校验正则")
|
||||||
@ -99,6 +101,14 @@ public class DynamicConfigFormDTO {
|
|||||||
this.dictionaryId = dictionaryId;
|
this.dictionaryId = dictionaryId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDictionaryName() {
|
||||||
|
return dictionaryName == null ? "" : dictionaryName.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDictionaryName(String dictionaryName) {
|
||||||
|
this.dictionaryName = dictionaryName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getVerifyType() {
|
public String getVerifyType() {
|
||||||
return verifyType == null ? "" : verifyType.trim();
|
return verifyType == null ? "" : verifyType.trim();
|
||||||
}
|
}
|
||||||
@ -142,7 +152,9 @@ public class DynamicConfigFormDTO {
|
|||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final StringBuilder sb = new StringBuilder("{");
|
final StringBuilder sb = new StringBuilder("{");
|
||||||
sb.append("\"tableName\":")
|
sb.append("\"id\":")
|
||||||
|
.append("\"").append(id).append("\"");
|
||||||
|
sb.append(",\"tableName\":")
|
||||||
.append("\"").append(tableName).append("\"");
|
.append("\"").append(tableName).append("\"");
|
||||||
sb.append(",\"fieldName\":")
|
sb.append(",\"fieldName\":")
|
||||||
.append("\"").append(fieldName).append("\"");
|
.append("\"").append(fieldName).append("\"");
|
||||||
@ -154,6 +166,8 @@ public class DynamicConfigFormDTO {
|
|||||||
.append("\"").append(fieldDefault).append("\"");
|
.append("\"").append(fieldDefault).append("\"");
|
||||||
sb.append(",\"dictionaryId\":")
|
sb.append(",\"dictionaryId\":")
|
||||||
.append("\"").append(dictionaryId).append("\"");
|
.append("\"").append(dictionaryId).append("\"");
|
||||||
|
sb.append(",\"dictionaryName\":")
|
||||||
|
.append("\"").append(dictionaryName).append("\"");
|
||||||
sb.append(",\"verifyType\":")
|
sb.append(",\"verifyType\":")
|
||||||
.append("\"").append(verifyType).append("\"");
|
.append("\"").append(verifyType).append("\"");
|
||||||
sb.append(",\"verifyRegular\":")
|
sb.append(",\"verifyRegular\":")
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.cm.common.plugin.pojo.vos.dynamic.config.form;
|
||||||
|
|
||||||
|
import com.cm.common.annotation.CheckBooleanAnnotation;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When you feel like quitting. Think about why you started
|
||||||
|
* 当你想要放弃的时候,想想当初你为何开始
|
||||||
|
*
|
||||||
|
* @ClassName: FieldShowVO
|
||||||
|
* @Description: 字段显示
|
||||||
|
* @Author: WangGeng
|
||||||
|
* @Date: 2019/12/8 11:08 下午
|
||||||
|
* @Version: 1.0
|
||||||
|
**/
|
||||||
|
@ApiModel
|
||||||
|
public class FieldShowVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "isShow", value = "显示")
|
||||||
|
@CheckBooleanAnnotation(name = "显示")
|
||||||
|
private Boolean isShow;
|
||||||
|
|
||||||
|
public Boolean getShow() {
|
||||||
|
return isShow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShow(Boolean show) {
|
||||||
|
isShow = show;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
final StringBuilder sb = new StringBuilder("{");
|
||||||
|
sb.append("\"isShow\":")
|
||||||
|
.append(isShow);
|
||||||
|
sb.append('}');
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -2,10 +2,12 @@ package com.cm.common.plugin.service.dynamic.config.form;
|
|||||||
|
|
||||||
import com.cm.common.exception.RemoveException;
|
import com.cm.common.exception.RemoveException;
|
||||||
import com.cm.common.exception.SearchException;
|
import com.cm.common.exception.SearchException;
|
||||||
|
import com.cm.common.exception.UpdateException;
|
||||||
import com.cm.common.plugin.pojo.dtos.dynamic.config.DynamicConfigTableDTO;
|
import com.cm.common.plugin.pojo.dtos.dynamic.config.DynamicConfigTableDTO;
|
||||||
import com.cm.common.plugin.pojo.dtos.dynamic.config.form.DynamicConfigFormDTO;
|
import com.cm.common.plugin.pojo.dtos.dynamic.config.form.DynamicConfigFormDTO;
|
||||||
import com.cm.common.plugin.pojo.vos.dynamic.config.DynamicConfigTableVO;
|
import com.cm.common.plugin.pojo.vos.dynamic.config.DynamicConfigTableVO;
|
||||||
import com.cm.common.plugin.pojo.vos.dynamic.config.form.DynamicConfigFormVO;
|
import com.cm.common.plugin.pojo.vos.dynamic.config.form.DynamicConfigFormVO;
|
||||||
|
import com.cm.common.plugin.pojo.vos.dynamic.config.form.FieldShowVO;
|
||||||
import com.cm.common.pojo.ListPage;
|
import com.cm.common.pojo.ListPage;
|
||||||
import com.cm.common.result.SuccessResult;
|
import com.cm.common.result.SuccessResult;
|
||||||
import com.cm.common.result.SuccessResultList;
|
import com.cm.common.result.SuccessResultList;
|
||||||
@ -53,6 +55,26 @@ public interface IDynamicConfigFormService {
|
|||||||
*/
|
*/
|
||||||
SuccessResult updateForm(String id, DynamicConfigFormVO dynamicConfigFormVO) throws Exception;
|
SuccessResult updateForm(String id, DynamicConfigFormVO dynamicConfigFormVO) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字段列表显示修改
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param fieldShowVO
|
||||||
|
* @return
|
||||||
|
* @throws UpdateException
|
||||||
|
*/
|
||||||
|
SuccessResult updateFieldListShow(String id, FieldShowVO fieldShowVO) throws UpdateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字段表单显示修改
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param fieldShowVO
|
||||||
|
* @return
|
||||||
|
* @throws UpdateException
|
||||||
|
*/
|
||||||
|
SuccessResult updateFieldFormShow(String id, FieldShowVO fieldShowVO) throws UpdateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表单详情
|
* 表单详情
|
||||||
*
|
*
|
||||||
@ -79,4 +101,5 @@ public interface IDynamicConfigFormService {
|
|||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
SuccessResultList<List<DynamicConfigFormDTO>> listPageForm(ListPage page) throws SearchException;
|
SuccessResultList<List<DynamicConfigFormDTO>> listPageForm(ListPage page) throws SearchException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,11 @@ package com.cm.common.plugin.service.dynamic.config.form.impl;
|
|||||||
import com.cm.common.base.AbstractService;
|
import com.cm.common.base.AbstractService;
|
||||||
import com.cm.common.exception.RemoveException;
|
import com.cm.common.exception.RemoveException;
|
||||||
import com.cm.common.exception.SearchException;
|
import com.cm.common.exception.SearchException;
|
||||||
|
import com.cm.common.exception.UpdateException;
|
||||||
import com.cm.common.plugin.dao.dynamic.config.form.IDynamicConfigFormDao;
|
import com.cm.common.plugin.dao.dynamic.config.form.IDynamicConfigFormDao;
|
||||||
import com.cm.common.plugin.pojo.dtos.dynamic.config.form.DynamicConfigFormDTO;
|
import com.cm.common.plugin.pojo.dtos.dynamic.config.form.DynamicConfigFormDTO;
|
||||||
import com.cm.common.plugin.pojo.vos.dynamic.config.form.DynamicConfigFormVO;
|
import com.cm.common.plugin.pojo.vos.dynamic.config.form.DynamicConfigFormVO;
|
||||||
|
import com.cm.common.plugin.pojo.vos.dynamic.config.form.FieldShowVO;
|
||||||
import com.cm.common.plugin.service.dynamic.config.form.IDynamicConfigFormService;
|
import com.cm.common.plugin.service.dynamic.config.form.IDynamicConfigFormService;
|
||||||
import com.cm.common.pojo.ListPage;
|
import com.cm.common.pojo.ListPage;
|
||||||
import com.cm.common.result.SuccessResult;
|
import com.cm.common.result.SuccessResult;
|
||||||
@ -64,6 +66,26 @@ public class DynamicConfigFormServiceImpl extends AbstractService implements IDy
|
|||||||
return new SuccessResult();
|
return new SuccessResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuccessResult updateFieldListShow(String id, FieldShowVO fieldShowVO) throws UpdateException {
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("id", id);
|
||||||
|
params.put("listShow", fieldShowVO.getShow() ? 1 : 0);
|
||||||
|
setUpdateInfo(params);
|
||||||
|
dynamicConfigFormDao.updateForm(params);
|
||||||
|
return new SuccessResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuccessResult updateFieldFormShow(String id, FieldShowVO fieldShowVO) throws UpdateException {
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("id", id);
|
||||||
|
params.put("formShow", fieldShowVO.getShow() ? 1 : 0);
|
||||||
|
setUpdateInfo(params);
|
||||||
|
dynamicConfigFormDao.updateForm(params);
|
||||||
|
return new SuccessResult();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DynamicConfigFormDTO getFormById(String id) throws SearchException {
|
public DynamicConfigFormDTO getFormById(String id) throws SearchException {
|
||||||
Map<String, Object> params = super.getHashMap(1);
|
Map<String, Object> params = super.getHashMap(1);
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
<result property="fieldType" column="field_type"/>
|
<result property="fieldType" column="field_type"/>
|
||||||
<result property="fieldDefault" column="field_default"/>
|
<result property="fieldDefault" column="field_default"/>
|
||||||
<result property="dictionaryId" column="dictionary_id"/>
|
<result property="dictionaryId" column="dictionary_id"/>
|
||||||
|
<result property="dictionaryName" column="dictionary_name"/>
|
||||||
<result property="verifyType" column="verify_type"/>
|
<result property="verifyType" column="verify_type"/>
|
||||||
<result property="verifyRegular" column="verify_regular"/>
|
<result property="verifyRegular" column="verify_regular"/>
|
||||||
<result property="fieldSort" column="field_sort"/>
|
<result property="fieldSort" column="field_sort"/>
|
||||||
@ -117,44 +118,54 @@
|
|||||||
<!-- 表单详情 -->
|
<!-- 表单详情 -->
|
||||||
<select id="getFormById" parameterType="map" resultMap="dynamicConfigFormDTO">
|
<select id="getFormById" parameterType="map" resultMap="dynamicConfigFormDTO">
|
||||||
SELECT
|
SELECT
|
||||||
*
|
t1.*,
|
||||||
|
t2.dictionary_name
|
||||||
FROM
|
FROM
|
||||||
dynamic_config_form
|
dynamic_config_form t1
|
||||||
|
LEFT JOIN
|
||||||
|
data_dictionary t2
|
||||||
|
ON
|
||||||
|
(t1.dictionary_id = t2.dictionary_id AND t2.is_delete = 0)
|
||||||
WHERE
|
WHERE
|
||||||
is_delete = 0
|
t1.is_delete = 0
|
||||||
AND
|
AND
|
||||||
id = #{id}
|
t1.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 表单全部列表单 -->
|
<!-- 表单全部列表单 -->
|
||||||
<select id="listForm" parameterType="map" resultMap="dynamicConfigFormDTO">
|
<select id="listForm" parameterType="map" resultMap="dynamicConfigFormDTO">
|
||||||
SELECT
|
SELECT
|
||||||
*
|
t1.*,
|
||||||
|
t2.dictionary_name
|
||||||
FROM
|
FROM
|
||||||
dynamic_config_form
|
dynamic_config_form t1
|
||||||
|
LEFT JOIN
|
||||||
|
data_dictionary t2
|
||||||
|
ON
|
||||||
|
(t1.dictionary_id = t2.dictionary_id AND t2.is_delete = 0)
|
||||||
WHERE
|
WHERE
|
||||||
is_delete = 0
|
t1.is_delete = 0
|
||||||
<if test="tableName != null">
|
<if test="tableName != null">
|
||||||
AND
|
AND
|
||||||
table_name = #{tableName}
|
t1.table_name = #{tableName}
|
||||||
</if>
|
</if>
|
||||||
<if test="keywords != null and keywords != ''">
|
<if test="keywords != null and keywords != ''">
|
||||||
AND (
|
AND (
|
||||||
table_name LIKE CONCAT('%', #{keywords}, '%')
|
t1.table_name LIKE CONCAT('%', #{keywords}, '%')
|
||||||
OR
|
OR
|
||||||
field_name LIKE CONCAT('%', #{keywords}, '%')
|
t1.field_name LIKE CONCAT('%', #{keywords}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="startTime != null and startTime != ''">
|
<if test="startTime != null and startTime != ''">
|
||||||
AND
|
AND
|
||||||
LEFT(gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="startTime != null and startTime != ''">
|
<if test="startTime != null and startTime != ''">
|
||||||
AND
|
AND
|
||||||
LEFT(gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||||||
</if>
|
</if>
|
||||||
ORDER BY
|
ORDER BY
|
||||||
field_sort
|
t1.field_sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -31,7 +31,9 @@
|
|||||||
<i class="fa fa-lg fa-search"></i> 搜索
|
<i class="fa fa-lg fa-search"></i> 搜索
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
<form class="layui-form layui-form-pane" lay-filter="tableForm">
|
||||||
|
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||||
|
</form>
|
||||||
<!-- 表头按钮组 -->
|
<!-- 表头按钮组 -->
|
||||||
<script type="text/html" id="headerToolBar">
|
<script type="text/html" id="headerToolBar">
|
||||||
<div class="layui-btn-group">
|
<div class="layui-btn-group">
|
||||||
@ -59,11 +61,12 @@
|
|||||||
base: 'assets/layuiadmin/'
|
base: 'assets/layuiadmin/'
|
||||||
}).extend({
|
}).extend({
|
||||||
index: 'lib/index'
|
index: 'lib/index'
|
||||||
}).use(['index', 'table', 'laydate'], function() {
|
}).use(['index', 'table', 'form', 'laydate'], function() {
|
||||||
var $ = layui.$;
|
var $ = layui.$;
|
||||||
var $win = $(window);
|
var $win = $(window);
|
||||||
var table = layui.table;
|
var table = layui.table;
|
||||||
var admin = layui.admin;
|
var admin = layui.admin;
|
||||||
|
var form = layui.form;
|
||||||
var laydate = layui.laydate;
|
var laydate = layui.laydate;
|
||||||
var resizeTimeout = null;
|
var resizeTimeout = null;
|
||||||
|
|
||||||
@ -86,17 +89,106 @@
|
|||||||
[
|
[
|
||||||
{type:'checkbox', fixed: 'left'},
|
{type:'checkbox', fixed: 'left'},
|
||||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||||
{field:'tableName', width:140, title: '表名', align:'center'},
|
{field:'tableName', width:120, title: '表名', align:'center', fixed: 'left'},
|
||||||
{field:'fieldName', width:140, title: '字段名称', align:'center'},
|
{field:'fieldName', width:120, title: '字段名称', align:'center', fixed: 'left'},
|
||||||
{field:'fieldExplain', width: 160, title: '字段说明', align:'center'},
|
{field:'fieldExplain', width: 160, title: '字段说明', align:'center'},
|
||||||
{field:'fieldType', width:140, title: '字段类型', align:'center'},
|
{field:'fieldType', width:100, title: '字段类型', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var value;
|
||||||
|
switch (row.fieldType) {
|
||||||
|
case 'datetime':
|
||||||
|
value = '时间戳';
|
||||||
|
break;
|
||||||
|
case 'date':
|
||||||
|
value = '日期';
|
||||||
|
break;
|
||||||
|
case 'number':
|
||||||
|
value = '整形';
|
||||||
|
break;
|
||||||
|
case 'double':
|
||||||
|
value = '双精度';
|
||||||
|
break;
|
||||||
|
case 'textarea':
|
||||||
|
value = '文本域';
|
||||||
|
break;
|
||||||
|
case 'richText':
|
||||||
|
value = '富文本';
|
||||||
|
break;
|
||||||
|
case 'select':
|
||||||
|
value = '下拉选择';
|
||||||
|
break;
|
||||||
|
case 'checkbox':
|
||||||
|
value = '复选';
|
||||||
|
break;
|
||||||
|
case 'radio':
|
||||||
|
value = '单选';
|
||||||
|
break;
|
||||||
|
case 'selectUser':
|
||||||
|
value = '选择人员';
|
||||||
|
break;
|
||||||
|
case 'selectDepartment':
|
||||||
|
value = '选择部门';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
value = '文本';
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
},
|
||||||
{field:'fieldDefault', width:140, title: '字段默认值', align:'center'},
|
{field:'fieldDefault', width:140, title: '字段默认值', align:'center'},
|
||||||
{field:'dictionaryId', width:140, title: '字典ID', align:'center'},
|
{field:'dictionaryName', width:140, title: '字典名称', align:'center'},
|
||||||
{field:'verifyType', width:140, title: '校验类型', align:'center'},
|
{field:'verifyType', width:100, title: '校验类型', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var value;
|
||||||
|
switch (row.verifyType) {
|
||||||
|
case 'required':
|
||||||
|
value = '不为空'
|
||||||
|
break;
|
||||||
|
case 'phone':
|
||||||
|
value = '手机号'
|
||||||
|
break;
|
||||||
|
case 'email':
|
||||||
|
value = '邮件'
|
||||||
|
break;
|
||||||
|
case 'url':
|
||||||
|
value = '链接'
|
||||||
|
break;
|
||||||
|
case 'number':
|
||||||
|
value = '数字'
|
||||||
|
break;
|
||||||
|
case 'date':
|
||||||
|
value = '日期'
|
||||||
|
break;
|
||||||
|
case 'identity':
|
||||||
|
value = '身份证'
|
||||||
|
break;
|
||||||
|
case 'custom':
|
||||||
|
value = '自定义'
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
value = '无';
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
},
|
||||||
{field:'verifyRegular', width:140, title: '校验正则', align:'center'},
|
{field:'verifyRegular', width:140, title: '校验正则', align:'center'},
|
||||||
{field:'fieldSort', width:140, title: '排序', align:'center'},
|
{field:'fieldSort', width:80, title: '排序', align:'center'},
|
||||||
{field:'listShow', width:140, title: '列表显示', align:'center'},
|
{field:'listShow', width:100, title: '列表显示', align:'center',
|
||||||
{field:'formShow', width:140, title: '表单显示', align:'center'},
|
templet: function(row) {
|
||||||
|
if(row.listShow == 1) {
|
||||||
|
return '<input type="checkbox" data-id="'+ row.id +'" lay-filter="listShow" lay-skin="switch" lay-text="开启|关闭" checked>';
|
||||||
|
}
|
||||||
|
return '<input type="checkbox" data-id="'+ row.id +'" lay-filter="listShow" lay-skin="switch" lay-text="开启|关闭">';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field:'formShow', width:100, title: '表单显示', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
if(row.formShow == 1) {
|
||||||
|
return '<input type="checkbox" data-id="'+ row.id +'" lay-filter="formShow" lay-skin="switch" lay-text="开启|关闭" checked>';
|
||||||
|
}
|
||||||
|
return '<input type="checkbox" data-id="'+ row.id +'" lay-filter="formShow" lay-skin="switch" lay-text="开启|关闭">';
|
||||||
|
}
|
||||||
|
},
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
page: true,
|
page: true,
|
||||||
@ -222,6 +314,24 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
form.on('switch(listShow)', function(data) {
|
||||||
|
top.restAjax.put(top.restAjax.path('api/dynamicconfigtable/dynamicconfigform/updatefieldlistshow/{id}', [this.dataset.id]), {
|
||||||
|
show: data.elem.checked
|
||||||
|
}, null, function(code, data) {
|
||||||
|
top.dialog.msg('修改成功');
|
||||||
|
}, function(code, data) {
|
||||||
|
top.dialog.msg(data.msg);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
form.on('switch(formShow)', function(data) {
|
||||||
|
top.restAjax.put(top.restAjax.path('api/dynamicconfigtable/dynamicconfigform/updatefieldformshow/{id}', [this.dataset.id]), {
|
||||||
|
show: data.elem.checked
|
||||||
|
}, null, function(code, data) {
|
||||||
|
top.dialog.msg('修改成功');
|
||||||
|
}, function(code, data) {
|
||||||
|
top.dialog.msg(data.msg);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
@ -65,9 +65,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">字段字典ID</label>
|
<label class="layui-form-label">字段字典</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input type="text" name="dictionaryId" placeholder="请输入字段默认值" class="layui-input">
|
<input type="hidden" id="dictionaryId" name="dictionaryId">
|
||||||
|
<input type="text" id="dictionaryName" name="dictionaryName" placeholder="点击选择字典" class="layui-input" readonly style="cursor: pointer;">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
@ -175,6 +176,37 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
$(document.body).on('click', '#dictionaryName', function() {
|
||||||
|
top.dialog.tree({
|
||||||
|
title: '绑定数据字典',
|
||||||
|
apiUri: top.restAjax.path('api/datadictionary/listztreedictionary', []),
|
||||||
|
width: '250px',
|
||||||
|
height: '400px',
|
||||||
|
dataFilter: function(treeId, parentNode, childNodes) {
|
||||||
|
return childNodes;
|
||||||
|
},
|
||||||
|
selectedNodes: [
|
||||||
|
{
|
||||||
|
id: $('#dictionaryId').val(),
|
||||||
|
name: $('#dictionaryName').val(),
|
||||||
|
title: $('#dictionaryName').val()
|
||||||
|
}
|
||||||
|
],
|
||||||
|
onClose: function() {
|
||||||
|
var selectNodes = top.dialog.dialogTreeData.selectedNodes;
|
||||||
|
if(typeof(selectNodes) != 'undefined' && selectNodes != null) {
|
||||||
|
if(selectNodes.length > 0) {
|
||||||
|
var selectedNode = selectNodes[0];
|
||||||
|
form.val('dataForm', {
|
||||||
|
dictionaryId: selectedNode.id,
|
||||||
|
dictionaryName: selectedNode.name
|
||||||
|
});
|
||||||
|
form.render(null, 'dataForm');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
$('.close').on('click', function() {
|
$('.close').on('click', function() {
|
||||||
closeBox();
|
closeBox();
|
||||||
});
|
});
|
||||||
|
@ -67,7 +67,8 @@
|
|||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">字段字典ID</label>
|
<label class="layui-form-label">字段字典ID</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input type="text" name="dictionaryId" placeholder="请输入字段默认值" class="layui-input">
|
<input type="hidden" id="dictionaryId" name="dictionaryId">
|
||||||
|
<input type="text" id="dictionaryName" name="dictionaryName" placeholder="点击选择字典" class="layui-input" readonly style="cursor: pointer;">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
@ -149,6 +150,7 @@
|
|||||||
fieldType: data.fieldType,
|
fieldType: data.fieldType,
|
||||||
fieldDefault: data.fieldDefault,
|
fieldDefault: data.fieldDefault,
|
||||||
dictionaryId: data.dictionaryId,
|
dictionaryId: data.dictionaryId,
|
||||||
|
dictionaryName: data.dictionaryName,
|
||||||
verifyType: data.verifyType,
|
verifyType: data.verifyType,
|
||||||
verifyRegular: data.verifyRegular,
|
verifyRegular: data.verifyRegular,
|
||||||
fieldSort: data.fieldSort,
|
fieldSort: data.fieldSort,
|
||||||
@ -201,6 +203,37 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
$(document.body).on('click', '#dictionaryName', function() {
|
||||||
|
top.dialog.tree({
|
||||||
|
title: '绑定数据字典',
|
||||||
|
apiUri: top.restAjax.path('api/datadictionary/listztreedictionary', []),
|
||||||
|
width: '250px',
|
||||||
|
height: '400px',
|
||||||
|
dataFilter: function(treeId, parentNode, childNodes) {
|
||||||
|
return childNodes;
|
||||||
|
},
|
||||||
|
selectedNodes: [
|
||||||
|
{
|
||||||
|
id: $('#dictionaryId').val(),
|
||||||
|
name: $('#dictionaryName').val(),
|
||||||
|
title: $('#dictionaryName').val()
|
||||||
|
}
|
||||||
|
],
|
||||||
|
onClose: function() {
|
||||||
|
var selectNodes = top.dialog.dialogTreeData.selectedNodes;
|
||||||
|
if(typeof(selectNodes) != 'undefined' && selectNodes != null) {
|
||||||
|
if(selectNodes.length > 0) {
|
||||||
|
var selectedNode = selectNodes[0];
|
||||||
|
form.val('dataForm', {
|
||||||
|
dictionaryId: selectedNode.id,
|
||||||
|
dictionaryName: selectedNode.name
|
||||||
|
});
|
||||||
|
form.render(null, 'dataForm');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
$('.close').on('click', function() {
|
$('.close').on('click', function() {
|
||||||
closeBox();
|
closeBox();
|
||||||
});
|
});
|
||||||
|
@ -86,10 +86,10 @@
|
|||||||
{type:'checkbox', fixed: 'left'},
|
{type:'checkbox', fixed: 'left'},
|
||||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||||
{field:'tableName', width:140, title: '表名', align:'center'},
|
{field:'tableName', width:140, title: '表名', align:'center'},
|
||||||
{field:'tableType', width:140, title: '类型', align:'center'},
|
{field:'tableType', width:120, title: '类型', align:'center'},
|
||||||
{field:'tableTemplate', width: 160, title: '模板', align:'center'},
|
{field:'tableTemplate', width: 120, title: '模板', align:'center'},
|
||||||
{field:'tableExplain', width:140, title: '说明', align:'center'},
|
{field:'tableExplain', width:250, title: '说明', align:'center'},
|
||||||
{field:'dynamicForm', width:140, title: '表单', align:'center',
|
{field:'dynamicForm', width:100, title: '表单', align:'center',
|
||||||
templet: function() {
|
templet: function() {
|
||||||
return '<button type="button" class="layui-btn layui-btn-xs" lay-event="dynamicForm"><i class="fa fa-pencil-square-o"></i> 编辑</button>';
|
return '<button type="button" class="layui-btn layui-btn-xs" lay-event="dynamicForm"><i class="fa fa-pencil-square-o"></i> 编辑</button>';
|
||||||
}
|
}
|
||||||
@ -226,12 +226,11 @@
|
|||||||
top.dialog.open({
|
top.dialog.open({
|
||||||
url: top.restAjax.path('route/dynamicconfigtable/dynamicconfigform/list/{tableName}', [data.tableName]),
|
url: top.restAjax.path('route/dynamicconfigtable/dynamicconfigform/list/{tableName}', [data.tableName]),
|
||||||
title: '表单列表',
|
title: '表单列表',
|
||||||
width: '900px',
|
width: '1000px',
|
||||||
height: '500px'
|
height: '500px'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 事
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
@ -87,6 +87,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$(document.body).on('click', '.item-close', function() {
|
||||||
|
removeSelectNodes(this.dataset.id);
|
||||||
|
});
|
||||||
// 初始化选中的节点
|
// 初始化选中的节点
|
||||||
function showSelectNodes() {
|
function showSelectNodes() {
|
||||||
$('#selectNodes').empty();
|
$('#selectNodes').empty();
|
||||||
@ -97,7 +100,7 @@
|
|||||||
i--;
|
i--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$('#selectNodes').append('<span id="selectNode_'+ item[selectTree.primaryKey] +'" class="layui-btn layui-btn-xs selected-node">'+ item.name +' <i class="fa fa-close" onclick="removeSelectNodes(\''+ item[selectTree.primaryKey] +'\')"></i></span>')
|
$('#selectNodes').append('<span id="selectNode_'+ item[selectTree.primaryKey] +'" class="layui-btn layui-btn-xs selected-node">'+ item.name +' <i class="fa fa-close item-close" data-id="'+ item[selectTree.primaryKey] +'"></i></span>')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 初始化节点
|
// 初始化节点
|
||||||
|
Loading…
Reference in New Issue
Block a user