diff --git a/ruoyi-admin/src/main/resources/static/img/close.png b/ruoyi-admin/src/main/resources/static/img/close.png new file mode 100644 index 0000000..f5cf82a Binary files /dev/null and b/ruoyi-admin/src/main/resources/static/img/close.png differ diff --git a/ruoyi-admin/src/main/resources/static/img/leftBtn.png b/ruoyi-admin/src/main/resources/static/img/leftBtn.png new file mode 100644 index 0000000..6ebb53c Binary files /dev/null and b/ruoyi-admin/src/main/resources/static/img/leftBtn.png differ diff --git a/ruoyi-admin/src/main/resources/static/img/lessen.png b/ruoyi-admin/src/main/resources/static/img/lessen.png new file mode 100644 index 0000000..27a91b8 Binary files /dev/null and b/ruoyi-admin/src/main/resources/static/img/lessen.png differ diff --git a/ruoyi-admin/src/main/resources/static/img/magnify.png b/ruoyi-admin/src/main/resources/static/img/magnify.png new file mode 100644 index 0000000..81b6617 Binary files /dev/null and b/ruoyi-admin/src/main/resources/static/img/magnify.png differ diff --git a/ruoyi-admin/src/main/resources/static/img/rightBtn.png b/ruoyi-admin/src/main/resources/static/img/rightBtn.png new file mode 100644 index 0000000..cf728b8 Binary files /dev/null and b/ruoyi-admin/src/main/resources/static/img/rightBtn.png differ diff --git a/ruoyi-admin/src/main/resources/static/js/Iot-ui/deviceMonitor.js b/ruoyi-admin/src/main/resources/static/js/Iot-ui/deviceMonitor.js index b9dc4a8..9a4796d 100644 --- a/ruoyi-admin/src/main/resources/static/js/Iot-ui/deviceMonitor.js +++ b/ruoyi-admin/src/main/resources/static/js/Iot-ui/deviceMonitor.js @@ -1,267 +1,283 @@ -const getParameter = function (dataType){ - var returnData; - let formData = new FormData(); - formData.append("sensorTypeId", dataType); - $.ajax({ - type: "post", - url: "/base/sysParamConfig/getParameter", - data: formData, - contentType: "application/json;charset=utf-8", - dataType: "json", - json: 'callback', - processData: false, - contentType: false, - async: false, - success: function (json) { - returnData = json; - }, - error: function () { - alert("错误"); - } - }); - return returnData; +const getParameter = async function (dataType) { + var returnData; + let formData = new FormData(); + formData.append("sensorTypeId", dataType); + await $.ajax({ + type: "post", + url: "/base/sysParamConfig/getParameter", + data: formData, + contentType: "application/json;charset=utf-8", + dataType: "json", + json: 'callback', + processData: false, + contentType: false, + async: true, + success: function (json) { + returnData = json; + return returnData; + }, + error: function () { + // alert("错误"); + } + }); + return returnData; } -const sensorCollectionRefresh = function (monitorUnitId) { - /*setInterval(function() { - - }, 500);*/ - $.ajax({ - url: "/iot/deviceMonitor/getSensorInfo?monitorunitId=" + monitorUnitId, - type: "get", - dataType: 'JSON', - success: (res) => { - $("#sensor-card-group").html(""); - res.map(x=>{ - let params = getParameter(x.datatype); - createDeviceModule(x,params); - }) - }, - error: () => { - console.log("失败"); - } - }) +const sensorCollectionRefresh = function (monitorUnitId,params) { + console.log(params) + $.ajax({ + url: "/iot/deviceMonitor/getSensorInfo?monitorunitId=" + monitorUnitId+'&pageNum='+(params?.pageNum||1)+'&pageSize='+(params?.pageSize||10), + type: "get", + dataType: 'JSON', + success: (res) => { + if (params.pageNum === 1) { + $("#sensor-card-group").html(""); + } + res.map(async (x) => { + let params = await getParameter(x.datatype); + createDeviceModule(x, params); + }) + loading = false + }, + error: () => { + console.log("失败"); + } + }) } -const createDeviceModule = function (sensor,params) { - let html = '
'; - switch (sensor.datatype) { - case "temperature": - html += `
${sensor.sensorName}
`; - - html += '
'; - for (let i=0; i${params[i].paramText+":"+(sensor[params[i].paramTitle] == null ? "-" : sensor[params[i].paramTitle])}
`; - } - html += '
'; - html += '
'; - //html+=`

${sensor['sensorStatus'] == null ? "-" : sensorStatus(sensor['sensorStatus'])}

`; - html+=`

${sensor['collectTime'] == null ? "-" : collectTime(sensor['collectTime'])}

`; - html += '' - html += '
'; - - $("#sensor-card-group").append(html); - break; - - case "humiture": - html += `
${sensor.sensorName}
`; - - html += '
'; - for (let i=0; i${params[i].paramText+":"+(sensor[params[i].paramTitle] == null ? "-" : sensor[params[i].paramTitle])}
`; - } - html += ''; - html += '
'; - html+=`

${sensor['collectTime'] == null ? "-" : collectTime(sensor['collectTime'])}

`; - html += '
'; - - $("#sensor-card-group").append(html); - break; - - case "image": - html += '
'; - html += `
${sensor.sensorName}
` - html += '
'; - let imgurl = sensor.imgstr.replace("D:/ruoyi/uploadPath","/profile"); - html += '' - html += '
' - html += '
'; - html += `

${sensor['collectTime'] == null ? "-" : collectTime(sensor['collectTime'])}

`; - for (let i=0; i${params[i].paramText+":"+(sensor[params[i].paramTitle] == null ? "-" : sensor[params[i].paramTitle])}

`; - } - } - html += '
'; - html += '
'; - - html += ``; - - $("#sensor-card-group").append(html); - break; - - case "smoke": - html += `
${sensor.sensorName}
`; - - html += '
'; - for (let i=0; i${params[i].paramText+":"+(sensor[params[i].paramTitle] == null ? "-" : sensor[params[i].paramTitle])}
`; - } - html += ''; - html += '
'; - html+=`

