新增:文件上传表单修改为根据表单配置进行渲染

master
Guo XIn 1 year ago
parent e50a322314
commit 4f20274977
  1. 5
      shandan-bianmu/src/main/java/com/keyware/shandan/bianmu/controller/MetadataController.java
  2. 43
      shandan-bianmu/src/main/resources/view/business/metadata/metadataEdit.html
  3. 13
      shandan-common/src/main/resources/static/css/common/common.css
  4. 5
      shandan-system/src/main/java/com/keyware/shandan/bianmu/controller/MetadataCommonController.java
  5. 2
      shandan-system/src/main/java/com/keyware/shandan/mark/controller/MarkViewController.java
  6. 2
      shandan-system/src/main/java/com/keyware/shandan/mark/services/MarkService.java
  7. 12
      shandan-system/src/main/java/com/keyware/shandan/system/constants/FormTypeEnum.java
  8. 6
      shandan-system/src/main/java/com/keyware/shandan/system/controller/SysFileController.java
  9. 5
      shandan-system/src/main/java/com/keyware/shandan/system/service/SysFormConfigService.java
  10. 10
      shandan-system/src/main/java/com/keyware/shandan/system/service/impl/SysFormConfigServiceImpl.java
  11. 2
      shandan-system/src/main/resources/static/js/sys/file/dirUpload.js
  12. 149
      shandan-system/src/main/resources/view/sys/file/dirUploadLayer.html

@ -13,6 +13,7 @@ import com.keyware.shandan.common.entity.Result;
import com.keyware.shandan.common.enums.SecretLevel; import com.keyware.shandan.common.enums.SecretLevel;
import com.keyware.shandan.common.util.StreamUtil; import com.keyware.shandan.common.util.StreamUtil;
import com.keyware.shandan.common.util.StringUtils; import com.keyware.shandan.common.util.StringUtils;
import com.keyware.shandan.system.constants.FormTypeEnum;
import com.keyware.shandan.system.entity.SysFile; import com.keyware.shandan.system.entity.SysFile;
import com.keyware.shandan.system.entity.SysFormConfig; import com.keyware.shandan.system.entity.SysFormConfig;
import com.keyware.shandan.system.service.SysFileService; import com.keyware.shandan.system.service.SysFileService;
@ -98,9 +99,7 @@ public class MetadataController extends BaseController<MetadataService, Metadata
public ModelAndView edit(ModelAndView mav) { public ModelAndView edit(ModelAndView mav) {
mav.setViewName("business/metadata/metadataEdit"); mav.setViewName("business/metadata/metadataEdit");
mav.addObject("LabelConfigSet", labelsService.formConfigList()); mav.addObject("LabelConfigSet", labelsService.formConfigList());
QueryWrapper<SysFormConfig> query = new QueryWrapper<>(); mav.addObject("metadataFormConfig", formConfigService.listByFormType(FormTypeEnum.metadataEditForm));
query.eq("FORM_TYPE", 1);
mav.addObject("metadataFormConfig", formConfigService.list(query));
return mav; return mav;
} }

@ -54,49 +54,6 @@
th:id="${'dict-'+field.fieldName}"></div> th:id="${'dict-'+field.fieldName}"></div>
</div> </div>
</div> </div>
<!--<div class="layui-form-item">
<label class="layui-form-label">数据名称</label>
<div class="layui-input-block">
<input type="hidden" name="metadataComment">
<input type="text" name="metadataName" autocomplete="off" placeholder="数据名称"
class="layui-input" lay-verify="required" readonly>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">任务时间</label>
<div class="layui-input-block">
<input type="text" id="collectionTime" name="collectionTime" placeholder="任务时间"
class="layui-input" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">数据来源</label>
<div class="layui-input-block">
<div dict-component="select" dict-type="data_source" dict-name="dataFrom"
id="dict-data-form"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">数据类型</label>
<div class="layui-input-block">
<div dict-component="select" dict-type="data_type" dict-name="dataType"
id="dict-data-type"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">数据密级</label>
<div class="layui-input-block">
<div dict-component="radio" dict-type="secret_level" dict-name="secretLevel"
id="dict-secret-level"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">主题任务</label>
<div class="layui-input-block">
<input type="text" name="themeTask" autocomplete="off" placeholder="主题任务"
class="layui-input">
</div>
</div>-->
<div class="layui-form-item" th:each="labelSet, iterState:${LabelConfigSet}"> <div class="layui-form-item" th:each="labelSet, iterState:${LabelConfigSet}">
<label class="layui-form-label" th:text="${labelSet.fieldTitle}">标签类型</label> <label class="layui-form-label" th:text="${labelSet.fieldTitle}">标签类型</label>
<div class="layui-input-block label-set-component" <div class="layui-input-block label-set-component"

