导入逻辑处理

This commit is contained in:
zhal 2022-09-30 16:00:34 +08:00
parent ea338a7a8d
commit a414ac07f1
3 changed files with 52 additions and 17 deletions

View File

@ -2666,25 +2666,40 @@ public class CoeProcessLevelWeb extends ActionWeb {
input = "<input class=\"awsui-textbox\" autocomplete='off' id=\"" + id + "\" name=\"dateTimePicker\" sid=\"" + sid + "\" uuid=\"" + uuid + "\" placeholder='" + desc + "' data-originvalue='" + inputValue + "' value='" + inputValue + "' isRequired='" + isRequired + "' onblur='saveContent($(this));'>" + "</input>";
}else if ("table".equals(type)){
JSONObject table = JSON.parseObject(jsonValue);
int subTableSize = 0;
if (null != table){
JSONArray subTable = table.getJSONArray("table");
if (null != subTable){
subTableSize = subTable.size();
}
}
String tableInput = subTableSize > 1 ? "请查看" : "请输入";
//判断如果table不为准确json格式则手动输入
boolean falgtrue = getJSONType(jsonValue);
String attrRef = attributeModel.getRef();
JSONObject refValue = JSON.parseObject(attrRef);
String tableTitle = attributeModel.getTitle();
input = "<span class=\"awsui-input-wrapper\" tableTitle="+ tableTitle +" ref="+ refValue +" onclick=\"showTableDialog($(this),"+ ( StringUtils.isEmpty(jsonValue) ? new JSONObject() : jsonValue.replace("\"","'") )+",'" + id + "')\">"
if (falgtrue == true) {
JSONObject table = JSON.parseObject(jsonValue);
int subTableSize = 0;
if (null != table) {
JSONArray subTable = table.getJSONArray("table");
if (null != subTable) {
subTableSize = subTable.size();
}
}
String tableInput = subTableSize > 1 ? "请查看" : "请输入";
input = "<span class=\"awsui-input-wrapper\" tableTitle=" + tableTitle + " ref=" + refValue + " onclick=\"showTableDialog($(this)," + (StringUtils.isEmpty(jsonValue) ? new JSONObject() : jsonValue.replace("\"", "'")) + ",'" + id + "')\">"
+ "<input type='text' id='" + id + "' value='" + tableInput + "' class=\"awsui-textbox\" />"
+ "<span class=\"awsui-input-suffix\" sid='" + sid + "' uuid='" + uuid + "' >"
+ " <i class=\"awsui-iconfont\" >&#xe7ff;</i>"
+ "</span>"
+ "</span>";
} else {
input = "<span class=\"awsui-input-wrapper\" tableTitle=" + tableTitle + " ref=" + refValue + " onclick=\"showTableDialog($(this),{}" + ",'" + id + "')\">"
+ "<input type='text' id='" + id + "' value='" + "请输入" + "' class=\"awsui-textbox\" />"
+ "<span class=\"awsui-input-suffix\" sid='" + sid + "' uuid='" + uuid + "' >"
+ " <i class=\"awsui-iconfont\" >&#xe7ff;</i>"
+ "</span>"
+ "</span>";
}
}
else {
if (readonly) {
@ -2700,6 +2715,25 @@ public class CoeProcessLevelWeb extends ActionWeb {
return map;
}
/**
* 判断是否为json格式
* @param str
* @return
*/
public static boolean getJSONType(String str) {
boolean result = false;
if (StringUtils.isNotBlank(str)) {
str = str.trim();
if (str.startsWith("{") && str.endsWith("}")) {
result = true;
} else if (str.startsWith("[") && str.endsWith("]")) {
result = true;
}
}
return result;
}
/**
* 获取资产库节点的 json
*

View File

@ -447,8 +447,8 @@ function openDialog(obj) {
for ( let i = 1; i < dialogTable.length; i++) {
let str =
'<tr id="' + dialogTable[i].id + '">'
+ '<td style="width: 30%;">' + dialogTable[i].name + '</td>'
+ '<td style="width: 70%;">' + dialogTable[i].desc + '</td>'
+ '<td style="width: 30%;font-size: 20px">' + dialogTable[i].name + '</td>'
+ '<td style="width: 70%;font-size: 20px">' + dialogTable[i].desc + '</td>'
+'</tr>'
$('#attribute-table-content2').append(str)
}
@ -456,6 +456,7 @@ function openDialog(obj) {
$("#attribute-table-window2").dialog({
title: tableName,
draggable: true,
height:50,
buttons : [{
text : '确定',
cls : "blue",