${sensor['collectTime'] == null ? "-" : collectTime(sensor['collectTime'])}

`; - html += '
'; - - $("#sensor-card-group").append(html); - break; - - case "doormagnetic": - html += `
${sensor.sensorName}
`; - - html += '
'; - for (let i=0; i${params[i].paramText+":"+(sensor[params[i].paramTitle] == null ? "-" : sensor[params[i].paramTitle])}
`; - } - html += ''; - html += '
'; - html+=`

${sensor['collectTime'] == null ? "-" : collectTime(sensor['collectTime'])}

`; - html += '
'; - - $("#sensor-card-group").append(html); - break; - - case "vibration": - html += `
${sensor.sensorName}
`; - - html += '
'; - for (let i=0; i${params[i].paramText+":"+(sensor[params[i].paramTitle] == null ? "-" : sensor[params[i].paramTitle])}
`; - } - html += ''; - html += '
'; - html+=`

${sensor['collectTime'] == null ? "-" : collectTime(sensor['collectTime'])}

`; - html += '
'; - - $("#sensor-card-group").append(html); - break; - - case "waterlogging": - html += `
${sensor.sensorName}
`; - - html += '
'; - for (let i=0; i${params[i].paramText+":"+(sensor[params[i].paramTitle] == null ? "-" : sensor[params[i].paramTitle])}
`; - } - html += ''; - html += '
'; - html+=`

${sensor['collectTime'] == null ? "-" : collectTime(sensor['collectTime'])}

`; - html += '
'; - - $("#sensor-card-group").append(html); - break; - - case "platen": - html += `
${sensor.sensorName}
`; - - html += '
'; - for (let i=0; i${params[i].paramText+":"+(sensor[params[i].paramTitle] == null ? "-" : sensor[params[i].paramTitle])}
`; - } - html += ''; - html += '
'; - //html+=`

${sensor['sensorStatus'] == null ? "-" : sensorStatus(sensor['sensorStatus'])}

`; - html+=`

${sensor['collectTime'] == null ? "-" : collectTime(sensor['collectTime'])}

`; - html += '
'; - - $("#sensor-card-group").append(html); - break; - - default: - html += `
${sensor.sensorName}
`; - - html += '
'; - for (let i=0; i${params[i].paramText+":"+(sensor[params[i].paramTitle] == null ? "-" : sensor[params[i].paramTitle])}
`; - } - html += ''; - html += '
'; - html+=`

${sensor['collectTime'] == null ? "-" : collectTime(sensor['collectTime'])}

`; - html += '
'; - - $("#sensor-card-group").append(html); - break; - } +const createDeviceModule = function (sensor, params) { + // console.log(sensor) + // console.log(params) + let html = '
'; + switch (sensor.datatype) { + case "temperature": + html += `
${sensor.sensorName}
`; + + html += '
'; + for (let i = 0; i < params.length; i++) { + html += `
${params[i].paramText + ":" + (sensor[params[i].paramTitle] == null ? "-" : sensor[params[i].paramTitle])}
`; + } + html += '
'; + html += '
'; + //html+=`

