feat: 设备监控增加【设备名称】检索

dev
chuguofei 2023-06-15 11:38:44 +08:00
parent 5aa131514f
commit b8f1ebcfe5
2 changed files with 45 additions and 25 deletions

View File

@ -283,10 +283,10 @@
t.iot_node_status,t.atime node_atime ,t.infos AS deviceinfos ,
t.iot_protocal_category ,
t.frequency , t.device_code ,t.template_id , o.*
FROM
FROM
<if test="limit!=null">
(
SELECT * FROM iot_node_info
SELECT * FROM iot_node_info
WHERE 1=1
<if test="scene_id !=null">
AND scene_id =#{scene_id}
@ -295,15 +295,15 @@
AND delete_flag=#{delete_flag}
</if>
<if test="device_code !=null">
AND device_code LIKE CONCAT("%", #{device_code},"%")
AND device_code LIKE CONCAT("%", #{device_code},"%")
</if>
<if test="user_id !=null">
AND scene_id IN ( SELECT scene_id FROM iot_scene_user_relation WHERE user_id = #{user_id} )
AND scene_id IN ( SELECT scene_id FROM iot_scene_user_relation WHERE user_id = #{user_id} )
</if>
<if test="id !=null">
AND id=#{id}
</if>
ORDER BY seq ASC
ORDER BY seq ASC
<include refid="Base.sql_limit_condition" />
)
</if>
@ -323,13 +323,16 @@
AND t.delete_flag=#{delete_flag}
</if>
<if test="device_code !=null">
AND device_code LIKE CONCAT("%", #{device_code},"%")
AND device_code LIKE CONCAT("%", #{device_code},"%")
</if>
<if test="id !=null">
AND t.id=#{id}
</if>
</if>
ORDER BY
<if test="scene_name != null">
AND o.name LIKE CONCAT("%", #{scene_name},"%")
</if>
ORDER BY
<if test="limit == null">
t.seq ASC , t.id ASC ,
</if>

View File

@ -125,9 +125,10 @@
<div class="mapContainer">
<div class="app-container">
<div style="padding: 6px 8px 6px 10px;background: #fff;border-left: 1px solid #f2f2f2;">
<input id="scene_name" class="hidden" />
<input type="text" style="display: inline;width: 210px;margin-right: 20px;"
autocomplete="off" placeholder="设备号检索" class="layui-input device_code">
<input id="scene_name" type="text" style="display: inline;width: 210px;margin-right: 20px;"
autocomplete="off" placeholder="设备号名称" class="layui-input device_code"/>
<button type="button" onclick="searchDevice();" style="line-height: 34px;height:34px;"
class="layui-btn layui-btn-normal">检索
</button>
@ -140,12 +141,27 @@
<div id="template0" class="hide">
<div class="box join-device-box">
<div class="device_container"><i class="icon-hdd-o"></i>&nbsp;
<span style="width: 100px;display: inline-block;">{0}</span> &nbsp;&nbsp;&nbsp;<span> {1}</span>
<span class="float-right pro-span" style="margin-right:20px;cursor: pointer;"
onclick="deviceSetting({4})" tag="{4}">设置参数</span>
<span class="float-right span-dis" style="">设备号:{2}</span>
<div class="device_container">
<div class="flex items-center flex-col lg:flex-row lg:justify-between">
<div class="flex items-center mb-1 w-full justify-between lg:w-auto lg:justify-start">
<div>
<i class="icon-hdd-o"></i>&nbsp;
<span class="mx-1 text-xs">{0}</span>
</div>
<span class="bg-[#3499da] py-1 px-1 text-xs text-white text-center rounded-sm cursor-pointer text-xs">{1}</span>
</div>
<div class="flex items-center mb-1 w-full justify-between lg:w-auto lg:justify-end">
<span class="mx-1 text-xs">设备号:{2}</span>
<span onclick="deviceSetting({4})" tag="{4}"
class="bg-[#4caf50] py-1 px-1 text-xs text-white text-center rounded-sm cursor-pointer ml-1">设置参数</span>
</div>
</div>
</div>
<div class="sensor_info_container w-full">
{3}
</div>
@ -164,7 +180,7 @@
</div>
<div class="flex items-center justify-center lg:justify-start text-xl flex-1 ml-2">
<span class="text-[#337ab7]">{3}</span>
<span class="{7}" onclick="downparam({4})">下发</span>
<span class="{7} text-sm ml-1 cursor-pointer underline underline-offset-4" onclick="downparam({4})">下发</span>
</div>
<a href="<%=basePath%>/service/iot/sensors_detail?id={4}&sid={5}"
class="text-xs cursor-pointer w-full mx-2 text-right lg:text-right lg:absolute lg:right-2 lg:top-1/2 lg:-translate-y-1/2 lg:mx-0 lg:w-12"
@ -188,7 +204,7 @@
</div>
<div class="flex items-center justify-center lg:justify-start text-xl flex-1 ml-2">
<img style="cursor: pointer;" tag="{7}" onclick="switchSensor(this,{4},{5})" {3}>
<span class="{9}" onclick="downparam({4})">下发</span>
<span class="{9} text-sm ml-1 cursor-pointer underline underline-offset-4" onclick="downparam({4})">下发</span>
</div>
<a href="<%=basePath%>/service/iot/sensors_detail?id={4}&sid={5}"
class="text-xs cursor-pointer w-full mx-2 text-right lg:text-right lg:absolute lg:right-2 lg:top-1/2 lg:-translate-y-1/2 lg:mx-0 lg:w-12"
@ -236,7 +252,7 @@
</div>
<div class="flex items-center justify-center lg:justify-start text-xl flex-1 ml-2">
<span class="text-[#337ab7]">{3}</span>
<span class="{7}" onclick="downparam({4})">下发</span>
<span class="{7} text-sm ml-1 cursor-pointer underline underline-offset-4" onclick="downparam({4})">下发</span>
</div>
<a href="<%=basePath%>/service/iot/sensors_detail?id={4}&sid={5}}"
class="text-xs cursor-pointer w-full mx-2 text-right lg:text-right lg:absolute lg:right-2 lg:top-1/2 lg:-translate-y-1/2 lg:mx-0 lg:w-12"
@ -379,13 +395,8 @@
})
function searchDevice() {
if (validater.empty($(".device_code").val())) {
tip("请输入的设备号");
return;
} else {
device_code = $(".device_code").val();
reflash($(".dashboard-menu li.active").attr("sid"));
}
device_code = $(".device_code").val();
reflash($(".dashboard-menu li.active").attr("sid"));
}
// 刷新传感器数据
@ -393,8 +404,14 @@
if (validater.empty(sid)) {
return;
}
var scene_name = document.getElementById("scene_name").value;
searchDeviceInfo({scene_id: sid, node_data_type: 0, device_code: device_code, scene_name: scene_name});
const scene_name = document.getElementById("scene_name").value;
searchDeviceInfo({
scene_id: sid,
node_data_type: 0,
device_code: device_code,
scene_name: scene_name,
limit: 1
});
}
function searchDeviceInfo(dataParam) {