Commit d3dca703 authored by 邢磊's avatar 邢磊

*)解析单选按钮功能

parent a7ca9bce
...@@ -33,6 +33,7 @@ import javax.script.ScriptEngineManager; ...@@ -33,6 +33,7 @@ import javax.script.ScriptEngineManager;
import java.net.URI; import java.net.URI;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream;
/** /**
* 大屏二级页面实现类 * 大屏二级页面实现类
...@@ -628,6 +629,24 @@ public class DPSubServiceImpl { ...@@ -628,6 +629,24 @@ public class DPSubServiceImpl {
jsonObject.put("value", ((JSONObject) z).getString("nameKey")); jsonObject.put("value", ((JSONObject) z).getString("nameKey"));
}); });
} }
} else if ("radio".equals(xObj.getString("componentKey"))) {
if (!ValidationUtil.isEmpty(visualParams.getJSONObject("api"))){
ResponseModel checkboxResult = this.getApiResult(visualParams.getJSONObject("api"), null);
if (!ValidationUtil.isEmpty(checkboxResult) && checkboxResult.getStatus() == 200 && !ValidationUtil.isEmpty(value)) {
List<Object> collect = ((JSONArray) checkboxResult.getResult()).stream().filter(y -> ((JSONArray) value).contains(JsonValueUtils.getValueByKey(y, "valueKey", "valueKey"))).collect(Collectors.toList());
String nameKey = collect.stream().map(item -> ((JSONObject) item).getString("nameKey")).collect(Collectors.joining("、"));
jsonObject.put("value", nameKey);
}
} else if(!ValidationUtil.isEmpty(value) && !ValidationUtil.isEmpty(visualParams.get("data"))){
JSONArray data = visualParams.getJSONArray("data");
Map<String, String> fieldMap = IntStream.range(0, data.size())
.mapToObj(index -> data.getJSONObject(index))
.collect(Collectors.toMap(
json -> json.getString("value"),
json -> json.getString("name")
));
jsonObject.put("value", fieldMap.get(value));
}
} }
} }
if (!("upload".equals(xObj.getString("componentKey")) || "attachmentUpload".equals(xObj.getString("componentKey")))){ if (!("upload".equals(xObj.getString("componentKey")) || "attachmentUpload".equals(xObj.getString("componentKey")))){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment