168 lines
6.3 KiB
Plaintext
168 lines
6.3 KiB
Plaintext
@page
|
|
@model Waste.Web.Entry.Pages.Result.IndexModel
|
|
@{
|
|
ViewData["Title"] = "投放记录";
|
|
}
|
|
<div class="layui-card">
|
|
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
|
|
<div class="layui-form-item">
|
|
<div class="layui-inline">
|
|
<div class="layui-input-inline">
|
|
<input type="text" class="layui-input" value="@Model.defaulttime" data-time="ysdatetime" autocomplete="off" name="time" id="time" placeholder="请选择时间" />
|
|
</div>
|
|
</div>
|
|
<div class="layui-inline">
|
|
<div class="layui-input-inline">
|
|
<input type="text" class="layui-input" name="FacEcode" id="FacEcode" placeholder="请输入设备编号" />
|
|
</div>
|
|
</div>
|
|
<div class="layui-inline">
|
|
<div class="layui-input-inline">
|
|
<input type="text" class="layui-input" name="Name" id="Name" placeholder="请输入设备名称" />
|
|
</div>
|
|
</div>
|
|
<div class="layui-inline">
|
|
<div class="layui-input-inline">
|
|
<select id="poststatus">
|
|
<option value="">请选择状态</option>
|
|
<option value="-1">未上报</option>
|
|
<option value="0">上报失败</option>
|
|
<option value="1">上报成功</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="layui-inline">
|
|
<button class="btn btn-primary btn-lg js-search" type="button">查询</button>
|
|
<button class="btn btn-primary btn-lg js-add" type="button">添加</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-card-body">
|
|
<table class="layui-table" id="list" lay-filter="list">
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<script type="text/html" id="optpl">
|
|
<a href="#" class="js-edit" title="编辑" data-id="{{d.id}}">编辑</a>
|
|
@*<a href="#" class="js-delete" title="删除" data-id="{{d.id}}">删除</a> *@
|
|
</script>
|
|
<script type="text/html" id="netstatustpl">
|
|
{{#if (d.poststatus == 0){ }}
|
|
<span style="color:red;">上报失败</span>
|
|
{{# } else if(d.poststatus == 1){ }}
|
|
<span style="color: #19be6b;">上报成功</span>
|
|
{{# }else{ }}
|
|
<span style="color: #b3b3b3;">未上报</span>
|
|
{{#} }}
|
|
</script>
|
|
@section Scripts
|
|
{
|
|
<script type="text/javascript">
|
|
let defColumn = @Json.Serialize(Model.DefaultColumn);
|
|
let oColumn = @Json.Serialize(Model.Column);
|
|
console.log(defColumn)
|
|
console.log(oColumn)
|
|
const column = [];
|
|
for (const property in defColumn) {
|
|
console.log(`${property}: ${defColumn[property]}`);
|
|
const col = {
|
|
field: property, title: defColumn[property], hide: true
|
|
};
|
|
oColumn[property] && (col.hide=false)
|
|
property == 'poststatus' && (col.templet= '#netstatustpl');
|
|
column.push(col);
|
|
}
|
|
console.log(column)
|
|
|
|
layui.use(['common'], function () {
|
|
var common = layui.common;
|
|
var queryparam = [];
|
|
var starttime = $("#time").val();
|
|
if (starttime != "") {
|
|
var times = starttime.split('~');
|
|
queryparam.push({
|
|
"Name": 'createtime',
|
|
"Type": QueryCond.GreaterThanOrEqual,
|
|
"Value": times[0].trim()
|
|
});
|
|
queryparam.push({
|
|
"Name": 'createtime',
|
|
"Type": QueryCond.LessThanOrEqual,
|
|
"Value": times[1].trim()
|
|
});
|
|
}
|
|
common.initTable({
|
|
url: '/api/result/getlist'
|
|
, method: 'post',
|
|
where: {
|
|
queryParam: queryparam
|
|
}
|
|
, cols: [column]
|
|
, done: function () {
|
|
// 记录筛选状态
|
|
const that = this;
|
|
that.elem.next().on('mousedown', 'input[lay-filter="LAY_TABLE_TOOL_COLS"]+', function () {
|
|
const input = $(this).prev()[0];
|
|
console.log('LAY_TABLE_TOOL_COLS', {
|
|
key: input.name
|
|
, value: input.checked
|
|
});
|
|
|
|
!input.checked ? (oColumn[input.name] = input.title): (oColumn[input.name]=null)
|
|
$.ajax({
|
|
url: "?handler=UpdateAccountConfig",
|
|
type: "post",
|
|
dataType: "json",
|
|
data: JSON.stringify(Object.keys(oColumn).filter(x=>oColumn[x]).map(x=>({name:x,title:oColumn[x]}))),
|
|
contentType: "application/json;charset=utf-8",
|
|
success: function (res) {
|
|
|
|
},
|
|
complete: function () {
|
|
|
|
},
|
|
fail: function (res) {
|
|
|
|
}
|
|
});
|
|
});
|
|
}
|
|
});
|
|
$(".js-search").on("click", function () {
|
|
var queryparam = [{
|
|
"Name": 'FacEcode',
|
|
"Type": QueryCond.Like,
|
|
"Value": $("#FacEcode").val()
|
|
}, {
|
|
"Name": 'Name',
|
|
"Type": QueryCond.Like,
|
|
"Value": $("#Name").val()
|
|
},{
|
|
"Name": 'poststatus',
|
|
"Type": QueryCond.Equal,
|
|
"Value": $("#poststatus").val()
|
|
}];
|
|
var starttime = $("#time").val();
|
|
if (starttime != "") {
|
|
var times = starttime.split('~');
|
|
queryparam.push({
|
|
"Name": 'createtime',
|
|
"Type": QueryCond.GreaterThanOrEqual,
|
|
"Value": times[0].trim()
|
|
});
|
|
queryparam.push({
|
|
"Name": 'createtime',
|
|
"Type": QueryCond.LessThanOrEqual,
|
|
"Value": times[1].trim()
|
|
});
|
|
}
|
|
common.reloadtable("list", {
|
|
where: {
|
|
queryParam: queryparam
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
}
|