表单字段类型

This commit is contained in:
jinqiming 2021-11-24 19:53:38 +08:00
parent 90d677e863
commit 2787bae3cf
2 changed files with 28 additions and 15 deletions

View File

@ -7,6 +7,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.snow.common.core.domain.AjaxResult; import com.snow.common.core.domain.AjaxResult;
import com.snow.common.enums.FormFieldTypeEnums; import com.snow.common.enums.FormFieldTypeEnums;
import com.snow.common.utils.StringUtils; import com.snow.common.utils.StringUtils;
@ -142,6 +143,7 @@ public class FormController {
@RequestParam String formField){ @RequestParam String formField){
JSONObject formFieldObject = JSON.parseObject(formField);
//解析前端传过来的数据 //解析前端传过来的数据
JSONArray formDataArray = JSON.parseArray(formData); JSONArray formDataArray = JSON.parseArray(formData);
for(int i=0;i<formDataArray.size();i++){ for(int i=0;i<formDataArray.size();i++){
@ -152,12 +154,20 @@ public class FormController {
List<Columns> columnsList=gridField.getColumns(); List<Columns> columnsList=gridField.getColumns();
if(CollUtil.isNotEmpty(columnsList)){ if(CollUtil.isNotEmpty(columnsList)){
columnsList.forEach(t->{ columnsList.forEach(t->{
List<BaseField> list = t.getList(); JSONArray newColumnsArray=
for(int j=0;j<list.size();j++){ JSONArray columnsArray = JSON.parseArray(t.getList());
if(list.get(j).getTag().equals(FormFieldTypeEnums.INPUT.getCode())){ for(int j=0;j<columnsArray.size();j++){
//获取组件类型
String tag= JSON.parseObject(columnsArray.getString(j)).getString("tag");
if(tag.equals(FormFieldTypeEnums.INPUT.getCode())){
InputField inputField = columnsArray.getObject(j, InputField.class);
String value = formFieldObject.getString(inputField.getId());
inputField.setDefaultValue(value);
inputField.setDocument("这个是帮助文档");
columnsArray.add(inputField);
} }
} }
System.out.println("----------");
}); });
} }
} }

View File

@ -17,5 +17,8 @@ public class Columns implements Serializable {
private int span; private int span;
private List<BaseField> list; /**
* list字符串
*/
private String list;
} }