diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/apis/dynamic/config/form/DynamicConfigFormController.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/apis/dynamic/config/form/DynamicConfigFormController.java index 9eb4a0a..05ea219 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/apis/dynamic/config/form/DynamicConfigFormController.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/apis/dynamic/config/form/DynamicConfigFormController.java @@ -6,6 +6,7 @@ import com.cm.common.constants.ISystemConstant; import com.cm.common.exception.SearchException; 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.FieldShowVO; import com.cm.common.plugin.service.dynamic.config.form.IDynamicConfigFormService; import com.cm.common.pojo.ListPage; import com.cm.common.result.ErrorResult; @@ -55,7 +56,7 @@ public class DynamicConfigFormController extends AbstractController { @ApiOperation(value = "表单修改", notes = "表单修改接口") @ApiImplicitParams({ - @ApiImplicitParam(name = "dictionaryId", value = "表单ID", paramType = "path") + @ApiImplicitParam(name = "id", value = "表单ID", paramType = "path") }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @PutMapping("updateform/{id}") @@ -64,6 +65,28 @@ public class DynamicConfigFormController extends AbstractController { 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查询)接口") @ApiImplicitParams({ @ApiImplicitParam(name = "dictionaryId", value = "表单ID", paramType = "path") diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/pojo/dtos/dynamic/config/form/DynamicConfigFormDTO.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/pojo/dtos/dynamic/config/form/DynamicConfigFormDTO.java index 7c631f8..faa060b 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/pojo/dtos/dynamic/config/form/DynamicConfigFormDTO.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/pojo/dtos/dynamic/config/form/DynamicConfigFormDTO.java @@ -32,6 +32,8 @@ public class DynamicConfigFormDTO { private String fieldDefault; @ApiModelProperty(name = "dictionaryId", value = "字典ID") private String dictionaryId; + @ApiModelProperty(name = "dictionaryName", value = "字典名称") + private String dictionaryName; @ApiModelProperty(name = "verifyType", value = "校验类型") private String verifyType; @ApiModelProperty(name = "verifyRegular", value = "校验正则") @@ -99,6 +101,14 @@ public class DynamicConfigFormDTO { this.dictionaryId = dictionaryId; } + public String getDictionaryName() { + return dictionaryName == null ? "" : dictionaryName.trim(); + } + + public void setDictionaryName(String dictionaryName) { + this.dictionaryName = dictionaryName; + } + public String getVerifyType() { return verifyType == null ? "" : verifyType.trim(); } @@ -142,7 +152,9 @@ public class DynamicConfigFormDTO { @Override public String toString() { final StringBuilder sb = new StringBuilder("{"); - sb.append("\"tableName\":") + sb.append("\"id\":") + .append("\"").append(id).append("\""); + sb.append(",\"tableName\":") .append("\"").append(tableName).append("\""); sb.append(",\"fieldName\":") .append("\"").append(fieldName).append("\""); @@ -154,6 +166,8 @@ public class DynamicConfigFormDTO { .append("\"").append(fieldDefault).append("\""); sb.append(",\"dictionaryId\":") .append("\"").append(dictionaryId).append("\""); + sb.append(",\"dictionaryName\":") + .append("\"").append(dictionaryName).append("\""); sb.append(",\"verifyType\":") .append("\"").append(verifyType).append("\""); sb.append(",\"verifyRegular\":") diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/pojo/vos/dynamic/config/form/FieldShowVO.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/pojo/vos/dynamic/config/form/FieldShowVO.java new file mode 100644 index 0000000..a5601b4 --- /dev/null +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/pojo/vos/dynamic/config/form/FieldShowVO.java @@ -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(); + } +} diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/config/form/IDynamicConfigFormService.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/config/form/IDynamicConfigFormService.java index 403a2f4..d9c024b 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/config/form/IDynamicConfigFormService.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/config/form/IDynamicConfigFormService.java @@ -2,10 +2,12 @@ package com.cm.common.plugin.service.dynamic.config.form; import com.cm.common.exception.RemoveException; 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.form.DynamicConfigFormDTO; 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.FieldShowVO; import com.cm.common.pojo.ListPage; import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResultList; @@ -53,6 +55,26 @@ public interface IDynamicConfigFormService { */ 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 */ SuccessResultList> listPageForm(ListPage page) throws SearchException; + } diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/config/form/impl/DynamicConfigFormServiceImpl.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/config/form/impl/DynamicConfigFormServiceImpl.java index 78dba33..4732813 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/config/form/impl/DynamicConfigFormServiceImpl.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/config/form/impl/DynamicConfigFormServiceImpl.java @@ -3,9 +3,11 @@ package com.cm.common.plugin.service.dynamic.config.form.impl; import com.cm.common.base.AbstractService; import com.cm.common.exception.RemoveException; 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.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.FieldShowVO; import com.cm.common.plugin.service.dynamic.config.form.IDynamicConfigFormService; import com.cm.common.pojo.ListPage; import com.cm.common.result.SuccessResult; @@ -64,6 +66,26 @@ public class DynamicConfigFormServiceImpl extends AbstractService implements IDy return new SuccessResult(); } + @Override + public SuccessResult updateFieldListShow(String id, FieldShowVO fieldShowVO) throws UpdateException { + Map 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 params = getHashMap(2); + params.put("id", id); + params.put("formShow", fieldShowVO.getShow() ? 1 : 0); + setUpdateInfo(params); + dynamicConfigFormDao.updateForm(params); + return new SuccessResult(); + } + @Override public DynamicConfigFormDTO getFormById(String id) throws SearchException { Map params = super.getHashMap(1); diff --git a/cloud-common-plugin/src/main/resources/mybatis/mapper/dynamic/config/form/dynamicconfigform-mapper.xml b/cloud-common-plugin/src/main/resources/mybatis/mapper/dynamic/config/form/dynamicconfigform-mapper.xml index 0917684..bc1001b 100644 --- a/cloud-common-plugin/src/main/resources/mybatis/mapper/dynamic/config/form/dynamicconfigform-mapper.xml +++ b/cloud-common-plugin/src/main/resources/mybatis/mapper/dynamic/config/form/dynamicconfigform-mapper.xml @@ -10,6 +10,7 @@ + @@ -117,44 +118,54 @@ \ No newline at end of file diff --git a/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/list.html b/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/list.html index 2736c06..b990038 100644 --- a/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/list.html +++ b/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/list.html @@ -31,7 +31,9 @@ 搜索 -
+
+
+
diff --git a/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/save.html b/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/save.html index 6021b1f..02dd85d 100644 --- a/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/save.html +++ b/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/save.html @@ -65,9 +65,10 @@
- +
- + +
@@ -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() { closeBox(); }); diff --git a/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/update.html b/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/update.html index f1d2a67..b5c62c0 100644 --- a/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/update.html +++ b/cloud-common-plugin/src/main/resources/templates/dynamic/config/form/update.html @@ -67,7 +67,8 @@
- + +
@@ -149,6 +150,7 @@ fieldType: data.fieldType, fieldDefault: data.fieldDefault, dictionaryId: data.dictionaryId, + dictionaryName: data.dictionaryName, verifyType: data.verifyType, verifyRegular: data.verifyRegular, 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() { closeBox(); }); diff --git a/cloud-common-plugin/src/main/resources/templates/dynamic/config/list.html b/cloud-common-plugin/src/main/resources/templates/dynamic/config/list.html index dd2db42..6c88040 100644 --- a/cloud-common-plugin/src/main/resources/templates/dynamic/config/list.html +++ b/cloud-common-plugin/src/main/resources/templates/dynamic/config/list.html @@ -86,10 +86,10 @@ {type:'checkbox', fixed: 'left'}, {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, {field:'tableName', width:140, title: '表名', align:'center'}, - {field:'tableType', width:140, title: '类型', align:'center'}, - {field:'tableTemplate', width: 160, title: '模板', align:'center'}, - {field:'tableExplain', width:140, title: '说明', align:'center'}, - {field:'dynamicForm', width:140, title: '表单', align:'center', + {field:'tableType', width:120, title: '类型', align:'center'}, + {field:'tableTemplate', width: 120, title: '模板', align:'center'}, + {field:'tableExplain', width:250, title: '说明', align:'center'}, + {field:'dynamicForm', width:100, title: '表单', align:'center', templet: function() { return ''; } @@ -226,12 +226,11 @@ top.dialog.open({ url: top.restAjax.path('route/dynamicconfigtable/dynamicconfigform/list/{tableName}', [data.tableName]), title: '表单列表', - width: '900px', + width: '1000px', height: '500px' }); } }); - // 事 }); diff --git a/cloud-common-plugin/src/main/resources/templates/tree/tree-v2.html b/cloud-common-plugin/src/main/resources/templates/tree/tree-v2.html index c4b76a0..0159cb6 100644 --- a/cloud-common-plugin/src/main/resources/templates/tree/tree-v2.html +++ b/cloud-common-plugin/src/main/resources/templates/tree/tree-v2.html @@ -87,6 +87,9 @@ } } } + $(document.body).on('click', '.item-close', function() { + removeSelectNodes(this.dataset.id); + }); // 初始化选中的节点 function showSelectNodes() { $('#selectNodes').empty(); @@ -97,7 +100,7 @@ i--; continue; } - $('#selectNodes').append(''+ item.name +' ') + $('#selectNodes').append(''+ item.name +' ') } } // 初始化节点