${sensor['sensorStatus'] == null ? "-" : sensorStatus(sensor['sensorStatus'])}

`; + html += `

${sensor['collectTime'] == null ? "-" : collectTime(sensor['collectTime'])}

`; + html += '' + html += '
'; + + $("#sensor-card-group").append(html); + break; + + case "humiture": + html += `
${sensor.sensorName}
`; + + html += '
'; + for (let i = 0; i < params.length; i++) { + html += `
${params[i].paramText + ":" + (sensor[params[i].paramTitle] == null ? "-" : sensor[params[i].paramTitle])}
`; + } + html += '
'; + html += '
'; + html += `

${sensor['collectTime'] == null ? "-" : collectTime(sensor['collectTime'])}

`; + html += '
'; + + $("#sensor-card-group").append(html); + break; + + case "image": + html += '
'; + html += `
${sensor.sensorName}
` + html += '
'; + let imgurl = sensor.imgstr.replace("D:/ruoyi/uploadPath", "/profile"); + html += '' + html += '
' + html += '
'; + html += `

${sensor['collectTime'] == null ? "-" : collectTime(sensor['collectTime'])}

`; + for (let i = 0; i < params.length; i++) { + if (!params[i].paramTitle.includes("img")) { + html += `

${params[i].paramText + ":" + (sensor[params[i].paramTitle] == null ? "-" : sensor[params[i].paramTitle])}

`; + } + } + html += '
'; + html += '
'; + + html += `
`; + + $("#sensor-card-group").append(html); + break; + + case "smoke": + html += `
${sensor.sensorName}
`; + + html += '
'; + for (let i = 0; i < params.length; i++) { + html += `
${params[i].paramText + ":" + (sensor[params[i].paramTitle] == null ? "-" : sensor[params[i].paramTitle])}
`; + } + html += '
'; + html += '
'; + html += `

${sensor['collectTime'] == null ? "-" : collectTime(sensor['collectTime'])}

`; + html += '
'; + + $("#sensor-card-group").append(html); + break; + + case "doormagnetic": + html += `
${sensor.sensorName}
`; + + html += '
'; + for (let i = 0; i < params.length; i++) { + html += `
${params[i].paramText + ":" + (sensor[params[i].paramTitle] == null ? "-" : sensor[params[i].paramTitle])}
`; + } + html += '
'; + html += '
'; + html += `

${sensor['collectTime'] == null ? "-" : collectTime(sensor['collectTime'])}

`; + html += '
'; + + $("#sensor-card-group").append(html); + break; + + case "vibration": + html += `
${sensor.sensorName}
`; + + html += '
'; + for (let i = 0; i < params.length; i++) { + html += `
${params[i].paramText + ":" + (sensor[params[i].paramTitle] == null ? "-" : sensor[params[i].paramTitle])}
`; + } + html += '
'; + html += '
'; + html += `

${sensor['collectTime'] == null ? "-" : collectTime(sensor['collectTime'])}

`; + html += '
'; + + $("#sensor-card-group").append(html); + break; + + case "waterlogging": + html += `
${sensor.sensorName}
`; + + html += '
'; + for (let i = 0; i < params.length; i++) { + html += `
${params[i].paramText + ":" + (sensor[params[i].paramTitle] == null ? "-" : sensor[params[i].paramTitle])}
`; + } + html += '
'; + html += '
'; + html += `

${sensor['collectTime'] == null ? "-" : collectTime(sensor['collectTime'])}

`; + html += '
'; + + $("#sensor-card-group").append(html); + break; + + case "platen": + html += `
${sensor.sensorName}
`; + + html += '
'; + for (let i = 0; i < params.length; i++) { + html += `
${params[i].paramText + ":" + (sensor[params[i].paramTitle] == null ? "-" : sensor[params[i].paramTitle])}
`; + } + html += '
'; + html += '
'; + //html+=`

${sensor['sensorStatus'] == null ? "-" : sensorStatus(sensor['sensorStatus'])}

`; + html += `

${sensor['collectTime'] == null ? "-" : collectTime(sensor['collectTime'])}

`; + html += '
'; + + $("#sensor-card-group").append(html); + break; + + default: + html += `
${sensor.sensorName}
`; + + html += '
'; + for (let i = 0; i < params.length; i++) { + html += `
${params[i].paramText + ":" + (sensor[params[i].paramTitle] == null ? "-" : sensor[params[i].paramTitle])}
`; + } + html += '
'; + html += '
'; + html += `

