btyjj-inspection/src/main/resources/static/route/check/list-check.html

421 lines
22 KiB
HTML
Raw Normal View History

2020-03-26 00:00:48 +08:00
<!doctype html>
<html lang="en">
<head>
<base href="/inspection/">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=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">
2020-05-22 19:08:45 +08:00
<link rel="stylesheet" href="assets/js/vendor/swiper3/css/swiper.min.css" media="all">
<link rel="stylesheet" href="assets/css/list-css.css" media="all">
2020-03-26 00:00:48 +08:00
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
2020-04-02 18:21:52 +08:00
<div class="layui-inline search-item-width-100">
2020-03-26 00:00:48 +08:00
<input type="text" id="keywords" class="layui-input search-item" placeholder="输入关键字">
</div>
2020-04-02 18:21:52 +08:00
<div class="layui-inline layui-form search-item" id="typeSelectTemplateBox" lay-filter="typeSelectTemplateBox"></div>
<script id="typeSelectTemplate" type="text/html">
<select id="type" name="type">
<option value="">企业类型</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
<div class="layui-inline layui-form search-item" id="industrySelectTemplateBox" lay-filter="industrySelectTemplateBox"></div>
<script id="industrySelectTemplate" type="text/html">
<select id="industry" name="industry">
<option value="">管理行业</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dictionaryId}}">{{item.dictionaryName}}</option>
{{# } }}
</select>
</script>
<div class="layui-inline layui-form search-item">
<select id="checkType" name="checkType">
<option value="">检查类型</option>
<option value="1">检查</option>
<option value="2">复查</option>
</select>
</div>
2020-04-02 18:21:52 +08:00
<div class="layui-inline layui-form search-item">
<select name="isCoordination" id="isCoordination">
<option value="">是否配合</option>
<option value="0">不配合</option>
<option value="1">配合</option>
</select>
</div>
<div class="layui-inline layui-form search-item">
<select name="isComplete" id="isComplete">
<option value="">是否完成</option>
<option value="0">未完成</option>
<option value="1">完成</option>
</select>
</div>
2020-03-26 00:00:48 +08:00
<button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索
</button>
</div>
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
<!-- 表头按钮组 -->
<script type="text/html" id="headerToolBar">
<div class="layui-btn-group">
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
<i class="fa fa-lg fa-plus"></i> 新增
</button>
2020-04-26 18:45:29 +08:00
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
<i class="fa fa-lg fa-trash"></i> 删除
</button>
2020-03-26 00:00:48 +08:00
</div>
</script>
</div>
</div>
</div>
</div>
</div>
2020-05-22 19:08:45 +08:00
<script src="assets/js/vendor/swiper3/js/swiper.min.js"></script>
2020-03-26 00:00:48 +08:00
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'table', 'laydate', 'common'], function() {
var $ = layui.$;
var $win = $(window);
var table = layui.table;
var admin = layui.admin;
var laydate = layui.laydate;
2020-04-02 18:21:52 +08:00
var form = layui.form;
var laytpl = layui.laytpl;
2020-03-26 00:00:48 +08:00
var common = layui.common;
var resizeTimeout = null;
2020-04-02 18:21:52 +08:00
var tableUrl = 'api/check/listpagecheck?checkType=1';
// 初始化企业类型下拉选择
function initTypeSelect() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/612415f3-0ebb-4bc2-b713-e9fb1acc7f76', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('typeSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('typeSelectTemplateBox').innerHTML = html;
});
form.render('select', 'typeSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
initTypeSelect();
// 初始化管理行业下拉选择
function initIndustrySelect() {
top.restAjax.get(top.restAjax.path('api/datadictionary/listdictionarybyparentid/b97630ab-45b7-45bc-a624-507d4df952ff', []), {}, null, function(code, data, args) {
laytpl(document.getElementById('industrySelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('industrySelectTemplateBox').innerHTML = html;
});
form.render('select', 'industrySelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
initIndustrySelect();
2020-03-26 00:00:48 +08:00
// 初始化表格
function initTable() {
table.render({
elem: '#dataTable',
id: 'dataTable',
url: top.restAjax.path(tableUrl, []),
width: admin.screen() > 1 ? '100%' : '',
height: $win.height() - 90,
limit: 20,
limits: [20, 40, 60, 80, 100, 200],
toolbar: '#headerToolBar',
request: {
pageName: 'page',
limitName: 'rows'
},
cols: [[
{type:'checkbox', fixed: 'left'},
2020-04-01 17:54:50 +08:00
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
2020-05-22 19:08:45 +08:00
{field:'photos', width: 200, title: '企业图片',
templet: function(row) {
var photos = '';
if(row.factoryGateByEnterpriseId) {
var photoArray = row.factoryGateByEnterpriseId.split(',');
for(var i = 0, item; item = photoArray[i++];) {
photos += '<img class="swiper-slide" src="route/file/downloadfile/false/'+ item +'">';
}
}
if(row.workplaceByEnterpriseId) {
var photoArray = row.workplaceByEnterpriseId.split(',');
for(var i = 0, item; item = photoArray[i++];) {
photos += '<img class="swiper-slide" src="route/file/downloadfile/false/'+ item +'">';
}
}
if(!photos) {
photos = '<img class="swiper-slide" src="assets/images/nonephoto.jpg">';
}
var photoDiv = '<div id="photo_'+ row.checkId +'" class="swiper-container enterprise-photos-box"><div class="swiper-wrapper">'+ photos +'</div></div>';
setTimeout(function() {
new Swiper('#photo_'+ row.checkId, {
autoplay: 3000
})
}, 50);
return photoDiv;
}
},
2020-05-21 19:30:49 +08:00
{field:'col1', width: 300, title: '检查企业', align: 'center',
2020-03-26 00:00:48 +08:00
templet: function(row) {
2020-05-21 19:30:49 +08:00
var infoDiv = '<table>';
infoDiv += '<tr><td colspan="2" class="col-content">'+ row.gmtCreate +'</td></tr>';
2020-05-22 19:08:45 +08:00
infoDiv += '<tr><td class="col-title">企业名称</td><td class="col-content"><div class="col-content-name" title="'+ row.nameJoinByEnterpriseId +'">'+ row.nameJoinByEnterpriseId +'</div></td></tr>';
2020-05-21 19:30:49 +08:00
infoDiv += '<tr><td class="col-title">企业类型</td><td class="col-content">'+ row.typeDictionaryName +'</td></tr>';
infoDiv += '</table>';
return infoDiv;
2020-03-26 00:00:48 +08:00
}
},
2020-05-21 19:30:49 +08:00
{field:'col2', width: 400, title: '行业风险', align: 'center',
2020-03-26 00:00:48 +08:00
templet: function(row) {
2020-05-21 19:30:49 +08:00
var infoDiv = '<table>';
infoDiv += '<tr><td class="col-title">管理行业</td><td class="col-content">'+ (row.industryDictionaryName ? row.industryDictionaryName : '-') +'</td></tr>';
infoDiv += '<tr><td class="col-title">作业风险</td><td class="col-content">'+ (row.riskOperationDictionaryName ? row.riskOperationDictionaryName : '-') +'</td></tr>';
if(row.enterpriseLngByEnterpriseId && row.enterpriseLatByEnterpriseId) {
2020-06-06 22:09:36 +08:00
infoDiv += '<tr><td colspan="2" class="col-content"><div class="col-content-div enterprise-location" title="'+ row.addressJoinByEnterpriseId +'" data-enterprise-name="'+ row.nameJoinByEnterpriseId +'" data-enterprise-id="'+ row.enterpriseId +'" data-enterprise-photos="'+ row.factoryGateByEnterpriseId +'" data-lng="'+ row.enterpriseLngByEnterpriseId +'" data-lat="'+ row.enterpriseLatByEnterpriseId +'"><i class="fa fa-map-marker"></i> '+ (row.addressJoinByEnterpriseId ? row.addressJoinByEnterpriseId : '查看企业定位') +'</div></td></tr>';
2020-05-21 19:30:49 +08:00
} else {
2020-05-22 19:08:45 +08:00
infoDiv += '<tr><td colspan="2" class="col-content"><div class="col-content-div" title="'+ row.addressJoinByEnterpriseId +'">'+ (row.addressJoinByEnterpriseId ? row.addressJoinByEnterpriseId : '-') +'</div></td></tr>';
2020-03-26 00:00:48 +08:00
}
2020-05-21 19:30:49 +08:00
infoDiv += '</table>';
return infoDiv;
2020-03-26 00:00:48 +08:00
}
},
2020-05-21 19:30:49 +08:00
{field:'col3', width: 240, title: '人员信息', align: 'center',
2020-03-26 00:00:48 +08:00
templet: function(row) {
2020-05-21 19:30:49 +08:00
var infoDiv = '<table>';
infoDiv += '<tr><td class="col-title">负责人</td><td class="col-content"><i class="fa fa-user-circle"></i> '+ (row.masterJoinByEnterpriseId ? row.masterJoinByEnterpriseId : '-') +'</td></tr>';
infoDiv += '<tr><td class="col-title">联系电话</td><td class="col-content"><i class="fa fa-mobile-phone"></i> '+ (row.phoneJoinByEnterpriseId ? row.phoneJoinByEnterpriseId : '-') +'</td></tr>';
infoDiv += '<tr><td class="col-title">从业人数</td><td class="col-content"><i class="fa fa-users"></i> '+ (row.engagedCountJoinByEnterpriseId ? (row.engagedCountJoinByEnterpriseId +' 人') : '-') +'</td></tr>';
infoDiv += '</table>';
return infoDiv;
2020-03-26 00:00:48 +08:00
}
},
2020-05-21 19:30:49 +08:00
{field:'col4', width: 100, title: '状态', align: 'center',
2020-03-26 00:00:48 +08:00
templet: function(row) {
2020-05-21 19:30:49 +08:00
var checkType = '【无检查类型】';
if(row.checkType == 1) {
checkType = '【检查】';
2020-04-01 23:35:33 +08:00
} else if(rowData == 2) {
2020-05-21 19:30:49 +08:00
checkType = '【复查】';
2020-04-01 23:35:33 +08:00
}
2020-05-21 19:30:49 +08:00
var isCoordination = '<span style="color: #FF5722;">【不配合】</span>';
if(row.isCoordination == 1) {
isCoordination = '<span style="color: #009688;">【配合】</span>';
2020-03-26 00:00:48 +08:00
}
2020-05-21 19:30:49 +08:00
var isComplete = '<span style="color: #FF5722;">【未完成】</span>';
if(row.isComplete == 1) {
isComplete = '<span style="color: #009688;">【完成】</span>'
2020-04-01 23:35:33 +08:00
}
2020-05-21 19:30:49 +08:00
var infoDiv = '<table>';
infoDiv += '<tr><td class="col-content">'+ checkType +'</td></tr>';
infoDiv += '<tr><td class="col-content">'+ isCoordination +'</td></tr>';
infoDiv += '<tr><td class="col-content">'+ isComplete +'</td></tr>';
infoDiv += '</table>';
return infoDiv;
2020-03-26 00:00:48 +08:00
}
2020-05-11 19:52:27 +08:00
},
2020-05-21 19:30:49 +08:00
{field:'col5', width: 120, title: '操作', align: 'center',
2020-05-11 19:52:27 +08:00
templet: function(row) {
2020-05-21 19:30:49 +08:00
var isCoordinationBtn = '<button type="button" class="layui-btn layui-btn-normal layui-btn-xs check-detail" data-checkid="'+ row.checkId +'" data-name="'+ row.nameJoinByEnterpriseId +'"><i class="fa fa-lg fa-search"></i> 检查项</button>';
2020-05-11 19:52:27 +08:00
if(row.isCoordination != 1) {
2020-05-21 19:30:49 +08:00
isCoordinationBtn = '不配合';
}
var infoDiv = '<table>';
infoDiv += '<tr><td class="col-content">'+ isCoordinationBtn +'</td></tr>';
if(row.checkLng && row.checkLat) {
2020-06-06 22:09:36 +08:00
infoDiv += '<tr><td class="col-content-opition"><div class="col-content-div check-location" data-lng="'+ row.checkLng +'" data-lat="'+ row.checkLat +'" data-enterprise-name="'+ row.nameJoinByEnterpriseId +'" data-enterprise-id="'+ row.enterpriseId +'" data-enterprise-photos="'+ row.factoryGateByEnterpriseId +'"><i class="fa fa-map-marker"></i> 查看检查位置</div></td></tr>';
2020-05-11 19:52:27 +08:00
}
2020-05-21 19:30:49 +08:00
infoDiv += '</table>';
return infoDiv;
2020-05-11 19:52:27 +08:00
}
},
2020-03-26 00:00:48 +08:00
]],
page: true,
parseData: function(data) {
return {
'code': 0,
'msg': '',
'count': data.total,
'data': data.rows
};
}
});
}
// 重载表格
function reloadTable(currentPage) {
table.reload('dataTable', {
url: top.restAjax.path(tableUrl, []),
where: {
keywords: $('#keywords').val(),
2020-04-02 18:21:52 +08:00
type: $('#type').val(),
industry: $('#industry').val(),
checkType: $('#checkType').val(),
2020-04-02 18:21:52 +08:00
isCoordination: $('#isCoordination').val(),
isComplete: $('#isComplete').val()
2020-03-26 00:00:48 +08:00
},
page: {
curr: currentPage
},
height: $win.height() - 90,
});
}
// 删除
function removeData(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/check/removecheck/{ids}', [ids]), {}, null, function (code, data) {
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
reloadTable();
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
});
}
});
}
initTable();
// 事件 - 页面变化
$win.on('resize', function() {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(function() {
reloadTable();
}, 500);
});
2020-05-22 19:08:45 +08:00
// 120s自动刷新
2020-05-21 19:30:49 +08:00
setInterval(function() {
reloadTable();
2020-05-22 19:08:45 +08:00
}, 120000);
2020-03-26 00:00:48 +08:00
// 事件 - 搜索
$(document).on('click', '#search', function() {
reloadTable(1);
});
// 事件 - 增删改
table.on('toolbar(dataTable)', function(obj) {
var layEvent = obj.event;
var checkStatus = table.checkStatus('dataTable');
var checkDatas = checkStatus.data;
if(layEvent === 'saveEvent') {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/check/save-check.html', []),
end: function() {
reloadTable();
}
});
} else if(layEvent === 'updateEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectEdit);
} else if(checkDatas.length > 1) {
top.dialog.msg(top.dataMessage.table.selectOneEdit);
} else {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/check/update-check.html?checkId={checkId}', [checkDatas[0].checkId]),
end: function() {
reloadTable();
}
});
}
} else if(layEvent === 'removeEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectDelete);
} else {
var ids = '';
for(var i = 0, item; item = checkDatas[i++];) {
if(i > 1) {
ids += '_';
}
ids += item['checkId'];
}
removeData(ids);
}
}
});
2020-05-11 19:52:27 +08:00
2020-05-21 19:30:49 +08:00
$(document).on('click', '.check-detail', function() {
var checkId = this.dataset.checkid;
var nameJoinByEnterpriseId = this.dataset.name;
top.dialog.open({
url: top.restAjax.path('route/check/get-check-item.html?checkId={checkId}', [checkId]),
title: '【'+ nameJoinByEnterpriseId + '】检、复查选项',
width: '80%',
height: '80%',
onClose: function() {}
});
});
$(document).on('click', '.enterprise-location', function() {
var lng = this.dataset.lng;
var lat = this.dataset.lat;
if(lng && lat) {
2020-05-22 19:08:45 +08:00
top.dialog.open({
url: top.restAjax.path('route/check/get-map-location.html?lng={lng}&lat={lat}', [lng, lat]),
title: '企业位置信息',
width: '80%',
height: '80%',
onClose: function() {}
});
2020-05-21 19:30:49 +08:00
} else {
top.dialog.msg('暂无定位信息');
}
});
$(document).on('click', '.check-location', function() {
var lng = this.dataset.lng;
var lat = this.dataset.lat;
if(lng && lat) {
2020-06-06 22:09:36 +08:00
top.dialog.dialogData.enterpriseCheckData = {
enterpriseId: this.dataset.enterpriseId,
enterpriseName: this.dataset.enterpriseName,
photoArray: this.dataset.photoArray,
}
2020-05-22 19:08:45 +08:00
top.dialog.open({
url: top.restAjax.path('route/check/get-map-location.html?lng={lng}&lat={lat}', [lng, lat]),
title: '检查位置信息',
width: '80%',
height: '80%',
2020-06-06 22:09:36 +08:00
onClose: function() {
top.dialog.dialogData.enterpriseCheckData = null;
}
2020-05-22 19:08:45 +08:00
});
2020-05-21 19:30:49 +08:00
} else {
top.dialog.msg('暂无检查定位信息');
2020-05-11 19:52:27 +08:00
}
});
2020-03-26 00:00:48 +08:00
});
</script>
</body>
</html>