btxtgxq-system-city/src/main/resources/static/route/leave/list.html
wans 01ca20b474 修改所有片长为网格长 所有N员为专管员
修改地图首页点击网格查看详情数据为空的问题
2021-07-05 12:54:56 +08:00

515 lines
23 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<base href="/servicecity/">
<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">
</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="areaSelectTemplateBox" style="width: 150px;"></div>
<script id="areaSelectTemplate" type="text/html">
<select id="areaId" name="areaId" lay-filter="changeArea">
<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="deptSelectTemplateBox" style="width: 150px;"></div>
<script id="deptSelectTemplate" type="text/html">
<select id="departmentId" name="departmentId">
<option value="">选择部门</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.id}}">{{item.name}}</option>
{{# } }}
</select>
</script>
<div class="layui-inline" id="communitySelectTemplateBox" style="width: 150px;"></div>
<script id="communitySelectTemplate" 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" style="width: 150px;">
<select id="userType" name="userType">
<option value="">人员类别</option>
<option value="1">一级网格长</option>
<option value="2">二级网格长</option>
<option value="3">三级网格长</option>
<option value="4">专管员</option>
</select>
</div>
<div class="layui-inline" style="width: 150px;">
<select id="leaveState" name="leaveState">
<option value="">审批结果</option>
<option value="0">未审批</option>
<option value="1">审批通过</option>
<option value="2">审批不通过</option>
</select>
</div>
</div>
<div class="test-table-reload-btn layui-form" style="margin-bottom: 5px;">
<div class="layui-inline">
<input type="text" id="keywords" class="layui-input search-item" placeholder="姓名" style="height: 38px;width: 150px;" autocomplete="off">
</div>
<div class="layui-inline" style="width: 100px;">
<select id="searchType" name="searchType" lay-filter="changeSearchType">
<option value="1" selected="selected">今日</option>
<option value="2">自定义</option>
</select>
</div>
<div class="layui-inline" style="width: 100px;">
<select id="todayRangeType" name="todayRangeType">
<option value="1" selected="selected">全天</option>
<option value="2">上午</option>
<option value="3">下午</option>
</select>
</div>
<div class="layui-inline">
<input type="text" id="startTime" class="layui-input search-item"
readonly="readonly" placeholder="开始时间" style="height: 38px;width: 120px;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: 115px;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>
<button type="button" id="exportTable" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-share"></i> 导出Excel
</button>
<button type="button" id="deleteTableData" class="layui-btn layui-btn-danger layui-btn-sm">
<i class="fa fa-lg fa-trash"></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/leave/listpageleavedetail';
var dataLoading = false;
function initTable() {
dataLoading = true;
table.render({
elem: '#dataTable',
id: 'dataTable',
url: top.restAjax.path(getParamsUrl(tableUrl), []),
width: admin.screen() > 1 ? '100%' : '',
height: $win.height() - 140,
limit: 20,
limits: [20, 40, 60, 80, 100, 200],
request: {
pageName: 'page',
limitName: 'rows'
},
cols: [[
{field:'rowNum', width:60, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{type:'checkbox', fixed: 'left'},
{field: 'leaveUserName', width: 100, title: '请假人', align:'center',fixed: 'left',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'userPhone', width: 120, title: '联系电话', align:'center',fixed: 'left',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'userAvatar', width: 60, title: '头像', align:'center',fixed: 'left',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '<img style="width: 30px;height: 30px;" src="assets/images/profile-photo.jpg"/>';
} else {
return '<img style="width: 30px;height: 30px;" src="route/file/downloadfile/false/'+ rowData +'"/>';
}
}
},
{field: 'leaveType', width: 100, title: '请假类型', align:'center',fixed: 'left',
templet: function(row) {
var rowData = row[this.field];
if(rowData == 'ill'){
return '生病'
}
if(rowData == 'busy'){
return '有事'
}
return '-';
}
},
{field: 'leaveTime', width: 160, title: '请假时间', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'leaveTimeEnd', width: 160, title: '结束时间', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'leaveTimeLong', width: 100, title: '请假时长', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData + '天';
}
},
{field: 'leaveSummary', width: 200, title: '请假事由', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'approverName', width: 100, title: '审批人', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'leaveState', width: 100, title: '审批状态', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(rowData == '0'){
return '<span style="color: #aa7700">未审批</span>'
}
if(rowData == '1'){
return '<span style="color: #00a0e9">通过</span>'
}
if(rowData == '2'){
return '<span style="color: red">拒绝</span>'
}
return '-';
}
},
{field: 'leaveRefuseSummary', width: 200, title: '审批意见', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'communityBossLevel', width: 100, title: '网格长等级', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'areaName', width: 120, title: '地区', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'communityNames', width: 120, title: '社区', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'departmentNames', width: 120, title: '部门', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'positionNames', width: 120, title: '职位', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
]],
page: true,
parseData: function(data) {
return {
'code': 0,
'msg': '',
'count': data.total,
'data': data.rows
};
},
done: function(){
dataLoading = false;
}
});
}
setTimeout(function(){
initTable();
},1000);
// 重载表格
function reloadTable(currentPage) {
dataLoading = true;
table.reload('dataTable', {
url: top.restAjax.path(getParamsUrl(tableUrl), []),
page: {
curr: currentPage
},
height: $win.height() - 140,
done:function(){
dataLoading = false;
}
});
}
//初始化地区
function initArea(){
top.restAjax.get('api/dict/listdict/9d179f05-3ea0-48f7-853c-d3b7124b791c', {}, null, function(code, data) {
laytpl(document.getElementById('areaSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('areaSelectTemplateBox').innerHTML = html;
});
form.render('select');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
initArea();
//初始化社区
function initCommunity(areaId) {
top.restAjax.get('api/community/listcommunity?areaId=' + areaId, {}, null, function(code, data) {
console.log(data);
laytpl(document.getElementById('communitySelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('communitySelectTemplateBox').innerHTML = html;
});
form.render('select');
$('#communitySelectTemplateBox').show();
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
//初始化部门
function initDept(){
top.restAjax.get('api/department/listdepartments', {}, null, function(code, data) {
laytpl(document.getElementById('deptSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('deptSelectTemplateBox').innerHTML = html;
});
form.render('select');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
initDept();
function initDateTime(){
laydate.render({
elem: '#startTime'
});
laydate.render({
elem: '#endTime'
});
}
initDateTime();
function getParamsUrl(url) {
var keywords = $('#keywords').val();
var startTime = $('#startTime').val();
var endTime = $('#endTime').val();
var searchType = $('#searchType').val();
var areaId = $('#areaId').val();
var communityId = $('#communityId').val();
var departmentId = $('#departmentId').val();
var userType = $('#userType').val();
var leaveState = $('#leaveState').val();
var todayRangeType = $('#todayRangeType').val();
var params = '?t='+ new Date().getTime();
if('' != keywords) {
params += '&keywords='+ encodeURI(keywords);
}
if('' != startTime) {
params += '&startTime='+ startTime;
}
if('' != endTime) {
params += '&endTime='+ endTime;
}
if('' != searchType) {
params += '&searchType='+ searchType;
}
if('' != areaId && 'none' != areaId) {
params += '&areaId='+ areaId;
}
if('' != communityId && 'undefined' != typeof(communityId)) {
params += '&communityId='+ communityId;
}
if('' != departmentId && 'none' != departmentId) {
params += '&departmentId='+ departmentId;
}
if('' != userType) {
params += '&userType='+ userType;
}
if('' != leaveState) {
params += '&leaveState='+ leaveState;
}
if('' != todayRangeType) {
params += '&todayRangeType='+ todayRangeType;
}
return url + params;
}
function remove(ids){
top.dialog.msg(top.dataMessage.delete, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
top.dialog.close(index);
var layIndex;
top.restAjax.delete(top.restAjax.path('api/leave/removeleave/{ids}', [ids]), {}, null, function (code, data) {
// success
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000}, function () {
reloadTable();
});
}, function (code, data) {
// error
top.dialog.msg(data.msg);
}, function () {
// before
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
}, function () {
// complete
top.dialog.close(layIndex);
});
}
});
}
$(document).on('click', '#search', function() {
if(dataLoading){
layer.msg('数据加载中,请稍等...');
return;
}
reloadTable(1);
});
$(document).on('click', '#exportTable', function() {
top.dialog.confirm('确定导出数据?', function(index) {
top.dialog.close(index);
window.open(getParamsUrl(top.restAjax.path('api/leave/listleavedetailtoexcel', [])), '_blank');
});
})
$(document).on('click', '#deleteTableData', function() {
var checkStatus = table.checkStatus('dataTable');
if(checkStatus.data.length == 0){
layer.msg('请先勾选要删除的数据')
return;
}
var ids = '';
for (var i = 0, item;item = checkStatus.data[i++];){
if(i > 1) {
ids += '_';
}
ids += item.leaveId;
}
remove(ids);
});
form.on('select(changeArea)',function(data){
if(data.value == ''){
$('#communitySelectTemplateBox').hide();
$('#communityId').val('');
$('#deptSelectTemplateBox').show();
} else {
initCommunity(data.value);
$('#departmentId').val('');
$('#deptSelectTemplateBox').hide();
}
initDept();
});
form.on('select(changeSearchType)',function(data){
if(data.value == '1'){
$('#todayRangeType').parent().show();
$('#startTime').val('').hide();
$('#endTime').val('').hide();
} else {
$('#todayRangeType').parent().hide();
$('#startTime').show();
$('#endTime').show();
}
initDept();
});
$('#startTime').val('').hide();
$('#endTime').val('').hide();
$('#communitySelectTemplateBox').hide();
});
</script>
</body>
</html>