184 lines
8.9 KiB
HTML
184 lines
8.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-cn">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>设备使用情况</title>
|
|
<link rel="stylesheet" href="/app/admin/component/pear/css/pear.css" />
|
|
<link rel="stylesheet" href="/app/admin/admin/css/reset.css" />
|
|
</head>
|
|
<body class="pear-container">
|
|
|
|
<div class="layui-card">
|
|
<div class="layui-card-body">
|
|
<form class="layui-form top-search-from">
|
|
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">所属医院</label>
|
|
<div class="layui-input-block">
|
|
<div id="hospitalSelect"></div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">设备名称</label>
|
|
<div class="layui-input-block">
|
|
<div id="deviceSelect"></div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">开始时间</label>
|
|
<div class="layui-input-block">
|
|
<input type="text" name="start_time" id="startTime" class="layui-input" placeholder="开始日期" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">结束时间</label>
|
|
<div class="layui-input-block">
|
|
<input type="text" name="end_time" id="endTime" class="layui-input" placeholder="结束日期" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item layui-inline">
|
|
<label class="layui-form-label"></label>
|
|
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="table-query">
|
|
<i class="layui-icon layui-icon-search"></i>查询
|
|
</button>
|
|
<button type="reset" class="pear-btn pear-btn-md" lay-submit lay-filter="table-reset">
|
|
<i class="layui-icon layui-icon-refresh"></i>重置
|
|
</button>
|
|
</div>
|
|
<div class="toggle-btn">
|
|
<a class="layui-hide">展开<i class="layui-icon layui-icon-down"></i></a>
|
|
<a class="layui-hide">收起<i class="layui-icon layui-icon-up"></i></a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="layui-card">
|
|
<div class="layui-card-body">
|
|
<table id="data-table" lay-filter="data-table"></table>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="/app/admin/component/layui/layui.js?v=2.8.12"></script>
|
|
<script src="/app/admin/component/pear/pear.js"></script>
|
|
<script src="/app/admin/admin/js/permission.js"></script>
|
|
<script src="/app/admin/admin/js/common.js"></script>
|
|
|
|
<script>
|
|
const SELECT_API = "/app/admin/device-usage/select";
|
|
const HOSPITAL_OPTIONS_API = "/app/admin/hospital/options";
|
|
const DEVICE_OPTIONS_API = "/app/admin/device-usage/device-options";
|
|
|
|
layui.use(["table", "form", "common", "popup", "xmSelect", "laydate"], function() {
|
|
let table = layui.table, form = layui.form, $ = layui.$, common = layui.common, laydate = layui.laydate;
|
|
|
|
// 日期选择器
|
|
laydate.render({ elem: "#startTime", type: "date" });
|
|
laydate.render({ elem: "#endTime", type: "date" });
|
|
|
|
// 医院多选下拉
|
|
let hospitalSelect = null;
|
|
$.ajax({
|
|
url: HOSPITAL_OPTIONS_API, dataType: "json", type: "get",
|
|
success: function(res) {
|
|
hospitalSelect = layui.xmSelect.render({
|
|
el: "#hospitalSelect",
|
|
name: "hospital_id",
|
|
tips: "全部医院",
|
|
filterable: true,
|
|
searchTips: "搜索医院",
|
|
data: res.data || []
|
|
});
|
|
}
|
|
});
|
|
|
|
// 设备下拉
|
|
let deviceSelect = null;
|
|
$.ajax({
|
|
url: DEVICE_OPTIONS_API, dataType: "json", type: "get",
|
|
success: function(res) {
|
|
deviceSelect = layui.xmSelect.render({
|
|
el: "#deviceSelect",
|
|
name: "device_id",
|
|
tips: "全部设备",
|
|
filterable: true,
|
|
searchTips: "搜索设备",
|
|
radio: true,
|
|
clickClose: true,
|
|
data: res.data || []
|
|
});
|
|
}
|
|
});
|
|
|
|
let cols = [
|
|
{ title: "序号", type: "numbers", align: "center", width: 60 },
|
|
{ title: "所属医院", field: "hospital_name", align: "center", minWidth: 150 },
|
|
{ title: "科室", field: "department", align: "center", minWidth: 120 },
|
|
{ title: "设备名称", field: "device_name", align: "center", minWidth: 140 },
|
|
{ title: "传感器SN", field: "sensor_sn", align: "center", width: 140 },
|
|
{ title: "传感器标签", field: "sensor_coding", align: "center", width: 120 },
|
|
{ title: "操作人", field: "operation", align: "center", width: 100 },
|
|
{ title: "灭菌开始时间", field: "start_time", align: "center", width: 170 },
|
|
{ title: "灭菌结束时间", field: "end_time", align: "center", width: 170 },
|
|
{ title: "使用时长", field: "duration", align: "center", width: 120 },
|
|
{ title: "灭菌批次", field: "pack", align: "center", width: 120 },
|
|
{
|
|
title: "状态", field: "is_warn", align: "center", width: 90,
|
|
templet: function(d) {
|
|
if (d.is_warn == 1) return '<span class="layui-badge" style="background:#4CAF50;padding:3px 10px;">正常</span>';
|
|
if (d.is_warn == 2) return '<span class="layui-badge" style="background:#FF5722;padding:3px 10px;">预警</span>';
|
|
return '<span class="layui-badge" style="background:#999;padding:3px 10px;">未知</span>';
|
|
}
|
|
}
|
|
];
|
|
|
|
table.render({
|
|
elem: "#data-table", url: SELECT_API, page: true, cols: [cols],
|
|
skin: "line", size: "lg", autoSort: false, limit: 20,
|
|
defaultToolbar: [{ title: "刷新", layEvent: "refresh", icon: "layui-icon-refresh" }, "filter", "print", "exports"]
|
|
});
|
|
|
|
table.on("toolbar(data-table)", function(obj) {
|
|
if (obj.event === "refresh") {
|
|
table.reloadData("data-table", { scrollPos: "fixed" });
|
|
}
|
|
});
|
|
|
|
form.on("submit(table-query)", function(data) {
|
|
let where = data.field;
|
|
if (hospitalSelect) {
|
|
let vals = hospitalSelect.getValue("value");
|
|
if (vals.length > 0) {
|
|
where["hospital_id[0]"] = "in";
|
|
where["hospital_id[1]"] = vals.join(",");
|
|
}
|
|
}
|
|
delete where.hospital_id;
|
|
if (deviceSelect) {
|
|
let vals = deviceSelect.getValue("value");
|
|
if (vals.length > 0) {
|
|
where.device_id = vals[0];
|
|
}
|
|
}
|
|
delete where.device_id_name;
|
|
table.reload("data-table", { page: { curr: 1 }, where: where });
|
|
return false;
|
|
});
|
|
|
|
form.on("submit(table-reset)", function() {
|
|
if (hospitalSelect) hospitalSelect.setValue([]);
|
|
if (deviceSelect) deviceSelect.setValue([]);
|
|
$("#startTime").val('');
|
|
$("#endTime").val('');
|
|
table.reload("data-table", { page: { curr: 1 }, where: {} });
|
|
return false;
|
|
});
|
|
|
|
table.on("sort(data-table)", function(obj) {
|
|
table.reload("data-table", { initSort: obj, scrollPos: "fixed", where: { field: obj.field, order: obj.type } });
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|