btxtgxq-system-bigdata/src/main/resources/static/route/kpi/community-count.html

287 lines
13 KiB
HTML
Raw Normal View History

<!doctype html>
<html lang="zh-CN">
<head>
<base href="/bigdata/">
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
2023-04-05 17:40:55 +08:00
<style>
.layui-table-cell a {text-decoration: underline;}
</style>
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="test-table-reload-btn layui-form" style="margin-bottom: 5px;">
<div class="layui-inline" id="areaBox" style="width: 150px;"></div>
<script id="areaTemplate" type="text/html">
<select id="areaId" name="areaId" lay-filter="areaChange">
<option value="">请选择地区</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictId}}">{{item.dictName}}</option>
{{# } }}
</select>
</script>
<div class="layui-inline" id="communityBox" style="width: 150px;"></div>
<script id="communityTemplate" type="text/html">
<select id="communityId" name="communityId">
<option value="">请选择社区</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.communityId}}">{{item.communityName}}</option>
{{# } }}
</select>
</script>
<div class="layui-inline">
<input type="text" id="startTime" class="layui-input search-item"
readonly="readonly" placeholder="开始时间" style="height: 38px;width:150px;cursor: pointer" autocomplete="off">
</div>
<div class="layui-inline">
<input type="text" id="endTime" class="layui-input search-item"
readonly="readonly" placeholder="结束时间" style="height: 38px;width:150px;cursor: pointer" autocomplete="off">
</div>
<button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索
</button>
2023-04-07 11:04:45 +08:00
<button type="button" id="refreshData" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-refresh"></i> 更新案件情况
</button>
2023-05-10 18:15:25 +08:00
<button type="button" id="exportData" class="layui-btn layui-btn-sm layui-btn-normal">
<i class="fa fa-lg fa-download"></i> 导出
</button>
</div>
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
</div>
</div>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script type="text/javascript">
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'table', 'laytpl', 'form','laydate'], function() {
var $ = layui.$;
var $win = $(window);
var laytpl = layui.laytpl;
var table = layui.table;
var admin = layui.admin;
var form = layui.form;
var laydate = layui.laydate;
var tableUrl = 'api/kpi/list-community-case-count';
var dataLoading = false;
function init(){
laydate.render({
elem: '#startTime'
,value: ''
});
laydate.render({
elem: '#endTime'
,value: ''
});
initArea();
initCommunity('');
initTable();
}
init();
//初始化地区
function initArea(){
top.restAjax.get('api/kpi/list-area', {}, null, function(code, data) {
laytpl(document.getElementById('areaTemplate').innerHTML).render(data, function(html) {
document.getElementById('areaBox').innerHTML = html;
});
form.render('select');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
form.on('select(areaChange)',function(data){
var areaId = data.value;
initCommunity(areaId);
});
//初始化社区
function initCommunity(areaId){
if(!areaId){
laytpl(document.getElementById('communityTemplate').innerHTML).render([], function(html) {
document.getElementById('communityBox').innerHTML = html;
});
form.render('select');
return;
}
top.restAjax.get('api/kpi/list-community/area-id/'+ areaId, {}, null, function(code, data) {
laytpl(document.getElementById('communityTemplate').innerHTML).render(data, function(html) {
document.getElementById('communityBox').innerHTML = html;
});
form.render('select');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化表格
function initTable() {
dataLoading = true;
table.render({
elem: '#dataTable',
id: 'dataTable',
url: top.restAjax.path(tableUrl, []),
where :{
areaId : $('#areaId').val(),
communityId : $('#communityId').val()
},
width: admin.screen() > 1 ? '100%' : '',
height: $win.height() - 100,
toolbar: false,
defaultToolbar: ['print', 'exports'],
cols: [[
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field:'areaName', width:140, title: '地区', fixed: 'left', align:'center'},
{field:'communityName', width:140, title: '社区', fixed: 'left', align:'center'},
{field:'caseTotal', width:100, title: '案件总数', align:'center',
templet: function(row) {
var rowData = row[this.field];
2023-04-05 17:40:55 +08:00
return `<a href="javascript:void(0)" lay-event="caseEvent">${rowData}件</a>`;
}
},
{field:'caseAcceptTotal', width:160, title: '已受理案件', align:'center',
templet: function(row) {
var rowData = row[this.field];
2023-04-05 17:40:55 +08:00
return `<a href="javascript:void(0)" lay-event="caseAcceptEvent">${rowData}件</a>`;
}
},
{field:'caseHandleTotal', width:160, title: '已处理案件', align:'center',
templet: function(row) {
var rowData = row[this.field];
2023-04-05 17:40:55 +08:00
return `<a href="javascript:void(0)" lay-event="caseHandleEvent">${rowData}件</a>`;
}
},
{field:'caseInspectTotal', width:160, title: '已检查案件', align:'center',
templet: function(row) {
var rowData = row[this.field];
2023-04-05 17:40:55 +08:00
return `<a href="javascript:void(0)" lay-event="caseInspectEvent">${rowData}件</a>`;
}
},
{field:'caseOnfileTotal', width:160, title: '已归档案件', align:'center',
templet: function(row) {
var rowData = row[this.field];
return rowData + '件';
}
},
]],
page: false,
parseData: function(data) {
return {
'code': 0,
'msg': '',
'count': data.length,
'data': data
};
},
done: function(){
dataLoading = false;
}
});
}
// 重载表格
function reloadTable() {
dataLoading = true;
table.reload('dataTable', {
url: top.restAjax.path(tableUrl, []),
where: {
areaId : $('#areaId').val(),
communityId : $('#communityId').val(),
startTime : $('#startTime').val(),
endTime : $('#endTime').val(),
},
height: $win.height() - 100,
done:function(){
dataLoading = false;
}
});
}
2023-04-05 17:40:55 +08:00
table.on('tool(dataTable)', function(obj) {
var data = obj.data;
var event = obj.event;
if(event === 'caseEvent') {
top.dialog.open({
title: `${data.userName} 案件总数`,
url: top.restAjax.path('route/kpi/detail/user-case.html?areaId={areaId}&communityId={communityId}&startTime={startTime}&endTime={endTime}', [data.areaId, data.communityId, $('#startTime').val(), $('#endTime').val()]),
width: '80%',
height: '80%',
onClose: function() {}
})
} else if(event === 'caseAcceptEvent') {
top.dialog.open({
title: `${data.userName} 案件总数`,
url: top.restAjax.path('route/kpi/detail/user-case.html?areaId={areaId}&communityId={communityId}&isAccept=1&startTime={startTime}&endTime={endTime}', [data.areaId, data.communityId, $('#startTime').val(), $('#endTime').val()]),
width: '80%',
height: '80%',
onClose: function() {}
})
} else if(event === 'caseHandleEvent') {
top.dialog.open({
title: `${data.userName} 案件总数`,
url: top.restAjax.path('route/kpi/detail/user-case.html?areaId={areaId}&communityId={communityId}&isHandle=1&startTime={startTime}&endTime={endTime}', [data.areaId, data.communityId, $('#startTime').val(), $('#endTime').val()]),
width: '80%',
height: '80%',
onClose: function() {}
})
} else if(event === 'caseInspectEvent') {
top.dialog.open({
title: `${data.userName} 案件总数`,
url: top.restAjax.path('route/kpi/detail/user-case.html?areaId={areaId}&communityId={communityId}&isInspect=1&startTime={startTime}&endTime={endTime}', [data.areaId, data.communityId, $('#startTime').val(), $('#endTime').val()]),
width: '80%',
height: '80%',
onClose: function() {}
})
}
});
$(document).on('click', '#search', function() {
if(dataLoading){
layer.msg('数据加载中,请稍等...');
return;
}
reloadTable(1);
});
2023-04-07 11:04:45 +08:00
$(document).on('click', '#refreshData', function() {
top.dialog.confirm('确定更新吗?时间可能较长,请不要关闭页面!', function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/kpi/update-case', []), {}, null, function(code, data) {
reloadTable(1);
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg('正在更新...', {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
});
2023-05-10 18:15:25 +08:00
$(document).on('click', '#exportData', function() {
window.open(top.restAjax.path('api/kpi/export-community-case-count?areaId={areaId}&communityId={communityId}&startTime={startTime}&endTime={endTime}', [$('#areaId').val(), $('#communityId').val(), $('#startTime').val(), $('#endTime').val()]))
});
})
</script>
</body>
</html>