diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/routes/dynamic/DynamicFormRouteController.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/routes/dynamic/DynamicFormRouteController.java index 5c44f5d..38b823c 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/routes/dynamic/DynamicFormRouteController.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/controller/routes/dynamic/DynamicFormRouteController.java @@ -4,6 +4,7 @@ import com.cm.common.base.AbstractController; import com.cm.common.constants.ISystemConstant; import com.cm.common.plugin.enums.dynamic.FieldTypeEnum; import com.cm.common.plugin.pojo.dtos.dynamic.DynamicFormFormShowFieldDTO; +import com.cm.common.plugin.service.datadictionary.IDataDictionaryService; import com.cm.common.plugin.service.dynamic.IDynamicFormService; import com.cm.common.result.ErrorResult; import io.swagger.annotations.*; @@ -15,7 +16,10 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * When you feel like quitting. Think about why you started @@ -34,6 +38,8 @@ public class DynamicFormRouteController extends AbstractController { @Autowired private IDynamicFormService dynamicFormService; + @Autowired + private IDataDictionaryService dataDictionaryService; @ApiOperation(value = "动态表单新增页面", notes = "动态表单新增页面接口") @ApiImplicitParams({ @@ -44,11 +50,10 @@ public class DynamicFormRouteController extends AbstractController { public ModelAndView saveDynamicForm(@PathVariable("tableName") String tableName) { ModelAndView mv = new ModelAndView("dynamic/form/savedynamicform"); mv.addObject("tableName", tableName); + List dynamicFormFormShowFieldDTOs = dynamicFormService.listFormShowFieldOfPage(tableName); mv.addObject("dynamicFormFormShowFieldDTOList", dynamicFormFormShowFieldDTOs); - for (DynamicFormFormShowFieldDTO dynamicFormFormShowFieldDTO : dynamicFormFormShowFieldDTOs) { - - } + setDynamicFieldData(mv, dynamicFormFormShowFieldDTOs); return mv; } @@ -63,7 +68,10 @@ public class DynamicFormRouteController extends AbstractController { ModelAndView mv = new ModelAndView("dynamic/form/updatedynamicform"); mv.addObject("tableName", tableName); mv.addObject("uuidValue", uuidValue); - mv.addObject("dynamicFormFormShowFieldDTOList", dynamicFormService.listFormShowFieldOfPage(tableName)); + + List dynamicFormFormShowFieldDTOs = dynamicFormService.listFormShowFieldOfPage(tableName); + mv.addObject("dynamicFormFormShowFieldDTOList", dynamicFormFormShowFieldDTOs); + setDynamicFieldData(mv, dynamicFormFormShowFieldDTOs); return mv; } @@ -74,21 +82,31 @@ public class DynamicFormRouteController extends AbstractController { * @param dynamicFormFormShowFieldDTOs */ private void setDynamicFieldData(ModelAndView mv, List dynamicFormFormShowFieldDTOs) { + List> selectMapList = new ArrayList<>(0); + List> checkboxMapList = new ArrayList<>(0); + List> radioMapList = new ArrayList<>(0); for (DynamicFormFormShowFieldDTO dynamicFormFormShowFieldDTO : dynamicFormFormShowFieldDTOs) { String dictionaryId = dynamicFormFormShowFieldDTO.getDictionaryId(); - String fieldDefault = dynamicFormFormShowFieldDTO.getFieldDefault(); if (StringUtils.equals(FieldTypeEnum.SELECT.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { - + Map selectMap = new HashMap<>(2); + selectMap.put("name", dynamicFormFormShowFieldDTO.getFieldName()); + selectMap.put("list", dataDictionaryService.listDictionaryByParentId(dictionaryId)); + selectMapList.add(selectMap); } else if (StringUtils.equals(FieldTypeEnum.CHECKBOX.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { - + Map checkboxMap = new HashMap<>(2); + checkboxMap.put("name", dynamicFormFormShowFieldDTO.getFieldName()); + checkboxMap.put("list", dataDictionaryService.listDictionaryByParentId(dictionaryId)); + checkboxMapList.add(checkboxMap); } else if (StringUtils.equals(FieldTypeEnum.RADIO.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { - - } else if (StringUtils.equals(FieldTypeEnum.SELECT_USER.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { - - } else if (StringUtils.equals(FieldTypeEnum.SELECT_DEPARTMENT.getValue(), dynamicFormFormShowFieldDTO.getFieldType())) { - + Map radioMap = new HashMap<>(2); + radioMap.put("name", dynamicFormFormShowFieldDTO.getFieldName()); + radioMap.put("list", dataDictionaryService.listDictionaryByParentId(dictionaryId)); + radioMapList.add(radioMap); } } + mv.addObject("selectMapList", selectMapList); + mv.addObject("checkboxMapList", checkboxMapList); + mv.addObject("radioMapList", radioMapList); } @ApiOperation(value = "动态表单列表页面", notes = "动态表单列表页面接口") diff --git a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicFormServiceImpl.java b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicFormServiceImpl.java index c133a5f..54c2ba7 100644 --- a/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicFormServiceImpl.java +++ b/cloud-common-plugin/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicFormServiceImpl.java @@ -115,6 +115,7 @@ public class DynamicFormServiceImpl extends AbstractService implements IDynamicF dynamicFormFormShowFieldDTO.setFieldName(WStringUtil.lowerUpper2UnderLine(dynamicFormDTO.getFieldName())); dynamicFormFormShowFieldDTO.setFieldExplain(dynamicFormDTO.getFieldExplain()); dynamicFormFormShowFieldDTO.setFieldDefault(dynamicFormDTO.getFieldDefault()); + dynamicFormFormShowFieldDTO.setDictionaryId(dynamicFormDTO.getDictionaryId()); dynamicFormFormShowFieldDTO.setFieldType(dynamicFormDTO.getFieldType()); dynamicFormFormShowFieldDTO.setVerifyType(dynamicFormDTO.getVerifyType()); dynamicFormFormShowFieldDTO.setVerifyRegular(dynamicFormDTO.getVerifyRegular()); diff --git a/cloud-common-plugin/src/main/resources/templates/datadictionary/list.html b/cloud-common-plugin/src/main/resources/templates/datadictionary/list.html index 83a9910..75d6267 100644 --- a/cloud-common-plugin/src/main/resources/templates/datadictionary/list.html +++ b/cloud-common-plugin/src/main/resources/templates/datadictionary/list.html @@ -84,9 +84,10 @@ [ {type:'checkbox', fixed: 'left'}, {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, - {field:'dictionaryName', width:170, title: '字典名称', align:'center',}, - {field:'dictionarySummary', width:170, title: '字典说明', align:'center',}, - {field:'dictionaryCode', width:170, title: '字典编码', align:'center',}, + {field:'dictionaryId', width:200, title: '字典ID', align:'center',}, + {field:'dictionaryName', width:160, title: '字典名称', align:'center',}, + {field:'dictionarySummary', width:160, title: '字典说明', align:'center',}, + {field:'dictionaryCode', width:160, title: '字典编码', align:'center',}, {field:'dictionarySort', width:100, title: '字典排序', align:'center',}, ] ], diff --git a/cloud-common-plugin/src/main/resources/templates/dynamic/form/savedynamicform.html b/cloud-common-plugin/src/main/resources/templates/dynamic/form/savedynamicform.html index d43fc97..85e2bea 100644 --- a/cloud-common-plugin/src/main/resources/templates/dynamic/form/savedynamicform.html +++ b/cloud-common-plugin/src/main/resources/templates/dynamic/form/savedynamicform.html @@ -61,15 +61,21 @@
- + +
+
+
+ +
+
+
+
+ +
+