${sensor['collectTime'] == null ? "-" : collectTime(sensor['collectTime'])}

`; + html += '
'; + + $("#sensor-card-group").append(html); + break; + } } -const imgOnclick = function (com) { - Dialog({ - title: '图像详情', - width: 600, - imageContent: { - src: com.src, - height: 480 - }, - showButton: false, - showTitle: true, - maskClose: true - }); +const imgOnclick = function (com, e) { + $('#imgMagnification').css({ + display:'block', + }) + $('#imgMagnification #center #centerImg').attr('src',e) + $('#imgMagnification #center #centerImg').css({ + transform:`scale(1.5,1.5)` + }) + $('#imgMagnification #closeBtn').click(function (){ + $('#imgMagnification').css({ + display:'none', + }) + }) + // Dialog({ + // title: '图像详情', + // width: 1920, + // imageContent: { + // src: com.src, + // height: 940 + // }, + // showButton: false, + // showTitle: true, + // maskClose: true + // }); } -const collectTime = function (time){ - let oldTime = (new Date(time)).getTime(); - let curTime = new Date(oldTime).format("yyyy-MM-dd hh:mm:ss"); - return curTime; +const collectTime = function (time) { + let oldTime = (new Date(time)).getTime(); + let curTime = new Date(oldTime).format("yyyy-MM-dd hh:mm:ss"); + return curTime; } const sensorStatus = function (status) { - let result = "-"; - switch (status) { - case 0: - result = `在线`; - break; - case 1: - result = `离线`; - break; - case 2: - result = `告警`; - break; - default: - result = `异常`; - break; - } - return result; + let result = "-"; + switch (status) { + case 0: + result = `在线`; + break; + case 1: + result = `离线`; + break; + case 2: + result = `告警`; + break; + default: + result = `异常`; + break; + } + return result; } -Date.prototype.format = function(fmt) { - var o = { - "M+" : this.getMonth()+1, //月份 - "d+" : this.getDate(), //日 - "h+" : this.getHours(), //小时 - "m+" : this.getMinutes(), //分 - "s+" : this.getSeconds(), //秒 - "q+" : Math.floor((this.getMonth()+3)/3), //季度 - "S" : this.getMilliseconds() //毫秒 - }; - if(/(y+)/.test(fmt)) { - fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); +Date.prototype.format = function (fmt) { + var o = { + "M+": this.getMonth() + 1, //月份 + "d+": this.getDate(), //日 + "h+": this.getHours(), //小时 + "m+": this.getMinutes(), //分 + "s+": this.getSeconds(), //秒 + "q+": Math.floor((this.getMonth() + 3) / 3), //季度 + "S": this.getMilliseconds() //毫秒 + }; + if (/(y+)/.test(fmt)) { + fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); + } + for (var k in o) { + if (new RegExp("(" + k + ")").test(fmt)) { + fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); } - for(var k in o) { - if(new RegExp("("+ k +")").test(fmt)){ - fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length))); - } - } - return fmt; + } + return fmt; } //温度传感器折线图 const temperatureTrend = function (sensorId) { - Dialog({ - title: "趋势分析", - width: 1100, - iframeContent: { - src: "/record/recordSensorData/getTemperatureTrend?id="+sensorId, - height: 600 - }, - showButton: false - }); -} \ No newline at end of file + Dialog({ + title: "趋势分析", + width: 1100, + iframeContent: { + src: "/record/recordSensorData/getTemperatureTrend?id=" + sensorId, + height: 600 + }, + showButton: false + }); +} diff --git a/ruoyi-admin/src/main/resources/templates/section/transformer-detail.html b/ruoyi-admin/src/main/resources/templates/section/transformer-detail.html index 9003d8c..a21f0a4 100644 --- a/ruoyi-admin/src/main/resources/templates/section/transformer-detail.html +++ b/ruoyi-admin/src/main/resources/templates/section/transformer-detail.html @@ -1,411 +1,492 @@ - - - - 设备监控 - - - - - - - - - - - - - - - - - - - - - - - - - - + .imgMagnification .closeBtn { + position: absolute; + width: 30px; + height: 30px; + right: 50px; + top: 50px; + transform: translate(-50%, -50%); + background-image: url("../../img/close.png"); + background-repeat: no-repeat; + background-size: 100% 100%; + } + + + + + + + + + + + + + + +
- - + +
-
+
+
@@ -422,222 +503,272 @@
+
+
+ +
+
+
+
+
+
+
+ + + -