@ -291,3 +291,16 @@ fieldset a, fieldset a:hover{
top: 0; top: 0;
font-size: 20px; font-size: 20px;
} }
.dynamic-form{
display: flex;
max-width: 100%;
flex-flow: wrap;
}
.dynamic-form .layui-form-item{
width: calc(50% - 20px);
margin-left: 10px;
}
.dynamic-form .layui-input-block{
margin-left: 0;
flex: 1;
}

@ -13,6 +13,7 @@ import com.keyware.shandan.common.util.StringUtils;
import com.keyware.shandan.datasource.entity.DBTableColumnVo; import com.keyware.shandan.datasource.entity.DBTableColumnVo;
import com.keyware.shandan.datasource.entity.DataSourceVo; import com.keyware.shandan.datasource.entity.DataSourceVo;
import com.keyware.shandan.datasource.service.DataSourceService; import com.keyware.shandan.datasource.service.DataSourceService;
import com.keyware.shandan.system.constants.FormTypeEnum;
import com.keyware.shandan.system.entity.SysFormConfig; import com.keyware.shandan.system.entity.SysFormConfig;
import com.keyware.shandan.system.service.SysFormConfigService; import com.keyware.shandan.system.service.SysFormConfigService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -81,9 +82,7 @@ public class MetadataCommonController {
mav.addObject("LabelConfigSet", labelsService.formConfigList()); mav.addObject("LabelConfigSet", labelsService.formConfigList());
QueryWrapper<SysFormConfig> query = new QueryWrapper<>(); mav.addObject("metadataFormConfig", formConfigService.listByFormType(FormTypeEnum.metadataEditForm));
query.eq("FORM_TYPE", 1);
mav.addObject("metadataFormConfig", formConfigService.list(query));
return mav; return mav;
} }

@ -1,6 +1,6 @@
package com.keyware.shandan.mark.controller; package com.keyware.shandan.mark.controller;
import com.keyware.shandan.mark.constant.FormTypeEnum; import com.keyware.shandan.system.constants.FormTypeEnum;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;

@ -1,7 +1,7 @@
package com.keyware.shandan.mark.services; package com.keyware.shandan.mark.services;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.keyware.shandan.mark.constant.FormTypeEnum; import com.keyware.shandan.system.constants.FormTypeEnum;
import com.keyware.shandan.mark.pojo.FormMark; import com.keyware.shandan.mark.pojo.FormMark;
import com.keyware.shandan.mark.pojo.MarkRecord; import com.keyware.shandan.mark.pojo.MarkRecord;
import com.keyware.shandan.mark.pojo.MarkType; import com.keyware.shandan.mark.pojo.MarkType;

