523 lines
18 KiB
Plaintext
523 lines
18 KiB
Plaintext
let form, layer, table, rightPopup, tableIns, laydate, user = getUser(), per = getPer();
|
|
let classId = ''
|
|
|
|
function setForm(obj) {
|
|
classId = obj;
|
|
layui.config({
|
|
base: "../../../js/layui/", //此处路径请自行处理, 可以使用绝对路径
|
|
}).extend({
|
|
rightPopup: "rightPopup2"
|
|
}).use(['form', 'layer', 'table', 'laydate', "rightPopup2"], function () {
|
|
form = layui.form;
|
|
layer = layui.layer;
|
|
table = layui.table;
|
|
laydate = layui.laydate;
|
|
laydate.render({
|
|
elem: '#createTime', //指定元素 元素选择器
|
|
type: 'date', //选择时间类型 可选值:year(年) month(年月) date(年月日) time(时分秒) datetime(年月日时分秒)
|
|
trigger: 'click',
|
|
range: true,
|
|
format: 'yyyy-MM-dd', //时间格式 常用时间格式:yyyy-MM-dd HH:mm:ss
|
|
btns: ['now', 'confirm'], //选择框右下角显示的按钮 清除-现在-确定
|
|
done: function (value, date) { //时间回调
|
|
}
|
|
});
|
|
|
|
rightPopup = layui.rightPopup2;
|
|
getOrgSelect();
|
|
getSelectParams();
|
|
pages(1, 30, 1);
|
|
})
|
|
}
|
|
|
|
function pages(pageNum, pageSize) {
|
|
let params = getReqParams(pageNum, pageSize);
|
|
$.ajax({
|
|
headers: {
|
|
"encrypt": sm3(JSON.stringify(params))
|
|
},
|
|
url: dataUrl + "proteam/pot/superStatistics/getSuperStatisticsList?token=" + token,
|
|
data: params,
|
|
type: 'GET',
|
|
async: false,
|
|
success: function (result) {
|
|
console.log(result)
|
|
if (result.code === 200) {
|
|
if (result.rows) {
|
|
initTable(result.rows, limitSize, pageNum)
|
|
laypages(result.total, pageNum, limitSize)
|
|
}
|
|
} else if (result.code === 500) {
|
|
layer.alert(result.msg, {icon: 2})
|
|
} else if (result.code === 401) {
|
|
logout(1);
|
|
}
|
|
}, error: function () {
|
|
}
|
|
});
|
|
}
|
|
function laypages(total, page, limit) {
|
|
layui.use(['laypage'], function () {
|
|
let laypage = layui.laypage;
|
|
laypage.render({
|
|
elem: 'voi-page',
|
|
count: total,
|
|
curr: page,
|
|
limit: limit,
|
|
limits: [30,50,100],
|
|
layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'],
|
|
groups: 5,
|
|
jump: function (obj, first) {
|
|
if (!first) {
|
|
pageNum = obj.curr;
|
|
limitSize = obj.limit;
|
|
pages(obj.curr, obj.limit, null);
|
|
}
|
|
}
|
|
});
|
|
})
|
|
}
|
|
/*初始化表格*/
|
|
function initTable(dataList, limit, page) {
|
|
tableIns = table.render({
|
|
elem: "#violationStatisticsTable",
|
|
id: "violationStatisticsTable",
|
|
height: "full-120",
|
|
data: dataList,
|
|
cols: [
|
|
[
|
|
//表头
|
|
{
|
|
field: "number",
|
|
type: "numbers",
|
|
title: "序号",
|
|
width: 80,
|
|
unresize: true,
|
|
align: "center",
|
|
},
|
|
{
|
|
field: "ticketNo",
|
|
title: "作业票编号",
|
|
width: 200,
|
|
unresize: true,
|
|
align: "center",
|
|
},
|
|
{
|
|
field: "proName",
|
|
title: "工程名称",
|
|
width: 200,
|
|
unresize: true,
|
|
align: "center",
|
|
},
|
|
{
|
|
title: "风险等级",
|
|
width: 150,
|
|
unresize: true,
|
|
align: "center",
|
|
templet: function (d) {
|
|
let html = '';
|
|
if (d.riskLevel === '2') {
|
|
html += '<span style="color: #FF5D5D">二级</span>'
|
|
} else if (d.riskLevel === '3') {
|
|
html += '<span style="color: #F9770F">三级</span>'
|
|
} else if (d.riskLevel === '4') {
|
|
html += '<span style="color: #FFE922">四级</span>'
|
|
} else if (d.riskLevel === '5') {
|
|
html += '<span style="color: #14B93B">五级</span>'
|
|
}
|
|
return html;
|
|
}
|
|
},
|
|
{
|
|
field: "org",
|
|
title: "违章单位",
|
|
width: 200,
|
|
unresize: true,
|
|
align: "center",
|
|
},
|
|
{
|
|
field: "levelId",
|
|
title: "违章等级",
|
|
width: 200,
|
|
unresize: true,
|
|
align: "center",
|
|
},
|
|
{
|
|
field: "content",
|
|
title: "违章内容",
|
|
width: 200,
|
|
unresize: true,
|
|
align: "center",
|
|
},
|
|
{
|
|
title: "违章照片",
|
|
width: 200,
|
|
unresize: true,
|
|
align: "center",
|
|
templet: function (d) {
|
|
let imgPath = d.imgPath;
|
|
if (imgPath) {
|
|
let imgPathArr = imgPath.split(',');
|
|
let obj = {
|
|
'filePath': imgPath
|
|
}
|
|
return "<span style='color: #0d6efd;cursor: pointer;' onclick='openImg("+JSON.stringify(obj)+")'>" + imgPathArr.length + "</span>"
|
|
} else {
|
|
return '<span style="color: #0d6efd;cursor: pointer;">0</span>'
|
|
}
|
|
|
|
}
|
|
},
|
|
{
|
|
field: "createTime",
|
|
title: "督查日期",
|
|
width: 200,
|
|
unresize: true,
|
|
align: "center",
|
|
},
|
|
{
|
|
field: "issUser",
|
|
title: "督查人",
|
|
width: 300,
|
|
unresize: true,
|
|
align: "center",
|
|
},
|
|
{
|
|
field: "status",
|
|
title: "状态",
|
|
width: 200,
|
|
unresize: true,
|
|
align: "center",
|
|
},
|
|
{
|
|
title: "操作",
|
|
width: 200,
|
|
unresize: true,
|
|
align: "center",
|
|
templet: function (d) {
|
|
let html = '';
|
|
if (d.status !== '申诉成功已归档') {
|
|
html = "<a onclick=\"noticeSheet('" + d.id + "')\">通知单</a>"
|
|
}
|
|
if (d.status === '未处理' && user.isSup === '2') {
|
|
html += "<div>|</div><a onclick=\"editData('" + d.id + "')\">修改</a>" +
|
|
"<div>|</div><a onclick=\"delData('" + d.id + "')\">删除</a>";
|
|
} else if ((d.status === '未处理' || d.status === '已驳回') && user.isSup === '3') {
|
|
html += "<div>|</div><a onclick=\"openRectification('" + d.id + "','1')\">整改</a>"
|
|
} else if ((d.status === '申诉中' || d.status === '已整改') && user.isSup === '2') {
|
|
html += "<div>|</div><a onclick=\"openRectification('" + d.id + "','2')\">审核</a>";
|
|
}
|
|
if (d.status !== '未处理' && d.status !== '申诉成功已归档') {
|
|
html += "<div>|</div><a onclick=\"viewData('" + d.id + "')\">详情</a>";
|
|
} else if (d.status !== '未处理' && d.status === '申诉成功已归档') {
|
|
html += "<a onclick=\"viewData('" + d.id + "')\">详情</a>";
|
|
}
|
|
return html;
|
|
}
|
|
}
|
|
],
|
|
],
|
|
done: function (res, curr, count) {
|
|
$(".layui-laypage-skip").css("display", "none");
|
|
table.resize("violationStatisticsTable");
|
|
count || this.elem.next(".layui-table-view").find(".layui-table-header").css("display", "inline-block");
|
|
count || this.elem.next(".layui-table-view").find(".layui-table-box").css("overflow", "auto");
|
|
},
|
|
});
|
|
}
|
|
|
|
/*新增违章依据*/
|
|
function openVioType() {
|
|
let layerIndex = layer.open({
|
|
id: "addVioType",
|
|
title: false,
|
|
type: 2,
|
|
maxmin: false,
|
|
content: '../dutyTask/vioType/vioType.html',
|
|
area: ['100%', '100%'],
|
|
move: false,
|
|
closeBtn: 0,
|
|
success: function (layero, index) {
|
|
}
|
|
});
|
|
}
|
|
|
|
/*新增违章单*/
|
|
function addVoi() {
|
|
let layerIndex = layer.open({
|
|
id: "addVio",
|
|
title: false,
|
|
type: 2,
|
|
maxmin: false,
|
|
content: '../../dutyTask/violation/addViolationForm.html',
|
|
area: ['100%', '100%'],
|
|
move: false,
|
|
closeBtn: 0,
|
|
success: function (layero, index) {
|
|
}
|
|
});
|
|
}
|
|
|
|
/*修改违章单*/
|
|
function editData(id) {
|
|
let layerIndex = layer.open({
|
|
id: "editVio",
|
|
title: false,
|
|
type: 2,
|
|
maxmin: false,
|
|
content: '../../dutyTask/violation/editViolationForm.html',
|
|
area: ['100%', '100%'],
|
|
move: false,
|
|
closeBtn: 0,
|
|
success: function (layero, index) {
|
|
let iframeWin = window["layui-layer-iframe" + layerIndex];
|
|
iframeWin.setParams(id);
|
|
}
|
|
});
|
|
}
|
|
|
|
/*违章整改页面*/
|
|
function openRectification(id, type) {
|
|
let html = '../../dutyTask/violation/rectifyForm.html';
|
|
if (type === '2') {
|
|
html = '../../dutyTask/violation/rectifyCheckForm.html';
|
|
}
|
|
let layerIndex = layer.open({
|
|
id: "rectify",
|
|
title: false,
|
|
type: 2,
|
|
maxmin: false,
|
|
content: html,
|
|
area: ['100%', '100%'],
|
|
move: false,
|
|
closeBtn: 0,
|
|
success: function (layero, index) {
|
|
let iframeWin = window["layui-layer-iframe" + layerIndex];
|
|
iframeWin.setParams(id);
|
|
}
|
|
});
|
|
}
|
|
|
|
/*通知单*/
|
|
function noticeSheet(id) {
|
|
let layerIndex = parent.layer.open({
|
|
type: 2,
|
|
title: false,
|
|
closeBtn: 0,
|
|
content: "../../html/dutyTask/violation/noticeSheet.html",
|
|
shadeClose: false,
|
|
area: ['740px', '780px'],
|
|
move: false,
|
|
success: function () {
|
|
let iframeWin = parent.window["layui-layer-iframe" + layerIndex];
|
|
iframeWin.setParams(id);
|
|
}
|
|
});
|
|
}
|
|
|
|
/*违章照片*/
|
|
function openImg(obj) {
|
|
let imgPath = obj.filePath;
|
|
let width = getChooseWidth().toFixed(0) + "px";
|
|
let height = getChooseHeight().toFixed(0) + "px";
|
|
let layerIndex = layer.open({
|
|
id: "voiImg",
|
|
title: ['<div style="border-left: 3px solid #2F82FB;display: flex;align-items: center;height: 20px;padding: 0 10px;">违章照片</div>', 'font-size:16px;background-color:#f0f0f0;display: flex;align-items: center;'],
|
|
type: 1,
|
|
maxmin: false,
|
|
content: setHtml(imgPath),
|
|
area: [width, height],
|
|
move: false,
|
|
shade: 0.1,
|
|
success: function (layero, index) {
|
|
let viewer = new Viewer(document.getElementById('main-box'), {
|
|
url: 'data-original',
|
|
show: function () {
|
|
viewer.update();
|
|
}
|
|
});
|
|
$(window).resize(function () {
|
|
if (autoChooseResizeWidth) autoChooseResizeWidth(index);
|
|
if (autoChooseResizeHeight) autoChooseResizeHeight(index);
|
|
});
|
|
},
|
|
});
|
|
}
|
|
|
|
function setHtml(imgPath) {
|
|
let html = '<div id="main-box" class="layout">';
|
|
let imgPathArr = imgPath.split(',');
|
|
$.each(imgPathArr, function (index, item) {
|
|
let path = photoUrl + item + '?token=' + token
|
|
html += '<img class="voiImg" src="' + path + '" data-original = "' + path + '">'
|
|
})
|
|
html += '</div>';
|
|
return html;
|
|
}
|
|
|
|
/* 详情 */
|
|
function viewData(id) {
|
|
let layerIndex = parent.layer.open({
|
|
type: 2,
|
|
title: false,
|
|
closeBtn: 0,
|
|
content: "../../html/dutyTask/violation/violationDetail.html",
|
|
shadeClose: false,
|
|
area: ['700px', '780px'],
|
|
move: false,
|
|
success: function () {
|
|
let iframeWin = parent.window["layui-layer-iframe" + layerIndex];
|
|
iframeWin.setParams(id);
|
|
}
|
|
});
|
|
}
|
|
|
|
/*删除违章单*/
|
|
function delData(id) {
|
|
layer.confirm("确定删除吗?", function () {
|
|
let loadingMsg = layer.msg('数据删除中,请稍候...', {icon: 16, scrollbar: false, time: 0});
|
|
$.ajax({
|
|
url: dataUrl + 'proteam/superStatistics/delNoticeVoiById?token=' + token,
|
|
data: {
|
|
params: encrypt(id),
|
|
},
|
|
type: 'DELETE',
|
|
async: true,
|
|
success: function (result) {
|
|
layer.close(loadingMsg); // 关闭提示层
|
|
if (result.msg === 'success') {
|
|
layer.msg('删除成功', {icon: 1})
|
|
query()
|
|
} else if (result.msg === 'error') {
|
|
layer.msg('服务异常,请稍后重试', {icon: 5})
|
|
} else {
|
|
layer.msg(result.msg, {icon: 5})
|
|
}
|
|
}, error: function () {
|
|
layer.close(loadingMsg); // 关闭提示层
|
|
layer.msg('服务异常,请稍后重试', {icon: 16, scrollbar: false, time: 2000});
|
|
}
|
|
});
|
|
})
|
|
}
|
|
|
|
// 获取参数
|
|
function getReqParams(page, limit) {
|
|
let obj = {
|
|
pageNum: page + "",
|
|
pageSize: limit + "",
|
|
classId: classId+"",
|
|
keyWord: transformNull($("#keyWord").val()),
|
|
org: transformNull($("#org").val()),
|
|
ticketNo: transformNull($("#ticketNo").val()),
|
|
levelId: transformNull($("#levelId").val()),
|
|
createTime: isEmpty($("#createTime").val()) ? "unData" + " - " + "unData" : $("#createTime").val(),
|
|
proName: transformNull($("#proName").val()),
|
|
riskLevel: transformNull($("#riskLevel").val()),
|
|
issUser: transformNull($("#issUser").val()),
|
|
status: transformNull($("#status").val()),
|
|
currentUserId: user.userId+"",
|
|
isSup: user.isSup,
|
|
currentUserOrgId: user.orgId
|
|
};
|
|
return obj;
|
|
}
|
|
|
|
/*导出*/
|
|
function exportData() {
|
|
let params = getReqParams();
|
|
let loadingMsg = layer.msg("数据导出中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
|
|
let url = dataUrl + "proteam/superStatistics/exportData?params=" + params + "&token=" + token;
|
|
let xhr = new XMLHttpRequest();
|
|
xhr.open("get", url, true);
|
|
xhr.responseType = "blob"; // 转换流
|
|
xhr.onload = function () {
|
|
layer.close(loadingMsg);
|
|
if (this.status === 200) {
|
|
let blob = this.response;
|
|
var a = document.createElement("a");
|
|
var url = window.URL.createObjectURL(blob);
|
|
a.href = url;
|
|
a.download = "违章统计" + getNowDate() + ".xlsx"; // 文件名
|
|
} else {
|
|
layer.msg("服务异常,请稍后重试", {icon: 16, scrollbar: false, time: 2000});
|
|
}
|
|
a.click();
|
|
window.URL.revokeObjectURL(url);
|
|
};
|
|
xhr.send();
|
|
}
|
|
|
|
function reloadData() {
|
|
let curr = tableIns.config.page.curr;
|
|
let limit = tableIns.config.page.limit;
|
|
let params = getReqParams();
|
|
table.reload("violationStatisticsTable", {
|
|
url: dataUrl + "proteam/superStatistics/getSuperStatisticsList?token=" + token,
|
|
where: {
|
|
params: params,
|
|
page: curr,
|
|
limit: limit,
|
|
}
|
|
});
|
|
}
|
|
|
|
// 查询/重置
|
|
function query() {
|
|
let params = getReqParams();
|
|
table.reload("violationStatisticsTable", {
|
|
url: dataUrl + "proteam/superStatistics/getSuperStatisticsList?token=" + token,
|
|
page: {
|
|
page: 1, //重新从第 1 页开始
|
|
},
|
|
where: {
|
|
params: params
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
//组织机构下拉选
|
|
function getOrgSelect() {
|
|
$.ajax({
|
|
headers: {
|
|
"encrypt": sm3(JSON.stringify({}))
|
|
},
|
|
url: dataUrl + 'proteam/pot/team/getOrgSelected' + '?token=' + token,
|
|
data: {},
|
|
type: 'post',
|
|
success: function (data) {
|
|
let html = '<option value="" selected>全部</option>';
|
|
$.each(data.data, function (index, item) {
|
|
html += '<option value="' + item.code + '">' + item.name + '</option>';
|
|
})
|
|
$('#org').empty().append(html);
|
|
form.render();
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
//组织机构下拉选
|
|
function getSelectParams() {
|
|
$.ajax({
|
|
headers: {
|
|
"encrypt": sm3(JSON.stringify({
|
|
code: 'risk_level'
|
|
}))
|
|
},
|
|
url: dataUrl + 'proteam/pot/team/getSelectParams' + '?token=' + token,
|
|
type: 'post',
|
|
data: {
|
|
code: 'risk_level'
|
|
},
|
|
success: function (data) {
|
|
let html = '<option value="" selected>全部</option>';
|
|
$.each(data.data, function (index, item) {
|
|
html += '<option value="' + item.key + '">' + item.value + '</option>';
|
|
})
|
|
$('#riskLevel').empty().append(html);
|
|
form.render();
|
|
}
|
|
});
|
|
} |