let form, laydate, flow, layer, rightPopup; let pageNum = 1, pageSize = 15; // 图片定义分页 let pageNum2 = 1, pageSize2 = 2; // 列表定义分页 let queryType = 1; // 默认图片 function setParams(obj) { layui.config({ base: "../../js/layui-v2.9.14/layui/", //此处路径请自行处理, 可以使用绝对路径 }).extend({ rightPopup: "rightPopup2", }).use(["form", 'laydate', 'flow', 'layer', 'rightPopup'], function () { form = layui.form; laydate = layui.laydate; flow = layui.flow; layer = layui.layer; rightPopup = layui.rightPopup; dataFlow(); }); } /**数据流加载*/ function dataFlow() { flow.load({ elem: '#ID-flow-demo', // 流加载容器 scrollElem: '#ID-flow-demo', // 滚动条所在元素,一般不用填,此处只是演示需要。 end: '数据加载完毕', direction: 'bottom', done: function (page, next) { // 执行下一页的回调 pageNum = page; let lis = []; let returnData = loadData(); if (returnData != null) { if (queryType === 1) { // 图片 lis = initImgData(returnData.data.list) } else { // 列表 lis = initListData(returnData.data.list) } next(lis.join(''), page < returnData.data.total / (queryType === 1 ? pageSize : pageSize2)); if (queryType === 1) { $('.img-info').on('mouseenter', function () { this.querySelector('.hidden-actions').style.display = 'block'; }); $('.img-info').on('mouseleave', function () { this.querySelector('.hidden-actions').style.display = 'none'; }); } else { $('.img-data').on('mouseenter', function () { this.querySelector('.hidden-actions2').style.display = 'block'; }); $('.img-data').on('mouseleave', function () { this.querySelector('.hidden-actions2').style.display = 'none'; }); } } } }); } /**加载图片数据*/ function loadData() { let returnData = null; let url = dataUrl + "/backstage/synthesisQuery/getImgList" let obj = {} if (queryType === 1) { // 图片 obj = { pageNum: pageNum, pageSize: pageSize, queryType: queryType } } else { // 列表 obj = { pageNum: pageNum2, pageSize: pageSize2, queryType: queryType } } let params = { encryptedData: encryptCBC(JSON.stringify(obj)) } ajaxRequest(url, "POST", params, false, function () { }, function (result) { if (result.status === 200) { console.log(result) returnData = result; } else { layer.msg(result.msg, {icon: 2}) } }, function (xhr) { error(xhr) }); return returnData; } /**渲染图片*/ function initImgData(list) { let htmlArr = []; if (list && list.length > 0) { $.each(list, function (index, item) { htmlArr.push("
" + item.uploadTime + "
" + "" + item.uploadTypeName + "
" + "" + item.sourceTypeName + "
" + setCollectData(item) + "
";
}
return "";
}
}
/**1.图片 2.列表*/
function changeType(that, type) {
if (type === 1) {
$(that).attr('src', '../../img/synthesisQuery/photo_check.png');
$(that).next().attr('src', '../../img/synthesisQuery/list.png');
} else {
$(that).attr('src', '../../img/synthesisQuery/list_check.png');
$(that).prev().attr('src', '../../img/synthesisQuery/photo.png');
}
queryType = type;
pageNum = 1;
pageNum2 = 1;
$('#ID-flow-demo').empty();
dataFlow();
}
/*图片类型查询*/
function queryByType(that, type) {
$('.type-num').each(function () {
$(this).removeClass('type-num-check');
})
$(that).addClass('type-num-check');
}
/**渲染列表图片*/
function initListData(list) {
let htmlArr = [];
if (list && list.length > 0) {
$.each(list, function (index, item) {
let html = "" + item.uploadTime + "
" + "" + item.uploadTypeName + "
" + "违章地点:
" + "" + item.id + "
" + "违章描述:
" + "施工人员未正确佩戴安全帽,存在安全隐患
" + "检查地点
" + "工地 A 区施工现场 3 号楼
" + "检查描述:
" + "施工人员未正确佩戴安全帽,存在安全隐患
" + "检查地点
" + "工地 A 区施工现场 3 号楼
" + "检查描述:
" + "施工人员未正确佩戴安全帽,存在安全隐患
" + "建设前描述
" + "工地 A 区施工现场 3 号楼
" + "建设中描述:
" + "施工人员未正确佩戴安全帽,存在安全隐患
" + "恢复后描述:
" + "施工人员未正确佩戴安全帽,存在安全隐患
" + "标题
" + "工地 A 区施工现场 3 号楼
" + "内容:
" + "施工人员未正确佩戴安全帽,存在安全隐患
" + "整改说明:
" + "施工人员已进行安全教育
" + "