@ -1,5 +1,6 @@
package com.keyware.shandan.mark.constant; package com.keyware.shandan.system.constants;
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
@ -16,16 +17,19 @@ public enum FormTypeEnum {
/** /**
* 数据资源注册表单 * 数据资源注册表单
*/ */
metadataEditForm("数据资源注册表单"), metadataEditForm(1,"数据资源注册表单"),
/** /**
* 文件上传表单 * 文件上传表单
*/ */
fileUploadForm("文件上传表单"), fileUploadForm(2, "文件上传表单"),
/** /**
* 文件夹上传表单 * 文件夹上传表单
*/ */
@Deprecated @Deprecated
dirUploadForm("文件夹上传表单"); dirUploadForm(3, "文件夹上传表单");
@EnumValue
private final Integer value;
/** /**
* 描述 * 描述

@ -8,10 +8,12 @@ import com.keyware.shandan.common.controller.BaseController;
import com.keyware.shandan.common.entity.Result; import com.keyware.shandan.common.entity.Result;
import com.keyware.shandan.common.util.FileDownload; import com.keyware.shandan.common.util.FileDownload;
import com.keyware.shandan.frame.properties.CustomProperties; import com.keyware.shandan.frame.properties.CustomProperties;
import com.keyware.shandan.system.constants.FormTypeEnum;
import com.keyware.shandan.system.entity.SysFile; import com.keyware.shandan.system.entity.SysFile;
import com.keyware.shandan.system.entity.SysFileChunk; import com.keyware.shandan.system.entity.SysFileChunk;
import com.keyware.shandan.system.entity.SysSetting; import com.keyware.shandan.system.entity.SysSetting;
import com.keyware.shandan.system.service.SysFileService; import com.keyware.shandan.system.service.SysFileService;
import com.keyware.shandan.system.service.SysFormConfigService;
import com.keyware.shandan.system.service.SysSettingService; import com.keyware.shandan.system.service.SysSettingService;
import com.keyware.shandan.system.utils.FileChunkUploadUtil; import com.keyware.shandan.system.utils.FileChunkUploadUtil;
import org.apache.tomcat.util.http.ResponseUtil; import org.apache.tomcat.util.http.ResponseUtil;
@ -57,12 +59,16 @@ public class SysFileController extends BaseController<SysFileService, SysFile, S
@Autowired @Autowired
private DataLabelsService labelsService; private DataLabelsService labelsService;
@Autowired
private SysFormConfigService formConfigService;
@GetMapping("/layer") @GetMapping("/layer")
public ModelAndView fileUploadLayer(ModelAndView mav) { public ModelAndView fileUploadLayer(ModelAndView mav) {
mav.setViewName("sys/file/fileUploadLayer"); mav.setViewName("sys/file/fileUploadLayer");
mav.addObject("LabelConfigSet", labelsService.formConfigList()); mav.addObject("LabelConfigSet", labelsService.formConfigList());
mav.addObject("uploadFormConfig", formConfigService.listByFormType(FormTypeEnum.fileUploadForm));
return mav; return mav;
} }

@ -1,8 +1,11 @@
package com.keyware.shandan.system.service; package com.keyware.shandan.system.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.keyware.shandan.system.constants.FormTypeEnum;
import com.keyware.shandan.system.entity.SysFormConfig; import com.keyware.shandan.system.entity.SysFormConfig;
import java.util.List;
/** /**
* 系统表单配置服务接口类 * 系统表单配置服务接口类
* *
@ -10,4 +13,6 @@ import com.keyware.shandan.system.entity.SysFormConfig;
* @date 2023/8/23 * @date 2023/8/23
*/ */
public interface SysFormConfigService extends IService<SysFormConfig> { public interface SysFormConfigService extends IService<SysFormConfig> {
List<SysFormConfig> listByFormType(FormTypeEnum formTypeEnum);
} }

@ -1,11 +1,15 @@
package com.keyware.shandan.system.service.impl; package com.keyware.shandan.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.keyware.shandan.system.constants.FormTypeEnum;
import com.keyware.shandan.system.entity.SysFormConfig; import com.keyware.shandan.system.entity.SysFormConfig;
import com.keyware.shandan.system.mapper.SysFormConfigMapper; import com.keyware.shandan.system.mapper.SysFormConfigMapper;
import com.keyware.shandan.system.service.SysFormConfigService; import com.keyware.shandan.system.service.SysFormConfigService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* 系统表单配置服务实现类 * 系统表单配置服务实现类
* *
@ -14,4 +18,10 @@ import org.springframework.stereotype.Service;
*/ */
@Service @Service
public class SysFormConfigServiceImpl extends ServiceImpl<SysFormConfigMapper, SysFormConfig> implements SysFormConfigService { public class SysFormConfigServiceImpl extends ServiceImpl<SysFormConfigMapper, SysFormConfig> implements SysFormConfigService {
@Override
public List<SysFormConfig> listByFormType(FormTypeEnum formTypeEnum) {
QueryWrapper<SysFormConfig> query = new QueryWrapper<>();
query.eq("FORM_TYPE", formTypeEnum.getValue());
return list(query);
}
} }

@ -129,7 +129,7 @@ layui.use(['layer', 'uploader', 'element', 'form', 'laydate', 'dict', 'datalabel
function bindDatetimePlugins() { function bindDatetimePlugins() {
//日期选择器 //日期选择器
laydate.render({ laydate.render({
elem: '#input-data', elem: 'input[name="inputDate"]',
format: "yyyy-MM-dd HH:mm:ss", format: "yyyy-MM-dd HH:mm:ss",
type: 'datetime', type: 'datetime',
value: new Date(), value: new Date(),

@ -49,7 +49,11 @@
background-color: #FFF; background-color: #FFF;
border-top: 1px solid #eee; border-top: 1px solid #eee;
} }
.star-mark{color: red; display: none}
.star-mark {
color: red;
display: none
}
</style> </style>
</head> </head>
@ -60,109 +64,50 @@
<div style="overflow: hidden; flex: 1"> <div style="overflow: hidden; flex: 1">
<div class="layui-upload" id="uploader-table"></div> <div class="layui-upload" id="uploader-table"></div>
</div> </div>
<div class="layui-form" lay-filter="file-form" <div class="layui-form dynamic-form" lay-filter="file-form"
style="border: 1px solid #eee; padding-top:15px; margin-bottom: 50px;"> style="border: 1px solid #eee; padding-top:15px; margin-bottom: 50px;" th:object="${@securityUtil.getLoginSysUser()}">
<div class="layui-form-item"> <div class="layui-form-item"
<div class="layui-inline"> th:each="field,iterStat : ${uploadFormConfig}"
<label class="layui-form-label"><span style="color: red">*</span>文件密级</label> th:if="${field.isShow}"
<div class="layui-input-inline"> th:style="${field.fieldType == 'textarea' ? 'width: calc(100% - 30px);' : ''}"
<div dict-component="select" dict-type="secret_level" dict-name="secretLevel" th:with="username=*{userName}">
dict-width="100%" id="dict-secret-level"></div> <label class="layui-form-label" th:text="${field.showTitle}">字段名称</label>
</div> <div class="layui-input-block">
</div> <!-- 文本框类型 -->
<div class="layui-inline"> <input class="layui-input" type="text" autocomplete="off"
<label class="layui-form-label">是否演训数据</label> th:if="${field.fieldType == 'input' || field.fieldType == 'date'}"
<div class="layui-input-inline"> th:name="${field.fieldName}"
<input class="layui-input" type="radio" name="exerciseData" value="0" title="否" checked lay-filter="exerciseData"/> th:value="${field.fieldName=='entryStaff'?username:''}"
<input class="layui-input" type="radio" name="exerciseData" value="1" title="是" lay-filter="exerciseData"/> th:disabled="${field.isDisabled}"
</div> th:placeholder="${field.showTitle}"
</div> th:lay-verify="${field.isRequired ? 'required' : ''}">
</div> <!-- 文本域类型 -->
<div class="layui-form-item"> <textarea class="layui-textarea" type="text" autocomplete="off"
<div class="layui-inline"> th:if="${field.fieldType == 'textarea'}"
<label class="layui-form-label"><span class="star-mark">*</span>任务时间</label> th:name="${field.fieldName}"
<div class="layui-input-inline"> th:disabled="${field.isDisabled}"
<input class="layui-input" id="input-data" name="inputDate" type="text"> th:placeholder="${field.showTitle}"
</div> th:lay-verify="${field.isRequired ? 'required' : ''}"></textarea>
</div> <th:block th:if="${field.fieldType == 'radio' && field.isShow}">
<div class="layui-inline"> <input class="layui-inline" type="radio"
<label class="layui-form-label">录入人员</label> th:each="exp, stat : ${#strings.listSplit(field.dictType, ';')}"
<div class="layui-input-inline" th:object="${@securityUtil.getLoginSysUser()}"> th:with="tmp=${#strings.arraySplit(exp, '-')}, value=${tmp[0]}, title=${tmp[1]}, checked=${#arrays.length(tmp)==3?tmp[2]:false}"
<input class="layui-input" name="entryStaff" type="text" readonly th:name="${field.fieldName}"
th:value="*{userName}"> th:value="${value}"
</div> th:title="${title}"
</div> th:checked="${checked}"
</div> />
<div class="layui-form-item"> </th:block>
<div class="layui-inline"> <!-- 数据字典类型 -->
<label class="layui-form-label"><span class="star-mark">*</span>文件来源</label> <div dict-component="select"
<div class="layui-input-inline"> th:if="${field.fieldType == 'dict'}"
<div dict-component="select" dict-type="data_source" dict-name="source" th:disabled="${field.isDisabled}"
dict-width="100%" id="dict-data-form"></div> th:dict-type="${field.dictType}"
</div> th:dict-name="${field.fieldName}"
</div> th:id="${'dict-'+field.fieldName}"></div>
<div class="layui-inline">
<label class="layui-form-label">目标/靶标类型</label>
<div class="layui-input-inline">
<div dict-component="select" dict-type="target_type" dict-name="targetNumber"
dict-width="100%" id="dict-target-type"></div>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label"><span class="star-mark">*</span>任务代号</label>
<div class="layui-input-inline">
<div dict-component="select" dict-type="task_code" dict-name="taskCode"
dict-width="100%" id="dict-task-code"></div>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label"><span class="star-mark">*</span>任务性质</label>
<div class="layui-input-inline">
<div dict-component="select" dict-type="task_nature" dict-name="taskNature"
dict-width="100%" id="dict-task-nature"></div>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label"><span class="star-mark">*</span>部队代号</label>
<div class="layui-input-inline">
<div dict-component="select" dict-type="troop_code" dict-name="troopCode"
dict-width="100%" id="dict-troop-code"></div>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label"><span class="star-mark">*</span>装备型号</label>
<div class="layui-input-inline">
<div dict-component="select" dict-type="equipment_model" dict-name="equipmentModel"
dict-width="100%" id="dict-equipment-model"></div>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">导弹编号</label>
<div class="layui-input-inline">
<div dict-component="select" dict-type="missile_number" dict-name="missileNumber"
dict-width="100%" id="dict-missile-number"></div>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">主题任务</label>
<div class="layui-input-inline">
<input class="layui-input" name="themeTask" type="text">
</div>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label" style="margin-left: -10px;">文件描述</label>
<div class="layui-input-block" style="width:calc(100% - 130px);margin-left: 0">
<textarea class="layui-textarea" name="remark"></textarea>
</div> </div>
</div> </div>
<div class="layui-form-item" th:each="labelSet, iterState:${LabelConfigSet}"> <div class="layui-form-item" th:each="labelSet, iterState:${LabelConfigSet}" style="width: 100%">
<label class="layui-form-label" th:text="${labelSet.fieldTitle}">标签类型</label> <label class="layui-form-label" th:text="${labelSet.fieldTitle}">标签类型</label>
<div class="layui-input-block label-set-component" <div class="layui-input-block label-set-component"
th:data-id="${labelSet.id}" th:data-id="${labelSet.id}"