<!DOCTYPE html>
|
<html lang="zh-CN">
|
<head>
|
<meta charset="utf-8"/>
|
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"/>
|
<title>压缩站计量</title>
|
<link rel="stylesheet" href="css.css"/>
|
</head>
|
<body>
|
<div class="wrap">
|
<div class="page-head">
|
<h1>压缩站计量</h1>
|
<a class="back-link" href="home.html">返回工作台</a>
|
</div>
|
<div class="card">
|
<label class="req">压缩站</label>
|
<select id="businessId"></select>
|
<label>垃圾类型</label>
|
<input value="干垃圾 SW64" disabled/>
|
<label class="req">重量(吨/或额定载荷)</label>
|
<input id="weight" type="number" step="0.01"/>
|
<label>备注</label>
|
<textarea id="remark" rows="3"></textarea>
|
<button class="btn" onclick="save()">上报</button>
|
</div>
|
<div class="card" id="list"></div>
|
</div>
|
<script src="app.js"></script>
|
<script>
|
api("/app/basicdata/options/sites", { siteType: "压缩站" }).then(function (rows) {
|
if (!(rows || []).length) {
|
$("businessId").innerHTML = "<option value=''>暂无本部门压缩站</option>";
|
toast("未找到本部门压缩站");
|
return;
|
}
|
$("businessId").innerHTML = (rows || []).map(function (r) {
|
return "<option value='" + r.businessId + "'>" + r.businessName + "</option>";
|
}).join("");
|
}).catch(function (e) { toast(e.message); });
|
|
function save() {
|
if (!$("businessId").value) { toast("请选择压缩站"); return; }
|
api("/app/push/sorter/siteweightAdd", {
|
businessId: $("businessId").value,
|
deviceNo: "人工填报",
|
garbageType: "SW64",
|
weight: Number($("weight").value),
|
remark: $("remark").value
|
}).then(function () {
|
toast("已上报"); $("weight").value = ""; load();
|
}).catch(function (e) { toast(e.message); });
|
}
|
function load() {
|
api("/app/push/sorter/siteweightPage", { page: 1, size: 30 }).then(function (res) {
|
var list = (res && res.list) || [];
|
$("list").innerHTML = list.length ? list.map(function (r) {
|
return "<div class='item'>" + (r.businessName || r.businessId) + " " + r.weight +
|
"<div class='muted'>" + (r.uploadTime || "") + " · " + (r.deviceNo || "") + "</div></div>";
|
}).join("") : "<div class='muted'>暂无记录</div>";
|
}).catch(function (e) { toast(e.message); });
|
}
|
load();
|
</script>
|
</body>
|
</html>
|