表格属性 内容包含单引号JS拼装DOM元素报错问题修改

This commit is contained in:
qinoy 2024-01-02 17:23:45 +08:00
parent 2eebf969d2
commit 48b501de18
3 changed files with 2 additions and 2 deletions

View File

@ -2945,7 +2945,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
}
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>";
input = "<span class=\"awsui-input-wrapper\" tableTitle=" + tableTitle + " ref=" + refValue + " onclick=\"showTableDialog($(this)," + (StringUtils.isEmpty(jsonValue) ? new JSONObject() : jsonValue.replace("\'", "\\'").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>";

View File

@ -586,7 +586,7 @@ function saveDialogTableValue(tableValue,id,dom) {
$.simpleAlert(awsui.decode(msg).msg, "error");
}
if(awsui.decode(msg).result == "ok") {
let tableEvent = "showTableDialog($(this)," + JSON.stringify(tableValue).replace(/\"/g,"'") +", '"+id+"')"
let tableEvent = "showTableDialog($(this)," + JSON.stringify(tableValue).replace(/\'/g,"\\'").replace(/\"/g,"'") +", '"+id+"')"
dom.attr('onclick',tableEvent)
if (tableValue.table.length > 1) {
$("#" + id).val('请查看')