From 11a3cb425e80031986f772abafaac64ed51ac596 Mon Sep 17 00:00:00 2001 From: cuibaocheng Date: Fri, 13 Aug 2021 19:26:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8A=A8=E6=80=81=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E8=87=AA=E5=8A=A8=E6=8E=92=E7=89=88=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E7=9A=84=E4=BF=9D=E5=AD=98=E5=9B=9E=E6=98=BE?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../update-bigdatatemplateareadata.html | 228 ++++++++++-------- .../PicturesTemplateAreaBuildingDTO.java | 8 +- 2 files changed, 136 insertions(+), 100 deletions(-) diff --git a/module-bigdata/src/main/resources/templates/bigdatatemplatearea/update-bigdatatemplateareadata.html b/module-bigdata/src/main/resources/templates/bigdatatemplatearea/update-bigdatatemplateareadata.html index b585af1..2a3df9e 100644 --- a/module-bigdata/src/main/resources/templates/bigdatatemplatearea/update-bigdatatemplateareadata.html +++ b/module-bigdata/src/main/resources/templates/bigdatatemplatearea/update-bigdatatemplateareadata.html @@ -42,41 +42,57 @@ + {{# if(typeof(d.title) == 'string' && !d.title.match(RegExp(/\"/g))) { }}
+ {{# } else { }} +
+ +
+ +
+
+ {{# } }}
模块data对象参数
{{# for(let key in d.data) { }} - {{# if(typeof(d.data[key]) == 'string') { }} -
- -
- - {{# if(key.indexOf('color') != -1 || key.indexOf('Color') != -1 ) { }} -
- {{# } }} -
-
+ {{# if(typeof(d.data[key]) == 'string' && !d.data[key].match(RegExp(/\"/g))) { }} +
+ +
+ + {{# if(key.indexOf('color') != -1 || key.indexOf('Color') != -1 ) { }} +
+ {{# } }} +
+
{{# } else if(typeof(d.data[key]) == 'number') { }} -
- -
- -
-
+
+ +
+ +
+
{{# } else if(typeof(d.data[key]) == 'boolean') { }} -
- -
- -
-
+
+ +
+ +
+
+ {{# } else { }} +
+ +
+ +
+
{{# } }} {{# } }} {{# var mList = d.list; }} @@ -93,60 +109,70 @@ 删除本行 {{# var mData = mList[i]; }} - {{# if(typeof(mData) == 'string') { }} -
- -
- -
+ {{# if(typeof(mData) == 'string' && !mData.match(RegExp(/\"/g))) { }} +
+ +
+
- {{# } else if(typeof(mData) == 'boolean') { }} -
- -
- -
+
+ {{# } else if(typeof(mData) == 'boolean') { }} +
+ +
+
- {{# } else if(typeof(mData) == 'number') { }} -
- -
- -
+
+ {{# } else if(typeof(mData) == 'number') { }} +
+ +
+
- {{# } else if(typeof(mData) == 'object') { }} - {{# for(let key in mData) { }} - {{# if(typeof(mData[key]) == 'string') { }} -
- -
- - {{# if(key.indexOf('color') != -1 || key.indexOf('Color') != -1 ) { }} -
- {{# } }} -
-
- {{# } else if(typeof(mData[key]) == 'number') { }} -
- -
- -
-
- {{# } else if(typeof(mData[key]) == 'boolean') { }} -
- -
- -
-
- {{# } }} - {{# } }} - {{# } else { }} -
- -
+
+ {{# } else if(typeof(mData) == 'object') { }} + {{# for(let key in mData) { }} + {{# if(typeof(mData[key]) == 'string' && !mData[key].match(RegExp(/\"/g))) { }} +
+ +
+ + {{# if(key.indexOf('color') != -1 || key.indexOf('Color') != -1 ) { }} +
{{# } }} +
+
+ {{# } else if(typeof(mData[key]) == 'number') { }} +
+ +
+ +
+
+ {{# } else if(typeof(mData[key]) == 'boolean') { }} +
+ +
+ +
+
+ {{# } else { }} +
+ +
+ +
+
+ {{# } }} + {{# } }} + {{# } else { }} +
+ +
+ +
+
+ {{# } }} {{# } }} @@ -380,16 +406,16 @@ var loadIndex = top.layer.load(1,{shade:0.5}); querySql = Encrypt(querySql); top.restAjax.get(top.restAjax.path('app/bigdatatemplate/querysqlrelease?querySql={querySql}', [querySql]), {}, null, function(code, data) { - if(code == 200 && data) { - if(data.state == 200) { - top.dialog.msg("语句校验通过"); - }else{ - top.dialog.msg("语句校验未通过"); - } - }else{ - top.dialog.msg("语句校验不通过"); - } - top.layer.close(loadIndex); + if(code == 200 && data) { + if(data.state == 200) { + top.dialog.msg("语句校验通过"); + }else{ + top.dialog.msg("语句校验未通过"); + } + }else{ + top.dialog.msg("语句校验不通过"); + } + top.layer.close(loadIndex); }, function(code, data) { top.dialog.msg(data.msg); top.layer.close(loadIndex); @@ -402,7 +428,8 @@ var loadLayerIndex; top.restAjax.get(top.restAjax.path('api/bigdatatemplatearea/getbigdatatemplateareabyid/{bigdataTemplateAreaId}', [bigdataTemplateAreaId]), {}, null, function(code, data) { areaData = data; - templateAreaModuleData = eval("("+ data.templateAreaModuleData+")"); + templateAreaModuleData = eval("("+ data.templateAreaModuleData +")"); + console.log(templateAreaModuleData) laytpl(document.getElementById('templateAreaModuleDataScript').innerHTML).render(templateAreaModuleData, function(html) { document.getElementById('templateAreaModuleDataDiv').innerHTML = html; form.render(); @@ -453,17 +480,17 @@ } // 对象 if(keySplit.length == 3) { - var obj = moduleMap.get(index); - if(obj) { - if(fieldData[key] == "true" || fieldData[key] == "false") { - obj[keySplit[2]] = fieldData[key].indexOf("true") != -1 ? true : false; - } else if(/^\d+(?=\.{0,1}\d+$|$)/ .test(fieldData[key])){ - obj[keySplit[2]] = Number(fieldData[key]); - } else { - obj[keySplit[2]] = fieldData[key]; - } - }else { - obj = {}; + var obj = moduleMap.get(index); + if(obj) { + if(fieldData[key] == "true" || fieldData[key] == "false") { + obj[keySplit[2]] = fieldData[key].indexOf("true") != -1 ? true : false; + } else if(/^\d+(?=\.{0,1}\d+$|$)/ .test(fieldData[key])){ + obj[keySplit[2]] = Number(fieldData[key]); + } else { + obj[keySplit[2]] = fieldData[key]; + } + }else { + obj = {}; var ke = keySplit[2]; if(fieldData[key] == "true" || fieldData[key] == "false") { obj[ke] = fieldData[key].indexOf("true") != -1 ? true : false; @@ -472,7 +499,7 @@ } else { obj[ke] = fieldData[key]; } - } + } moduleMap.set(index, obj); } } @@ -488,7 +515,16 @@ dataList.push(data); } templateAreaModuleJsonData.list = dataList; - var newtTemplateAreaModuleData = JSON.stringify(templateAreaModuleJsonData).replace(/\"/g,"'"); + var newtTemplateAreaModuleData = JSON.stringify(templateAreaModuleJsonData) + if(newtTemplateAreaModuleData.indexOf("\'") > 1) { + layer.msg("不允许使用单引号"); + return; + } + console.log(newtTemplateAreaModuleData); + newtTemplateAreaModuleData = newtTemplateAreaModuleData.replace(/\"/g,"'"); + console.log(newtTemplateAreaModuleData); + newtTemplateAreaModuleData = newtTemplateAreaModuleData.replace(/\\'/g,"\""); + console.log(newtTemplateAreaModuleData); top.restAjax.put(top.restAjax.path('api/bigdatatemplatearea/updatebigdatatemplateareapointmoduledata/{bigdataTemplateAreaId}?templateAreaModuleData={newtTemplateAreaModuleData}', [bigdataTemplateAreaId]), newtTemplateAreaModuleData, null, function(code, data) { top.dialog.close(index); // window.location.reload(); diff --git a/pojo-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/pojo/dtos/picturestemplatearea/PicturesTemplateAreaBuildingDTO.java b/pojo-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/pojo/dtos/picturestemplatearea/PicturesTemplateAreaBuildingDTO.java index 504e4ab..714c4a5 100644 --- a/pojo-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/pojo/dtos/picturestemplatearea/PicturesTemplateAreaBuildingDTO.java +++ b/pojo-building-pictures/src/main/java/cn/com/tenlion/buildingpictures/pojo/dtos/picturestemplatearea/PicturesTemplateAreaBuildingDTO.java @@ -43,7 +43,7 @@ public class PicturesTemplateAreaBuildingDTO { @ApiModelProperty(name = "templateAreaFontColor", value = "文字颜色") private String templateAreaFontColor; @ApiModelProperty(name = "templateAreaFontSize", value = "文字大小") - private String templateAreaFontSize; + private Integer templateAreaFontSize; @ApiModelProperty(name = "templateAreaFontLength", value = "字体长度限制") private Integer templateAreaFontLength = 0; @ApiModelProperty(name = "templateAreaFontBold", value = "文字加粗0:正常,1:加粗,2:斜体") @@ -179,11 +179,11 @@ public class PicturesTemplateAreaBuildingDTO { this.templateAreaFontColor = templateAreaFontColor; } - public String getTemplateAreaFontSize() { - return templateAreaFontSize == null ? "" : templateAreaFontSize; + public Integer getTemplateAreaFontSize() { + return templateAreaFontSize == null ? 0 : templateAreaFontSize; } - public void setTemplateAreaFontSize(String templateAreaFontSize) { + public void setTemplateAreaFontSize(Integer templateAreaFontSize) { this.templateAreaFontSize = templateAreaFontSize; }