From 0313511b5cddba2c2e80ece2be208a4515f330c8 Mon Sep 17 00:00:00 2001 From: wenc000 <450292408@qq.com> Date: Mon, 10 Feb 2020 00:16:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EAPP=E7=9A=84=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E8=A1=A8=E5=8D=95=E8=AE=BE=E7=BD=AE=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=8E=9F=E5=8A=A8=E6=80=81=E8=A1=A8=E5=8D=95=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../routes/DynamicFormAppRouteController.java | 40 ++ .../dynamic/DynamicFormRouteController.java | 9 +- .../dynamic/impl/DynamicTableServiceImpl.java | 2 +- .../dynamic/form/app/save-dynamic-form.html | 385 ++++++++++++++++++ ...ynamicform.html => list-dynamic-form.html} | 13 +- ...ynamicform.html => save-dynamic-form.html} | 0 ...amicform.html => update-dynamic-form.html} | 55 ++- ...orm.html => update-dynamic-join-form.html} | 56 ++- 8 files changed, 508 insertions(+), 52 deletions(-) create mode 100644 cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/app/routes/DynamicFormAppRouteController.java create mode 100644 cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/app/save-dynamic-form.html rename cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/{listdynamicform.html => list-dynamic-form.html} (96%) rename cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/{savedynamicform.html => save-dynamic-form.html} (100%) rename cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/{updatedynamicform.html => update-dynamic-form.html} (95%) rename cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/{updatedynamicjoinform.html => update-dynamic-join-form.html} (95%) diff --git a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/app/routes/DynamicFormAppRouteController.java b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/app/routes/DynamicFormAppRouteController.java new file mode 100644 index 0000000..c14a779 --- /dev/null +++ b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/app/routes/DynamicFormAppRouteController.java @@ -0,0 +1,40 @@ +package com.cm.common.plugin.controller.app.routes; + +import com.cm.common.constants.ISystemConstant; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +/** + * When you feel like quitting. Think about why you started + * 当你想要放弃的时候,想想当初你为何开始 + * + * @ClassName: DynamicFormAppRouteController + * @Description: 动态表单APP + * @Author: WangGeng + * @Date: 2020/2/8 10:25 下午 + * @Version: 1.0 + **/ +@Api(tags = ISystemConstant.API_TAGS_APP_ROUTE_PREFIX + "动态表单页面接口") +@Controller +@RequestMapping(ISystemConstant.APP_ROUTE_PREFIX + "/dynamicform") +public class DynamicFormAppRouteController { + + @ApiOperation(value = "动态表单新增页面", notes = "动态表单新增页面接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "tableName", value = "表名", paramType = "path") + }) + @GetMapping("savedynamicformrelease/{tableName}") + public ModelAndView saveDynamicForm(@PathVariable("tableName") String tableName) { + ModelAndView mv = new ModelAndView("dynamic/form/app/save-dynamic-form.html"); + mv.addObject("tableName", tableName); + return mv; + } + +} diff --git a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/routes/dynamic/DynamicFormRouteController.java b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/routes/dynamic/DynamicFormRouteController.java index 8587e20..11905f0 100644 --- a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/routes/dynamic/DynamicFormRouteController.java +++ b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/controller/routes/dynamic/DynamicFormRouteController.java @@ -54,7 +54,7 @@ public class DynamicFormRouteController extends AbstractController { }) @GetMapping("savedynamicform/{tableName}") public ModelAndView saveDynamicForm(@PathVariable("tableName") String tableName) { - ModelAndView mv = new ModelAndView("dynamic/form/savedynamicform"); + ModelAndView mv = new ModelAndView("dynamic/form/save-dynamic-form"); mv.addObject("tableName", tableName); List dynamicFormFormShowFieldDTOs = dynamicFormService.listFormShowFieldOfPage(tableName); @@ -71,13 +71,14 @@ public class DynamicFormRouteController extends AbstractController { }) @GetMapping("updatedynamicform/{tableName}/{uuidValue}") public ModelAndView updateDynamicForm(@PathVariable("tableName") String tableName, @PathVariable("uuidValue") String uuidValue) { - ModelAndView mv = new ModelAndView("dynamic/form/updatedynamicform"); + ModelAndView mv = new ModelAndView("dynamic/form/update-dynamic-form"); mv.addObject("tableName", tableName); mv.addObject("uuidValue", uuidValue); List dynamicFormFormShowFieldDTOs = dynamicFormService.listFormShowFieldOfPage(tableName); mv.addObject("dynamicFormFormShowFieldDTOList", dynamicFormFormShowFieldDTOs); setDynamicFieldData(mv, dynamicFormFormShowFieldDTOs); + setCurrentUserIdAndNameValues(mv, dynamicFormFormShowFieldDTOs); return mv; } @@ -88,7 +89,7 @@ public class DynamicFormRouteController extends AbstractController { }) @GetMapping("updatedynamicjoinform/{tableName}/{joinKey}/{joinId}") public ModelAndView updateDynamicJoinForm(@PathVariable("tableName") String tableName, @PathVariable("joinKey") String joinKey, @PathVariable("joinId") String joinId) { - ModelAndView mv = new ModelAndView("dynamic/form/updatedynamicjoinform"); + ModelAndView mv = new ModelAndView("dynamic/form/update-dynamic-join-form"); mv.addObject("tableName", tableName); mv.addObject("joinKey", joinKey); mv.addObject("joinId", joinId); @@ -139,7 +140,7 @@ public class DynamicFormRouteController extends AbstractController { }) @GetMapping("listdynamicform/{tableName}") public ModelAndView listDynamicForm(@PathVariable("tableName") String tableName) { - ModelAndView mv = new ModelAndView("dynamic/form/listdynamicform"); + ModelAndView mv = new ModelAndView("dynamic/form/list-dynamic-form"); mv.addObject("tableName", tableName); mv.addObject("uuidField", String.format("%sId", tableName)); mv.addObject("dynamicListFormShowFieldDTOList", dynamicFormService.listListShowFieldOfPage(tableName)); diff --git a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicTableServiceImpl.java b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicTableServiceImpl.java index c24df89..d875824 100644 --- a/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicTableServiceImpl.java +++ b/cloud-common-plugin-dynamic/src/main/java/com/cm/common/plugin/service/dynamic/impl/DynamicTableServiceImpl.java @@ -55,7 +55,7 @@ public class DynamicTableServiceImpl extends AbstractService implements IDynamic @Override public void deleteTableColumnType(String tableName, String deleteDynamicFormField) throws RemoveException { - StringBuilder deleteTableColumnTypeSQL = new StringBuilder(String.format("ALTER TABLE `%s%s` DROP %s", DYNAMIC_TABLE_PREFIX, WStringUtil.lowerUpper2UnderLine(tableName), deleteDynamicFormField)); + StringBuilder deleteTableColumnTypeSQL = new StringBuilder(String.format("ALTER TABLE `%s%s` DROP `%s`", DYNAMIC_TABLE_PREFIX, WStringUtil.lowerUpper2UnderLine(tableName), deleteDynamicFormField)); dynamicTableDao.deleteTableColumnType(deleteTableColumnTypeSQL.toString()); } diff --git a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/app/save-dynamic-form.html b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/app/save-dynamic-form.html new file mode 100644 index 0000000..eb506ea --- /dev/null +++ b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/app/save-dynamic-form.html @@ -0,0 +1,385 @@ + + + + + + + + + + + + + +
+ +
+
输入文本
+
+
+ +
+
+
+ + +
+
时间戳
+
+
+ +
+
+
+ + +
+
日期
+
+
+ +
+
+
+ + +
+
整形
+
+
+ +
+
+
+ + +
+
双精度
+
+
+ +
+
+
+ + +
+
文本域
+
+
+ +
+
+
+ + +
+
富文本
+
+
+
+
+
+
+ + +
+
下拉列表
+
+
+ +
+
+
+ + +
+
单选列表项
+
+ + +
+
+ + +
+
复选列表项
+
+ + +
+
+ + +
+
上传文件
+
+
+
+

天字第一号

+
+
删除
+
+
+ +
+ + +
+
选择人员
+
+
+ + +
+
+
+ + +
+
选择人员
+
+
+ + +
+
+
+ +
+ + + + + + + + + + + + diff --git a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/listdynamicform.html b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/list-dynamic-form.html similarity index 96% rename from cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/listdynamicform.html rename to cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/list-dynamic-form.html index 25a4daa..dc60fa4 100644 --- a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/listdynamicform.html +++ b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/list-dynamic-form.html @@ -162,19 +162,18 @@ return value; } }); - } else if(item.fieldTyp === 'currentUser' - || item.fieldTyp === 'currentDepartment' - || item.fieldTyp === 'currentRole' - || item.fieldTyp === 'currentGroup' - || item.fieldTyp === 'currentPosition') { + } else if(item.fieldType === 'currentUser' + || item.fieldType === 'currentDepartment' + || item.fieldType === 'currentRole' + || item.fieldType === 'currentGroup' + || item.fieldType === 'currentPosition') { autoCols.push({field: item.fieldName, width: 150, title: item.fieldExplain, align:'center', templet: function(row) { var currentData = row[this.field]; if(typeof(currentData) === 'undefined' || currentData == null || currentData == '') { return '-'; } - var idAndNameValue = currentData; - return idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : '无'; + return currentData != null && currentData != '' ? currentData.split('|')[1] : '无'; } }); } else { diff --git a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/savedynamicform.html b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/save-dynamic-form.html similarity index 100% rename from cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/savedynamicform.html rename to cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/save-dynamic-form.html diff --git a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/updatedynamicform.html b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/update-dynamic-form.html similarity index 95% rename from cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/updatedynamicform.html rename to cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/update-dynamic-form.html index 894d8bb..f2a2b36 100644 --- a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/updatedynamicform.html +++ b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/update-dynamic-form.html @@ -126,40 +126,40 @@
- - + +
- - + +
- - + +
- - + +
- - + +
@@ -467,38 +467,53 @@ }, function(code, data) { top.dialog.msg(data.msg); }); - } else if(item.fieldTyp === 'currentUser') { + } else if(item.fieldType === 'currentUser') { var formData = {}; var idAndNameValue = dataFormData[item.fieldName]; - var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : ''; + if(nameValue === '') { + return; + } formData[item.fieldName] = idAndNameValue; formData[item.fieldName +'CurrentUser'] = nameValue; form.val('dataForm', formData); - } else if(item.fieldTyp === 'currentDepartment') { + } else if(item.fieldType === 'currentDepartment') { var formData = {}; var idAndNameValue = dataFormData[item.fieldName]; - var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : ''; + if(nameValue === '') { + return; + } formData[item.fieldName] = idAndNameValue; formData[item.fieldName +'CurrentDepartment'] = nameValue; form.val('dataForm', formData); - } else if(item.fieldTyp === 'currentRole') { + } else if(item.fieldType === 'currentRole') { var formData = {}; var idAndNameValue = dataFormData[item.fieldName]; - var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : ''; + if(nameValue === '') { + return; + } formData[item.fieldName] = idAndNameValue; formData[item.fieldName +'CurrentRole'] = nameValue; form.val('dataForm', formData); - } else if(item.fieldTyp === 'currentGroup') { + } else if(item.fieldType === 'currentGroup') { var formData = {}; var idAndNameValue = dataFormData[item.fieldName]; - var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : ''; + if(nameValue === '') { + return; + } formData[item.fieldName] = idAndNameValue; formData[item.fieldName +'CurrentGroup'] = nameValue; form.val('dataForm', formData); - } else if(item.fieldTyp === 'currentPosition') { + } else if(item.fieldType === 'currentPosition') { var formData = {}; var idAndNameValue = dataFormData[item.fieldName]; - var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : ''; + if(nameValue === '') { + return; + } formData[item.fieldName] = idAndNameValue; formData[item.fieldName +'CurrentPosition'] = nameValue; form.val('dataForm', formData); diff --git a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/updatedynamicjoinform.html b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/update-dynamic-join-form.html similarity index 95% rename from cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/updatedynamicjoinform.html rename to cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/update-dynamic-join-form.html index a3782b2..e1af10d 100644 --- a/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/updatedynamicjoinform.html +++ b/cloud-common-plugin-dynamic/src/main/resources/templates/dynamic/form/update-dynamic-join-form.html @@ -120,40 +120,40 @@
- - + +
- - + +
- - + +
- - + +
- - + +
@@ -466,38 +466,54 @@ }, function(code, data) { top.dialog.msg(data.msg); }); - } else if(item.fieldTyp === 'currentUser') { + } else if(item.fieldType === 'currentUser') { var formData = {}; var idAndNameValue = dataFormData[item.fieldName]; - var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + console.log(idAndNameValue) + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : ''; + if(nameValue === '') { + return; + } formData[item.fieldName] = idAndNameValue; formData[item.fieldName +'CurrentUser'] = nameValue; form.val('dataForm', formData); - } else if(item.fieldTyp === 'currentDepartment') { + } else if(item.fieldType === 'currentDepartment') { var formData = {}; var idAndNameValue = dataFormData[item.fieldName]; - var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : ''; + if(nameValue === '') { + return; + } formData[item.fieldName] = idAndNameValue; formData[item.fieldName +'CurrentDepartment'] = nameValue; form.val('dataForm', formData); - } else if(item.fieldTyp === 'currentRole') { + } else if(item.fieldType === 'currentRole') { var formData = {}; var idAndNameValue = dataFormData[item.fieldName]; - var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : ''; + if(nameValue === '') { + return; + } formData[item.fieldName] = idAndNameValue; formData[item.fieldName +'CurrentRole'] = nameValue; form.val('dataForm', formData); - } else if(item.fieldTyp === 'currentGroup') { + } else if(item.fieldType === 'currentGroup') { var formData = {}; var idAndNameValue = dataFormData[item.fieldName]; - var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : ''; + if(nameValue === '') { + return; + } formData[item.fieldName] = idAndNameValue; formData[item.fieldName +'CurrentGroup'] = nameValue; form.val('dataForm', formData); - } else if(item.fieldTyp === 'currentPosition') { + } else if(item.fieldType === 'currentPosition') { var formData = {}; var idAndNameValue = dataFormData[item.fieldName]; - var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.splice('\\|')[1] : ''; + var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : ''; + if(nameValue === '') { + return; + } formData[item.fieldName] = idAndNameValue; formData[item.fieldName +'CurrentPosition'] = nameValue; form.val('dataForm', formData);