var mqttMpcode = ""; var switchHiddenPoints = ""; var switchAllPoints = []; //人员定位自定义mq主题 var personnelPositioning_auto_mq_theme = []; //摄像头_报警_自定义列表 var cameraAlarmList = []; //摄像头_报警_自定义mq主题 var cameraAlarm_auto_mq_theme = []; //svg_报警_自定义列表 var svgAlarmList = []; //svg_报警_自定义mq主题 var svgAlarm_auto_mq_theme = []; //任务点_报警_自定义mq主题 var taskPointslarm_auto_mq_theme = []; /** * 测量点组件 DI */ function showAssembly_mpdata_DI(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualMPoint/getJson.do?pid=" + content.id, async: false, globle: false, error: function () { return false; }, success: function (data) { var datas = eval('(' + data + ')'); var parmValue = datas[0].mPoint.parmvalue; var ledtype = datas[0].mPoint.ledtype;//DI的情况下类别状态 1运行点0故障点 var ledcolor = datas[0].mPoint.ledcolor;//颜色状态 1红开绿停0绿开红停;黄色永远表示故障 let signaltag = ""; if (datas[0].mPoint.signaltag != '') { signaltag = datas[0].mPoint.signaltag; } let signaltag_color = "0"; //0绿色 1红色 2黄色 -1 透明 var showColor = "#000000"; if (ledtype == '1') {//运行点 if (ledcolor == '1') {//红开绿停 if (Number(parmValue) == 0) { showColor = '#00ff00';//绿 signaltag_color = '0'; } else if (Number(parmValue) == 1) { showColor = '#FF0000';//红 signaltag_color = '1'; } else if (Number(parmValue) == 2) { showColor = 'yellow'; signaltag_color = '2'; } } else if (ledcolor == '0') {//绿开红停 if (Number(parmValue) == 0) { showColor = '#FF0000';//红 signaltag_color = '1'; } else if (Number(parmValue) == 1) { showColor = '#00ff00';//绿 signaltag_color = '0'; } else if (Number(parmValue) == 2) { showColor = 'yellow'; signaltag_color = '2'; } } } else if (ledtype == '0') {//故障点 //透明正常黄故障 if (Number(parmValue) == 0) { showColor = 'transparent'; signaltag_color = '-1'; } else if (Number(parmValue) == 1) { showColor = 'yellow'; signaltag_color = '2'; } } var style = ""; var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } // if (content.isfull == 'true') { // width = width.replace("%", "") + "%"; // height = height.replace("%", "") + "%"; // } else { // if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { // width += "px"; // } // if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { // height += "px"; // } // } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv\" onmouseup=\"doUp2('" + content.id + "');\" "; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; let showStyle = "style1"; if (datas[0].showStyle != null && datas[0].showStyle != '') { showStyle = datas[0].showStyle; } if (showStyle == 'style1') { divHtml += "
"; divHtml += ""; } else { var width = "25px"; var height = "25px"; if (content.width != '') { width = content.width; } if (content.height != '') { height = content.height; } if (width.indexOf("%") < 0) { width = width.replace("px", "") + "px"; } if (height.indexOf("%") < 0) { height = height.replace("px", "") + "px"; } divHtml += "
"; let img_path = ""; if (signaltag == 'KQWINDOW') { if (signaltag_color == '0') { img_path = ext.contextPath + "/IMG/dataVisual/开启窗-绿.png"; } else if (signaltag_color == '1') { img_path = ext.contextPath + "/IMG/dataVisual/开启窗-红.png"; } else if (signaltag_color == '2') { img_path = ext.contextPath + "/IMG/dataVisual/开启窗-黄.png"; } } else if (signaltag == 'XHFAN') { if (signaltag_color == '0') { img_path = ext.contextPath + "/IMG/dataVisual/循环风机-绿.png"; } else if (signaltag_color == '1') { img_path = ext.contextPath + "/IMG/dataVisual/循环风机-红.png"; } else if (signaltag_color == '2') { img_path = ext.contextPath + "/IMG/dataVisual/循环风机-黄.png"; } } else if (signaltag == 'CZFAN') { if (signaltag_color == '0') { img_path = ext.contextPath + "/IMG/dataVisual/垂直风机-绿.png"; } else if (signaltag_color == '1') { img_path = ext.contextPath + "/IMG/dataVisual/垂直风机-红.png"; } else if (signaltag_color == '2') { img_path = ext.contextPath + "/IMG/dataVisual/垂直风机-黄.png"; } } divHtml += "
"; } divHtml += "
"; } }); return divHtml; } function showAssembly_mpdata_DI_View(content, showData) { var divHtml = ""; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualMPoint/getJson.do?pid=" + content.id, // async: false, // globle: false, // error: function () { // return false; // }, // success: function (data) { // var datas = eval('(' + data + ')'); let parmValue = "0"; let ledtype = "1";//DI的情况下类别状态 1运行点0故障点 let ledcolor = "1";//颜色状态 1红开绿停0绿开红停;黄色永远表示故障 let parmName = ""; let mpid = ""; let signaltag = ""; if (showData.mPoint != null) { parmValue = showData.mPoint.parmvalue; ledtype = showData.mPoint.ledtype;//DI的情况下类别状态 1运行点0故障点 ledcolor = showData.mPoint.ledcolor;//颜色状态 1红开绿停0绿开红停;黄色永远表示故障 parmName = showData.mPoint.parmname; mpid = showData.mPoint.id; mqttMpcode = mqttMpcode + mpid + ","; if (showData.mPoint.signaltag != null) { if (showData.mPoint.signaltag != '') { signaltag = showData.mPoint.signaltag; } } } let showColor = getDIColor(ledtype, ledcolor, parmValue); var style = ""; var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } let showStyle = "style1"; if (showData.showStyle != null && showData.showStyle != '') { showStyle = showData.showStyle; } if (showStyle == 'style1') { divHtml += "
"; divHtml += ""; } else { let signaltag_color = "0"; //0绿色 1红色 2黄色 -1 透明 if (showColor == '#00ff00') { signaltag_color = '0'; } else if (showColor == '#FF0000') { signaltag_color = '1'; } else if (showColor == 'yellow') { signaltag_color = '2'; } var width = "25px"; var height = "25px"; if (content.width != '') { width = content.width; } if (content.height != '') { height = content.height; } if (width.indexOf("%") < 0) { width = width.replace("px", "") + "px"; } if (height.indexOf("%") < 0) { height = height.replace("px", "") + "px"; } divHtml += "
"; let img_path = ""; if (signaltag == 'KQWINDOW') { if (signaltag_color == '0') { img_path = ext.contextPath + "/IMG/dataVisual/开启窗-绿.png"; } else if (signaltag_color == '1') { img_path = ext.contextPath + "/IMG/dataVisual/开启窗-红.png"; } else if (signaltag_color == '2') { img_path = ext.contextPath + "/IMG/dataVisual/开启窗-黄.png"; } } else if (signaltag == 'XHFAN') { if (signaltag_color == '0') { img_path = ext.contextPath + "/IMG/dataVisual/循环风机-绿.png"; } else if (signaltag_color == '1') { img_path = ext.contextPath + "/IMG/dataVisual/循环风机-红.png"; } else if (signaltag_color == '2') { img_path = ext.contextPath + "/IMG/dataVisual/循环风机-黄.png"; } } else if (signaltag == 'CZFAN') { if (signaltag_color == '0') { img_path = ext.contextPath + "/IMG/dataVisual/垂直风机-绿.png"; } else if (signaltag_color == '1') { img_path = ext.contextPath + "/IMG/dataVisual/垂直风机-红.png"; } else if (signaltag_color == '2') { img_path = ext.contextPath + "/IMG/dataVisual/垂直风机-黄.png"; } } divHtml += "
"; } divHtml += "
"; // } // }); return divHtml; } function getDIColor(ledtype, ledcolor, parmValue) { let showColor = "#000000"; if (ledtype == '1') {//运行点 if (ledcolor == '1') {//红开绿停 if (Number(parmValue) == 0) { showColor = '#00ff00'; } else if (Number(parmValue) == 1) { showColor = '#FF0000'; } else if (Number(parmValue) == 2) { showColor = 'yellow'; } } else if (ledcolor == '0') {//绿开红停 if (Number(parmValue) == 0) { showColor = '#FF0000'; } else if (Number(parmValue) == 1) { showColor = '#00ff00'; } else if (Number(parmValue) == 2) { showColor = 'yellow'; } } } else if (ledtype == '0') {//故障点 //透明正常黄故障 if (Number(parmValue) == 0) { showColor = 'transparent'; } else if (Number(parmValue) == 1) { showColor = 'yellow'; } } return showColor; } /** * 测量点组件 AI */ function showAssembly_mpdata_AI(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualMPoint/getJson.do?pid=" + content.id, async: false, globle: false, dataType: 'json', error: function () { return false; }, success: function (data) { var showData = data[0]; var parmValue = "0"; var unit = ""; if (showData.mPoint != null) { parmValue = showData.mPoint.parmvalue; if (showData.mPoint.unit != '') { unit = showData.mPoint.unit; } } var style = ""; if (content.style != '') { style = content.style; } var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let onmouseupSt2 = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv\" onmousedown=\"doDown();\" onmouseup=\"doUp();\" onmousemove=\"doMove();\" "; onmouseupSt2 = "onmouseup=\"doUp2('" + content.id + "');\""; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; let showStyle = "style1"; if (showData.showStyle != null && showData.showStyle != '') { showStyle = showData.showStyle; } let signaltag = ""; if (showData.mPoint != null) { if (showData.mPoint.signaltag != null) { if (showData.mPoint.signaltag != '') { signaltag = showData.mPoint.signaltag; } } } let titleSwitch = "true"; if (showData.titleSwitch != null && showData.titleSwitch != '') { titleSwitch = showData.titleSwitch; } let unitSwitch = "true"; if (showData.unitSwitch != null && showData.unitSwitch != '') { unitSwitch = showData.unitSwitch; } if (showStyle == 'style1') { divHtml = "
"; if (titleSwitch == 'true' && unitSwitch == 'true') { divHtml += "
" + showData.name + "
"; divHtml += "
" + parmValue + "
"; divHtml += "
" + unit + "
"; } if (titleSwitch == 'false' && unitSwitch == 'true') { divHtml += "
" + parmValue + "
"; divHtml += "
" + unit + "
"; } if (titleSwitch == 'true' && unitSwitch == 'false') { divHtml += "
" + showData.name + "
"; divHtml += "
" + parmValue + "
"; } if (titleSwitch == 'false' && unitSwitch == 'false') { divHtml += "
" + parmValue + "
"; } divHtml += "
"; } else { let img_path = ""; if (signaltag == 'H2S') { img_path = ext.contextPath + "/IMG/dataVisual/H2S.png"; } else if (signaltag == 'CH4') { img_path = ext.contextPath + "/IMG/dataVisual/CH4.png"; } else if (signaltag == 'LT') { img_path = ext.contextPath + "/IMG/dataVisual/LT.png"; } else if (signaltag == 'TT' || signaltag == 'HT') { img_path = ext.contextPath + "/IMG/dataVisual/TT.png"; } let showContent = parmValue; if (unit != '') { showContent += unit; } divHtml = "
"; divHtml += "
"; divHtml += "
" + showContent + "
"; divHtml += "
"; } } }); return divHtml; } function showAssembly_mpdata_AI_View(content, showData) { var divHtml = ""; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualMPoint/getJson.do?pid=" + content.id, // async: false, // globle: false, // error: function () { // return false; // }, // success: function (data) { // var datas = eval('(' + data + ')'); let parmValue = "0"; let unit = ""; let mpid = ""; let color = showData.textColor; if (showData.mPoint != null) { let mp = showData.mPoint; parmValue = mp.parmvalue; if (mp.unit != '') { unit = mp.unit; } mpid = mp.id; mqttMpcode = mqttMpcode + mpid + ","; } let style = ""; if (content.style != '') { style = content.style; } let zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } let showStyle = "style1"; if (showData.showStyle != null && showData.showStyle != '') { showStyle = showData.showStyle; } let signaltag = ""; if (showData.mPoint != null) { if (showData.mPoint.signaltag != null) { if (showData.mPoint.signaltag != '') { signaltag = showData.mPoint.signaltag; } } } let titleSwitch = "true"; if (showData.titleSwitch != null && showData.titleSwitch != '') { titleSwitch = showData.titleSwitch; } let unitSwitch = "true"; if (showData.unitSwitch != null && showData.unitSwitch != '') { unitSwitch = showData.unitSwitch; } if (showStyle == 'style1') { // divHtml="
"+showData.name+":"+parmValue+""+unit+"
"; divHtml = "
"; if (titleSwitch == 'true' && unitSwitch == 'true') { divHtml += "
" + showData.name + "
"; divHtml += "
" + parmValue + "
"; divHtml += "
" + unit + "
"; } if (titleSwitch == 'false' && unitSwitch == 'true') { divHtml += "
" + parmValue + "
"; divHtml += "
" + unit + "
"; } if (titleSwitch == 'true' && unitSwitch == 'false') { divHtml += "
" + showData.name + "
"; divHtml += "
" + parmValue + "
"; divHtml += "
" + unit + "
"; } if (titleSwitch == 'false' && unitSwitch == 'false') { divHtml += "
" + parmValue + "
"; } divHtml += "
"; } else { let img_path = ""; if (signaltag == 'H2S') { img_path = ext.contextPath + "/IMG/dataVisual/H2S.png"; } else if (signaltag == 'CH4') { img_path = ext.contextPath + "/IMG/dataVisual/CH4.png"; } else if (signaltag == 'LT') { img_path = ext.contextPath + "/IMG/dataVisual/LT.png"; } else if (signaltag == 'TT' || signaltag == 'HT') { img_path = ext.contextPath + "/IMG/dataVisual/TT.png"; } let showContent = parmValue; if (unit != '') { showContent += unit; } divHtml = "
"; divHtml += "
"; divHtml += "
" + showContent + "
"; divHtml += "
"; } // } // }); return divHtml; } /** * 文本组件 */ function showAssembly_Text(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualText/getJson.do?pid=" + content.id, async: false, globle: false, error: function () { return false; }, success: function (data) { var datas = eval('(' + data + ')'); var textContent = ""; let mpid = ""; if (datas[0].mpid != null && datas[0].mpid != "") { mpid = datas[0].mpid; } if (mpid != "") { textContent = mpid; } else if (datas[0].urldata != null && datas[0].urldata != '') { textContent = "urldata"; } else { if (datas[0].textcontent != null && datas[0].textcontent != '') { textContent = datas[0].textcontent; } } var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv reSize\" onmousedown=\"doDown();\" onmouseup=\"doUp();\" onmousemove=\"doMove();\""; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; // if (width.indexOf("{value}") >= 0) { // width = width.replace("{value}", textContent); // width = width.replace("px", ""); // width = eval('(' + width + ')'); // width += "px"; // } var textHeight = (datas[0].textheight).replace("px", "") + "px"; // divHtml = "
"; divHtml = "
"; divHtml += textContent; divHtml += "
"; // divHtml+="
"; } }); return divHtml; } function showAssembly_Text_View(content, showData) { var divHtml = ""; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualText/getJson.do?pid=" + content.id, // async: false, // globle: false, // error: function () { // return false; // }, // success: function (data) { // var datas = eval('(' + data + ')'); var textContent = ""; let mpid = ""; if (showData.mpid != null && showData.mpid != "") { mpid = showData.mpid; } if (mpid != "") { // $.ajax({ // type: 'GET', // url: ext.contextPath + "/work/mpoint/getMpointJsonForEXAndDV.do", // async: false, // globle: false, // data: { // mpid: mpid, // valuemethod: showData.valuemethod, // sdt: sdt, // edt: edt // }, // dataType: 'json', // error: function () { // return false; // }, // success: function (result) { textContent = showData.textcontent; //系数 if (showData.rate != null && showData.rate != "") { let rate = showData.rate; if ("+-*/".indexOf(rate.substring(0, 1)) == -1) { rate = "*" + rate; } textContent = eval(textContent + rate); } if (showData.numtail != null && showData.numtail != "") { textContent = Number(textContent).toFixed(Number(showData.numtail)); } if (showData.unitst != '' && (showData.unitst == "true" || showData.unitst == "TRUE")) { if (showData.mPoint.unit != null) { textContent += showData.mPoint.unit; } } // } // }); mqttMpcode = mqttMpcode + mpid + ","; } else if (showData.urldata != null && showData.urldata != '') { $.ajax({ type: 'GET', url: ext.contextPath + showData.urldata, async: false, globle: false, dataType: 'json', error: function () { return false; }, success: function (result) { textContent = result.result; if (showData.numtail != null && showData.numtail != "") { textContent = Number(textContent).toFixed(Number(showData.numtail)); } } }); } else { if (showData.textcontent != null && showData.textcontent != '') { textContent = showData.textcontent; } } var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; } if (width.indexOf("{value}") >= 0) { width = width.replace("{value}", textContent); width = width.replace("px", ""); width = eval('(' + width + ')'); width += "px"; } var clickName = ""; var clickparameter = ""; var onmouseoverAndoutName = ""; var onmouseoverAndoutparameter = ""; if (showData.clickname != '' && showData.clickname != '-') { clickName = showData.clickname; style += "cursor:pointer;"; if (showData.clickparameter != '') { if (clickName == 'showFrame') { clickparameter = "'" + showData.clickparameter + "'"; } else if (clickName == 'openFrame') { clickparameter = "'" + showData.clickparameter + "'"; } else if (clickName == 'tabFrame') { clickparameter = "'" + showData.clickparameter + "'"; } } if (clickName == 'openLine') { let chartMpid = mpid; if (showData.chartmpids != null && showData.chartmpids != '') { chartMpid = showData.chartmpids; } clickparameter = "'" + chartMpid + "'"; } else if (clickName == 'roundTime') { clickName = ""; onmouseoverAndoutName = "showRoundtimeOne"; onmouseoverAndoutparameter = "'" + showData.roundtimeid + "'"; } if (showData.urlstring != '' && clickName == 'showFrame') { clickName = "reFrame"; clickparameter = "'" + showData.urlstring + "'"; } else if (showData.urlstring != '' && clickName == 'openFrame') { clickName = "urlClick"; clickparameter = "'openFrame','" + showData.urlstring + "'"; } else if (showData.urlstring != '' && clickName == 'tabFrame') { let tabFrameUrls = showData.urlstring.split(","); let tabFrameName = "标签页"; if (tabFrameUrls.length > 1) { tabFrameName = tabFrameUrls[1]; } clickName = "urlClick"; clickparameter = "'tabFrame','" + tabFrameUrls[0] + "','" + showData.id + "','" + tabFrameName + "'"; } } var textHeight = (showData.textheight).replace("px", "") + "px"; divHtml = "
"; // if (clickName != '' && clickName != '-') { // divHtml += "" + textContent + ""; // } else { // divHtml += textContent; // } divHtml += textContent; divHtml += "
"; // } // }); return divHtml; } /** * 摄像头组件 */ function showAssembly_Camera(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualCamera/getJson.do?pid=" + content.id, async: false, globle: false, error: function () { return false; }, success: function (data) { var datas = eval('(' + data + ')'); var color = datas[0].color; var camera = datas[0].camera; var showContent = ""; var cameraId = ""; var cameraName = ""; if (camera != null) { cameraId = camera.id; cameraName = camera.name; if (camera.style == '0') {//枪机 showContent += ""; showContent += ""; showContent += ""; } else if (camera.style == '1') {//球机 showContent += ""; showContent += ""; showContent += ""; } } var style = ""; var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "onmouseup=\"doUp2('" + content.id + "');\" "; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; divHtml = "
"; divHtml += "
" + showContent + "
" divHtml += "
" + camera.name + "
" divHtml += "
"; } }); return divHtml; } function showAssembly_Camera_View(content, showData) { var divHtml = ""; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualCamera/getJson.do?pid=" + content.id, // async: false, // globle: false, // error: function () { // return false; // }, // success: function (data) { // var datas = eval('(' + data + ')'); var color = showData.color; var camera = showData.camera; var showContent = ""; var cameraId = ""; var cameraName = ""; if (camera != null) { cameraId = camera.id; cameraName = camera.name; if (camera.style == '0') {//枪机 showContent += ""; showContent += ""; showContent += ""; } else if (camera.style == '1') {//球机 showContent += ""; showContent += ""; showContent += ""; } } var style = ""; var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; divHtml = "
"; divHtml += "
" + showContent + "
" divHtml += "
"; if (showData.mqTheme != '') { let addthemeSt = true; if (cameraAlarm_auto_mq_theme.length > 0) { for (let i = 0; i < cameraAlarm_auto_mq_theme.length; i++) { if (cameraAlarm_auto_mq_theme[i] == showData.mqTheme) { addthemeSt = false; } } if (addthemeSt) { cameraAlarm_auto_mq_theme.push(showData.mqTheme); } } else { cameraAlarm_auto_mq_theme.push(showData.mqTheme); } } $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualCameraAlarm/getJson.do?pid=" + showData.id, async: false, error: function () { return false; }, success: function (data) { var datas = eval('(' + data + ')'); cameraAlarmList.push({ id: showData.cameraid, child: datas }) } }); return divHtml; } /** * 表格组件 */ function showAssembly_Form(content) { var style = content.style; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } // var divwidth = content.width; // var divheight = content.height; // let postX = content.postx; // let postY = content.posty; // if (postX.indexOf("%") < 0) { // postX += "px"; // } // if (postY.indexOf("%") < 0) { // postY += "px"; // } // if (divwidth.indexOf("px") < 0 && divwidth.indexOf("%") < 0) { // divwidth += "px"; // } // if (divheight.indexOf("px") < 0 && divheight.indexOf("%") < 0) { // divheight += "px"; // } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "onmouseup=\"doUp2('" + content.id + "');\" "; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; var divHtml = "
"; divHtml += ""; //table-layout: fixed; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualForm/getJson.do?pid=" + content.id + "&unitId=" + unitId, async: false, globle: false, error: function () { return false; }, success: function (data) { data = eval('(' + data + ')'); for (var i = 0; i < data.length; i++) { var r = data[i]; divHtml += "" if (r.nodes != '') { for (var j = 0; j < r.nodes.length; j++) { let c = r.nodes[j]; let tdStyle = c.style; let width = c.width + "%"; let height = c.height + "%"; let bkcolor = c.background; let textcontent = ""; // if (c.textcontent != null && c.textcontent != '') { // textcontent = c.textcontent; // } if (c.formSql != null && c.formSql == 'true') { textcontent = "s"; } else if (c.mpid != null && c.mpid != '') { textcontent = "m"; } else if (c.urldata != null && c.urldata != '') { textcontent = "u"; } else { if (c.textcontent != null && c.textcontent != '') { textcontent = c.textcontent; } } let fontsize = (c.fontsize).replace("px", "") + "px"; let fontcolor = c.fontcolor; let textalign = c.textalign; let verticalalign = c.verticalalign; if (verticalalign == "center") { verticalalign = "middle"; } let fontweight = c.fontweight; let border = c.border; if (border != '') { tdStyle += border; } let borderradius = c.borderradius; if (borderradius != '') { tdStyle += borderradius; } let padding = c.padding; if (padding != '') { tdStyle += padding; } divHtml += ""; } } divHtml += ""; } } }); divHtml += "
"; divHtml += "" + textcontent + "
"; divHtml += "
"; return divHtml; } var roundtimecontentList = ""; var formSqlPointList = []; var formRowStyleList = []; function showAssembly_Form_View(content, showData) { var style = content.style; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var divwidth = content.width; var divheight = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (divwidth.indexOf("px") < 0 && divwidth.indexOf("%") < 0) { divwidth += "px"; } if (divheight.indexOf("px") < 0 && divheight.indexOf("%") < 0) { divheight += "px"; } if (content.roundtimecontent != null && content.roundtimecontent != '') { style += "display:none;"; roundtimecontentList += content.id + ","; } else { style += "display:block;"; } var divHtml = "
"; divHtml += ""; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualForm/getJson.do?pid=" + content.id, // async: false, // globle: false, // error: function () { // return false; // }, // success: function (data) { // data = eval('(' + data + ')'); for (var i = 0; i < showData.length; i++) { var r = showData[i]; divHtml += "" if (r.nodes != '') { for (var j = 0; j < r.nodes.length; j++) { let c = r.nodes[j]; let tdStyle = c.style; let width = c.width + "%"; let height = c.height + "%"; let bkcolor = c.background; let textcontent = ""; let fontsize = (c.fontsize).replace("px", "") + "px"; let fontcolor = c.fontcolor; let textalign = c.textalign; let verticalalign = c.verticalalign; if (verticalalign == "center") { verticalalign = "middle"; } let fontweight = c.fontweight; let border = c.border; if (border != '') { tdStyle += border; } let borderradius = c.borderradius; if (borderradius != '') { tdStyle += borderradius; } let padding = c.padding; if (padding != '') { tdStyle += padding; } if (c.formSql != null && c.formSql != '') { // console.log(c.formSql) formSqlPointList.push(c.formSql) } if (c.showStyle != null && c.showStyle != '') { formRowStyleList.push(c.showStyle); } if (c.mpid != null && c.mpid != '') { let mp = c.textcontent; // console.log(mp) if (c.timest != null && c.timest != "" && c.timest == 'true') { let timestnum = ""; if (c.timestnum != null && c.timestnum != "") { if (c.timestnum.indexOf(",") >= 0) { timestnum = c.timestnum; } else { timestnum = "0," + c.timestnum; } } let timestnumS = timestnum.split(","); textcontent = mp.substring(Number(timestnumS[0]), Number(timestnumS[1])); } else { textcontent = mp; //系数 if (c.rate != null && c.rate != "") { let rate = c.rate; if ("+-*/".indexOf(rate.substring(0, 1)) == -1) { rate = "*" + rate; } textcontent = eval(textcontent + rate); } if (c.numtail != null && c.numtail != "") { textcontent = Number(textcontent).toFixed(Number(c.numtail)); } if (c.unitst != '' && c.unitst == "true") { if (mp.unit != null) { textcontent += mp.unit; } } } // console.log(textcontent) mqttMpcode = mqttMpcode + c.mpid + ","; } else if (c.urldata != null && c.urldata != '') { $.ajax({ type: 'GET', url: ext.contextPath + c.urldata, async: false, globle: false, dataType: 'json', error: function () { return false; }, success: function (result) { textcontent = result.result; if (c.numtail != null && c.numtail != "") { textcontent = Number(textcontent).toFixed(Number(c.numtail)); } } }); } else { if (c.textcontent != null && c.textcontent != '') { textcontent = c.textcontent; } } divHtml += ""; } } divHtml += ""; } // } // }); divHtml += "
"; divHtml += "" + textcontent + "
"; divHtml += "
"; return divHtml; } /** * 折线图组件 */ function showAssembly_LineChart(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualLineChart/getJson.do?pid=" + content.id, async: false, globle: false, error: function () { return false; }, success: function (data) { let datas = eval('(' + data + ')'); var style = ""; if (content.style != '') { style = content.style; } var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv reSize\" onmousedown=\"doDown();\" onmouseup=\"doUp();\" onmousemove=\"doMove();\""; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; divHtml = "
"; divHtml += ""; divHtml += "
"; // divHtml+="
"; } }); return divHtml; } function showAssembly_LineChart_View(content, showData) { var divHtml = ""; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualLineChart/getJson.do?pid=" + content.id, // async: false, // globle: false, // error: function () { // return false; // }, // success: function (data) { // let datas = eval('(' + data + ')'); var style = ""; if (content.style != '') { style = content.style; } var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let onmouseupSt = ""; if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; } divHtml = "
"; divHtml += "
"; // } // }); return divHtml; } function showLineChart(contentId, refreshtime, showData, showSeriesData, showYAxisData) { // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualLineChart/getChartJson.do?contentId=" + contentId, // async: true, // globle: false, // dataType: 'json', // error: function () { // return false; // }, // success: function (data) { var dataVisualLineChart = showData; var dataVisualLineChartSeries = showSeriesData; var dataVisualLineChartYAxis = showYAxisData; document.getElementById(contentId).removeAttribute("_echarts_instance_"); var myChart = echarts.init(document.getElementById(contentId)); myChart.showLoading({ text: '数据正在加载...', textStyle: {fontSize: 30, color: '#444'}, effectOption: {backgroundColor: 'rgba(0, 0, 0, 0)'}, zlevel: 0 }); let colors = dataVisualLineChart.colors.split(','); let titleData = []; let titleColor = ""; if (dataVisualLineChart.titleColor != null && dataVisualLineChart.titleColor != '') { titleColor = dataVisualLineChart.titleColor } let titleFontSize = "18"; if (dataVisualLineChart.titleFontSize != null && dataVisualLineChart.titleFontSize != '') { titleFontSize = dataVisualLineChart.titleFontSize } let titleFontWeight = "bolder"; if (dataVisualLineChart.titleFontWeight != null && dataVisualLineChart.titleFontWeight != '') { titleFontWeight = dataVisualLineChart.titleFontWeight } let subtitleColor = "#aaa"; if (dataVisualLineChart.subtitleColor != null && dataVisualLineChart.subtitleColor != '') { subtitleColor = dataVisualLineChart.subtitleColor } let subtitleFontSize = "12"; if (dataVisualLineChart.subtitleFontSize != null && dataVisualLineChart.subtitleFontSize != '') { subtitleFontSize = dataVisualLineChart.subtitleFontSize } let subtitleFontWeight = "normal"; if (dataVisualLineChart.subtitleFontWeight != null && dataVisualLineChart.subtitleFontWeight != '') { subtitleFontWeight = dataVisualLineChart.subtitleFontWeight } titleData.push({ text: dataVisualLineChart.titleText, textStyle: { // color: titleColor, fontSize: titleFontSize, fontWeight: titleFontWeight }, subtext: dataVisualLineChart.subtitleText, subtextStyle: { color: subtitleColor, fontSize: subtitleFontSize, fontWeight: subtitleFontWeight }, left: dataVisualLineChart.titlePosition }) if (titleColor != '') { titleData[0].textStyle.color = titleColor; } let datazoomst = []; if (dataVisualLineChart.datazoomst == 'true') { datazoomst.push({ type: 'inside', start: 0, end: 100 }) datazoomst.push({ start: 0, end: 100, handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z', handleSize: '50%', height: '25px', handleStyle: { color: '#fff', shadowBlur: 3, shadowColor: 'rgba(0, 0, 0, 0.6)', shadowOffsetX: 2, shadowOffsetY: 2 } }) } let xAxisData = []; let xaxisd = ""; if (dataVisualLineChart.xaxisdata != null && dataVisualLineChart.xaxisdata != '') { xaxisd = dataVisualLineChart.xaxisdata; } let xaxislinecolor = "#ccc"; if (dataVisualLineChart.xaxislinecolor != null && dataVisualLineChart.xaxislinecolor != '') { xaxislinecolor = dataVisualLineChart.xaxislinecolor; } let xaxisaxislabelfontsize = "12"; if (dataVisualLineChart.xaxisaxislabelfontsize != null && dataVisualLineChart.xaxisaxislabelfontsize != '') { xaxisaxislabelfontsize = dataVisualLineChart.xaxisaxislabelfontsize; } let xaxisaxislabelcolor = "#ccc"; if (dataVisualLineChart.xaxisaxislabelcolor != null && dataVisualLineChart.xaxisaxislabelcolor != '') { xaxisaxislabelcolor = dataVisualLineChart.xaxisaxislabelcolor; } let xaxissplitlinetype = "solid"; if (dataVisualLineChart.xaxissplitlinetype != null && dataVisualLineChart.xaxissplitlinetype != '') { xaxissplitlinetype = dataVisualLineChart.xaxissplitlinetype; } let xaxissplitlinecolor = "#ccc"; if (dataVisualLineChart.xaxissplitlinecolor != null && dataVisualLineChart.xaxissplitlinecolor != '') { xaxissplitlinecolor = dataVisualLineChart.xaxissplitlinecolor; } let xaxisLabel = []; let xaxistype = dataVisualLineChart.xaxistype; if (xaxistype == 'time') { xaxisLabel = ({ show: eval(dataVisualLineChart.xaxisaxislabelshow.toLowerCase()), fontSize: xaxisaxislabelfontsize, color: xaxisaxislabelcolor, formatter: { none: '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}' } }) } else { xaxisLabel = ({ show: eval(dataVisualLineChart.xaxisaxislabelshow.toLowerCase()), fontSize: xaxisaxislabelfontsize, color: xaxisaxislabelcolor }) } if (xaxisd != '') { xAxisData.push({ data: xaxisd.split(","), type: dataVisualLineChart.xaxistype, boundaryGap: false, axisLine: { show: eval(dataVisualLineChart.xaxislineshow.toLowerCase()), lineStyle: { color: xaxislinecolor } }, axisTick: { show: eval(dataVisualLineChart.xaxisaxistickshow.toLowerCase()) }, splitLine: { show: eval(dataVisualLineChart.xaxissplitlineshow.toLowerCase()), lineStyle: { color: xaxissplitlinecolor, type: xaxissplitlinetype } }, axisLabel: xaxisLabel }) } else { xAxisData.push({ type: dataVisualLineChart.xaxistype, boundaryGap: false, axisLine: { show: eval(dataVisualLineChart.xaxislineshow.toLowerCase()), lineStyle: { color: xaxislinecolor } }, axisTick: { show: eval(dataVisualLineChart.xaxisaxistickshow.toLowerCase()) }, splitLine: { show: eval(dataVisualLineChart.xaxissplitlineshow.toLowerCase()), lineStyle: { color: xaxissplitlinecolor, type: xaxissplitlinetype } }, axisLabel: xaxisLabel }) } let legendDataD = []; let series = []; let reMpids = ""; let selectedSt = {}; for (let i = 0; i < dataVisualLineChartSeries.length; i++) { let seriesData = dataVisualLineChartSeries[i]; legendDataD.push(seriesData.name); let markPointData = []; let markLineData = []; let maxshow = seriesData.maxshow; if (maxshow == "true") { markPointData.push({ type: "max", name: "最大值" }) } let minshow = seriesData.minshow; if (minshow == "true") { markPointData.push({ type: "min", name: "最小值" }) } let avgshow = seriesData.avgshow; if (avgshow == "true") { markLineData.push({ type: "average", name: "平均值", label: { position: 'insideEndTop' } }) } if (seriesData.markerline != null && seriesData.markerline != '') { let markerlines = seriesData.markerline.split(","); for (let m = 0; m < markerlines.length; m++) { markLineData.push({ label: { position: 'insideEndTop' }, yAxis: markerlines[m] }) } } let stackst = ""; if (seriesData.stackst != null && seriesData.stackst != '') { stackst = seriesData.stackst } let areaStyleData = []; if (seriesData.areastyle == "true") { areaStyleData.push({ opacity: 0.2 }) } else if (seriesData.areastyle == "false") { areaStyleData.push({ opacity: 0 }) } let symbolst = "none"; if (seriesData.symbolst == "true") { symbolst = "emptyCircle"; } let mpid = ""; if (seriesData.mpid != null && seriesData.mpid != '') { mpid = seriesData.mpid; reMpids += mpid + ","; } let seriesPushData = []; if (seriesData.ishistorydata == 'true') { let timerange = seriesData.timerange; let lsdt = ""; let ledt = ""; if (timerange != 'dateSelect') { let nowTime = getNowTime(); lsdt = ""; ledt = nowTime; if (timerange == "hour") { lsdt = getPlusTime(nowTime, -1, 'hour'); } else if (timerange == "day") { lsdt = getPlusTime(nowTime, -1, 'day'); } else if (timerange == "week") { lsdt = getPlusTime(nowTime, -7, 'day'); } else if (timerange == "month") { lsdt = getPlusTime(nowTime, -1, 'month'); } else if (timerange == "year") { lsdt = getPlusTime(nowTime, -1, 'year'); ledt = ledt.substring(0, 4) + "-12-31 23:59"; } } else { lsdt = sdt; ledt = edt; } let xsubstring = "all"; if (dataVisualLineChart.xsubstring != null && dataVisualLineChart.xsubstring != '') { xsubstring = dataVisualLineChart.xsubstring; } $.ajax({ type: 'GET', url: ext.contextPath + "/data/getDetailDataForEXAndDV.do", async: false, globle: false, data: { mpcode: mpid, sdt: lsdt, edt: ledt, timerange: timerange, xsubstring: xsubstring }, dataType: 'json', error: function () { return false; }, success: function (result) { for (let i = 0; i < result.length; i++) { seriesPushData.push(result[i].data); } } }); seriesPushData = seriesPushData[0]; } else { if (mpid != "") { let mpids = mpid.split(","); for (let i = 0; i < mpids.length; i++) { $.ajax({ type: 'GET', url: ext.contextPath + "/work/mpoint/getMpointJsonForEX.do", async: false, globle: false, data: { mpid: mpids[i] }, dataType: 'json', error: function () { return false; }, success: function (result) { let mp = result[0]; seriesPushData.push(mp.parmvalue); } }); } } else if (seriesData.urldata != null && seriesData.urldata != '') { $.ajax({ type: 'GET', url: ext.contextPath + seriesData.urldata, async: false, globle: false, dataType: 'json', error: function () { return false; }, success: function (result) { seriesPushData.push(result.result); seriesPushData = seriesPushData[0]; } }); } else { let fixedvalue = ""; if (seriesData.fixedvalue != null && seriesData.fixedvalue != '') { fixedvalue = seriesData.fixedvalue; } seriesPushData = fixedvalue.split(","); } } series.push({ data: seriesPushData, symbol: symbolst, name: seriesData.name, type: 'line', stack: stackst, smooth: true, markPoint: { data: markPointData }, markLine: { data: markLineData }, areaStyle: areaStyleData[0], yAxisIndex: seriesData.yaxisindex }) let selecteSt = "true"; if (seriesData.selectst != '') { selecteSt = seriesData.selectst; } selectedSt[seriesData.name] = eval(selecteSt.toLowerCase()); } let yAxis = []; let leftMorder = 0; let rightMorder = 0; for (let i = 0; i < dataVisualLineChartYAxis.length; i++) { let yAxisData = dataVisualLineChartYAxis[i]; let offset = 0; let position = yAxisData.position; if (position == 'left') { offset = leftMorder * 40; leftMorder++; } else if (position == 'right') { offset = rightMorder * 40; rightMorder++; } let linecolor = "#ccc"; if (yAxisData.linecolor != null && yAxisData.linecolor != '') { linecolor = yAxisData.linecolor; } let axislabelcolor = "#ccc"; if (yAxisData.axislabelcolor != null && yAxisData.axislabelcolor != '') { axislabelcolor = yAxisData.axislabelcolor; } let axislabelfontsize = "12"; if (yAxisData.axislabelfontsize != null && yAxisData.axislabelfontsize != '') { axislabelfontsize = yAxisData.axislabelfontsize; } let yaxissplitlinetype = "solid"; if (yAxisData.splitlinetype != null && yAxisData.splitlinetype != '') { yaxissplitlinetype = yAxisData.splitlinetype; } let yaxissplitlinecolor = "#ccc"; if (yAxisData.splitlinecolor != null && yAxisData.splitlinecolor != '') { yaxissplitlinecolor = yAxisData.splitlinecolor; } yAxis.push({ type: 'value', name: yAxisData.unit, position: position, offset: offset,//循环显示Y轴位置 axisLine: { show: eval(yAxisData.lineshow.toLowerCase()), lineStyle: { color: linecolor } }, axisTick: { show: eval(yAxisData.axistickshow.toLowerCase()) }, splitLine: { show: eval(yAxisData.splitlineshow.toLowerCase()), lineStyle: { color: yaxissplitlinecolor, type: yaxissplitlinetype } }, axisLabel: { show: eval(yAxisData.axislabelshow.toLowerCase()), color: axislabelcolor, fontSize: axislabelfontsize }, scale: eval(yAxisData.scale.toLowerCase())//设置成 true 后坐标刻度不会强制包含零刻度。 }); if (yAxisData.max != null && yAxisData.max != '') { yAxis[i].max = yAxisData.max } if (yAxisData.min != null && yAxisData.min != '') { yAxis[i].min = yAxisData.min } // console.log(yAxis[i]) } let legendData = []; let legendShow = eval("true".toLowerCase()); let legendPosition = "center"; let legendTextFontsize = "12"; let legendSt = dataVisualLineChart.legendPosition; if (legendSt == 'false') { legendShow = eval("false".toLowerCase()); } else { legendPosition = legendSt; legendShow = eval("true".toLowerCase()); if (dataVisualLineChart.legendTextFontsize != '') { legendTextFontsize = dataVisualLineChart.legendTextFontsize; } } let xsubstring = "all"; if (dataVisualLineChart.xsubstring != null && dataVisualLineChart.xsubstring != '') { xsubstring = dataVisualLineChart.xsubstring; } legendData.push({ show: legendShow, data: legendDataD, left: legendPosition, textStyle: { color: colors, fontSize: legendTextFontsize }, selected: selectedSt }) let option = { color: colors, animation: false, title: titleData, legend: legendData, grid: { left: '10px', // 与容器左侧的距离 right: '10px', // 与容器右侧的距离 top: '60px', // 与容器顶部的距离 bottom: '15px', // 与容器底部的距离 containLabel: true }, xAxis: xAxisData, yAxis: yAxis, series: series, tooltip: { trigger: 'axis' }, dataZoom: datazoomst }; myChart.setOption(option, true); myChart.hideLoading(); window.addEventListener('resize', function () {//执行 myChart.resize(); }) if (refreshtime != null && refreshtime != '' && refreshtime != '0') { if (reMpids != '') { reMpids = reMpids.substring(0, reMpids.length - 1); reMpids = reMpids.split(","); setInterval(function () { for (var i = 0; i < reMpids.length; i++) { let seriesData = dataVisualLineChartSeries[i]; if (seriesData.ishistorydata == 'true') { let timerange = seriesData.timerange; let lsdt = ""; let ledt = ""; if (timerange != 'dateSelect') { let nowTime = getNowTime(); lsdt = ""; ledt = nowTime; if (timerange == "hour") { lsdt = getPlusTime(nowTime, -1, 'hour'); } else if (timerange == "day") { lsdt = getPlusTime(nowTime, -1, 'day'); } else if (timerange == "week") { lsdt = getPlusTime(nowTime, -7, 'day'); } else if (timerange == "month") { lsdt = getPlusTime(nowTime, -1, 'month'); } else if (timerange == "year") { lsdt = getPlusTime(nowTime, -1, 'year'); } } else { lsdt = sdt; ledt = edt; } // console.log(reMpids[i]); $.ajax({ type: 'GET', url: ext.contextPath + "/data/getDetailDataForEXAndDV.do", async: false, globle: false, data: { mpcode: reMpids[i], sdt: lsdt, edt: ledt, timerange: timerange, xsubstring: xsubstring }, dataType: 'json', error: function () { return false; }, success: function (result) { option.series[i].data = result[0].data; // myChart.setOption({ // series: [{ // data: result[0].data // }] // }); // myChart.appendData({ // seriesIndex: i, // data: result[0].data // }); //刷新 myChart.setOption(option, true); } }); } else { $.ajax({ type: 'GET', url: ext.contextPath + "/work/mpoint/getMpointJsonForEX.do", async: false, globle: false, data: { mpid: reMpids[i] }, dataType: 'json', error: function () { return false; }, success: function (result) { var mpvalue = new Array(); mpvalue[0] = result[0].parmvalue; option.series[i].data = mpvalue; //刷新 myChart.setOption(option, true); } }); } } }, Number(refreshtime) * 30000); } } // } // }); } /** * 柱状图组件 */ function showAssembly_BarChart(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualBarChart/getJson.do?pid=" + content.id, async: false, globle: false, error: function () { return false; }, success: function (data) { let datas = eval('(' + data + ')'); var style = ""; if (content.style != '') { style = content.style; } var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv reSize\" onmousedown=\"doDown();\" onmouseup=\"doUp();\" onmousemove=\"doMove();\""; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; divHtml = "
"; divHtml += ""; divHtml += "
"; // divHtml+="
"; } }); return divHtml; } function showAssembly_BarChart_View(content, showData) { var divHtml = ""; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualBarChart/getJson.do?pid=" + content.id, // async: false, // globle: false, // error: function () { // return false; // }, // success: function (data) { // let datas = eval('(' + data + ')'); var style = ""; if (content.style != '') { style = content.style; } var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let onmouseupSt = ""; if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; } divHtml = "
"; divHtml += "
"; // } // }); return divHtml; } function showBarChart(contentId, refreshtime, showData, showSeriesData, showYAxisData) { // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualBarChart/getChartJson.do?contentId=" + contentId, // async: true, // globle: false, // dataType: 'json', // error: function () { // return false; // }, // success: function (data) { // if (data != '' && data.length == 3) { var dataVisualBarChart = showData; var dataVisualBarChartSeries = showSeriesData; var dataVisualBarChartYAxis = showYAxisData; document.getElementById(contentId).removeAttribute("_echarts_instance_"); var myChart = echarts.init(document.getElementById(contentId)); myChart.showLoading({ text: '数据正在加载...', textStyle: {fontSize: 30, color: '#444'}, effectOption: {backgroundColor: 'rgba(0, 0, 0, 0)'}, zlevel: 0 }); let colors = dataVisualBarChart.colors.split(','); let titleData = []; let titleColor = ""; if (dataVisualBarChart.titleColor != null && dataVisualBarChart.titleColor != '') { titleColor = dataVisualBarChart.titleColor } let titleFontSize = "18"; if (dataVisualBarChart.titleFontSize != null && dataVisualBarChart.titleFontSize != '') { titleFontSize = dataVisualBarChart.titleFontSize } let titleFontWeight = "bolder"; if (dataVisualBarChart.titleFontWeight != null && dataVisualBarChart.titleFontWeight != '') { titleFontWeight = dataVisualBarChart.titleFontWeight } let subtitleColor = "#aaa"; if (dataVisualBarChart.subtitleColor != null && dataVisualBarChart.subtitleColor != '') { subtitleColor = dataVisualBarChart.subtitleColor } let subtitleFontSize = "12"; if (dataVisualBarChart.subtitleFontSize != null && dataVisualBarChart.subtitleFontSize != '') { subtitleFontSize = dataVisualBarChart.subtitleFontSize } let subtitleFontWeight = "normal"; if (dataVisualBarChart.subtitleFontWeight != null && dataVisualBarChart.subtitleFontWeight != '') { subtitleFontWeight = dataVisualBarChart.subtitleFontWeight } titleData.push({ text: dataVisualBarChart.titleText, textStyle: { // color: titleColor, fontSize: titleFontSize, fontWeight: titleFontWeight }, subtext: dataVisualBarChart.subtitleText, subtextStyle: { color: subtitleColor, fontSize: subtitleFontSize, fontWeight: subtitleFontWeight }, left: dataVisualBarChart.titlePosition }) if (titleColor != '') { titleData[0].textStyle.color = titleColor; } let datazoomst = []; if (dataVisualBarChart.datazoomst == 'true') { datazoomst.push({ type: 'inside', start: 0, end: 100 }) datazoomst.push({ start: 0, end: 100, handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z', handleSize: '50%', height: '25px', handleStyle: { color: '#fff', shadowBlur: 3, shadowColor: 'rgba(0, 0, 0, 0.6)', shadowOffsetX: 2, shadowOffsetY: 2 } }) } let xAxisData = []; let xaxisd = ""; if (dataVisualBarChart.xaxisdata != null && dataVisualBarChart.xaxisdata != '') { xaxisd = dataVisualBarChart.xaxisdata; } let xaxislinecolor = "#ccc"; if (dataVisualBarChart.xaxislinecolor != null && dataVisualBarChart.xaxislinecolor != '') { xaxislinecolor = dataVisualBarChart.xaxislinecolor; } let xaxisaxislabelfontsize = "12"; if (dataVisualBarChart.xaxisaxislabelfontsize != null && dataVisualBarChart.xaxisaxislabelfontsize != '') { xaxisaxislabelfontsize = dataVisualBarChart.xaxisaxislabelfontsize; } let xaxisaxislabelcolor = "#ccc"; if (dataVisualBarChart.xaxisaxislabelcolor != null && dataVisualBarChart.xaxisaxislabelcolor != '') { xaxisaxislabelcolor = dataVisualBarChart.xaxisaxislabelcolor; } let xsubstring = "all"; if (dataVisualBarChart.xsubstring != null && dataVisualBarChart.xsubstring != '') { xsubstring = dataVisualBarChart.xsubstring; } let direction = "0"; if (dataVisualBarChart.direction != null && dataVisualBarChart.direction != '') { direction = dataVisualBarChart.direction } let xaxisLabel = []; let xaxistype = dataVisualBarChart.xaxistype; if (xaxistype == 'time') { xaxisLabel = ({ show: eval(dataVisualBarChart.xaxisaxislabelshow.toLowerCase()), fontSize: xaxisaxislabelfontsize, color: xaxisaxislabelcolor, formatter: { none: '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}' } }) } else { xaxisLabel = ({ show: eval(dataVisualBarChart.xaxisaxislabelshow.toLowerCase()), fontSize: xaxisaxislabelfontsize, color: xaxisaxislabelcolor }) } if (direction == '0') { if (xaxisd != '') { xAxisData.push({ data: xaxisd.split(","), type: dataVisualBarChart.xaxistype, axisLine: { show: eval(dataVisualBarChart.xaxislineshow.toLowerCase()), lineStyle: { color: xaxislinecolor } }, axisTick: { show: eval(dataVisualBarChart.xaxisaxistickshow.toLowerCase()) }, splitLine: { show: eval(dataVisualBarChart.xaxissplitlineshow.toLowerCase()) }, axisLabel: xaxisLabel }) } else { xAxisData.push({ type: dataVisualBarChart.xaxistype, axisLine: { show: eval(dataVisualBarChart.xaxislineshow.toLowerCase()), lineStyle: { color: xaxislinecolor } }, axisTick: { show: eval(dataVisualBarChart.xaxisaxistickshow.toLowerCase()) }, splitLine: { show: eval(dataVisualBarChart.xaxissplitlineshow.toLowerCase()) }, axisLabel: xaxisLabel }) } } else if (direction == '1') { xAxisData.push({ type: "value", axisLine: { show: eval(dataVisualBarChart.xaxislineshow.toLowerCase()), lineStyle: { color: xaxislinecolor } }, axisTick: { show: eval(dataVisualBarChart.xaxisaxistickshow.toLowerCase()) }, splitLine: { show: eval(dataVisualBarChart.xaxissplitlineshow.toLowerCase()) }, axisLabel: xaxisLabel }) } let legendDataD = []; let series = []; let reMpids = []; let selectedSt = {}; for (let i = 0; i < dataVisualBarChartSeries.length; i++) { let seriesData = dataVisualBarChartSeries[i]; legendDataD.push(seriesData.name); let markPointData = []; let markBarData = []; let maxshow = seriesData.maxshow; if (maxshow == "true") { markPointData.push({ type: "max", name: "最大值" }) } let minshow = seriesData.minshow; if (minshow == "true") { markPointData.push({ type: "min", name: "最小值" }) } let avgshow = seriesData.avgshow; if (avgshow == "true") { markBarData.push({ type: "average", name: "平均值", label: { position: 'insideEndTop' } }) } if (seriesData.markerline != null && seriesData.markerline != '') { let markerlines = seriesData.markerline.split(","); for (let m = 0; m < markerlines.length; m++) { markBarData.push({ label: { position: 'insideEndTop' }, yAxis: markerlines[m] }) } } let stackst = ""; if (seriesData.stackst != null && seriesData.stackst != '') { stackst = seriesData.stackst } let mpid = ""; if (seriesData.mpid != null && seriesData.mpid != '') { mpid = seriesData.mpid; reMpids.push(mpid); } let seriesPushData = []; if (seriesData.ishistorydata == 'true') { let timerange = seriesData.timerange; let lsdt = ""; let ledt = ""; if (timerange != 'dateSelect') { let nowTime = getNowTime(); lsdt = ""; ledt = nowTime; if (timerange == "hour") { lsdt = getPlusTime(nowTime, -1, 'hour'); } else if (timerange == "day") { lsdt = getPlusTime(nowTime, -1, 'day'); } else if (timerange == "week") { lsdt = getPlusTime(nowTime, -7, 'day'); } else if (timerange == "month") { lsdt = getPlusTime(nowTime, -1, 'month'); } else if (timerange == "year") { lsdt = getPlusTime(nowTime, -1, 'year'); ledt = ledt.substring(0, 4) + "-12-31 23:59"; } } else { lsdt = sdt; ledt = edt; } $.ajax({ type: 'GET', url: ext.contextPath + "/data/getDetailDataForEXAndDV.do", async: false, globle: false, data: { mpcode: mpid, sdt: lsdt, edt: ledt, timerange: timerange, xsubstring: xsubstring }, dataType: 'json', error: function () { return false; }, success: function (result) { for (let i = 0; i < result.length; i++) { seriesPushData.push(result[i].data); } } }); seriesPushData = seriesPushData[0]; } else { if (mpid != "") { let mpids = mpid.split(","); for (let i = 0; i < mpids.length; i++) { $.ajax({ type: 'GET', url: ext.contextPath + "/work/mpoint/getMpointJsonForEX.do", async: false, globle: false, data: { mpid: mpids[i] }, dataType: 'json', error: function () { return false; }, success: function (result) { let mp = result[0]; seriesPushData.push(mp.parmvalue); } }); } } else if (seriesData.urldata != null && seriesData.urldata != '') { $.ajax({ type: 'GET', url: ext.contextPath + seriesData.urldata, async: false, globle: false, dataType: 'json', error: function () { return false; }, success: function (result) { seriesPushData.push(result.result); seriesPushData = seriesPushData[0]; } }); } else { let fixedvalue = ""; if (seriesData.fixedvalue != null && seriesData.fixedvalue != '') { fixedvalue = seriesData.fixedvalue; } seriesPushData = fixedvalue.split(","); } } let barwidth = ""; if (seriesData.barwidth != null && seriesData.barwidth != '') { barwidth = seriesData.barwidth; } let borderradius = ""; if (seriesData.borderradius != null && seriesData.borderradius != '') { if (seriesData.borderradius.indexOf(",") >= 0) { borderradius = eval('(' + seriesData.borderradius + ')'); } else { borderradius = Number(seriesData.borderradius); } } let bkstylecolor = ""; let showBackground = ""; if (seriesData.bkstylecolor != null && seriesData.bkstylecolor != '') { showBackground = eval("true".toLowerCase()); bkstylecolor = seriesData.bkstylecolor; } else { showBackground = eval("false".toLowerCase()); } let bkstyleborderradius = ""; if (seriesData.bkstyleborderradius != null && seriesData.bkstyleborderradius != '') { if (seriesData.bkstyleborderradius.indexOf(",") >= 0) { bkstyleborderradius = eval('(' + seriesData.bkstyleborderradius + ')'); } else { bkstyleborderradius = Number(seriesData.bkstyleborderradius); } } let stype = "bar"; if (seriesData.type != null && seriesData.type != '') { stype = seriesData.type } let labelposition = "false"; if (seriesData.labelposition != null && seriesData.labelposition != '') { labelposition = seriesData.labelposition } let labelpositionSt = 'false'; if (labelposition != 'false') { labelpositionSt = 'true'; } let labelpositionfontsize = "12"; if (seriesData.labelpositionfontsize != null && seriesData.labelpositionfontsize != '') { labelpositionfontsize = seriesData.labelpositionfontsize } let labelpositioncolor = "#ccc"; if (seriesData.labelpositioncolor != null && seriesData.labelpositioncolor != '') { labelpositioncolor = seriesData.labelpositioncolor } let labelpositionunit = ""; if (seriesData.labelpositionunit != null && seriesData.labelpositionunit != '') { labelpositionunit = seriesData.labelpositionunit } series.push({ data: seriesPushData, name: seriesData.name, type: stype, stack: stackst, smooth: true, barWidth: barwidth, // barGap:bargap, itemStyle: { borderRadius: borderradius }, markPoint: { data: markPointData }, markLine: { data: markBarData }, showBackground: showBackground, backgroundStyle: { color: bkstylecolor, borderRadius: bkstyleborderradius }, yAxisIndex: seriesData.yaxisindex, label: { show: eval(labelpositionSt.toLowerCase()), position: labelposition, color: labelpositioncolor, fontSize: labelpositionfontsize, formatter: function (params) { if (params.value.length > 1) { return params.value[1] + labelpositionunit } else { return params.value + labelpositionunit } } } }) if (i == 0) { if (seriesData.bargap != null && seriesData.bargap != '') { series[0].barGap = seriesData.bargap; } } let selecteSt = "true"; if (seriesData.selectst != '') { selecteSt = seriesData.selectst; } selectedSt[seriesData.name] = eval(selecteSt.toLowerCase()); } let yAxis = []; let leftMorder = 0; let rightMorder = 0; for (let i = 0; i < dataVisualBarChartYAxis.length; i++) { let yAxisData = dataVisualBarChartYAxis[i]; let offset = 0; let position = yAxisData.position; if (position == 'left') { offset = leftMorder * 40; leftMorder++; } else if (position == 'right') { offset = rightMorder * 40; rightMorder++; } let linecolor = "#ccc"; if (yAxisData.linecolor != null && yAxisData.linecolor != '') { linecolor = yAxisData.linecolor; } let axislabelcolor = "#ccc"; if (yAxisData.axislabelcolor != null && yAxisData.axislabelcolor != '') { axislabelcolor = yAxisData.axislabelcolor; } let axislabelfontsize = "12"; if (yAxisData.axislabelfontsize != null && yAxisData.axislabelfontsize != '') { axislabelfontsize = yAxisData.axislabelfontsize; } if (direction == '0') { yAxis.push({ type: 'value', name: yAxisData.unit, position: position, offset: offset,//循环显示Y轴位置 axisLine: { show: eval(yAxisData.lineshow.toLowerCase()), lineStyle: { color: linecolor } }, axisTick: { show: eval(yAxisData.axistickshow.toLowerCase()) }, splitLine: { show: eval(yAxisData.splitlineshow.toLowerCase()) }, axisLabel: { show: eval(yAxisData.axislabelshow.toLowerCase()), color: axislabelcolor, fontSize: axislabelfontsize }, scale: eval(yAxisData.scale.toLowerCase())//设置成 true 后坐标刻度不会强制包含零刻度。 }); } else if (direction == '1') { if (xaxisd != '') { yAxis.push({ data: xaxisd.split(","), type: dataVisualBarChart.xaxistype, name: yAxisData.unit, position: position, offset: offset,//循环显示Y轴位置 axisLine: { show: eval(yAxisData.lineshow.toLowerCase()), lineStyle: { color: linecolor } }, axisTick: { show: eval(yAxisData.axistickshow.toLowerCase()) }, splitLine: { show: eval(yAxisData.splitlineshow.toLowerCase()) }, axisLabel: { show: eval(yAxisData.axislabelshow.toLowerCase()), color: axislabelcolor, fontSize: axislabelfontsize }, scale: eval(yAxisData.scale.toLowerCase())//设置成 true 后坐标刻度不会强制包含零刻度。 }) } else { yAxis.push({ type: dataVisualBarChart.xaxistype, name: yAxisData.unit, position: position, offset: offset,//循环显示Y轴位置 axisLine: { show: eval(yAxisData.lineshow.toLowerCase()), lineStyle: { color: linecolor } }, axisTick: { show: eval(yAxisData.axistickshow.toLowerCase()) }, splitLine: { show: eval(yAxisData.splitlineshow.toLowerCase()) }, axisLabel: { show: eval(yAxisData.axislabelshow.toLowerCase()), color: axislabelcolor, fontSize: axislabelfontsize }, scale: eval(yAxisData.scale.toLowerCase())//设置成 true 后坐标刻度不会强制包含零刻度。 }) } } if (yAxisData.max != null && yAxisData.max != '') { yAxis[i].max = yAxisData.max } if (yAxisData.min != null && yAxisData.min != '') { yAxis[i].min = yAxisData.min } // console.log(yAxis[i]) } let legendData = []; let legendShow = eval("true".toLowerCase()); let legendPosition = "center"; let legendTextFontsize = "12"; let legendSt = dataVisualBarChart.legendPosition; if (legendSt == 'false') { legendShow = eval("false".toLowerCase()); } else { legendPosition = legendSt; legendShow = eval("true".toLowerCase()); if (dataVisualBarChart.legendTextFontsize != '') { legendTextFontsize = dataVisualBarChart.legendTextFontsize; } } legendData.push({ show: legendShow, data: legendDataD, left: legendPosition, textStyle: { color: colors, fontSize: legendTextFontsize }, selected: selectedSt }) let option = { color: colors, animation: false, title: titleData, legend: legendData, grid: { left: '0px', // 与容器左侧的距离 right: '0px', // 与容器右侧的距离 top: '60px', // 与容器顶部的距离 bottom: '15px', // 与容器底部的距离 containLabel: true }, xAxis: xAxisData, yAxis: yAxis, series: series, tooltip: { trigger: 'axis' }, dataZoom: datazoomst }; myChart.setOption(option, true); myChart.hideLoading(); window.addEventListener('resize', function () {//执行 myChart.resize(); }) if (refreshtime != null && refreshtime != '' && refreshtime != '0') { if (reMpids.length > 0) { setInterval(function () { for (var i = 0; i < reMpids.length; i++) { let seriesData = dataVisualBarChartSeries[i]; if (seriesData.ishistorydata == 'true') { let timerange = seriesData.timerange; let lsdt = ""; let ledt = ""; if (timerange != 'dateSelect') { let nowTime = getNowTime(); lsdt = ""; ledt = nowTime; if (timerange == "hour") { lsdt = getPlusTime(nowTime, -1, 'hour'); } else if (timerange == "day") { lsdt = getPlusTime(nowTime, -1, 'day'); } else if (timerange == "week") { lsdt = getPlusTime(nowTime, -7, 'day'); } else if (timerange == "month") { lsdt = getPlusTime(nowTime, -1, 'month'); } else if (timerange == "year") { lsdt = getPlusTime(nowTime, -1, 'year'); } } else { lsdt = sdt; ledt = edt; } // console.log(reMpids[i]); $.ajax({ type: 'GET', url: ext.contextPath + "/data/getDetailDataForEXAndDV.do", async: false, globle: false, data: { mpcode: reMpids[i], sdt: lsdt, edt: ledt, timerange: timerange }, dataType: 'json', error: function () { return false; }, success: function (result) { option.series[i].data = result[0].data; //刷新 myChart.setOption(option, true); } }); } else { for (let i = 0; i < reMpids.length; i++) { let nowmpids = reMpids[i].split(","); let barNhisData = []; for (let j = 0; j < nowmpids.length; j++) { $.ajax({ type: 'GET', url: ext.contextPath + "/work/mpoint/getMpointJsonForEX.do", async: false, globle: false, data: { mpid: nowmpids[j] }, dataType: 'json', error: function () { return false; }, success: function (result) { barNhisData.push(result[0].parmvalue); } }); } option.series[i].data = barNhisData; //刷新 myChart.setOption(option, true); } } } }, Number(refreshtime) * 30000); } } // } // } // }); } /** * 分值环图组件 */ function showAssembly_PercentChart(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualPercentChart/getJson.do?pid=" + content.id, async: false, globle: false, error: function () { return false; }, success: function (data) { let datas = eval('(' + data + ')'); var style = ""; if (content.style != '') { style = content.style; } var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv reSize\" onmousedown=\"doDown();\" onmouseup=\"doUp();\" onmousemove=\"doMove();\""; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; divHtml = "
"; divHtml += ""; divHtml += ""; divHtml += ""; divHtml += ""; divHtml += ""; divHtml += "
"; // divHtml+="
"; } }); return divHtml; } function showAssembly_PercentChart_View(content, showData) { var divHtml = ""; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualPercentChart/getJson.do?pid=" + content.id, // async: false, // globle: false, // error: function () { // return false; // }, // success: function (data) { // let datas = eval('(' + data + ')'); var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; } divHtml = "
"; divHtml += "
"; // } // }); return divHtml; } function showPercentChart(contentId, showData) { // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualPercentChart/getJson.do?pid=" + contentId, // async: true, // globle: false, // dataType: 'json', // error: function () { // return false; // }, // success: function (data) { let data = showData; // console.log(data) document.getElementById(contentId).removeAttribute("_echarts_instance_"); var myChart = echarts.init(document.getElementById(contentId)); myChart.showLoading({ text: '数据正在加载...', textStyle: {fontSize: 30, color: '#444'}, effectOption: {backgroundColor: 'rgba(0, 0, 0, 0)'}, zlevel: 0 }); let titleText = ""; if (data.mpid != null && data.mpid != "") { titleText = data.showData; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/work/mpoint/getMpointJsonForEXAndDV.do", // async: false, // globle: false, // data: { // mpid: data.mpid, // valuemethod: data.valuemethod, // sdt: sdt, // edt: edt // }, // dataType: 'json', // error: function () { // return false; // }, // success: function (result) { // let mp = result[0]; // titleText = mp.parmvalue; // } // }); } else if (data.urldata != null && data.urldata != "") { $.ajax({ type: 'GET', url: ext.contextPath + data.urldata, async: false, globle: false, dataType: 'json', error: function () { return false; }, success: function (result) { titleText = result.result; } }); } else { titleText = data.titleText; } //系数 if (data.rate != null && data.rate != "") { let rate = data.rate; if ("+-*/".indexOf(rate.substring(0, 1)) == -1) { rate = "*" + rate; } titleText = eval(titleText + rate); } if (data.numtail != null && data.numtail != "") { titleText = Number(titleText).toFixed(Number(data.numtail)); } let titleColor = "#000000"; if (data.titleColor != null && data.titleColor != "") { titleColor = data.titleColor; } let titleFontSize = "18"; if (data.titleFontSize != null && data.titleFontSize != "") { titleFontSize = data.titleFontSize; } let titleFontWeight = "normal"; if (data.titleFontWeight != null && data.titleFontWeight != "") { titleFontWeight = data.titleFontWeight; } let unittitleText = ""; if (data.unittitleText != null && data.unittitleText != "") { unittitleText = data.unittitleText; } let unittitleColor = "#000000"; if (data.unittitleColor != null && data.unittitleColor != "") { unittitleColor = data.unittitleColor; } let unittitleFontSize = "16"; if (data.unittitleFontSize != null && data.unittitleFontSize != "") { unittitleFontSize = data.unittitleFontSize; } let unittitleFontWeight = "normal"; if (data.unittitleFontWeight != null && data.unittitleFontWeight != "") { unittitleFontWeight = data.unittitleFontWeight; } let unitisneedbr = ""; if (data.unitisneedbr != null && data.unitisneedbr != "") { if (data.unitisneedbr == "true") { unitisneedbr = "\n"; } } let titleData = ['{a|' + titleText + '}', '{b|' + unittitleText + '}'].join('' + unitisneedbr + ''); let subtitleText = ""; if (data.subtitleText != null && data.subtitleText != "") { subtitleText = data.subtitleText; } let subtitleColor = "#000000"; if (data.subtitleColor != null && data.subtitleColor != "") { subtitleColor = data.subtitleColor; } let subtitleFontSize = "18"; if (data.subtitleFontSize != null && data.subtitleFontSize != "") { subtitleFontSize = data.subtitleFontSize; } let subtitleFontWeight = "normal"; if (data.subtitleFontWeight != null && data.subtitleFontWeight != "") { subtitleFontWeight = data.subtitleFontWeight; } let subtitlePosition = "-50"; if (data.subtitlePosition != null && data.subtitlePosition != "") { subtitlePosition = data.subtitlePosition; } let titleLeftPosition = "44%"; if (data.titleLeftPosition != null && data.titleLeftPosition != "") { titleLeftPosition = data.titleLeftPosition; } let titleTopPosition = "50%"; if (data.titleTopPosition != null && data.titleTopPosition != "") { titleTopPosition = data.titleTopPosition; } let clockwise = eval("true".toLowerCase()); if (data.clockwise != null && data.clockwise != "") { clockwise = eval(data.clockwise.toLowerCase()) } let radius = "100%"; if (data.radius != null && data.radius != "") { if (data.radius.indexOf(",") > 0) { radius = data.radius.split(","); } else { radius = data.radius; } } let scoreringwidth = "12"; if (data.scoreringwidth != null && data.scoreringwidth != "") { scoreringwidth = data.scoreringwidth; } let scoreringcolor = "#2ec7c9"; if (data.scoreringcolor != null && data.scoreringcolor != "") { scoreringcolor = data.scoreringcolor; } let bgringwidth = "18"; if (data.bgringwidth != null && data.bgringwidth != "") { bgringwidth = data.bgringwidth; } let bgringcolor = "#eeeeee"; if (data.bgringcolor != null && data.bgringcolor != "") { bgringcolor = data.bgringcolor; } let bgringposition = "22"; if (data.bgringposition != null && data.bgringposition != "") { bgringposition = data.bgringposition; } bgringposition = -100 - Number(bgringposition) + "%"; let angleaxismax = "100"; if (data.angleaxismax != null && data.angleaxismax != "") { angleaxismax = data.angleaxismax; } let startangle = "100"; if (data.startangle != null && data.startangle != "") { startangle = data.startangle; } let option = { animation: false, title: { text: titleData, textStyle: { rich: { a: { color: titleColor, fontSize: titleFontSize, fontWeight: titleFontWeight }, b: { color: unittitleColor, fontSize: unittitleFontSize, fontWeight: unittitleFontWeight } } }, subtext: subtitleText, subtextStyle: { color: subtitleColor, fontSize: subtitleFontSize, fontWeight: subtitleFontWeight }, itemGap: Number(subtitlePosition), // 主副标题距离 left: titleLeftPosition, top: titleTopPosition, textAlign: 'center' }, angleAxis: { max: Number(angleaxismax), clockwise: clockwise, // 顺时针 startAngle: Number(startangle), // 隐藏刻度线 axisLine: { show: false }, axisTick: { show: false }, axisLabel: { show: false }, splitLine: { show: false } }, radiusAxis: { type: 'category', // 隐藏刻度线 axisLine: { show: false }, axisTick: { show: false }, axisLabel: { show: false }, splitLine: { show: false } }, polar: { center: ['50%', '50%'], radius: radius //图形大小 }, series: [{ type: 'bar', data: [{ name: '百分比', value: Number(titleText), itemStyle: { color: scoreringcolor } }], coordinateSystem: 'polar', roundCap: true, barWidth: scoreringwidth, barGap: '-100%', // 两环重叠 z: 2 }, { // 灰色环 type: 'bar', data: [{ value: 100, itemStyle: { color: bgringcolor, shadowColor: 'rgba(0, 0, 0, 0.2)', shadowBlur: 2, shadowOffsetY: 2 } }], coordinateSystem: 'polar', roundCap: true, barWidth: bgringwidth, barGap: bgringposition, // 两环重叠 z: 1 }] }; myChart.setOption(option, true); myChart.hideLoading(); window.addEventListener('resize', function () {//执行 myChart.resize(); }) // } // }); } /** * 雷达图组件 */ function showAssembly_RadarChart(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualRadarChart/getJson.do?pid=" + content.id, async: false, globle: false, error: function () { return false; }, success: function (data) { let datas = eval('(' + data + ')'); var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv reSize\" onmousedown=\"doDown();\" onmouseup=\"doUp();\" onmousemove=\"doMove();\""; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; divHtml = "
"; divHtml += ""; divHtml += ""; divHtml += ""; divHtml += ""; divHtml += " "; divHtml += " "; divHtml += " "; divHtml += " "; divHtml += " "; divHtml += "
"; } }); return divHtml; } function showAssembly_RadarChart_View(content, showData) { var divHtml = ""; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualRadarChart/getJson.do?pid=" + content.id, // async: false, // globle: false, // error: function () { // return false; // }, // success: function (data) { // let datas = eval('(' + data + ')'); var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let onmouseupSt = ""; if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; } divHtml = "
"; divHtml += "
"; // } // }); return divHtml; } function showRadarChart(contentId, showData, showSeriesData, showAxisData) { // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualRadarChart/getChartJson.do?contentId=" + contentId, // async: true, // globle: false, // dataType: 'json', // error: function () { // return false; // }, // success: function (data) { var dataVisualRadarChart = showData; var dataVisualRadarChartSerieslist = showSeriesData; var dataVisualRadarChartAxislist = showAxisData; // console.log(data) document.getElementById(contentId).removeAttribute("_echarts_instance_"); var myChart = echarts.init(document.getElementById(contentId)); myChart.showLoading({ text: '数据正在加载...', textStyle: {fontSize: 30, color: '#444'}, effectOption: {backgroundColor: 'rgba(0, 0, 0, 0)'}, zlevel: 0 }); let colors = dataVisualRadarChart.colors.split(','); let titleText = ""; if (dataVisualRadarChart.titleText != null && dataVisualRadarChart.titleText != "") { titleText = dataVisualRadarChart.titleText; } let titlePosition = "left"; if (dataVisualRadarChart.titlePosition != null && dataVisualRadarChart.titlePosition != "") { titlePosition = dataVisualRadarChart.titlePosition; } let titleColor = "#000000"; if (dataVisualRadarChart.titleColor != null && dataVisualRadarChart.titleColor != "") { titleColor = dataVisualRadarChart.titleColor; } let titleFontSize = "18"; if (dataVisualRadarChart.titleFontSize != null && dataVisualRadarChart.titleFontSize != "") { titleFontSize = dataVisualRadarChart.titleFontSize; } let titleFontWeight = "bolder"; if (dataVisualRadarChart.titleFontWeight != null && dataVisualRadarChart.titleFontWeight != "") { titleFontWeight = dataVisualRadarChart.titleFontWeight; } let radius = 100; if (dataVisualRadarChart.radius != null && dataVisualRadarChart.radius != "") { radius = dataVisualRadarChart.radius; } let shapeData = "polygon"; if (dataVisualRadarChart.shape != null && dataVisualRadarChart.shape != "") { shapeData = dataVisualRadarChart.shape; } let axisNameData = []; let axisnameformatter = "{value}"; if (dataVisualRadarChart.axisnameformatter != null && dataVisualRadarChart.axisnameformatter != "") { axisnameformatter = dataVisualRadarChart.axisnameformatter; } let axisnamecolor = "#333"; if (dataVisualRadarChart.axisnamecolor != null && dataVisualRadarChart.axisnamecolor != "") { axisnamecolor = dataVisualRadarChart.axisnamecolor; } let axisnamefontSize = "16"; if (dataVisualRadarChart.axisnamefontSize != null && dataVisualRadarChart.axisnamefontSize != "") { axisnamefontSize = dataVisualRadarChart.axisnamefontSize; } let axisnamefontWeight = "normal"; if (dataVisualRadarChart.axisnamefontWeight != null && dataVisualRadarChart.axisnamefontWeight != "") { axisnamefontWeight = dataVisualRadarChart.axisnamefontWeight; } axisNameData.push({ formatter: axisnameformatter, color: axisnamecolor, fontSize: axisnamefontSize, fontWeight: axisnamefontWeight }) let splitNumber = 5; if (dataVisualRadarChart.splitNumber != null && dataVisualRadarChart.splitNumber != "") { splitNumber = dataVisualRadarChart.splitNumber; } let axislinecolor = "#e0e0e0"; if (dataVisualRadarChart.axislinecolor != null && dataVisualRadarChart.axislinecolor != "") { axislinecolor = dataVisualRadarChart.axislinecolor; } let splitlinecolor = "#e0e0e0"; if (dataVisualRadarChart.splitlinecolor != null && dataVisualRadarChart.splitlinecolor != "") { splitlinecolor = dataVisualRadarChart.splitlinecolor; } let splitareacolors = "#FFFFFF|#F6F8FC"; if (dataVisualRadarChart.splitareacolors != null && dataVisualRadarChart.splitareacolors != "") { splitareacolors = dataVisualRadarChart.splitareacolors; } splitareacolors = splitareacolors.split("|"); let legendPushData = []; let seriesPushDatas = []; for (let s = 0; s < dataVisualRadarChartSerieslist.length; s++) { legendPushData.push(dataVisualRadarChartSerieslist[s].name); let seriesPushData = []; let mpid = ""; if (dataVisualRadarChartSerieslist[s].mpid != null && dataVisualRadarChartSerieslist[s].mpid != "") { mpid = dataVisualRadarChartSerieslist[s].mpid; } if (mpid != "") { let mpvalues = dataVisualRadarChartSerieslist[s].fixedvalue.split(","); for (let i = 0; i < mpvalues.length; i++) { seriesPushData.push(mpvalues[i]); // $.ajax({ // type: 'GET', // url: ext.contextPath + "/work/mpoint/getMpointJsonForEXAndDV.do", // async: false, // globle: false, // data: { // mpid: mpids[i], // valuemethod: dataVisualRadarChartSerieslist[s].valuemethod, // sdt: sdt, // edt: edt // }, // dataType: 'json', // error: function () { // return false; // }, // success: function (result) { // let mp = result[0]; // seriesPushData.push(mp.parmvalue); // } // }); } } else { let fixedvalue = ""; if (dataVisualRadarChartSerieslist[s].fixedvalue != null && dataVisualRadarChartSerieslist[s].fixedvalue != "") { fixedvalue = dataVisualRadarChartSerieslist[s].fixedvalue; } seriesPushData = fixedvalue.split(","); } let areaStyleData = []; if (dataVisualRadarChartSerieslist[s].areastyle == "true") { let areastylecolor = colors[s]; if (dataVisualRadarChartSerieslist[s].areastylecolor != null && dataVisualRadarChartSerieslist[s].areastylecolor != "") { areastylecolor = dataVisualRadarChartSerieslist[s].areastylecolor; } areaStyleData.push({ color: areastylecolor, opacity: 1 }) } else if (dataVisualRadarChartSerieslist[s].areastyle == "false") { areaStyleData.push({ opacity: 0 }) } seriesPushDatas.push({ value: seriesPushData, name: dataVisualRadarChartSerieslist[s].name, areaStyle: areaStyleData[0] }); } let legendData = []; let legendShow = eval("true".toLowerCase()); let legendPosition = "center"; let legendSt = dataVisualRadarChart.legendPosition; if (legendSt == 'false') { legendShow = eval("false".toLowerCase()); } else { legendPosition = legendSt; legendShow = eval("true".toLowerCase()); } legendData.push({ show: legendShow, data: legendPushData, left: legendPosition, textStyle: { color: colors } }) let indicatorData = []; for (let s = 0; s < dataVisualRadarChartAxislist.length; s++) { if (dataVisualRadarChartAxislist[s].max != null && dataVisualRadarChartAxislist[s].max != '') { indicatorData.push({ name: dataVisualRadarChartAxislist[s].name, max: dataVisualRadarChartAxislist[s].max }) } else { indicatorData.push({ name: dataVisualRadarChartAxislist[s].name }) } } let option = { color: colors, title: { text: titleText, textStyle: { color: titleColor, fontSize: titleFontSize, fontWeight: titleFontWeight }, left: titlePosition }, legend: legendData, tooltip: { trigger: 'item' }, radar: { shape: shapeData, indicator: indicatorData, center: ['50%', '50%'], radius: radius, axisName: axisNameData[0], splitNumber: splitNumber, splitArea: { areaStyle: { color: splitareacolors } }, axisLine: { lineStyle: { color: axislinecolor } }, splitLine: { lineStyle: { color: splitlinecolor } } }, series: [ { type: 'radar', data: seriesPushDatas } ] }; myChart.setOption(option, true); myChart.hideLoading(); window.addEventListener('resize', function () {//执行 myChart.resize(); }) // } // }); } /** * 饼图组件 */ function showAssembly_PieChart(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualPieChart/getJson.do?pid=" + content.id, async: false, globle: false, error: function () { return false; }, success: function (data) { let datas = eval('(' + data + ')'); var style = ""; if (content.style != '') { style = content.style; } var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv reSize\" onmousedown=\"doDown();\" onmouseup=\"doUp();\" onmousemove=\"doMove();\""; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; divHtml = "
"; divHtml += " "; divHtml += "
"; } }); return divHtml; } function showAssembly_PieChart_View(content, showData) { var divHtml = ""; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualPieChart/getJson.do?pid=" + content.id, // async: false, // globle: false, // error: function () { // return false; // }, // success: function (data) { // let datas = eval('(' + data + ')'); var style = ""; if (content.style != '') { style = content.style; } var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let onmouseupSt = ""; if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; } divHtml = "
"; divHtml += "
"; // } // }); return divHtml; } function showPieChart(contentId, showData, showSeriesData) { // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualPieChart/getChartJson.do?contentId=" + contentId, // async: true, // globle: false, // dataType: 'json', // error: function () { // return false; // }, // success: function (data) { var dataVisualPieChart = showData; var dataVisualPieChartSerieslist = showSeriesData; // console.log(data) document.getElementById(contentId).removeAttribute("_echarts_instance_"); var myChart = echarts.init(document.getElementById(contentId)); myChart.showLoading({ text: '数据正在加载...', textStyle: {fontSize: 30, color: '#444'}, effectOption: {backgroundColor: 'rgba(0, 0, 0, 0)'}, zlevel: 0 }); let colors = dataVisualPieChart.colors.split(','); let titleText = ""; if (dataVisualPieChart.titleText != null && dataVisualPieChart.titleText != "") { titleText = dataVisualPieChart.titleText; } let titlePosition = "left"; if (dataVisualPieChart.titlePosition != null && dataVisualPieChart.titlePosition != "") { titlePosition = dataVisualPieChart.titlePosition; } let titleColor = "#000000"; if (dataVisualPieChart.titleColor != null && dataVisualPieChart.titleColor != "") { titleColor = dataVisualPieChart.titleColor; } let titleFontSize = "18"; if (dataVisualPieChart.titleFontSize != null && dataVisualPieChart.titleFontSize != "") { titleFontSize = dataVisualPieChart.titleFontSize; } let titleFontWeight = "bolder"; if (dataVisualPieChart.titleFontWeight != null && dataVisualPieChart.titleFontWeight != "") { titleFontWeight = dataVisualPieChart.titleFontWeight; } let subtitleText = ""; if (dataVisualPieChart.subtitleText != null && dataVisualPieChart.subtitleText != "") { subtitleText = dataVisualPieChart.subtitleText; } let subtitleColor = "#333"; if (dataVisualPieChart.subtitleColor != null && dataVisualPieChart.subtitleColor != "") { subtitleColor = dataVisualPieChart.subtitleColor; } let subtitleFontSize = "16"; if (dataVisualPieChart.subtitleFontSize != null && dataVisualPieChart.subtitleFontSize != "") { subtitleFontSize = dataVisualPieChart.subtitleFontSize; } let subtitleFontWeight = "normal"; if (dataVisualPieChart.subtitleFontWeight != null && dataVisualPieChart.subtitleFontWeight != "") { subtitleFontWeight = dataVisualPieChart.subtitleFontWeight; } let radius = "60%"; if (dataVisualPieChart.radius != null && dataVisualPieChart.radius != "") { radius = dataVisualPieChart.radius; } if (radius.indexOf(",") >= 0) { radius = radius.split(","); } let lableShow = eval("true".toLowerCase()); if (dataVisualPieChart.lableShow != null && dataVisualPieChart.lableShow != "") { lableShow = eval(dataVisualPieChart.lableShow.toLowerCase()); } let lablePosition = "outside"; if (dataVisualPieChart.lablePosition != null && dataVisualPieChart.lablePosition != "") { lablePosition = dataVisualPieChart.lablePosition; } let lableColor = "#333"; if (dataVisualPieChart.lableColor != null && dataVisualPieChart.lableColor != "") { lableColor = dataVisualPieChart.lableColor; } let lableFontsize = "12"; if (dataVisualPieChart.lableFontsize != null && dataVisualPieChart.lableFontsize != "") { lableFontsize = dataVisualPieChart.lableFontsize; } let lableFontweight = "normal"; if (dataVisualPieChart.lableFontweight != null && dataVisualPieChart.lableFontweight != "") { lableFontweight = dataVisualPieChart.lableFontweight; } let borderradius = "0"; if (dataVisualPieChart.borderradius != null && dataVisualPieChart.borderradius != "") { borderradius = dataVisualPieChart.borderradius; } let legendDataD = []; let seriesData = []; for (let i = 0; i < dataVisualPieChartSerieslist.length; i++) { let seriesPushData = []; let dataVisualPieChartSeries = dataVisualPieChartSerieslist[i]; legendDataD.push(dataVisualPieChartSeries.name); let mpid = ""; if (dataVisualPieChartSeries.mpid != null && dataVisualPieChartSeries.mpid != "") { mpid = dataVisualPieChartSeries.mpid; } if (mpid != "") { let outData = dataVisualPieChartSeries.fixedvalue; //系数 if (dataVisualPieChartSeries.rate != null && dataVisualPieChartSeries.rate != "") { let rate = dataVisualPieChartSeries.rate; if ("+-*/".indexOf(rate.substring(0, 1)) == -1) { rate = "*" + rate; } outData = eval(outData + rate); } if (dataVisualPieChartSeries.numtail != null && dataVisualPieChartSeries.numtail != "") { outData = Number(outData).toFixed(Number(dataVisualPieChartSeries.numtail)); } seriesPushData.push(outData); // $.ajax({ // type: 'GET', // url: ext.contextPath + "/work/mpoint/getMpointJsonForEXAndDV.do", // async: false, // globle: false, // data: { // mpid: mpid, // valuemethod: dataVisualPieChartSeries.valuemethod, // sdt: sdt, // edt: edt // }, // dataType: 'json', // error: function () { // return false; // }, // success: function (result) { // let mp = result[0]; // seriesPushData.push(mp.parmvalue); // } // }); } else { let fixedvalue = ""; if (dataVisualPieChartSeries.fixedvalue != null && dataVisualPieChartSeries.fixedvalue != "") { fixedvalue = dataVisualPieChartSeries.fixedvalue; } seriesPushData = fixedvalue.split(","); } seriesData.push({ value: seriesPushData, name: dataVisualPieChartSeries.name }) } let legendData = []; let legendShow = eval("true".toLowerCase()); let legendPosition = "center"; let legendSt = dataVisualPieChart.legendPosition; if (legendSt == 'false') { legendShow = eval("false".toLowerCase()); } else { legendPosition = legendSt; legendShow = eval("true".toLowerCase()); } legendData.push({ show: legendShow, data: legendDataD, left: legendPosition, textStyle: { color: colors } }) let option = { color: colors, title: { text: titleText, textStyle: { color: titleColor, fontSize: titleFontSize, fontWeight: titleFontWeight }, subtext: subtitleText, subtextStyle: { color: subtitleColor, fontSize: subtitleFontSize, fontWeight: subtitleFontWeight }, left: dataVisualPieChart.titlePositionX, top: dataVisualPieChart.titlePositionY }, tooltip: { trigger: 'item' }, legend: legendData, series: [ { type: 'pie', radius: radius, itemStyle: { borderRadius: borderradius }, label: { show: lableShow, position: lablePosition, color: lableColor, fontSize: lableFontsize, fontWeight: lableFontweight }, labelLine: { show: true }, data: seriesData } ] }; myChart.setOption(option, true); myChart.hideLoading(); window.addEventListener('resize', function () {//执行 myChart.resize(); }) // } // }); } /** * 图片组件 */ function showAssembly_Picture(content) { var divHtml = ""; var style = ""; if (content.style != '') { style = content.style; } var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv reSize\" onmousedown=\"doDown();\" onmouseup=\"doUp();\" onmousemove=\"doMove();\""; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; var paths = getFilePictureShowList(content.id, 'tb_pro_dataVisual_picture_file').split(","); let borderStyle = "border:2px solid red;"; if (paths != "") { borderStyle = "border:0px solid transparent;"; } divHtml = "
"; if (paths.length > 1) { divHtml += ""; } else { divHtml += " "; } divHtml += "
"; return divHtml; } function showAssembly_Picture_View(content, showData) { var divHtml = ""; var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; } //需要绑定开关组件加 let hiddenSt = "display:block;"; if (switchHiddenPoints.indexOf(content.id) != -1) { hiddenSt = "display:none;"; } style += hiddenSt; // var paths = getFilePictureShowList(content.id, 'tb_pro_dataVisual_picture_file').split(","); let path = ""; if (showData != null) { if (showData.length > 0) { for (let p = 0; p < showData.length; p++) { let nowPath = showData[p].abspath; nowPath = nowPath.substring(nowPath.indexOf('webapps') + 7, nowPath.length); nowPath = ext.basePath.replace(ext.contextPath, '') + nowPath.replace(/\\/g, "\/"); path += nowPath + ","; } } } var paths = path.split(","); // let voiceSt = ""; // if (content.isvoiceknow != null && content.isvoiceknow != '') { // if (content.isvoiceknow == 'true') { // voiceSt += "onclick=\"voiceClick('" + content.voicetext + "','" + content.voicemethod + "','" + paths + "','" + content.id + "');\" "; // // voiceSt += "onmousedown=\"voicemousedown();\" "; // // voiceSt += "onmouseup=\"voicemouseup('"+content.voicetext+"','"+content.voicemethod+"');\" "; // } // } divHtml = "
"; if (paths.length > 1) { divHtml += ""; } // else { // divHtml += " "; // } divHtml += "
"; return divHtml; } function getFilePictureShowList(masterId, tbName) { var path = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/base/getInputFileList.do", async: false, globle: false, data: {masterId: masterId, tbName: tbName}, dataType: 'json', error: function () { return false; }, success: function (data) { if (data.length > 0) { for (let p = 0; p < data.length; p++) { let nowPath = data[p].abspath; nowPath = nowPath.substring(nowPath.indexOf('webapps') + 7, nowPath.length); nowPath = ext.basePath.replace(ext.contextPath, '') + nowPath.replace(/\\/g, "\/"); path += nowPath + ","; } } } }); return path; }; /** * 仪表盘组件 */ function showAssembly_GaugeChart(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualGaugeChart/getJson.do?pid=" + content.id, async: false, globle: false, error: function () { return false; }, success: function (data) { let datas = eval('(' + data + ')'); var style = ""; if (content.style != '') { style = content.style; } var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv reSize\" onmousedown=\"doDown();\" onmouseup=\"doUp();\" onmousemove=\"doMove();\""; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; divHtml = "
"; divHtml += ""; divHtml += ""; divHtml += ""; divHtml += "
"; } }); return divHtml; } function showAssembly_GaugeChart_View(content, showData) { var divHtml = ""; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualGaugeChart/getJson.do?pid=" + content.id, // async: false, // globle: false, // error: function () { // return false; // }, // success: function (data) { // let datas = eval('(' + data + ')'); var style = ""; if (content.style != '') { style = content.style; } var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let onmouseupSt = ""; if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; } divHtml = "
"; divHtml += "
"; // } // }); return divHtml; } function showGaugeChart(contentId, showData) { // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualGaugeChart/getJson.do?pid=" + contentId, // async: true, // globle: false, // dataType: 'json', // error: function () { // return false; // }, // success: function (data) { // console.log(data) var dataVisualGaugeChart = showData; document.getElementById(contentId).removeAttribute("_echarts_instance_"); var myChart = echarts.init(document.getElementById(contentId)); myChart.showLoading({ text: '数据正在加载...', textStyle: {fontSize: 30, color: '#444'}, effectOption: {backgroundColor: 'rgba(0, 0, 0, 0)'}, zlevel: 0 }); let showValue = "0"; let mpid = ""; if (dataVisualGaugeChart.mpid != null && dataVisualGaugeChart.mpid != "") { mpid = dataVisualGaugeChart.mpid; } if (mpid != "") { showValue = dataVisualGaugeChart.fixedvalue; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/work/mpoint/getMpointJsonForEXAndDV.do", // async: false, // globle: false, // data: { // mpid: mpid, // valuemethod: dataVisualGaugeChart.valuemethod, // sdt: sdt, // edt: edt // }, // dataType: 'json', // error: function () { // return false; // }, // success: function (result) { // let mp = result[0]; // showValue = mp.parmvalue; // } // }); } else { let fixedvalue = ""; if (dataVisualGaugeChart.fixedvalue != null && dataVisualGaugeChart.fixedvalue != "") { fixedvalue = dataVisualGaugeChart.fixedvalue; showValue = fixedvalue; } } showValue = Number(showValue); let jsshowValue = "0"; let max = "100"; if (dataVisualGaugeChart.max != null && dataVisualGaugeChart.max != "") { max = dataVisualGaugeChart.max; } max = Number(max); let min = "0"; if (dataVisualGaugeChart.min != null && dataVisualGaugeChart.min != "") { min = dataVisualGaugeChart.min; } min = Number(min); jsshowValue = (showValue - min) / (max - min); let startAngle = "225"; if (dataVisualGaugeChart.startAngle != null && dataVisualGaugeChart.startAngle != "") { startAngle = dataVisualGaugeChart.startAngle; } let endAngle = "-45"; if (dataVisualGaugeChart.endAngle != null && dataVisualGaugeChart.endAngle != "") { endAngle = dataVisualGaugeChart.endAngle; } let radius = "100%"; if (dataVisualGaugeChart.radius != null && dataVisualGaugeChart.radius != "") { radius = dataVisualGaugeChart.radius; } let pointerst = eval("true".toLowerCase()); if (dataVisualGaugeChart.pointerst != null && dataVisualGaugeChart.pointerst != "") { pointerst = eval(dataVisualGaugeChart.pointerst.toLowerCase()); } let pointerLength = "60%"; if (dataVisualGaugeChart.pointerLength != null && dataVisualGaugeChart.pointerLength != "") { pointerLength = dataVisualGaugeChart.pointerLength; } let pointerWidth = "6"; if (dataVisualGaugeChart.pointerWidth != null && dataVisualGaugeChart.pointerWidth != "") { pointerWidth = dataVisualGaugeChart.pointerWidth; } let pointerColor = "#2ec7c9"; if (dataVisualGaugeChart.pointerColor != null && dataVisualGaugeChart.pointerColor != "") { pointerColor = dataVisualGaugeChart.pointerColor; } let splitlinest = eval("true".toLowerCase()); if (dataVisualGaugeChart.splitlinest != null && dataVisualGaugeChart.splitlinest != "") { splitlinest = eval(dataVisualGaugeChart.splitlinest.toLowerCase()); } let splitlineDistance = "10"; if (dataVisualGaugeChart.splitlineDistance != null && dataVisualGaugeChart.splitlineDistance != "") { splitlineDistance = dataVisualGaugeChart.splitlineDistance; } let splitlineLength = "10"; if (dataVisualGaugeChart.splitlineLength != null && dataVisualGaugeChart.splitlineLength != "") { splitlineLength = dataVisualGaugeChart.splitlineLength; } let splitlineColor = "#63677A"; if (dataVisualGaugeChart.splitlineColor != null && dataVisualGaugeChart.splitlineColor != "") { splitlineColor = dataVisualGaugeChart.splitlineColor; } let splitlineWidth = "3"; if (dataVisualGaugeChart.splitlineWidth != null && dataVisualGaugeChart.splitlineWidth != "") { splitlineWidth = dataVisualGaugeChart.splitlineWidth; } let axistickst = eval("true".toLowerCase()); if (dataVisualGaugeChart.axistickst != null && dataVisualGaugeChart.axistickst != "") { axistickst = eval(dataVisualGaugeChart.axistickst.toLowerCase()); } let axistickSplitnumber = "5"; if (dataVisualGaugeChart.axistickSplitnumber != null && dataVisualGaugeChart.axistickSplitnumber != "") { axistickSplitnumber = dataVisualGaugeChart.axistickSplitnumber; } let axistickDistance = "10"; if (dataVisualGaugeChart.axistickDistance != null && dataVisualGaugeChart.axistickDistance != "") { axistickDistance = dataVisualGaugeChart.axistickDistance; } let axistickLength = "6"; if (dataVisualGaugeChart.axistickLength != null && dataVisualGaugeChart.axistickLength != "") { axistickLength = dataVisualGaugeChart.axistickLength; } let axistickColor = "#63677A"; if (dataVisualGaugeChart.axistickColor != null && dataVisualGaugeChart.axistickColor != "") { axistickColor = dataVisualGaugeChart.axistickColor; } let axistickWidth = "10"; if (dataVisualGaugeChart.axistickWidth != null && dataVisualGaugeChart.axistickWidth != "") { axistickWidth = dataVisualGaugeChart.axistickWidth; } let axislabelst = eval("true".toLowerCase()); if (dataVisualGaugeChart.axislabelst != null && dataVisualGaugeChart.axislabelst != "") { axislabelst = eval(dataVisualGaugeChart.axislabelst.toLowerCase()); } let axislabelDistance = "15"; if (dataVisualGaugeChart.axislabelDistance != null && dataVisualGaugeChart.axislabelDistance != "") { axislabelDistance = dataVisualGaugeChart.axislabelDistance; } let axislabelColor = "#000000"; if (dataVisualGaugeChart.axislabelColor != null && dataVisualGaugeChart.axislabelColor != "") { axislabelColor = dataVisualGaugeChart.axislabelColor; } let axislabelFontSize = "12"; if (dataVisualGaugeChart.axislabelFontSize != null && dataVisualGaugeChart.axislabelFontSize != "") { axislabelFontSize = dataVisualGaugeChart.axislabelFontSize; } let axislabelFontWeight = "normal"; if (dataVisualGaugeChart.axislabelFontWeight != null && dataVisualGaugeChart.axislabelFontWeight != "") { axislabelFontWeight = dataVisualGaugeChart.axislabelFontWeight; } let titleText = ""; if (dataVisualGaugeChart.titleText != null && dataVisualGaugeChart.titleText != "") { titleText = dataVisualGaugeChart.titleText; } let titleColor = "#464646"; if (dataVisualGaugeChart.titleColor != null && dataVisualGaugeChart.titleColor != "") { titleColor = dataVisualGaugeChart.titleColor; } let titleFontSize = "16"; if (dataVisualGaugeChart.titleFontSize != null && dataVisualGaugeChart.titleFontSize != "") { titleFontSize = dataVisualGaugeChart.titleFontSize; } let titleFontWeight = "normal"; if (dataVisualGaugeChart.titleFontWeight != null && dataVisualGaugeChart.titleFontWeight != "") { titleFontWeight = dataVisualGaugeChart.titleFontWeight; } let titleXPosition = "0"; if (dataVisualGaugeChart.titleXPosition != null && dataVisualGaugeChart.titleXPosition != "") { titleXPosition = dataVisualGaugeChart.titleXPosition; } let titleYPosition = "20%"; if (dataVisualGaugeChart.titleYPosition != null && dataVisualGaugeChart.titleYPosition != "") { titleYPosition = dataVisualGaugeChart.titleYPosition; } let datast = eval("true".toLowerCase()); if (dataVisualGaugeChart.datast != null && dataVisualGaugeChart.datast != "") { datast = eval(dataVisualGaugeChart.datast.toLowerCase()); } let dataColor = "#464646"; if (dataVisualGaugeChart.dataColor != null && dataVisualGaugeChart.dataColor != "") { dataColor = dataVisualGaugeChart.dataColor; } let dataFontSize = "20"; if (dataVisualGaugeChart.dataFontSize != null && dataVisualGaugeChart.dataFontSize != "") { dataFontSize = dataVisualGaugeChart.dataFontSize; } let dataFontWeight = "normal"; if (dataVisualGaugeChart.dataFontWeight != null && dataVisualGaugeChart.dataFontWeight != "") { dataFontWeight = dataVisualGaugeChart.dataFontWeight; } let dataXPosition = "0"; if (dataVisualGaugeChart.dataXPosition != null && dataVisualGaugeChart.dataXPosition != "") { dataXPosition = dataVisualGaugeChart.dataXPosition; } let dataYPosition = "40%"; if (dataVisualGaugeChart.dataYPosition != null && dataVisualGaugeChart.dataYPosition != "") { dataYPosition = dataVisualGaugeChart.dataYPosition; } let axislinest = eval("true".toLowerCase()); if (dataVisualGaugeChart.axislinest != null && dataVisualGaugeChart.axislinest != "") { axislinest = eval(dataVisualGaugeChart.axislinest.toLowerCase()); } let axislineWidth = "10"; if (dataVisualGaugeChart.axislineWidth != null && dataVisualGaugeChart.axislineWidth != "") { axislineWidth = dataVisualGaugeChart.axislineWidth; } let axislineColors = []; let axislineColor = ""; let firstColor = ""; let endColor = ""; if (dataVisualGaugeChart.axislineColor != null && dataVisualGaugeChart.axislineColor != "") { axislineColor = dataVisualGaugeChart.axislineColor.split(","); } if (axislineColor != null && axislineColor.length >= 2) { endColor = axislineColor[axislineColor.length - 1]; for (let c = 0; c < axislineColor.length - 1; c++) { firstColor = axislineColor[c]; axislineColors.push(axislineColor[c]) } } let axislineColorsData = []; if (axislineColors != '' && axislineColors.length > 1) { let axislineColorsDataD = []; for (let c = 0; c < axislineColors.length; c++) { axislineColorsDataD.push({ offset: (1 / (axislineColors.length - 1)) * c, color: axislineColors[c] }) } axislineColorsData = [ //颜色为渐变色 [ jsshowValue, new echarts.graphic.LinearGradient(0, 0, 1, 0, axislineColorsDataD) ], [1, endColor] ] } else { axislineColorsData = [[jsshowValue, firstColor], [1, endColor]]; } let option = { series: [{ type: 'gauge', startAngle: startAngle, endAngle: endAngle, max: max, min: min, radius: radius,//仪表盘半径 pointer: {//是否显示指针 show: pointerst, length: pointerLength, width: pointerWidth, itemStyle: { color: pointerColor } }, splitLine: {//是否显示分隔线 show: splitlinest, distance: Number(splitlineDistance), length: Number(splitlineLength), lineStyle: { color: splitlineColor, width: Number(splitlineWidth) } }, axisLine: {//仪表盘轴线 show: axislinest, lineStyle: { width: Number(axislineWidth), color: axislineColorsData } }, axisTick: {//刻度 show: axistickst, splitNumber: Number(axistickSplitnumber), distance: Number(axistickDistance), length: Number(axistickLength), lineStyle: { color: axistickColor, width: Number(axistickWidth) } }, axisLabel: { show: axislabelst, distance: Number(axislabelDistance), color: axislabelColor, fontSize: axislabelFontSize, fontWeight: axislabelFontWeight }, data: [{ value: showValue, name: titleText, title: { show: true, color: titleColor, offsetCenter: [titleXPosition, titleYPosition], fontSize: titleFontSize, fontWeight: titleFontWeight }, detail: { show: datast, color: dataColor, offsetCenter: [dataXPosition, dataYPosition], fontSize: dataFontSize, fontWeight: dataFontWeight }, }] }] }; myChart.setOption(option, true); myChart.hideLoading(); // } // }); } /** * 日期控件 */ function showAssembly_Date(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualDate/getJson.do?pid=" + content.id, async: false, globle: false, dataType: 'json', error: function () { return false; }, success: function (data) { data = data[0]; // console.log(data) let style = ""; let zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv reSize\" onmousedown=\"doDown();\" onmouseup=\"doUp();\" onmousemove=\"doMove();\""; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";width:" + width + ";height:" + height + ";"; if (data.background != null && data.background != '') { style += "background:" + data.background + ";"; } if (data.fontcolor != null && data.fontcolor != '') { style += "color:" + data.fontcolor + ";"; } else { style += "color:#000000;"; } let fontsize = "font-size:14px;"; if (data.fontsize != null && data.fontsize != '') { fontsize = data.fontsize.replace("px", ""); style += "font-size:" + fontsize + "px;"; } else { style += fontsize; } if (data.fontweight != null && data.fontweight != '') { style += "font-weight:" + data.fontweight + ";"; } else { style += "font-weight:400;"; } if (data.textAlign != null && data.textAlign != '') { style += "text-align:" + data.textAlign + ";"; } else { style += "text-align:center;"; } let showContent = ""; if (data.types != null && data.types != '') { showContent = data.types; } // let nowDate = getNowTime(); let myDate = new Date; if (showContent.indexOf("year") >= 0) { let year = myDate.getFullYear(); //获取当前年 showContent = showContent.replaceAll("year", year); } if (showContent.indexOf("month") >= 0) { let mon = myDate.getMonth() + 1; //获取当前月 if (mon < 10) { mon = "0" + mon; } showContent = showContent.replaceAll("month", mon); } if (showContent.indexOf("day") >= 0) { let day = myDate.getDate(); //获取当前日 if (day < 10) { day = "0" + day; } showContent = showContent.replaceAll("day", day); } if (showContent.indexOf("12hour") >= 0) { let h = myDate.getHours();//获取当前小时数(0-23) if (h < 10) { h = "0" + h; } if (Number(h) > 12) { if ((Number(h) - 12) < 10) { h = "下午 0" + ((Number(h) - 12)); } else { h = "下午 " + ((Number(h) - 12)); } } else { h = "上午 " + h; } showContent = showContent.replaceAll("12hour", h); } if (showContent.indexOf("24hour") >= 0) { let h = myDate.getHours();//获取当前小时数(0-23) if (h < 10) { h = "0" + h; } showContent = showContent.replaceAll("24hour", h); } if (showContent.indexOf("min") >= 0) { let m = myDate.getMinutes();//获取当前分钟数(0-59) if (m < 10) { m = "0" + m; } showContent = showContent.replaceAll("min", m); } if (showContent.indexOf("sec") >= 0) { let s = myDate.getSeconds();//获取当前秒 if (s < 10) { s = "0" + s; } showContent = showContent.replaceAll("sec", s); } if (showContent.indexOf("week") >= 0) { var weekday = myDate.getDay(); var weeks = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"); let week = weeks[weekday]; showContent = showContent.replaceAll("week", week); } if (showContent.indexOf("lunar") >= 0) { var yy = myDate.getFullYear(); var mm = myDate.getMonth() + 1; var dd = myDate.getDate(); console.log(yy + "-" + mm + "-" + dd); let lunar = GetLunarDay(yy, mm, dd); console.log(lunar); showContent = showContent.replaceAll("lunar", lunar); } if (content.style != null && content.style != '') { style += content.style; } divHtml += "
"; divHtml += showContent; divHtml += "
"; } }); return divHtml; } function showAssembly_Date_View(content, showData) { var divHtml = ""; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualDate/getJson.do?pid=" + content.id, // async: false, // globle: false, // dataType: 'json', // error: function () { // return false; // }, // success: function (data) { let data = showData; // console.log(data) let style = ""; let zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } let width = content.width; let height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } style += "top:" + postY + ";left:" + postX + ";width:" + width + ";height:" + height + ";line-height:" + height + ";"; if (data.background != null && data.background != '') { style += "background:" + data.background + ";"; } if (data.fontcolor != null && data.fontcolor != '') { style += "color:" + data.fontcolor + ";"; } else { style += "color:#000000;"; } if (data.fontsize != null && data.fontsize != '') { style += "font-size:" + data.fontsize + ";"; } else { style += "font-size:14px;"; } if (data.fontweight != null && data.fontweight != '') { style += "font-weight:" + data.fontweight + ";"; } else { style += "font-weight:400;"; } if (data.textAlign != null && data.textAlign != '') { style += "text-align:" + data.textAlign + ";"; } else { style += "text-align:center;"; } let showContent = ""; if (data.types != null && data.types != '') { showContent = data.types; } // let nowDate = getNowTime(); let myDate = new Date; if (showContent.indexOf("year") >= 0) { let year = myDate.getFullYear(); //获取当前年 showContent = showContent.replaceAll("year", year); } if (showContent.indexOf("month") >= 0) { let mon = myDate.getMonth() + 1; //获取当前月 if (mon < 10) { mon = "0" + mon; } showContent = showContent.replaceAll("month", mon); } if (showContent.indexOf("day") >= 0) { let day = myDate.getDate(); //获取当前日 if (day < 10) { day = "0" + day; } showContent = showContent.replaceAll("day", day); } if (showContent.indexOf("12hour") >= 0) { let h = myDate.getHours();//获取当前小时数(0-23) if (h < 10) { h = "0" + h; } if (Number(h) > 12) { if ((Number(h) - 12) < 10) { h = "下午 0" + ((Number(h) - 12)); } else { h = "下午 " + ((Number(h) - 12)); } } else { h = "上午 " + h; } showContent = showContent.replaceAll("12hour", h); } if (showContent.indexOf("24hour") >= 0) { let h = myDate.getHours();//获取当前小时数(0-23) if (h < 10) { h = "0" + h; } showContent = showContent.replaceAll("24hour", h); } if (showContent.indexOf("min") >= 0) { let m = myDate.getMinutes();//获取当前分钟数(0-59) if (m < 10) { m = "0" + m; } showContent = showContent.replaceAll("min", m); } if (showContent.indexOf("sec") >= 0) { let s = myDate.getSeconds();//获取当前秒 if (s < 10) { s = "0" + s; } showContent = showContent.replaceAll("sec", s); } if (showContent.indexOf("week") >= 0) { var weekday = myDate.getDay(); var weeks = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"); let week = weeks[weekday]; showContent = showContent.replaceAll("week", week); } if (content.style != null && content.style != '') { style += content.style; } divHtml += "
"; divHtml += showContent; divHtml += "
"; // } // }); return divHtml; } function showAssembly_Date_View_Show(contentId, types) { let showContent = types; // let nowDate = getNowTime(); let myDate = new Date; if (showContent.indexOf("year") >= 0) { let year = myDate.getFullYear(); //获取当前年 showContent = showContent.replaceAll("year", year); } if (showContent.indexOf("month") >= 0) { let mon = myDate.getMonth() + 1; //获取当前月 if (mon < 10) { mon = "0" + mon; } showContent = showContent.replaceAll("month", mon); } if (showContent.indexOf("day") >= 0) { let day = myDate.getDate(); //获取当前日 if (day < 10) { day = "0" + day; } showContent = showContent.replaceAll("day", day); } if (showContent.indexOf("12hour") >= 0) { let h = myDate.getHours();//获取当前小时数(0-23) if (h < 10) { h = "0" + h; } if (Number(h) > 12) { if ((Number(h) - 12) < 10) { h = "下午 0" + ((Number(h) - 12)); } else { h = "下午 " + ((Number(h) - 12)); } } else { h = "上午 " + h; } showContent = showContent.replaceAll("12hour", h); } if (showContent.indexOf("24hour") >= 0) { let h = myDate.getHours();//获取当前小时数(0-23) if (h < 10) { h = "0" + h; } showContent = showContent.replaceAll("24hour", h); } if (showContent.indexOf("min") >= 0) { let m = myDate.getMinutes();//获取当前分钟数(0-59) if (m < 10) { m = "0" + m; } showContent = showContent.replaceAll("min", m); } if (showContent.indexOf("sec") >= 0) { let s = myDate.getSeconds();//获取当前秒 if (s < 10) { s = "0" + s; } showContent = showContent.replaceAll("sec", s); } if (showContent.indexOf("week") >= 0) { var weekday = myDate.getDay(); var weeks = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"); let week = weeks[weekday]; showContent = showContent.replaceAll("week", week); } $('#' + contentId).html(showContent); } /** * 日期选择控件 */ function showAssembly_DateSelect(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualDateSelect/getJson.do?pid=" + content.id, async: false, globle: false, dataType: 'json', error: function () { return false; }, success: function (data) { data = data[0]; // console.log(data) let style = ""; if (content.style != null && content.style != '') { style += content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } let width = content.width; let height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } style += "top:" + postY + ";left:" + postX + ";width:" + width + ";height:" + height + ";"; let inputStyle = ""; if (data.style != null && data.style != '') { inputStyle += data.style; } let background = "transparent"; if (data.background != null && data.background != '') { inputStyle += "background:" + data.background + ";"; background = data.background; } let fontsize = "14px"; if (data.fontsize != null && data.fontsize != '') { inputStyle += "font-size:" + data.fontsize + "px;"; fontsize = data.fontsize + "px"; } let fontcolor = "#333"; if (data.fontcolor != null && data.fontcolor != '') { inputStyle += "color:" + data.fontcolor + ";"; fontcolor = data.fontcolor; } let fontweight = "400"; if (data.fontweight != null && data.fontweight != '') { inputStyle += "font-weight:" + data.fontweight + ";"; fontweight = data.fontweight; } let jsWidth = 20 * Number(width.replace("px", "")) / 200; if (jsWidth < 20) { jsWidth = 20; } divHtml += "
"; divHtml += " "; divHtml += ""; divHtml += "
"; } }); return divHtml; } function showAssembly_DateSelect_View(content, showData) { var divHtml = ""; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualDateSelect/getJson.do?pid=" + content.id, // async: false, // globle: false, // dataType: 'json', // error: function () { // return false; // }, // success: function (data) { data = showData; // console.log(data) let style = ""; if (content.style != null && content.style != '') { style += content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } let width = content.width; let height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } style += "top:" + postY + ";left:" + postX + ";width:" + width + ";height:" + height + ";"; let inputStyle = ""; if (data.style != null && data.style != '') { inputStyle += data.style; } let background = "transparent"; if (data.background != null && data.background != '') { inputStyle += "background:" + data.background + ";"; background = data.background; } let fontsize = "14px"; if (data.fontsize != null && data.fontsize != '') { inputStyle += "font-size:" + data.fontsize + "px;"; fontsize = data.fontsize + "px"; } let fontcolor = "#333"; if (data.fontcolor != null && data.fontcolor != '') { inputStyle += "color:" + data.fontcolor + ";"; fontcolor = data.fontcolor; } let fontweight = "400"; if (data.fontweight != null && data.fontweight != '') { inputStyle += "font-weight:" + data.fontweight + ";"; fontweight = data.fontweight; } let jsWidth = 20 * Number(width.replace("px", "")) / 200; if (jsWidth < 20) { jsWidth = 20; } divHtml += "
"; divHtml += " "; divHtml += ""; divHtml += "
"; // } // }); return divHtml; } function showDateSelect(contentId, type) { var beginTimeStore = ''; var endTimeStore = ''; let separator = " ~ "; let singleDatePicker = "false"; let calendarMode = "day"; let format = "YYYY-MM-DD"; if (type == '0') { singleDatePicker = "true"; calendarMode = "day"; format = "YYYY-MM-DD"; if (sdt != '') { beginTimeStore = sdt.substring(0, 10); } else { beginTimeStore = moment().subtract(0, 'days').format(format); } $('#' + contentId + 'reservationtime').val(beginTimeStore); } else if (type == '1') { singleDatePicker = "true"; calendarMode = "month"; format = "YYYY-MM"; if (sdt != '') { beginTimeStore = sdt.substring(0, 7); } else { beginTimeStore = moment().subtract(0, 'days').format(format); } $('#' + contentId + 'reservationtime').val(beginTimeStore); } else if (type == '2') { singleDatePicker = "true"; calendarMode = "year"; format = "YYYY"; if (sdt != '') { beginTimeStore = sdt.substring(0, 4); } else { beginTimeStore = moment().subtract(0, 'days').format(format); } $('#' + contentId + 'reservationtime').val(beginTimeStore); } else if (type == '3') { singleDatePicker = "false"; calendarMode = "day"; format = "YYYY-MM-DD"; if (sdt != '') { beginTimeStore = sdt.substring(0, 10); } else { beginTimeStore = moment().subtract(6, 'days').format(format); } if (edt != '') { endTimeStore = edt.substring(0, 10); } else { endTimeStore = moment().subtract(0, 'days').format(format); } $('#' + contentId + 'reservationtime').val(beginTimeStore + separator + endTimeStore); } else if (type == '4') { singleDatePicker = "false"; calendarMode = "month"; format = "YYYY-MM"; if (sdt != '') { beginTimeStore = sdt.substring(0, 7); } else { beginTimeStore = moment().subtract(1, 'month').format(format); } if (edt != '') { endTimeStore = edt.substring(0, 7); } else { endTimeStore = moment().subtract(0, 'days').format(format); } $('#' + contentId + 'reservationtime').val(beginTimeStore + separator + endTimeStore); } else if (type == '5') { singleDatePicker = "false"; calendarMode = "year"; format = "YYYY"; if (sdt != '') { beginTimeStore = sdt.substring(0, 4); } else { beginTimeStore = moment().subtract(1, 'year').format(format); } if (edt != '') { endTimeStore = edt.substring(0, 4); } else { endTimeStore = moment().subtract(0, 'days').format(format); } $('#' + contentId + 'reservationtime').val(beginTimeStore + separator + endTimeStore); } var locale = { "format": format, "separator": separator, "applyLabel": "确定", "cancelLabel": "取消", "fromLabel": "起始时间", "toLabel": "结束时间", "customRangeLabel": "自定义", "weekLabel": "W", "daysOfWeek": ["日", "一", "二", "三", "四", "五", "六"], "monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], "firstDay": 1 }; $('#' + contentId + 'reservationtime').daterangepicker({ startDate: beginTimeStore, endDate: endTimeStore, singleDatePicker: eval(singleDatePicker.toLowerCase()), //单日历 // minDate: '1937-01-01', // maxDate: moment(), // dateLimit: { // days: 14000 // }, calendarMode: calendarMode, showDropdowns: false, showWeekNumbers: false, timePicker: false, timePickerIncrement: 1, timePicker12Hour: false, linkedCalendars: false, autoUpdateInput: false, timePickerSeconds: false, // buttonClasses: ['btn'], // applyClass: 'green', // cancelClass: 'default', format: format, separator: separator, // alwaysShowCalendars:true, // autoApply:true, // ranges: { // // '今日': [moment(), moment().subtract(-1, 'days')], // '昨日': [moment().subtract(1, 'days'), moment()], // '最近7日': [moment().subtract(6, 'days'), moment().subtract(-1, 'days')], // '本月': [moment().startOf('month'), moment().endOf('month').subtract(-1, 'days')], // '上月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month').subtract(-1, 'days')] // }, locale: locale }, function (start, end, label) { beginTimeStore = start.format(format); endTimeStore = end.format(format); sdt = beginTimeStore; edt = endTimeStore; if (sdt.length == 7) { sdt = sdt + "-01"; } else if (sdt.length == 4) { sdt = sdt + "-01-01"; } if (type == '0') { edt = sdt.substring(0, 10) + " 23:59"; } else if (type == '1') { let lastDay = getMonthMaxDay(sdt); edt = sdt.substring(0, 7) + "-" + lastDay + " 23:59"; } else if (type == '2') { edt = sdt.substring(0, 4) + "-12-31 23:59"; } if (edt.length == 7) { edt = edt + "-01"; } else if (edt.length == 4) { edt = edt + "-01-01"; } // console.log(sdt) // console.log(edt) showFrame(frameId); }); // if (sdt != '') { // sdt = sdt; // } else { sdt = beginTimeStore; // } // if (edt != '') { // edt = edt; // } else { edt = endTimeStore; // } if (sdt.length == 7) { sdt = sdt + "-01"; } else if (sdt.length == 4) { sdt = sdt + "-01-01"; } if (type == '0') { edt = sdt.substring(0, 10) + " 23:59"; } else if (type == '1') { let lastDay = getMonthMaxDay(sdt); edt = sdt.substring(0, 7) + "-" + lastDay + " 23:59"; } else if (type == '2') { edt = sdt.substring(0, 4) + "-12-31 23:59"; } if (edt.length == 7) { edt = edt + "-01"; } else if (edt.length == 4) { edt = edt + "-01-01"; } // console.log(sdt) // console.log(edt) } /** * 外部链接组件 */ function showAssembly_Iframe(content) { var divHtml = ""; var style = ""; if (content.style != '') { style = content.style; } var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } let showName = ""; if (content.name != "") { showName = content.name; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv reSize\" onmousedown=\"doDown();\" onmouseup=\"doUp();\" onmousemove=\"doMove();\""; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; divHtml = "
" + "" + showName + ""; divHtml += ""; divHtml += ""; divHtml += ""; divHtml += ""; divHtml += "
"; return divHtml; } /** * 外部链接组件 */ function showAssembly_Iframe_View(content) { var divHtml = ""; var style = ""; if (content.style != '') { style = content.style; } var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } //需要绑定开关组件加 let hiddenSt = "display:block;"; if (switchHiddenPoints.indexOf(content.id) != -1) { hiddenSt = "display:none;"; } style += hiddenSt; var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } if (content.isfull == 'true') { width = width.replace("%", "").replace("px", "") + "%"; height = height.replace("%", "").replace("px", "") + "%"; } let src = ""; if (content.src != null && content.src != '') { src = content.src; } if (src.indexOf("http") >= 0) { src = src; } else { if (src.substring(0, 1) == '/') { src = ext.contextPath + src; } else { src = ext.contextPath + '/' + src; } } divHtml = "
"; divHtml += ""; divHtml += "
"; return divHtml; } /** * 标签页组件 */ function showAssembly_Tab(content) { var style = content.style; var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv\" onmouseup=\"doUp2('" + content.id + "');\" \""; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; var divHtml = "
"; if (content.tabtype != null && content.tabtype == 'se') {//下拉 $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualTab/getJson.do?pid=" + content.id, async: false, globle: false, dataType: 'json', error: function () { return false; }, success: function (data) { var ckData = JSON.stringify(data); for (let i = 0; i < data.length; i++) { let tab = data[i]; let ckbackground = 'transparent'; if (tab.ckbackground != null && tab.ckbackground != '') { ckbackground = tab.ckbackground; } let ckfontcolor = '#3c8dbc'; if (tab.ckfontcolor != null && tab.ckfontcolor != '') { ckfontcolor = tab.ckfontcolor; } let ckfontsize = '14'; if (tab.ckfontsize != null && tab.ckfontsize != '') { ckfontsize = tab.ckfontsize; } let ckfontweight = '400'; if (tab.ckfontweight != null && tab.ckfontweight != '') { ckfontweight = tab.ckfontweight; } let height = '100%'; if (tab.height != null && tab.height != '') { height = tab.height; } let ckstyle = ''; if (tab.ckstyle != null && tab.ckstyle != '') { ckstyle = tab.ckstyle; } if (i == 0) { divHtml += ""; } else if (content.tabtype != null && content.tabtype == 'sheet') { $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualTab/getJson.do?pid=" + content.id, async: false, globle: false, dataType: 'json', error: function () { return false; }, success: function (data) { var ckData = JSON.stringify(data); for (let i = 0; i < data.length; i++) { let tab = data[i]; let text = ''; if (tab.text != null && tab.text != '') { text = tab.text; } let firstck = 'false'; if (tab.firstck != null && tab.firstck != '') { firstck = tab.firstck; } let width = '120'; if (tab.width != null && tab.width != '') { width = tab.width; } let height = '60'; if (tab.height != null && tab.height != '') { height = tab.height; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } let ckbackground = 'transparent'; if (tab.ckbackground != null && tab.ckbackground != '') { ckbackground = tab.ckbackground; if (ckbackground.indexOf("/") >= 0) { var path = getRootPath() + ckbackground; ckbackground = 'url(' + path + ') no-repeat'; } } let ckfontcolor = '#3c8dbc'; if (tab.ckfontcolor != null && tab.ckfontcolor != '') { ckfontcolor = tab.ckfontcolor; } let ckfontsize = '14'; if (tab.ckfontsize != null && tab.ckfontsize != '') { ckfontsize = tab.ckfontsize; } let ckfontweight = '400'; if (tab.ckfontweight != null && tab.ckfontweight != '') { ckfontweight = tab.ckfontweight; } let cktextAlign = 'center'; // if (tab.cktextAlign != null && tab.cktextAlign != '') { // cktextAlign = tab.cktextAlign; // } let ckstyle = ''; if (tab.ckstyle != null && tab.ckstyle != '') { ckstyle = tab.ckstyle; } let unckbackground = 'transparent'; if (tab.unckbackground != null && tab.unckbackground != '') { unckbackground = tab.unckbackground; if (unckbackground.indexOf("/") >= 0) { var path = getRootPath() + unckbackground; unckbackground = 'url(' + path + ') no-repeat'; } } let unckfontcolor = '#555555'; if (tab.unckfontcolor != null && tab.unckfontcolor != '') { unckfontcolor = tab.unckfontcolor; } let unckfontsize = '14'; if (tab.unckfontsize != null && tab.unckfontsize != '') { unckfontsize = tab.unckfontsize; } let unckfontweight = '400'; if (tab.unckfontweight != null && tab.unckfontweight != '') { unckfontweight = tab.unckfontweight; } let uncktextAlign = 'center'; // if (tab.uncktextAlign != null && tab.uncktextAlign != '') { // uncktextAlign = tab.uncktextAlign; // } let unckstyle = ''; if (tab.unckstyle != null && tab.unckstyle != '') { unckstyle = tab.unckstyle; } if (firstck == 'true') { divHtml += "
"; } else { divHtml += "
"; } divHtml += text; divHtml += "
"; } } }); } else if (content.tabtype != null && content.tabtype == 'radio') { $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualTab/getJson.do?pid=" + content.id, async: false, globle: false, dataType: 'json', error: function () { return false; }, success: function (data) { var ckData = JSON.stringify(data); for (let i = 0; i < data.length; i++) { let tab = data[i]; let text = ''; if (tab.text != null && tab.text != '') { text = tab.text; } let firstck = 'false'; if (tab.firstck != null && tab.firstck != '') { firstck = tab.firstck; } let width = '120'; if (tab.width != null && tab.width != '') { width = tab.width; } let height = '60'; if (tab.height != null && tab.height != '') { height = tab.height; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } let ckbackground = 'transparent'; if (tab.ckbackground != null && tab.ckbackground != '') { ckbackground = tab.ckbackground; if (ckbackground.indexOf("/") >= 0) { var path = getRootPath() + ckbackground; ckbackground = 'url(' + path + ') no-repeat'; } } let ckfontcolor = '#3c8dbc'; if (tab.ckfontcolor != null && tab.ckfontcolor != '') { ckfontcolor = tab.ckfontcolor; } let ckfontsize = '14'; if (tab.ckfontsize != null && tab.ckfontsize != '') { ckfontsize = tab.ckfontsize; } let ckfontweight = '400'; if (tab.ckfontweight != null && tab.ckfontweight != '') { ckfontweight = tab.ckfontweight; } let cktextAlign = 'center'; // if (tab.cktextAlign != null && tab.cktextAlign != '') { // cktextAlign = tab.cktextAlign; // } let ckstyle = ''; if (tab.ckstyle != null && tab.ckstyle != '') { ckstyle = tab.ckstyle; } let unckbackground = 'transparent'; if (tab.unckbackground != null && tab.unckbackground != '') { unckbackground = tab.unckbackground; if (unckbackground.indexOf("/") >= 0) { var path = getRootPath() + unckbackground; unckbackground = 'url(' + path + ') no-repeat'; } } let unckfontcolor = '#555555'; if (tab.unckfontcolor != null && tab.unckfontcolor != '') { unckfontcolor = tab.unckfontcolor; } let unckfontsize = '14'; if (tab.unckfontsize != null && tab.unckfontsize != '') { unckfontsize = tab.unckfontsize; } let unckfontweight = '400'; if (tab.unckfontweight != null && tab.unckfontweight != '') { unckfontweight = tab.unckfontweight; } let uncktextAlign = 'center'; // if (tab.uncktextAlign != null && tab.uncktextAlign != '') { // uncktextAlign = tab.uncktextAlign; // } let unckstyle = ''; if (tab.unckstyle != null && tab.unckstyle != '') { unckstyle = tab.unckstyle; } let radioBackground = tab.radioBackground; let radioCkBackground = tab.radioCkBackground; let radioSize = tab.radioSize.replace("px", ""); let radioCkSize = tab.radioCkSize.replace("px", ""); let m_t = (height.replace("px", "") - radioSize) / 2; let m_t2 = (radioSize - radioCkSize) / 2; divHtml += "
"; if (firstck == 'true') { divHtml += "
"; divHtml += "
"; divHtml += "
"; divHtml += "
" + text + "
"; } else { divHtml += "
"; divHtml += "
"; divHtml += "
"; divHtml += "
" + text + "
"; } divHtml += "
"; } } }); } divHtml += "
"; return divHtml; } function showAssembly_Tab_View(content, showData) { var contentStyle = content.style; var divwidth = content.width; var divheight = content.height; let onmouseupSt = ""; var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { contentStyle += "z-index:" + content.zIndex + ";"; } let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (divwidth.indexOf("px") < 0 && divwidth.indexOf("%") < 0) { divwidth += "px"; } if (divheight.indexOf("px") < 0 && divheight.indexOf("%") < 0) { divheight += "px"; } var divHtml = "
"; var ckData = JSON.stringify(showData); if (content.tabtype != null && content.tabtype == 'se') {//下拉 // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualTab/getJson.do?pid=" + content.id, // async: false, // globle: false, // dataType: 'json', // error: function () { // return false; // }, // success: function (data) { for (let i = 0; i < showData.length; i++) { let tab = showData[i]; let ckbackground = 'transparent'; if (tab.ckbackground != null && tab.ckbackground != '') { ckbackground = tab.ckbackground; } let ckfontcolor = '#3c8dbc'; if (tab.ckfontcolor != null && tab.ckfontcolor != '') { ckfontcolor = tab.ckfontcolor; } let ckfontsize = '14'; if (tab.ckfontsize != null && tab.ckfontsize != '') { ckfontsize = tab.ckfontsize; } let ckfontweight = '400'; if (tab.ckfontweight != null && tab.ckfontweight != '') { ckfontweight = tab.ckfontweight; } let ckstyle = ''; if (tab.ckstyle != null && tab.ckstyle != '') { ckstyle = tab.ckstyle; } if (i == 0) { divHtml += ""; } else if (content.tabtype != null && content.tabtype == 'sheet') { // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualTab/getJson.do?pid=" + content.id, // async: false, // globle: false, // dataType: 'json', // error: function () { // return false; // }, // success: function (data) { // console.log(showData) for (let i = 0; i < showData.length; i++) { let tab = showData[i]; let text = ''; if (tab.text != null && tab.text != '') { text = tab.text; } let firstck = 'false'; if (tab.firstck != null && tab.firstck != '') { firstck = tab.firstck; } let width = '120'; if (tab.width != null && tab.width != '') { width = tab.width; } let height = '60'; if (tab.height != null && tab.height != '') { height = tab.height; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } let ckbackground = 'transparent'; if (tab.ckbackground != null && tab.ckbackground != '') { ckbackground = tab.ckbackground; if (ckbackground.indexOf("/") >= 0) { var path = getRootPath() + ckbackground; ckbackground = 'url(' + path + ') no-repeat'; } } let ckfontcolor = '#3c8dbc'; if (tab.ckfontcolor != null && tab.ckfontcolor != '') { ckfontcolor = tab.ckfontcolor; } let ckfontsize = '14'; if (tab.ckfontsize != null && tab.ckfontsize != '') { ckfontsize = tab.ckfontsize; } let ckfontweight = '400'; if (tab.ckfontweight != null && tab.ckfontweight != '') { ckfontweight = tab.ckfontweight; } let cktextAlign = 'center'; // if (tab.cktextAlign != null && tab.cktextAlign != '') { // cktextAlign = tab.cktextAlign; // } let ckstyle = ''; if (tab.ckstyle != null && tab.ckstyle != '') { ckstyle = tab.ckstyle; } let unckbackground = 'transparent'; if (tab.unckbackground != null && tab.unckbackground != '') { unckbackground = tab.unckbackground; if (unckbackground.indexOf("/") >= 0) { var path = getRootPath() + unckbackground; unckbackground = 'url(' + path + ') no-repeat'; } } let unckfontcolor = '#555555'; if (tab.unckfontcolor != null && tab.unckfontcolor != '') { unckfontcolor = tab.unckfontcolor; } let unckfontsize = '14'; if (tab.unckfontsize != null && tab.unckfontsize != '') { unckfontsize = tab.unckfontsize; } let unckfontweight = '400'; if (tab.unckfontweight != null && tab.unckfontweight != '') { unckfontweight = tab.unckfontweight; } let uncktextAlign = 'center'; // if (tab.uncktextAlign != null && tab.uncktextAlign != '') { // uncktextAlign = tab.uncktextAlign; // } let unckstyle = ''; if (tab.unckstyle != null && tab.unckstyle != '') { unckstyle = tab.unckstyle; } // if (nowCk == '') { // nowTabIds = tab.id; if (firstck == 'true') { divHtml += "
"; } else { divHtml += "
"; } // } else { // nowTabIds = nowCk; // if(tab.id==nowCk){ // divHtml += "
"; // }else{ // divHtml += "
"; // } // } divHtml += text; divHtml += "
"; } // } // }); } else if (content.tabtype != null && content.tabtype == 'radio') { for (let i = 0; i < showData.length; i++) { let tab = showData[i]; let text = ''; if (tab.text != null && tab.text != '') { text = tab.text; } let firstck = 'false'; if (tab.firstck != null && tab.firstck != '') { firstck = tab.firstck; } let width = '120'; if (tab.width != null && tab.width != '') { width = tab.width; } let height = '60'; if (tab.height != null && tab.height != '') { height = tab.height; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } let ckbackground = 'transparent'; if (tab.ckbackground != null && tab.ckbackground != '') { ckbackground = tab.ckbackground; if (ckbackground.indexOf("/") >= 0) { var path = getRootPath() + ckbackground; ckbackground = 'url(' + path + ') no-repeat'; } } let ckfontcolor = '#3c8dbc'; if (tab.ckfontcolor != null && tab.ckfontcolor != '') { ckfontcolor = tab.ckfontcolor; } let ckfontsize = '14'; if (tab.ckfontsize != null && tab.ckfontsize != '') { ckfontsize = tab.ckfontsize; } let ckfontweight = '400'; if (tab.ckfontweight != null && tab.ckfontweight != '') { ckfontweight = tab.ckfontweight; } let cktextAlign = 'center'; // if (tab.cktextAlign != null && tab.cktextAlign != '') { // cktextAlign = tab.cktextAlign; // } let ckstyle = ''; if (tab.ckstyle != null && tab.ckstyle != '') { ckstyle = tab.ckstyle; } let unckbackground = 'transparent'; if (tab.unckbackground != null && tab.unckbackground != '') { unckbackground = tab.unckbackground; if (unckbackground.indexOf("/") >= 0) { var path = getRootPath() + unckbackground; unckbackground = 'url(' + path + ') no-repeat'; } } let unckfontcolor = '#555555'; if (tab.unckfontcolor != null && tab.unckfontcolor != '') { unckfontcolor = tab.unckfontcolor; } let unckfontsize = '14'; if (tab.unckfontsize != null && tab.unckfontsize != '') { unckfontsize = tab.unckfontsize; } let unckfontweight = '400'; if (tab.unckfontweight != null && tab.unckfontweight != '') { unckfontweight = tab.unckfontweight; } let uncktextAlign = 'center'; // if (tab.uncktextAlign != null && tab.uncktextAlign != '') { // uncktextAlign = tab.uncktextAlign; // } let unckstyle = ''; if (tab.unckstyle != null && tab.unckstyle != '') { unckstyle = tab.unckstyle; } let radioBackground = tab.radioBackground; let radioCkBackground = tab.radioCkBackground; let radioSize = tab.radioSize.replace("px", ""); let radioCkSize = tab.radioCkSize.replace("px", ""); let m_t = (height.replace("px", "") - radioSize) / 2; let m_t2 = (radioSize - radioCkSize) / 2; divHtml += "
"; if (firstck == 'true') { divHtml += "
"; divHtml += "
"; divHtml += "
"; divHtml += "
" + text + "
"; } else { divHtml += "
"; divHtml += "
"; divHtml += "
"; divHtml += "
" + text + "
"; } divHtml += "
"; } } divHtml += "
"; return divHtml; } /** * 下拉跳转 */ function showAssembly_SelectJump(content) { var style = content.style; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv\" onmouseup=\"doUp2('" + content.id + "');\" "; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; var divHtml = "
"; divHtml += ""; divHtml += ""; divHtml += ""; divHtml += ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualSelect/getJson.do?pid=" + content.id, async: false, globle: false, dataType: 'json', error: function () { return false; }, success: function (datas) { // console.log(datas) if (datas.length > 0) { divHtml += ""; } } }); divHtml += "
"; return divHtml; } function showAssembly_SelectJump_View(content, showData) { var style = content.style; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv\" onmouseup=\"doUp2('" + content.id + "');\" "; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; var divHtml = "
"; // console.log(datas) if (showData.length > 0) { divHtml += ""; } divHtml += "
"; return divHtml; } /** * 数据映射组件 */ function showAssembly_MpView(content) { var style = content.style; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv\" onmouseup=\"doUp2('" + content.id + "');\" "; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; var divHtml = "
"; divHtml += ""; divHtml += ""; divHtml += ""; divHtml += "
"; return divHtml; } function showAssembly_MpView_View(content, showData, mqSt) { var contentStyle = content.style; var divwidth = content.width; var divheight = content.height; if (content.zIndex != null && content.zIndex != '') { contentStyle += "z-index:" + content.zIndex + ";"; } let postX = content.postx; let postY = content.posty; if (postX.indexOf("px") < 0 && postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("px") < 0 && postY.indexOf("%") < 0) { postY += "px"; } if (divwidth.indexOf("px") < 0 && divwidth.indexOf("%") < 0) { divwidth += "px"; } if (divheight.indexOf("px") < 0 && divheight.indexOf("%") < 0) { divheight += "px"; } var divHtml = "
"; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualMpView/getJson.do?pid=" + content.id, // async: false, // globle: false, // dataType: 'json', // error: function () { // return false; // }, // success: function (data) { let background = ""; for (let i = 0; i < showData.length; i++) { let mpView = showData[i]; let mpid = ""; if (mpView.mpid != null && mpView.mpid != '') { mpid = mpView.mpid; // mqttMpcode = mqttMpcode + mpid + ","; } let jsmpValue = ""; if (mpView.jsmpValue != null) { jsmpValue = mpView.jsmpValue; } let jsvalue = ""; if (jsmpValue != '') { jsvalue = jsmpValue; } else { if (mpView.jsvalue != null) { jsvalue = mpView.jsvalue; } } let jsmethod = ""; if (mpView.jsmethod != null && mpView.jsmethod != '') { jsmethod = mpView.jsmethod; } let forbackground = ""; if (mpView.background != null && mpView.background != '') { forbackground = mpView.background; } else { forbackground = "transparent"; } let parmvalue = ""; if (mpView.mpid != null && mpView.mpid != '') { parmvalue = mpView.mpValue; } else if (mpView.url != null && mpView.url != '') { $.ajax({ type: 'GET', url: ext.contextPath + mpView.url, async: false, globle: false, dataType: 'json', error: function () { return false; }, success: function (result) { parmvalue = result.result; } }); } let showBackground = getMpValueForShow(parmvalue, jsvalue, jsmethod, forbackground, i); if (showBackground != '-') { background += showBackground + "|"; } else { // background += "-|"; } } background = background.substring(0, background.length - 1); background = background.split("|"); // console.log(background) // mpValueDataJson if (background != null && background.length > 0) { // for (let j = 0; j < background.length; j++) { // mpValueDataJson.nowIndex = background[1]; let bkData = background[0]; if (bkData != '-' && bkData != '') { let bkS = bkData.split(","); //为mq更新使用 记录 首次或者上次采用的映射条件序号 eval("mpValueDataJson.AA" + content.id + "").nowIndex = bkS[1]; // console.log(eval("mpValueDataJson.AA" + content.id + ".nowIndex")) let backgroundT = ""; let filest = "false"; if (showData[Number(bkS[1])].filest != '') { filest = showData[Number(bkS[1])].filest; } let ckid = showData[Number(bkS[1])].id; let ckMinioId = ""; if (filest == 'true') { ckMinioId = showData[Number(bkS[1])].id; if (mqSt == 'true') { backgroundT = "url(" + getMinioFile(showData[Number(bkS[1])].id, 'tb_pro_dataVisual_mpView_file', 'datavisual') + ")"; } } else { backgroundT = bkS[0]; } let fontsize = "14px"; if (showData[Number(bkS[1])].fontsize != null) { if (showData[Number(bkS[1])].fontsize != '') { fontsize = showData[Number(bkS[1])].fontsize.replace("px") + "px"; } } let fontcolor = "#000000"; if (showData[Number(bkS[1])].fontcolor != null) { if (showData[Number(bkS[1])].fontcolor != '') { fontcolor = showData[Number(bkS[1])].fontcolor; } } let fontweight = "400"; if (showData[Number(bkS[1])].fontweight != null) { if (showData[Number(bkS[1])].fontweight != '') { fontweight = showData[Number(bkS[1])].fontweight; } } let outValueType = "0"; if (showData[Number(bkS[1])].outValueType != null) { if (showData[Number(bkS[1])].outValueType != '') { outValueType = showData[Number(bkS[1])].outValueType; } } let autoBkSt = "false"; let autoheight = "100"; let textShow = ""; if (outValueType == '0') { if (showData[Number(bkS[1])].textshow != null) { if (showData[Number(bkS[1])].textshow != '') { textShow = showData[Number(bkS[1])].textshow; } } } else if (outValueType == '1') { if (showData[Number(bkS[1])].autoBkSt != null) { if (showData[Number(bkS[1])].autoBkSt != '') { autoBkSt = showData[Number(bkS[1])].autoBkSt; } } if (autoBkSt == 'true') { let autoBkStMaxvalue = ""; if (showData[Number(bkS[1])].autoBkStMaxvalue != null) { if (showData[Number(bkS[1])].autoBkStMaxvalue != '') { autoBkStMaxvalue = showData[Number(bkS[1])].autoBkStMaxvalue; } } if (autoBkStMaxvalue != '') { autoheight = ((Number(showData[Number(bkS[1])].mpValue) / Number(autoBkStMaxvalue)) * 100).toFixed(0); } } } if (Number(autoheight) > 100) { autoheight = "100"; } let opacity = "1"; if (showData[Number(bkS[1])].opacity != null) { if (showData[Number(bkS[1])].opacity != '') { opacity = showData[Number(bkS[1])].opacity; } } let style = ""; if (showData[Number(bkS[1])].style != null) { if (showData[Number(bkS[1])].style != '') { style = showData[Number(bkS[1])].style; } } if (autoBkSt == 'true') { let autoBkTextSt = "true"; if (showData[Number(bkS[1])].autoBkTextSt != null) { if (showData[Number(bkS[1])].autoBkTextSt != '') { autoBkTextSt = showData[Number(bkS[1])].autoBkTextSt; } } let autoBkTextType = ""; if (showData[Number(bkS[1])].autoBkTextType != null) { if (showData[Number(bkS[1])].autoBkTextType != '') { autoBkTextType = showData[Number(bkS[1])].autoBkTextType; } } if (autoBkTextSt == 'true') { if (autoBkTextType == '1') { textShow = showData[Number(bkS[1])].mpValue; } else if (autoBkTextType == '2') { textShow = autoheight + "%"; } else { textShow = ""; } } let autoBkBackground = ""; if (showData[Number(bkS[1])].autoBkBackground != null) { if (showData[Number(bkS[1])].autoBkBackground != '') { autoBkBackground = showData[Number(bkS[1])].autoBkBackground; } } divHtml += "
" + "
" + "
" + textShow + "
" + "
"; } else { divHtml += "
" + textShow + "
"; } } // } } // } // }); divHtml += "
"; return divHtml; } function getMpValueForShow(parmvalue, jsvalue, jsmethod, forbackground, index) { let showBackground = "-"; if (jsmethod == '0') { if (Number(parmvalue) > Number(jsvalue)) { if (forbackground.indexOf("/") >= 0) { var path = getRootPath() + forbackground; showBackground = 'url(' + path + ') no-repeat'; } else { showBackground = forbackground; } return showBackground + "," + index; } } else if (jsmethod == '1') { if (Number(parmvalue) >= Number(jsvalue)) { if (forbackground.indexOf("/") >= 0) { var path = getRootPath() + forbackground; showBackground = 'url(' + path + ') no-repeat'; } else { showBackground = forbackground; } return showBackground + "," + index; } } else if (jsmethod == '2') { if (Number(parmvalue) == Number(jsvalue)) { if (forbackground.indexOf("/") >= 0) { var path = getRootPath() + forbackground; showBackground = 'url(' + path + ') no-repeat'; } else { showBackground = forbackground; } return showBackground + "," + index; } } else if (jsmethod == '3') { if (Number(parmvalue) < Number(jsvalue)) { if (forbackground.indexOf("/") >= 0) { var path = getRootPath() + forbackground; showBackground = 'url(' + path + ') no-repeat'; } else { showBackground = forbackground; } return showBackground + "," + index; } } else if (jsmethod == '4') { if (Number(parmvalue) <= Number(jsvalue)) { if (forbackground.indexOf("/") >= 0) { var path = getRootPath() + forbackground; showBackground = 'url(' + path + ') no-repeat'; } else { showBackground = forbackground; } return showBackground + "," + index; } } return showBackground; } function getMinioFile(masterId, tbName, bucketName) { let path = "-"; $.ajax({ type: 'GET', url: ext.contextPath + "/base/getInputFileList_minio.do", async: false, globle: false, data: { masterId: masterId, tbName: tbName, bucketName: bucketName }, dataType: 'json', error: function () { return false; }, success: function (data) { if (data.length > 0) { path = 'data:image/png;base64,' + data[0].streamFile; } } }); return path; } /** * 进度条组件 */ function showAssembly_ProgressBarChart(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualProgressBarChart/getJson.do?pid=" + content.id, async: false, globle: false, error: function () { return false; }, success: function (data) { let datas = eval('(' + data + ')'); var style = ""; if (content.style != '') { style = content.style; } var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv reSize\" onmousedown=\"doDown();\" onmouseup=\"doUp();\" onmousemove=\"doMove();\""; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; divHtml = "
"; divHtml += ""; divHtml += ""; divHtml += ""; divHtml += "
"; // divHtml+="
"; } }); return divHtml; } function showAssembly_ProgressBarChart_View(content, showData) { var divHtml = ""; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualProgressBarChart/getJson.do?pid=" + content.id, // async: false, // globle: false, // error: function () { // return false; // }, // success: function (data) { // let datas = eval('(' + data + ')'); var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; } divHtml = "
"; divHtml += "
"; // } // }); return divHtml; } function showProgressBarChart(contentId, showData) { // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualProgressBarChart/getJson.do?pid=" + contentId, // async: true, // globle: false, // dataType: 'json', // error: function () { // return false; // }, // success: function (data) { // console.log(data) var dataVisualGaugeChart = showData; document.getElementById(contentId).removeAttribute("_echarts_instance_"); var myChart = echarts.init(document.getElementById(contentId)); myChart.showLoading({ text: '数据正在加载...', textStyle: {fontSize: 30, color: '#444'}, effectOption: {backgroundColor: 'rgba(0, 0, 0, 0)'}, zlevel: 0 }); let showValue = "0"; let mpid = ""; if (dataVisualGaugeChart.mpid != null && dataVisualGaugeChart.mpid != "") { mpid = dataVisualGaugeChart.mpid; } if (mpid != "") { showValue = dataVisualGaugeChart.text; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/work/mpoint/getMpointJsonForEXAndDV.do", // async: false, // globle: false, // data: { // mpid: mpid, // valuemethod: dataVisualGaugeChart.valuemethod, // sdt: sdt, // edt: edt // }, // dataType: 'json', // error: function () { // return false; // }, // success: function (result) { // let mp = result[0]; // showValue = mp.parmvalue; // } // }); } else { if (dataVisualGaugeChart.text != null && dataVisualGaugeChart.text != "") { showValue = dataVisualGaugeChart.text; } } showValue = Number(showValue); let showbktextValue = "100"; let bkmptext = ""; if (dataVisualGaugeChart.bkmptext != null && dataVisualGaugeChart.bkmptext != "") { bkmptext = dataVisualGaugeChart.bkmptext; } if (bkmptext != "") { $.ajax({ type: 'GET', url: ext.contextPath + "/work/mpoint/getMpointJsonForEX.do", async: false, globle: false, data: { mpid: bkmptext }, dataType: 'json', error: function () { return false; }, success: function (result) { let mp = result[0]; showbktextValue = mp.parmvalue; } }); } else { if (dataVisualGaugeChart.bktext != null && dataVisualGaugeChart.bktext != "") { showbktextValue = dataVisualGaugeChart.bktext; } } showbktextValue = Number(showbktextValue); let textPosition = "false"; if (dataVisualGaugeChart.textPosition != null && dataVisualGaugeChart.textPosition != '') { textPosition = dataVisualGaugeChart.textPosition; } let labelShow = "false"; if (textPosition != 'false') { labelShow = 'true'; } labelShow = eval(labelShow.toLowerCase()); let textColor = "#fff"; if (dataVisualGaugeChart.textColor != null && dataVisualGaugeChart.textColor != '') { textColor = dataVisualGaugeChart.textColor; } let textFontsize = "16"; if (dataVisualGaugeChart.textFontsize != null && dataVisualGaugeChart.textFontsize != '') { textFontsize = dataVisualGaugeChart.textFontsize; } let textFontweight = "normal"; if (dataVisualGaugeChart.textFontweight != null && dataVisualGaugeChart.textFontweight != '') { textFontweight = dataVisualGaugeChart.textFontweight; } let datacolor = "#69F6F9"; if (dataVisualGaugeChart.datacolors != null && dataVisualGaugeChart.datacolors != '') { datacolor = dataVisualGaugeChart.datacolors; } let datacolors = datacolor.split(","); let colorsData = []; if (datacolors != '' && datacolors.length > 1) { let colorsDataD = []; for (let c = 0; c < datacolors.length; c++) { colorsDataD.push({ offset: (1 / (datacolors.length - 1)) * c, color: datacolors[c] }) } colorsData = new echarts.graphic.LinearGradient(0, 0, 1, 0, colorsDataD) } else { colorsData = datacolor; } let databarwidth = "40"; if (dataVisualGaugeChart.databarwidth != null && dataVisualGaugeChart.databarwidth != '') { databarwidth = dataVisualGaugeChart.databarwidth; } let dataradius = "20"; if (dataVisualGaugeChart.dataradius != null && dataVisualGaugeChart.dataradius != '') { dataradius = dataVisualGaugeChart.dataradius; } let bkcolors = "#e0e0e0"; if (dataVisualGaugeChart.bkcolors != null && dataVisualGaugeChart.bkcolors != '') { bkcolors = dataVisualGaugeChart.bkcolors; } let bkbarwidth = "40"; if (dataVisualGaugeChart.bkbarwidth != null && dataVisualGaugeChart.bkbarwidth != '') { bkbarwidth = dataVisualGaugeChart.bkbarwidth; } let bkradius = "20"; if (dataVisualGaugeChart.bkradius != null && dataVisualGaugeChart.bkradius != '') { bkradius = dataVisualGaugeChart.bkradius; } let option = { grid: { left: 0, // 与容器左侧的距离 right: 0, // 与容器右侧的距离 top: 0, bottom: 0 }, xAxis: { show: false, type: "value", max: showbktextValue // boundaryGap: [0, 0] }, yAxis: [ { show: false, // type: "category", data: [""], // axisLine: {show: false}, // axisTick: [ // { // show: false // } // ] } ], series: [ { name: "数据", type: "bar", zlevel: 1, itemStyle: { normal: { barBorderRadius: Number(dataradius), color: colorsData } }, label: { show: labelShow, position: textPosition, color: textColor, fontSize: textFontsize, fontWeight: textFontweight }, barWidth: databarwidth, data: [showValue], showBackground: true, backgroundStyle: { color: bkcolors, borderRadius: Number(bkradius) } } // , // { // name: "背景", // type: "bar", // barWidth: bkbarwidth, // barGap: "-100%", // data: [showbktextValue], // itemStyle: { // normal: { // color: bkcolors, // barBorderRadius: Number(bkradius) // } // } // } ] }; myChart.setOption(option, true); myChart.hideLoading(); window.addEventListener('resize', function () {//执行 myChart.resize(); }) // } // }); } /** * 线条组件 */ function showAssembly_Line(content) { var divHtml = ""; var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "onmouseup=\"doUp2('" + content.id + "');\" "; } } divHtml = "
"; divHtml += "
"; return divHtml; } function showAssembly_Line_View(content) { var divHtml = ""; var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } //需要绑定开关组件加 let hiddenSt = "display:block;"; if (switchHiddenPoints.indexOf(content.id) != -1) { hiddenSt = "display:none;"; } style += hiddenSt; divHtml = "
"; divHtml += "
"; return divHtml; } /** * 开关组件 */ function showAssembly_Switch(content) { var divHtml = ""; var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "onmouseup=\"doUp2('" + content.id + "');\" "; } } divHtml = "
"; divHtml += ""; divHtml += "
"; return divHtml; } function showAssembly_Switch_View(content, showData) { var divHtml = ""; var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } let width = content.width; let height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } let opacityst = "1"; if (content.opacityst != null && content.opacityst != '') { opacityst = content.opacityst; } style += "top:" + postY + ";left:" + postX + ";opacity:" + opacityst + ";"; let switchId = "switch_" + showData.id; //获取绑定点 $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualSwitchPoint/getPoints.do?pid=" + switchId.replace("switch_", ""), async: false, globle: false, error: function () { return false; }, success: function (datas) { if (showData.openst == 'false') { switchHiddenPoints += datas; } switchAllPoints["AA"+showData.id] = datas; } }); divHtml += "
"; divHtml += "
"; return divHtml; } /** * 悬浮框组件 */ function showAssembly_SuspensionFrame(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualSuspensionFrame/getJson.do?pid=" + content.id, async: false, globle: false, error: function () { return false; }, success: function (datas) { let data = eval('(' + datas + ')'); data = data[0]; var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv reSize\" onmousedown=\"doDown();\" onmouseup=\"doUp();\" onmousemove=\"doMove();\""; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; var textcontent = ""; if (data.textcontent != null && data.textcontent != "") { textcontent = data.textcontent; } divHtml += "
"; divHtml += textcontent; divHtml += "
"; } }); return divHtml; } function showAssembly_SuspensionFrame_View(content, showData) { var divHtml = ""; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualSuspensionFrame/getJson.do?pid=" + content.id, // async: false, // globle: false, // error: function () { // return false; // }, // success: function (datas) { // let data = eval('(' + datas + ')'); // data = data[0]; var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } let width = content.width; let height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } style += "top:" + postY + ";left:" + postX + ";"; var textcontent = ""; if (showData.textcontent != null && showData.textcontent != "") { textcontent = showData.textcontent; } divHtml += "
"; divHtml += textcontent; divHtml += "
"; // } // }); return divHtml; } function showVoice(id) { $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualSuspensionFrame/getById.do?id=" + id, async: true, globle: false, dataType: 'json', error: function () { return false; }, success: function (data) { let to_speak = window.speechSynthesis; to_speak = new SpeechSynthesisUtterance(data[0].textcontent); window.speechSynthesis.speak(to_speak); } }); } /** * 极坐标组件 */ function showAssembly_PolarCoordinates(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualPolarCoordinates/getJson.do?pid=" + content.id, async: false, globle: false, error: function () { return false; }, success: function (data) { let datas = eval('(' + data + ')'); var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv reSize\" onmousedown=\"doDown();\" onmouseup=\"doUp();\" onmousemove=\"doMove();\""; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; divHtml = "
"; divHtml += ""; divHtml += " "; divHtml += " "; divHtml += " "; divHtml += " "; divHtml += " "; divHtml += " "; divHtml += " "; divHtml += "
"; // divHtml+="
"; } }); return divHtml; } function showAssembly_PolarCoordinates_View(content, showData) { var divHtml = ""; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualPolarCoordinates/getJson.do?pid=" + content.id, // async: false, // globle: false, // error: function () { // return false; // }, // success: function (data) { // let datas = eval('(' + data + ')'); var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; } divHtml = "
"; divHtml += "
"; // } // }); return divHtml; } function showPolarCoordinates(contentId, showData, showSeriesData) { // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualPolarCoordinates/getChartJson.do?contentId=" + contentId, // async: true, // globle: false, // dataType: 'json', // error: function () { // return false; // }, // success: function (data) { // console.log(data) var dataVisualGaugeChart = showData; var dataVisualPolarCoordinatesSeries = showSeriesData; document.getElementById(contentId).removeAttribute("_echarts_instance_"); var myChart = echarts.init(document.getElementById(contentId)); myChart.showLoading({ text: '数据正在加载...', textStyle: {fontSize: 30, color: '#444'}, effectOption: {backgroundColor: 'rgba(0, 0, 0, 0)'}, zlevel: 0 }); let colors = dataVisualGaugeChart.colors.split(','); let radius = '80%'; if (dataVisualGaugeChart.radius != null && dataVisualGaugeChart.radius != '') { radius = dataVisualGaugeChart.radius; } let barWidth = '20'; if (dataVisualGaugeChart.barwidth != null && dataVisualGaugeChart.barwidth != '') { barWidth = dataVisualGaugeChart.barwidth; } let roundCap = 'true'; if (dataVisualGaugeChart.roundcapst != null && dataVisualGaugeChart.roundcapst != '') { roundCap = dataVisualGaugeChart.roundcapst; } let showBackground = 'true'; if (dataVisualGaugeChart.backgroundst != null && dataVisualGaugeChart.backgroundst != '') { showBackground = dataVisualGaugeChart.backgroundst; } let backgroundcolor = '#27333F'; if (dataVisualGaugeChart.backgroundcolor != null && dataVisualGaugeChart.backgroundcolor != '') { backgroundcolor = dataVisualGaugeChart.backgroundcolor; } let max = 100; if (dataVisualGaugeChart.max != null && dataVisualGaugeChart.max != '') { max = dataVisualGaugeChart.max; } let legendShow = eval("true".toLowerCase()); let legendPosition = "center"; let legendSt = dataVisualGaugeChart.legendPosition; if (legendSt == 'false') { legendShow = eval("false".toLowerCase()); } else { legendPosition = legendSt; legendShow = eval("true".toLowerCase()); } let legendFontsize = '16px'; if (dataVisualGaugeChart.legendFontsize != null && dataVisualGaugeChart.legendFontsize != '') { legendFontsize = dataVisualGaugeChart.legendFontsize; } let legendData = []; let series = []; for (let s = 0; s < dataVisualPolarCoordinatesSeries.length; s++) { let seriesData = dataVisualPolarCoordinatesSeries[s]; legendData.push(seriesData.name); let showValue = 0; if (seriesData.mpid != null && seriesData.mpid != '') { showValue = seriesData.fixedvalue; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/work/mpoint/getMpointJsonForEX.do", // async: false, // globle: false, // data: { // mpid: seriesData.mpid // }, // dataType: 'json', // error: function () { // return false; // }, // success: function (result) { // let mp = result[0]; // showValue = mp.parmvalue; // } // }); } else { if (seriesData.fixedvalue != null && seriesData.fixedvalue != '') { showValue = seriesData.fixedvalue; } } let cdata = []; for (let i = 0; i < (s + 1); i++) { // console.log(s); if (i == s) { cdata.push(Number(showValue)); } else { cdata[i] = 0; } } if (s == 0) { series.push({ type: "bar", barWidth: barWidth, data: cdata, coordinateSystem: "polar", name: seriesData.name, stack: "a", roundCap: eval(roundCap.toLowerCase()), showBackground: eval(showBackground.toLowerCase()), backgroundStyle: { color: backgroundcolor } }) } else { series.push({ type: "bar", data: cdata, coordinateSystem: "polar", name: seriesData.name, stack: "a", roundCap: eval(roundCap.toLowerCase()), showBackground: eval(showBackground.toLowerCase()), backgroundStyle: { color: backgroundcolor } }) } } let option = { color: colors, angleAxis: { max: max, type: "value", axisLine: { show: false }, axisTick: { show: false }, splitLine: { show: false }, axisLabel: { show: false } }, radiusAxis: { type: "category", data: legendData, z: 100, axisLine: { show: false }, axisTick: { show: false }, axisLabel: { show: false } }, polar: { center: ["50%", "50%"], radius: radius }, tooltip: { show: true }, series: series, legend: { show: legendShow, left: legendPosition, data: legendData, textStyle: { fontSize: legendFontsize } } }; myChart.setOption(option, true); myChart.hideLoading(); window.addEventListener('resize', function () {//执行 myChart.resize(); }) // } // }); } /** * 日期控件 */ function showAssembly_Weather(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualWeather/getJson.do?pid=" + content.id, async: false, globle: false, dataType: 'json', error: function () { return false; }, success: function (data) { data = data[0]; // console.log(data) let style = ""; let zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "class=\"moveDiv reSize\" onmousedown=\"doDown();\" onmouseup=\"doUp();\" onmousemove=\"doMove();\""; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";width:" + width + ";height:" + height + ";"; if (data.background != null && data.background != '') { style += "background:" + data.background + ";"; } if (data.fontcolor != null && data.fontcolor != '') { style += "color:" + data.fontcolor + ";"; } else { style += "color:#000000;"; } let fontsize = "font-size:14px;"; if (data.fontsize != null && data.fontsize != '') { fontsize = data.fontsize.replace("px", ""); style += "font-size:" + fontsize + "px;"; } else { style += fontsize; } if (data.fontweight != null && data.fontweight != '') { style += "font-weight:" + data.fontweight + ";"; } else { style += "font-weight:400;"; } if (data.textAlign != null && data.textAlign != '') { style += "text-align:" + data.textAlign + ";"; } else { style += "text-align:center;"; } let type = "weather"; if (data.type != null && data.type != '') { type = data.type; } // let showContent = ""; if (content.style != null && content.style != '') { style += content.style; } divHtml += "
"; divHtml += ""; divHtml += ""; divHtml += " "; divHtml += ""; divHtml += ""; divHtml += ""; divHtml += ""; divHtml += " "; divHtml += "
"; } }); return divHtml; } function showAssembly_Weather_View(content, showData, showWeatherData) { var divHtml = ""; // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualDate/getJson.do?pid=" + content.id, // async: false, // globle: false, // dataType: 'json', // error: function () { // return false; // }, // success: function (data) { let data = showData; // console.log(data) let style = ""; let zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } let width = content.width; let height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX += "px"; } if (postY.indexOf("%") < 0) { postY += "px"; } if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } style += "top:" + postY + ";left:" + postX + ";width:" + width + ";height:" + height + ";line-height:" + height + ";"; if (data.background != null && data.background != '') { style += "background:" + data.background + ";"; } if (data.fontcolor != null && data.fontcolor != '') { style += "color:" + data.fontcolor + ";"; } else { style += "color:#000000;"; } if (data.fontsize != null && data.fontsize != '') { style += "font-size:" + data.fontsize + ";"; } else { style += "font-size:14px;"; } if (data.fontweight != null && data.fontweight != '') { style += "font-weight:" + data.fontweight + ";"; } else { style += "font-weight:400;"; } if (data.textAlign != null && data.textAlign != '') { style += "text-align:" + data.textAlign + ";"; } else { style += "text-align:center;"; } let type = ""; if (data.type != null && data.type != '') { type = data.type; } let showContent = ""; if (showWeatherData != null && showWeatherData.length > 0) { showWeatherData = showWeatherData[0]; if (type == 'weather') { showContent = showWeatherData.weather; } else if (type == 'temp') { showContent = showWeatherData.temp; } else if (type == 'wind') { showContent = showWeatherData.wind; } else if (type == 'windPower') { showContent = showWeatherData.windPower; } else if (type == 'humidity') { showContent = showWeatherData.humidity; } } if (content.style != null && content.style != '') { style += content.style; } divHtml += "
"; divHtml += showContent; divHtml += "
"; // } // }); return divHtml; } /** * 人员定位 */ function showAssembly_PersonnelPositioning(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualPersonnelPositioning/getJson.do?pid=" + content.id, async: false, globle: false, error: function () { return false; }, success: function (data) { let datas = eval('(' + data + ')'); let color = datas[0].color; var showContent = ""; showContent += ""; showContent += ""; showContent += ""; showContent += ""; showContent += ""; var style = ""; var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = Number(postX.replace("px", "")); postX = postX + "px"; } if (postY.indexOf("%") < 0) { postY = Number(postY.replace("px", "")); postY = postY + "px"; } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "onmouseup=\"doUp2('" + content.id + "');\" "; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; divHtml = "
"; divHtml += "
" + showContent + "
" divHtml += "
人名
"; divHtml += "
"; } }); return divHtml; } function showAssembly_PersonnelPositioning_View(content, showData) { var divHtml = ""; let color = showData.color; if (showData.mqTheme != '') { personnelPositioning_auto_mq_theme.push({ themeName: showData.mqTheme }) } var showContent = ""; showContent += ""; showContent += ""; showContent += ""; showContent += ""; showContent += ""; var style = ""; var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = Number(postX.replace("px", "")); postX = postX + "px"; } if (postY.indexOf("%") < 0) { postY = Number(postY.replace("px", "")); postY = postY + "px"; } let shiftingLeft = 0; let shiftingTop = 0; if (content.shiftingLeft != null && content.shiftingLeft != '') { shiftingLeft = content.shiftingLeft } if (content.shiftingTop != null && content.shiftingTop != '') { shiftingTop = content.shiftingTop } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; divHtml = "
"; divHtml += "
" + showContent + "
" divHtml += "
"; return divHtml; } /** * svg图形 */ function showAssembly_Svg(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualSvg/getJson.do?pid=" + content.id, async: false, globle: false, error: function () { return false; }, success: function (data) { let datas = eval('(' + data + ')'); // console.log(datas) let dataContent = datas[0]; let type = dataContent.type; let fill = "none"; if (dataContent.fill != null && dataContent.fill != '') { fill = dataContent.fill; } let stroke = "red"; if (dataContent.stroke != null && dataContent.stroke != '') { stroke = dataContent.stroke; } let strokeWidth = dataContent.strokeWidth; let points = dataContent.points.split("|"); var style = ""; var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = Number(postX.replace("px", "")) - (Number(strokeWidth) / 2); postX = postX + "px"; } if (postY.indexOf("%") < 0) { postY = Number(postY.replace("px", "")) - (Number(strokeWidth) / 2); postY = postY + "px"; } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { // if (postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { // } else { // onmouseupSt = "onmouseup=\"doUp2('" + content.id + "');\" "; // } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; divHtml = "
"; divHtml += ""; let pointsContent = ""; for (let i = 0; i < points.length; i++) { let point = points[i].split(","); let point_x = Number(point[0]) - Number(postX.replace("px", "")); let point_y = Number(point[1]) - Number(postY.replace("px", "")); // let point_x = Number(point[0]); // let point_y = Number(point[1]); pointsContent += point_x + "," + point_y + " "; } let dasharrayStyle = ""; let dashedlinetype = "false"; if (dataContent.dashedlinetype != null && dataContent.dashedlinetype != '') { dashedlinetype = dataContent.dashedlinetype; } if (dashedlinetype == 'true') { let dashedline1 = "10"; let dashedline2 = "5"; if (dataContent.dashedline1 != null && dataContent.dashedline1 != '') { dashedline1 = dataContent.dashedline1; } if (dataContent.dashedline2 != null && dataContent.dashedline2 != '') { dashedline2 = dataContent.dashedline2; } dasharrayStyle = "stroke-dasharray=\"" + dashedline1 + " " + dashedline2 + "\""; } if (type == 'polyline') { divHtml += ""; } else if (type == 'polygon') { divHtml += ""; } divHtml += ""; divHtml += "
"; } }); return divHtml; } function showAssembly_Svg_View(content, showData) { var divHtml = ""; // let datas = eval('(' + data + ')'); // // console.log(datas) // let dataContent = datas[0]; if (showData.mqTheme != '') { svgAlarm_auto_mq_theme.push({ themeName: showData.mqTheme }) // personnelPositioning_auto_mq_theme += showData.mqTheme + ","; } let type = showData.type; let fill = "none"; if (showData.fill != null && showData.fill != '') { fill = showData.fill; } let stroke = "transparent"; if (showData.stroke != null && showData.stroke != '') { stroke = showData.stroke; } let strokeWidth = showData.strokeWidth; let points = showData.points.split("|"); var style = ""; var zIndex = ""; if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = Number(postX.replace("px", "")) - (Number(strokeWidth) / 2); postX = postX + "px"; } if (postY.indexOf("%") < 0) { postY = Number(postY.replace("px", "")) - (Number(strokeWidth) / 2); postY = postY + "px"; } let onmouseupSt = ""; style += "position:absolute;top:" + postY + ";left:" + postX + ";"; divHtml = "
"; divHtml += ""; let pointsContent = ""; for (let i = 0; i < points.length; i++) { let point = points[i].split(","); let point_x = Number(point[0]) - Number(postX.replace("px", "")); let point_y = Number(point[1]) - Number(postY.replace("px", "")); // let point_x = Number(point[0]); // let point_y = Number(point[1]); pointsContent += point_x + "," + point_y + " "; } let dasharrayStyle = ""; let dashedlinetype = "false"; if (showData.dashedlinetype != null && showData.dashedlinetype != '') { dashedlinetype = showData.dashedlinetype; } if (dashedlinetype == 'true') { let dashedline1 = "10"; let dashedline2 = "5"; if (showData.dashedline1 != null && showData.dashedline1 != '') { dashedline1 = showData.dashedline1; } if (showData.dashedline2 != null && showData.dashedline2 != '') { dashedline2 = showData.dashedline2; } dasharrayStyle = "stroke-dasharray=\"" + dashedline1 + " " + dashedline2 + "\""; } if (type == 'polyline') { divHtml += ""; } else if (type == 'polygon') { divHtml += ""; } divHtml += ""; divHtml += "
"; if (showData.mqTheme != null && showData.mqTheme != '') { $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualSvgAlarm/getJson.do?pid=" + showData.id, async: true, error: function () { return false; }, success: function (data) { var datas = eval('(' + data + ')'); svgAlarmList.push({ id: showData.mqTheme.replace("dataVisualData_svg_", "") + "_id", mqId: showData.mqTheme.replace("dataVisualData_svg_", ""), child: datas }) } }); } return divHtml; } /** * 任务点 */ function showAssembly_TaskPoints(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualTaskPoints/getJson.do?pid=" + content.id, async: false, globle: false, error: function () { return false; }, success: function (data) { let datas = eval('(' + data + ')'); var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "onmouseup=\"doUp2('" + content.id + "');\" "; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; let point_code = datas[0].task_pointCode; let point_name = datas[0].task_name; divHtml = "
"; let img_path = ""; if (point_code == '1') { img_path = ext.contextPath + "/IMG/dataVisual/safe_tool_normal.png"; divHtml += "
"; divHtml += "
"; } else if (point_code == '2') { img_path = ext.contextPath + "/IMG/dataVisual/fireFighting_tool_normal.png"; divHtml += "
"; } else { } divHtml += "
"; } }); return divHtml; } function showAssembly_TaskPoints_View(content, showData) { var divHtml = ""; // let datas = showData; var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } // if (content.isfull == 'true') { // width = width.replace("%", "") + "%"; // height = height.replace("%", "") + "%"; // } else { // if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { // width += "px"; // } // if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { // height += "px"; // } // } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; let point_code = showData.task_pointCode; let point_name = showData.task_name; let task_id = showData.taskid; divHtml = "
"; let img_path = ""; if (point_code == '1') { let outValue = "-"; $.ajax({ type: 'GET', url: ext.contextPath + "/timeEfficiency/patrolPlan/getNextTime.do", async: false, globle: false, data: { id: task_id, type: 1 }, dataType: 'json', error: function () { return false; }, success: function (data) { if (data.result != null) { outValue = data.result; } } }); img_path = ext.contextPath + "/IMG/dataVisual/safe_tool_normal.png"; divHtml += "
"; divHtml += "
" + outValue + "
"; } else if (point_code == '2') { img_path = ext.contextPath + "/IMG/dataVisual/fireFighting_tool_normal.png"; divHtml += "
"; } divHtml += "
"; if (showData.mqTheme != '') { let addthemeSt = true; if (taskPointslarm_auto_mq_theme.length > 0) { for (let i = 0; i < taskPointslarm_auto_mq_theme.length; i++) { if (taskPointslarm_auto_mq_theme[i] == showData.mqTheme) { addthemeSt = false; } } if (addthemeSt) { taskPointslarm_auto_mq_theme.push(showData.mqTheme); } } else { taskPointslarm_auto_mq_theme.push(showData.mqTheme); } } return divHtml; } /** * 设备点 */ function showAssembly_EqPoints(content) { var divHtml = ""; $.ajax({ type: 'GET', url: ext.contextPath + "/process/dataVisualEqPoints/getJson.do?pid=" + content.id, async: false, globle: false, error: function () { return false; }, success: function (data) { let datas = eval('(' + data + ')'); var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } let onmouseupSt = ""; let isfixed = content.isfixed; if (isfixed == 'true') { } else { if (width.indexOf("%") >= 0 || height.indexOf("%") >= 0 || postX.indexOf("%") >= 0 || postY.indexOf("%") >= 0) { } else { onmouseupSt = "onmouseup=\"doUp2('" + content.id + "');\" "; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; let eq_name = datas[0].eqName; divHtml = "
"; let img_path = ""; img_path = ext.contextPath + "/IMG/dataVisual/special_eq.png"; divHtml += "
"; divHtml += "
"; divHtml += "
"; } }); return divHtml; } function showAssembly_EqPoints_View(content, showData) { var divHtml = ""; var style = ""; if (content.style != '') { style = content.style; } if (content.zIndex != null && content.zIndex != '') { style += "z-index:" + content.zIndex + ";"; } var width = content.width; var height = content.height; let postX = content.postx; let postY = content.posty; if (postX.indexOf("%") < 0) { postX = postX.replace("px", "") + "px"; } if (postY.indexOf("%") < 0) { postY = postY.replace("px", "") + "px"; } if (content.isfull == 'true') { width = width.replace("%", "") + "%"; height = height.replace("%", "") + "%"; } else { if (width.indexOf("px") < 0 && width.indexOf("%") < 0) { width += "px"; } if (height.indexOf("px") < 0 && height.indexOf("%") < 0) { height += "px"; } } style += "position:absolute;top:" + postY + ";left:" + postX + ";"; let eq_name = showData.eqName; let eq_id = showData.eqid; let outValue = "-"; $.ajax({ type: 'GET', url: ext.contextPath + "/timeEfficiency/patrolPlan/getNextTime.do", async: false, globle: false, data: { id: eq_id, type: 0 }, dataType: 'json', error: function () { return false; }, success: function (data) { if (data.result != null) { outValue = data.result; } } }); divHtml = "
"; let img_path = ""; img_path = ext.contextPath + "/IMG/dataVisual/special_eq.png"; divHtml += "
"; divHtml += "
" + outValue + "
"; divHtml += "
"; return divHtml; } var client; function getMqtt(mqttStatus, mqttHostWeb) { try { //初始化mqtt if (mqttStatus == '0') { let mqttId = "dataVisual_consumer_" + frameId + "_" + Math.random(); initialMqtt(mqttId, mqttHostWeb); // setTimeout(function () { // // }, 10000); } else { console.log('mq已关闭') } } catch (err) { //处理错误 } } function initialMqtt(mqttId, mqttHostWeb) { //动态拿取mq定制化数据 $.ajax({ type: 'POST', url: ext.contextPath + "/mqtt/addTopic.do", async: false, globle: false, data: { topic: 'topic_dataVisual_' + nowUnitId + '_' + frameId, mpointIds: mqttMpcode }, dataType: 'json', error: function () { return false; }, success: function (data) { } }); // console.log(mqttMpcode); const options = { clean: true, // cleanSession : false, // reconnect : true, connectTimeout: 10000, clientId: mqttId, username: "admin", password: 'public' } const connectUrl = mqttHostWeb; client = mqtt.connect(connectUrl, options); //当重新连接启动触发回调 client.on('reconnect', function () { // console.log('正在重连.....'); }); //连接断开后触发的回调 client.on("close", function () { console.log('客户端已断开连接.....'); }); //从broker接收到断开连接的数据包后发出。MQTT 5.0特性 client.on("disconnect", function (packet) { console.log('从broker接收到断开连接的数据包.....' + packet); }); //客户端脱机下线触发回调 client.on("offline", function () { console.log('客户端脱机下线.....'); }); //当客户端无法连接或出现错误时触发回调 client.on("error", (error) => { console.log('客户端出现错误.....' + error); }); //当客户端发送任何数据包时发出。这包括published()包以及MQTT用于管理订阅和连接的包 client.on("packetsend", (packet) => { // console.log('客户端已发出数据包:' + packet); }); //当客户端接收到任何数据包时发出。这包括来自订阅主题的信息包以及MQTT用于管理订阅和连接的信息包 client.on("packetreceive", (packet) => { // console.log('收到:' + packet); }); //成功连接后触发的回调 client.on("connect", function (connack) { // layer.msg('成功连接上mq服务器'); console.log('可视化' + mqttId + '成功连接上mqtt服务器'); //订阅某主题 /** * client.subscribe(topic/topic array/topic object, [options], [callback]) * topic:一个string类型的topic或者一个topic数组,也可以是一个对象 * options */ let auto_mq_theme_in = ['dataVisualData_' + frameId, 'topic_dataVisual_' + nowUnitId + '_' + frameId, nowUnitId + '_' + frameId + "_dataVisual"]; for (let i = 0; i < personnelPositioning_auto_mq_theme.length; i++) { // dataVisualData_personnel_positioning_xxxx 人员定位 auto_mq_theme_in.push(personnelPositioning_auto_mq_theme[i].themeName); } for (let i = 0; i < cameraAlarm_auto_mq_theme.length; i++) { // dataVisualData_cameraAlarm_xxxx 摄像头报警 auto_mq_theme_in.push(cameraAlarm_auto_mq_theme[i]); } for (let i = 0; i < svgAlarm_auto_mq_theme.length; i++) { // dataVisualData_personnel_positioning_xxxx 区域变色 auto_mq_theme_in.push(svgAlarm_auto_mq_theme[i].themeName); } for (let i = 0; i < taskPointslarm_auto_mq_theme.length; i++) { // dataVisualData_taskPointsAlarm_xxxx 任务点报警 auto_mq_theme_in.push(taskPointslarm_auto_mq_theme[i]); } client.subscribe(auto_mq_theme_in, {qos: 2}); //每隔2秒发布一次数据 // setInterval(publish, 2000) }); function publish() { //发布数据 /** * client.publish(topic,message,[options], [callback]) * * message: Buffer or String * options:{ * qos:0, //默认0 * retain:false, //默认false * dup:false, //默认false * properties:{} * } * callback:function (err){} */ const message = "h5 message " + Math.random() + new Date(); client.publish("testtopic/123", message, {qos: 2}); } //当客户端接收到发布消息时触发回调 /** * topic:收到的数据包的topic * message:收到的数据包的负载playload * packet:收到的数据包 */ client.on('message', (topic, message, packet) => { // console.log(message.getpay); // console.log(topic); if (topic == 'dataVisualData_' + frameId) { let json = JSON.parse(message.toString()); // console.log(json); if (json.length > 0) { for (let i = 0; i < json.length; i++) { if (json[i].type == 'DI') { if (document.getElementById(json[i].id)) { let divHtml = showAssembly_mpdata_DI_View(json[i].content, json[i].showData); $('#' + json[i].id).remove(); $('#' + json[i].cid + 'contentRelativeDiv').append(divHtml); } } else if (json[i].type == 'AI') { if (document.getElementById(json[i].id)) { let divHtml = showAssembly_mpdata_AI_View(json[i].content, json[i].showData); $('#' + json[i].id).remove(); $('#' + json[i].cid + 'contentRelativeDiv').append(divHtml); // $('#' + json[i].id+"value").text(json[i].value); } } else if (json[i].type == 'PercentChart') { if (document.getElementById(json[i].id)) { showPercentChart(json[i].id, json[i].showData); } } else if (json[i].type == 'MpView') { if (document.getElementById(json[i].id)) { let divHtml = showAssembly_MpView_View(json[i].content, json[i].showData, 'true'); $('#' + json[i].content.id).remove(); $('#' + json[i].cid + 'contentRelativeDiv').append(divHtml); } } else { if (document.getElementById(json[i].id)) { $('#' + json[i].id).text(json[i].value); } } } } } else if (topic == nowUnitId + '_01_UP_VUE') { let json = JSON.parse(message.toString()); // console.log(json); if (json.length > 0) { for (let i = 0; i < json.length; i++) { $('.' + json[i].id).text(json[i].parmvalue); } } } else if (topic == nowUnitId + "_" + frameId + "_dataVisual") {//以后这个推送方式为主 let json = JSON.parse(message.toString()); console.log(json); if (json.length > 0) { for (let i = 0; i < json.length; i++) { if (json[i].type == 'DI' || json[i].type == 'AI' || json[i].type == 'Form') { $('.' + json[i].mpid).text(json[i].parmvalue); } else if (json[i].type == 'Text') { let value = json[i].parmvalue; let unitst = json[i].unitst; let numtail = json[i].numtail; if (numtail != '') { value = Number(value).toFixed(Number(numtail)); } value = value + unitst; $('.' + json[i].mpid).text(value); } else if (json[i].type == 'MpView') { if (json[i].st != null && json[i].st == 'true') { let mpViewData = eval("mpValueDataJson.AA" + json[i].contentId); let mpViewData_showData = mpViewData.showData; let showBackground = ""; let lastIndex = Number(eval("mpValueDataJson.AA" + json[i].contentId + ".nowIndex")); //需要判断是否改变了值 if (eval("mpValueDataJson.AA" + json[i].contentId + ".nowIndex") != '-') { if (mpViewData_showData[lastIndex].autoBkSt != null && mpViewData_showData[lastIndex].autoBkSt == 'true') { if (mpViewData_showData.length > 0) { if (Number(mpViewData_showData[0].mpValue) != Number(eval("json[" + i + "]." + mpViewData_showData[0].mpid))) { //console.log('in') mpViewData_showData[0].mpValue = eval("json[" + i + "]." + mpViewData_showData[0].mpid); let divHtml = showAssembly_MpView_View(mpViewData.contnent, mpViewData_showData, 'true'); $('#' + mpViewData.contnent.id).remove(); $('#' + mpViewData.contnent.pid + 'contentRelativeDiv').append(divHtml); } } } else { for (let m = 0; m < mpViewData_showData.length; m++) { let for_mpViewData_showData = mpViewData_showData[m]; if (eval("json[" + i + "]." + for_mpViewData_showData.mpid) != null) { for_mpViewData_showData.mpValue = eval("json[" + i + "]." + for_mpViewData_showData.mpid); } } let jsvalue = mpViewData_showData[lastIndex].jsvalue; let jsmethod = mpViewData_showData[lastIndex].jsmethod; let forbackground = ""; if (mpViewData_showData[lastIndex].background != null && mpViewData_showData[lastIndex].background != '') { forbackground = mpViewData_showData[lastIndex].background; } else { forbackground = "transparent"; } showBackground = getMpValueForShow(mpViewData_showData[lastIndex].mpValue, jsvalue, jsmethod, forbackground, lastIndex); if (showBackground == '-') { let divHtml = showAssembly_MpView_View(mpViewData.contnent, mpViewData_showData, 'true'); $('#' + mpViewData.contnent.id).remove(); $('#' + mpViewData.contnent.pid + 'contentRelativeDiv').append(divHtml); } } } } } else if (json[i].type == 'PercentChart') { let percentChartData = eval("percentChartDataJson.AA" + json[i].contentId); let percentChartData_showData = percentChartData.showData; percentChartData_showData.showData = json[i].parmvalue; showPercentChart(json[i].contentId, percentChartData_showData); } } } } else if (topic == 'topic_dataVisual_' + nowUnitId + '_' + frameId) { let json = JSON.parse(message.toString()); // console.log(json); // console.log(nowFrameDataJson) if (json.length > 0) { for (let i = 0; i < json.length; i++) { if (nowFrameDataJson.length > 0) { for (let j = 0; j < nowFrameDataJson.length; j++) { let showData = nowFrameDataJson[j].showData; let ctype = nowFrameDataJson[j].type; // console.log(showData); // console.log(ctype) if (showData != null) { if (showData.mPoint != null) { let nowMPoint = showData.mPoint; if (nowMPoint.id == json[i].id) { if (ctype == 'DI') { let showColor = getDIColor(nowMPoint.ledtype, nowMPoint.ledcolor, json[i].parmvalue); $('#' + json[i].id).css('color', showColor); continue; } else if (ctype == 'AI') { $('.' + json[i].id).text(json[i].parmvalue); continue; } else { $('.' + json[i].id).text(json[i].parmvalue); continue; } } } else { // console.log(ctype) if (ctype == 'Form') { // console.log(json[i].parmvalue) $('.' + json[i].id).text(json[i].parmvalue); continue; } else if (ctype == 'Text') { // console.log(json[i].parmvalue) $('.' + json[i].id).text(json[i].parmvalue); continue; } else if (ctype == 'MpView') { // console.log(ctype) // console.log(nowFrameDataJson[j]) if (showData.length > 0) { for (let k = 0; k < showData.length; k++) { if (showData[k].mpid == json[i].id) { showData[k].mpValue = json[i].parmvalue; } } } // console.log(showData) let divHtml = showAssembly_MpView_View(nowFrameDataJson[j].content, showData); $('#' + nowFrameDataJson[j].content.id).remove(); // $('#'+nowFrameDataJson[j].content.id).html(divHtml); $('#' + nowFrameDataJson[j].cid + 'contentRelativeDiv').append(divHtml); continue; } } } } } } } } else if (topic.indexOf("dataVisualData_personnel_positioning") != -1) { let json = JSON.parse(message.toString()); // console.log(json); let name = json.name; let outType = json.out; let divContent = $('#RYDW_' + topic); let width = divContent.css("width").replace("px", ""); let height = divContent.css("height").replace("px", ""); let left = divContent.css("left").replace("px", ""); let top = divContent.css("top").replace("px", ""); let fontsize = divContent.attr("peopleFontsize").replace("px", ""); let fontcolor = divContent.attr("peopleFontcolor"); //偏移量 let shiftingLeft = divContent.attr("shiftingLeft"); let shiftingTop = divContent.attr("shiftingTop"); if (document.getElementById("RYDW_" + json.name) == null) { let divHtml = ""; divHtml += "
"; divHtml += "
"; $("#" + divContent.attr("pid") + "contentRelativeDiv").append(divHtml); $("#RYDW_" + name).html(divContent.html()); } if (document.getElementById(json.name) == null) { $('#RYDW_' + name).append("
" + name + "
"); } $('#RYDW_' + name).css("left", Number(left) + Number(json.left) + Number(shiftingLeft)); $('#RYDW_' + name).css("top", Number(top) + Number(json.top) + Number(shiftingTop)); if (outType == '1') { $('#RYDW_' + name).remove(); } } else if (topic.indexOf("dataVisualData_cameraAlarm") != -1) { let json = JSON.parse(message.toString()); // console.log(cameraAlarmList) for (let i = 0; i < cameraAlarmList.length; i++) { let cameraId = cameraAlarmList[i].id; if (cameraId == json.cameraid) { let type = json.type; let outColor = cameraAlarmSt(cameraAlarmList[i].child, type); $('#' + cameraId).attr("fill", outColor); } } } else if (topic.indexOf("dataVisualData_svg") != -1) { let json = JSON.parse(message.toString()); // console.log(json) // console.log(svgAlarmList) for (let i = 0; i < svgAlarmList.length; i++) { let mqId = svgAlarmList[i].mqId; if (mqId == json.id) { let result = json.result; let outColor = svgAlarmSt(svgAlarmList[i].child, result).split("|"); let fill = outColor[0]; let stroke = outColor[1]; if (fill != '-') { $('#' + svgAlarmList[i].id).css("fill", fill); } if (stroke != '-') { $('#' + svgAlarmList[i].id).css("stroke", stroke); } } } } else if (topic.indexOf("dataVisualData_taskPointsAlarm") != -1) { let json = JSON.parse(message.toString()); // console.log(json); if (json.length > 0) { for (let i = 0; i < json.length; i++) { let taskPointId = json[i].id; let status = json[i].status; let nextDate = json[i].nextDate; let type = json[i].type; // 1 安全用具;2 消防器具 let imgName = ext.contextPath + "/IMG/dataVisual/"; if (status == '0') {//正常 if (type == '1') { imgName += "safe_tool_normal.png"; } else if (type == '2') { imgName += "fireFighting_tool_normal.png"; } } else if (status == '1') {//异常 if (type == '1') { imgName += "safe_tool_abnormal.png"; } else if (type == '2') { imgName += "fireFighting_tool_abnormal.png"; } } $('#' + taskPointId + '_IMG').css('background', 'url(' + imgName + ')'); $('#' + taskPointId + '_IMG').css('background-size', '100% 100%'); if (type == '1') { $('#' + taskPointId).text(nextDate); if (status == '0') {//正常 // $('#' + taskPointId).css("background", "#FCE6FF"); $('#' + taskPointId).css("border", "2px solid #DF0DFF"); $('#' + taskPointId).css("color", "#DF0DFF"); } else if (status == '1') {//异常 // $('#' + taskPointId).css("background", "#FCE6FF"); $('#' + taskPointId).css("border", "2px solid #FF0D0D"); $('#' + taskPointId).css("color", "#FF0D0D"); } } } } } // else if (topic == nowUnitId + '_01_UP_VUE') { // var json = JSON.parse(message.toString()); // // console.log(json); // if (json.length > 0) { // for (let i = 0; i < json.length; i++) { // if (nowFrameDataJson.length > 0) { // for (let j = 0; j < nowFrameDataJson.length; j++) { // let showData = nowFrameDataJson[j].showData; // if (showData.mPoint != null) { // let nowMPoint = nowFrameDataJson[j].showData.mPoint; // if (nowMPoint.id == json[i].id) { // if (nowMPoint.signaltype == 'AI') { // $('.' + json[i].id).text(json[i].parmvalue); // break; // } else if (nowMPoint.signaltype == 'DI') { // let showColor = getDIColor(nowMPoint.ledtype, nowMPoint.ledcolor, json[i].parmvalue); // $('#' + json[i].id).css('color', showColor); // break; // } // } // } // } // } // // } // } // } }); //页面离开自动断开连接 $(window).bind("beforeunload", () => { // console.log("客户端窗口关闭,断开连接"); client.disconnect(); }) } function showAllContent(data) { let divHtml = ""; if (data.type == 'AADateSelect') { divHtml = showAssembly_DateSelect_View(data.content, data.showData); } else if (data.type == 'DI') { divHtml = showAssembly_mpdata_DI_View(data.content, data.showData); } else if (data.type == 'AI') { divHtml = showAssembly_mpdata_AI_View(data.content, data.showData); } else if (data.type == 'Text') { divHtml = showAssembly_Text_View(data.content, data.showData); } else if (data.type == 'Camera') { divHtml = showAssembly_Camera_View(data.content, data.showData); } else if (data.type == 'Form') { divHtml = showAssembly_Form_View(data.content, data.showData); } else if (data.type == 'PieChart') { divHtml = showAssembly_PieChart_View(data.content, data.showData); } else if (data.type == 'PercentChart') { divHtml = showAssembly_PercentChart_View(data.content, data.showData); } else if (data.type == 'RadarChart') { divHtml = showAssembly_RadarChart_View(data.content, data.showData); } else if (data.type == 'GaugeChart') { divHtml = showAssembly_GaugeChart_View(data.content, data.showData); } else if (data.type == 'Picture') { divHtml = showAssembly_Picture_View(data.content, data.showData); } else if (data.type == 'Date') { divHtml = showAssembly_Date_View(data.content, data.showData); } else if (data.type == 'Weather') { divHtml = showAssembly_Weather_View(data.content, data.showData, data.showWeatherData); } else if (data.type == 'Iframe') { divHtml = showAssembly_Iframe_View(data.content); } else if (data.type == 'Line') { divHtml = showAssembly_Line_View(data.content); } else if (data.type == 'MpView') { divHtml = showAssembly_MpView_View(data.content, data.showData); } else if (data.type == 'ProgressBar') { divHtml = showAssembly_ProgressBarChart_View(data.content, data.showData); } else if (data.type == 'SuspensionFrame') { divHtml = showAssembly_SuspensionFrame_View(data.content, data.showData); } else if (data.type == 'PolarCoordinates') { divHtml = showAssembly_PolarCoordinates_View(data.content, data.showData); } else if (data.type == 'LineChart') { divHtml = showAssembly_LineChart_View(data.content, data.showData); } else if (data.type == 'BarChart') { divHtml = showAssembly_BarChart_View(data.content, data.showData); } else if (data.type == '11Switch') { divHtml = showAssembly_Switch_View(data.content, data.showData); } else if (data.type == 'personnelPositioning') { divHtml = showAssembly_PersonnelPositioning_View(data.content, data.showData); } else if (data.type == 'svg') { divHtml = showAssembly_Svg_View(data.content, data.showData); } else if (data.type == 'TaskPoints') { divHtml = showAssembly_TaskPoints_View(data.content, data.showData); } else if (data.type == 'EqPoints') { divHtml = showAssembly_EqPoints_View(data.content, data.showData); } else if (data.type == 'SelectJump') { divHtml = showAssembly_SelectJump_View(data.content, data.showData); } else if (data.type == 'Tab') { divHtml = showAssembly_Tab_View(data.content, data.showData); $('#' + data.cid + 'contentRelativeDiv').append(divHtml); if (data.showTabData != null && data.showTabData.length > 0) { for (let i = 0; i < data.showTabData.length; i++) { data.showTabData[i].cid = data.cid; showAllContent(data.showTabData[i]); clearInterval(roundtimeT); if (roundtimecontentList != '' && roundtimecontentList.length > 0) { let roundtimecontentLists = roundtimecontentList.substring(0, roundtimecontentList.length - 1).split(","); roundtimeT = setInterval(function () { for (let t = 0; t < roundtimecontentLists.length; t++) { if (roundtimecontentLists[t] == roundtimecontentLists[nowTNum - 1]) { $("#" + roundtimecontentLists[t]).css('display', 'block'); } else { $("#" + roundtimecontentLists[t]).css('display', 'none'); } } if (nowTNum < roundtimecontentLists.length) { nowTNum++; } else { nowTNum = 1; } }, 5000); } } } } if (data.type != 'Tab') { $('#' + data.cid + 'contentRelativeDiv').append(divHtml); } if (data.type == 'DI') { $("#" + data.content.id).mousedown(function (e) { //右键为3 if (3 == e.which) { let eqid = $("#" + data.content.id).attr('eqid'); if (eqid != '') { stopBubbleDefaultEvent(); $.post(ext.contextPath + '/equipment/doview.do', {id: eqid}, function (data) { $("#subDiv").html(data); openModal('subModal'); }); } } else if (1 == e.which) { //左键为1 showCurveForMp(data.content.id); } }) } if (data.type == 'PieChart') { showPieChart(data.content.id, data.showData, data.showSeriesData); } else if (data.type == 'PercentChart') { showPercentChart(data.content.id, data.showData); } else if (data.type == 'RadarChart') { showRadarChart(data.content.id, data.showData, data.showSeriesData, data.showAxisData); } else if (data.type == 'GaugeChart') { showGaugeChart(data.content.id, data.showData); } else if (data.type == 'ProgressBar') { showProgressBarChart(data.content.id, data.showData); } else if (data.type == 'PolarCoordinates') { showPolarCoordinates(data.content.id, data.showData, data.showSeriesData); } else if (data.type == 'Date') { if (data.content.refreshtime != null && data.content.refreshtime != '' && data.content.refreshtime != '0') { setInterval(function () { showAssembly_Date_View_Show(data.content.id, data.showData.types); }, Number(data.content.refreshtime) * 1000); } } else if (data.type == 'LineChart') { showLineChart(data.content.id, data.content.refreshtime, data.showData, data.showSeriesData, data.showYAxisData); } else if (data.type == 'BarChart') { showBarChart(data.content.id, data.content.refreshtime, data.showData, data.showSeriesData, data.showYAxisData); } else if (data.type == 'AADateSelect') { let dateSelectType = data.showData.type; showDateSelect(data.content.id, dateSelectType); } else if (data.type == 'Camera') { $.ajax({ type: 'GET', url: ext.contextPath + "/work/camera/getCameraAlarmType.do?cameraid=" + data.showData.cameraid, async: false, error: function () { return false; }, success: function (stData) { stData = eval('(' + stData + ')'); if (stData != null && stData.length > 0) { let type = stData[0].type; for (let i = 0; i < cameraAlarmList.length; i++) { let cameraId = cameraAlarmList[i].id; if (cameraId == stData[0].cameraId) { let outColor = cameraAlarmSt(cameraAlarmList[i].child, type); $('#' + cameraId).attr("fill", outColor); } } } } }); } else if (data.type == 'SelectJump') { // $("#"+data.content.id+"select-menu-list").hide(); $("#" + data.content.id).on("click", function (e) { $("#" + data.content.id + "_select-menu-list").toggle(); }); } else if (data.type == 'Form') { // console.log(formSqlPointList) if (formSqlPointList.length > 0) { for (let fqMi = 0; fqMi < formSqlPointList.length; fqMi++) { let fqMContent = formSqlPointList[fqMi]; for (let fqi = 0; fqi < fqMContent.length; fqi++) { let nowSQLcontent = fqMContent[fqi]; $('#' + nowSQLcontent.id).text(nowSQLcontent.value); $('#' + nowSQLcontent.id).attr('title', nowSQLcontent.value); } } } formSqlPointList = []; if (formRowStyleList.length > 0) { for (let i = 0; i < formRowStyleList.length; i++) { let formRowStyleMContent = formRowStyleList[i]; // console.log(formRowStyleContent); for (let j = 0; j < formRowStyleMContent.length; j++) { let formRowStyleContent = formRowStyleMContent[j]; let tdText = $.trim($('#' + formRowStyleContent.pid).html()); if (formRowStyleContent.ckmethod == '=') { if (formRowStyleContent.ckcontent == tdText) { formRowStyleShow(formRowStyleContent, formRowStyleContent.showst); break; } } else { if (formRowStyleContent.ckmethod == '>') { if (Number(tdText) > Number(formRowStyleContent.ckcontent)) { formRowStyleShow(formRowStyleContent, formRowStyleContent.showst); break; } } else if (formRowStyleContent.ckmethod == '>=') { if (Number(tdText) >= Number(formRowStyleContent.ckcontent)) { formRowStyleShow(formRowStyleContent, formRowStyleContent.showst); break; } } else if (formRowStyleContent.ckmethod == '<') { if (Number(tdText) < Number(formRowStyleContent.ckcontent)) { formRowStyleShow(formRowStyleContent, formRowStyleContent.showst); break; } } else if (formRowStyleContent.ckmethod == '<=') { if (Number(tdText) <= Number(formRowStyleContent.ckcontent)) { formRowStyleShow(formRowStyleContent, formRowStyleContent.showst); break; } } } } } } formRowStyleList = []; } else if (data.type == '11Switch') { let divId = data.content.id; let switchType = ""; if (data.showData.type != null && data.showData.type != "") { switchType = data.showData.type; } let background = "transparent"; if (data.showData.background != null && data.showData.background != "") { background = data.showData.background; } let openst = "false"; if (data.showData.openst != null && data.showData.openst != "") { openst = data.showData.openst; } if (switchType == 'point') { let showStyle = "switch"; if (data.showData.showStyle != null && data.showData.showStyle != '') { showStyle = data.showData.showStyle; } if (showStyle == 'switch') { let switchId = "switch_" + data.showData.id; let switch_divHtml = ""; switch_divHtml += "
"; switch_divHtml += ""; switch_divHtml += "
"; $('#' + divId).append(switch_divHtml); $('#' + switchId).bootstrapSwitch({ onText: '显示', offText: '隐藏', size: "small", onSwitchChange: function (event, state) { let sid = event.target.id.replace("switch_", ""); let ck_datas = eval("switchAllPoints.AA" + sid); ck_datas = ck_datas.substring(0, ck_datas.length - 1); ck_datas = ck_datas.split(","); if (state) { for (let i = 0; i < ck_datas.length; i++) { $('#' + ck_datas[i]).css("display", "block"); } } else { for (let i = 0; i < ck_datas.length; i++) { $('#' + ck_datas[i]).css("display", "none"); } } // console.log(event.target.id); //获取绑定点 // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualSwitchPoint/getPoints.do?pid=" + sid, // async: false, // globle: false, // error: function () { // return false; // }, // success: function (datas) { // datas = datas.substring(0, datas.length - 1); // datas = datas.split(","); // if (state) { // for (let i = 0; i < datas.length; i++) { // $('#' + datas[i]).css("display", "block"); // } // } else { // for (let i = 0; i < datas.length; i++) { // $('#' + datas[i]).css("display", "none"); // } // } // } // }); } }); if (openst == 'false') { $('#' + switchId).bootstrapSwitch('state', false, true); } else if (openst == 'true') { $('#' + switchId).bootstrapSwitch('state', true, true); } else { $('#' + switchId).bootstrapSwitch('state', false, true); } } else if (showStyle == 'check') { let ckColor = "#FFFFFF"; if (data.showData.ckColor != null && data.showData.ckColor != "") { ckColor = data.showData.ckColor; } let ckSize = "14"; if (data.showData.ckSize != null && data.showData.ckSize != "") { ckSize = data.showData.ckSize; } let ckStyle = ""; if (data.showData.ckStyle != null && data.showData.ckStyle != "") { ckStyle = data.showData.ckStyle; } // //获取绑定点 // $.ajax({ // type: 'GET', // url: ext.contextPath + "/process/dataVisualSwitchPoint/getPoints.do?pid=" + data.showData.id, // async: false, // globle: false, // error: function () { // return false; // }, // success: function (datas) { // ck_datas = datas.substring(0, datas.length - 1); // // ck_datas = datas.substring(0, datas.length - 1); // // ck_datas = ck_datas.split(","); // } // }); let showT = ""; if (openst == 'true') { showT = "✔"; } let check_divHtml = ""; check_divHtml += "
" + "" + showT + ""; check_divHtml += "
"; $('#' + divId).append(check_divHtml); } } else if (switchType == 'url') { $('#' + divId).css('cursor', 'pointer'); $("#" + divId).on("click", function () { let switchUrl = switchType = data.showData.url; if (switchUrl.substring(0, 1) != '/') { switchUrl = "/" + switchUrl; } if (data.showData.urlType == '0') { let submodalName = switchType = data.showData.submodalName; $.post(ext.contextPath + switchUrl, {}, function (data) { $("#subDiv").html(data); openModal(submodalName); }); } else if (data.showData.urlType == '1') { let urlWidth = switchType = data.showData.urlWidth; let urlHeight = switchType = data.showData.urlHeight; $.post(ext.contextPath + "/process/dataVisualSwitch/urlOpen.do", { switchUrl: switchUrl, urlWidth: urlWidth.replace("px", ""), urlHeight: urlHeight.replace("px", "") }, function (data) { $("#subDiv").html(data); openModal('urlOpenSubModal'); }); } }) } } else if (data.type == 'MpView') { $('#' + data.content.id + ' div').each(function () { let ckMinioId = $(this).attr("ckMinioId"); // console.log(ckMinioId); if (ckMinioId != null && ckMinioId != '') { $.ajax({ type: 'GET', url: ext.contextPath + "/base/getInputFileList_minio.do", async: true, globle: true, data: { masterId: ckMinioId, tbName: 'tb_pro_dataVisual_mpView_file', bucketName: 'datavisual' }, dataType: 'json', error: function () { return false; }, success: function (data_minio) { if (data_minio.length > 0) { let mpView_minio = 'data:image/png;base64,' + data_minio[0].streamFile; // console.log(mpView_minio); $('#' + ckMinioId).css('background', "url(" + mpView_minio + ")"); $('#' + ckMinioId).css('background-size', "100% 100%"); } } }); // let mpView_minio = getMinioFile(ckMinioId, 'tb_pro_dataVisual_mpView_file', 'datavisual'); // console.log(mpView_minio); // $('#' + ckMinioId).css('background', "url(" + mpView_minio + ")"); } }) } } function formRowStyleShow(formRowStyleContent, st) { // console.log(formRowStyleContent) if (formRowStyleContent.background != '') { if (st == '0') { $('#' + formRowStyleContent.pid).css('background', formRowStyleContent.background); } else { $('#' + formRowStyleContent.pid).parent().css('background', formRowStyleContent.background); $('#' + formRowStyleContent.pid).parent().children().css('background', formRowStyleContent.background); } } if (formRowStyleContent.fontcolor != '') { if (st == '0') { $('#' + formRowStyleContent.pid).css('color', formRowStyleContent.fontcolor); } else { $('#' + formRowStyleContent.pid).parent().css('color', formRowStyleContent.fontcolor); $('#' + formRowStyleContent.pid).parent().children().css('color', formRowStyleContent.fontcolor); } } if (formRowStyleContent.fontsize != '') { if (st == '0') { $('#' + formRowStyleContent.pid).css('font-size', formRowStyleContent.fontsize); } else { $('#' + formRowStyleContent.pid).parent().css('font-size', formRowStyleContent.fontsize); $('#' + formRowStyleContent.pid).parent().children().css('font-size', formRowStyleContent.fontsize); } } if (formRowStyleContent.fontweight != '') { if (st == '0') { $('#' + formRowStyleContent.pid).css('font-weight', formRowStyleContent.fontweight); } else { $('#' + formRowStyleContent.pid).parent().css('font-weight', formRowStyleContent.fontweight); $('#' + formRowStyleContent.pid).parent().children().css('font-weight', formRowStyleContent.fontweight); } } } function cameraAlarmSt(cameraAlarmList, value) { let outColor = ""; for (let i = 0; i < cameraAlarmList.length; i++) { let jsmethod = cameraAlarmList[i].jsmethod; let jsvalue = cameraAlarmList[i].jsvalue; let colorSt = false; if (jsmethod == '>') { if (Number(value) > jsvalue) { colorSt = true; } } else if (jsmethod == '>=') { if (Number(value) >= jsvalue) { colorSt = true; } } else if (jsmethod == '=') { if (Number(value) == jsvalue) { colorSt = true; } } else if (jsmethod == '<') { if (Number(value) < jsvalue) { colorSt = true; } } else if (jsmethod == '<=') { if (Number(value) <= jsvalue) { colorSt = true; } } else if (jsmethod == '!=') { if (Number(value) != jsvalue) { colorSt = true; } } if (colorSt) { outColor = cameraAlarmList[i].color; } } return outColor; } function svgAlarmSt(svgAlarmList, value) { let outColor = ""; for (let i = 0; i < svgAlarmList.length; i++) { let jsmethod = svgAlarmList[i].jsmethod; let jsvalue = svgAlarmList[i].jsvalue; let colorSt = false; if (jsmethod == '>') { if (Number(value) > jsvalue) { colorSt = true; } } else if (jsmethod == '>=') { if (Number(value) >= jsvalue) { colorSt = true; } } else if (jsmethod == '=') { if (value == jsvalue) { colorSt = true; } } else if (jsmethod == '<') { if (Number(value) < jsvalue) { colorSt = true; } } else if (jsmethod == '<=') { if (Number(value) <= jsvalue) { colorSt = true; } } else if (jsmethod == '!=') { if (Number(value) != jsvalue) { colorSt = true; } } if (colorSt) { let fill = "-"; let stroke = "-"; if (svgAlarmList[i].fill != '') { fill = svgAlarmList[i].fill; } if (svgAlarmList[i].stroke != '') { stroke = svgAlarmList[i].stroke; } outColor = fill + "|" + stroke; } } return outColor; } function showSvgLine(points) { $("#lssvg").remove(); let pointss = points.split("|"); let linePoint = ""; for (let i = 0; i < pointss.length; i++) { linePoint += pointss[i] + " "; } let html = "
"; return html; } /* * 浏览器全屏 */ function fullScreen() { $("#fullScreenSt1").css("display", "none"); $("#fullScreenSt2").css("display", "block"); var elem = document.body; if (elem.webkitRequestFullScreen) { elem.webkitRequestFullScreen(); } else if (elem.mozRequestFullScreen) { elem.mozRequestFullScreen(); } else if (elem.requestFullScreen) { elem.requestFullscreen(); } else { //浏览器不支持全屏API或已被禁用 } } /* * 浏览器退出全屏 */ function exitFullScreen() { $("#fullScreenSt2").css("display", "none"); $("#fullScreenSt1").css("display", "block"); var de = document; if (de.exitFullscreen) { de.exitFullscreen(); } else if (de.msExitFullscreen) { de.msExitFullscreen(); } else if (de.mozCancelFullScreen) { de.mozCancelFullScreen(); } else if (de.webkitExitFullscreen) { de.webkitExitFullscreen(); } } function radioSelect(pid, num, nowck, radioCkBackground, id, ckData) { for (let i = 0; i < num; i++) { if (i == nowck) { $('#' + pid + '_' + i + '_in').css('background', radioCkBackground); } else { $('#' + pid + '_' + i + '_in').css('background', 'transparent'); } } clickTab(id, ckData); } function switch_check_click(divId, showDataId) { // console.log("switchAllPoints", switchAllPoints); // console.log("switchHiddenPoints", switchHiddenPoints); let ck_datas = eval("switchAllPoints.AA" + showDataId); ck_datas = ck_datas.substring(0, ck_datas.length - 1); ck_datas = ck_datas.split(","); // console.log("ck_datas",ck_datas); let obj = $('#' + showDataId); let st = obj.attr('openst'); if (st == 'true') { obj.attr('openst', 'false'); obj.text(""); for (let i = 0; i < ck_datas.length; i++) { $('#' + ck_datas[i]).css("display", "none"); } } else { obj.attr('openst', 'true'); obj.text("✔"); for (let i = 0; i < ck_datas.length; i++) { $('#' + ck_datas[i]).css("display", "block"); } } }