IntelligentRecognition/ah-jjsp-web/.svn/pristine/7b/7bc577e0fb6a9530e15fcdb9335...

1132 lines
39 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

let form, layer, table, rightPopup4, formSelects, tableIns, laydate, user = getUser();
let orgList, riskLevelList, voiStatusList, voiLevelList, bidProList;
let pageNum = 1, limitSize = 50; // 默认第一页分页数量为10
let myChart12 = echarts.init(document.getElementById('echarts-one'));
let myChart13 = echarts.init(document.getElementById('echarts-two'));
let paramcode='',xfUser='';//下发人 违章类型
// 是否是值长管理员
let isShiftSup = user.roleName === '值长管理员' ? true : false;
setBtns();
var url = window.location.href;
var queryParams = window.location.search.substring(1);
if(queryParams!='' && queryParams!=null){
let queryParamsObj = {};
var params = decodeURIComponent(queryParams).split('&');
params.forEach(function (param) {
var keyValue = param.split('=');
queryParamsObj[keyValue[0]] = keyValue[1];
});
paramcode=queryParamsObj.paramcode;
xfUser=queryParamsObj.xsuser
console.log(paramcode)
}
layui.config({
base: "../../js/layui/", //此处路径请自行处理, 可以使用绝对路径
}).extend({
rightPopup4: "rightPopup4",
formSelects: 'formSelects-v4'
}).use(['form', 'layer', 'table', 'laydate', "rightPopup4", 'formSelects'], 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) { //时间回调
}
});
$('#createTime').val(getStartTime() + " - " + getEndTime())
rightPopup4 = layui.rightPopup4;
formSelects = layui.formSelects;
orgList = getOrgNumAndRate(1);
riskLevelList = getRiskLevelSelect('risk_level');
voiStatusList = getRiskLevelSelect('voi_status');
voiLevelList = getRiskLevelSelect('voi_level');
bidProList = getProSelected('2');
setOrg();
setBidPro();
setRiskLevel();
setStatus();
setLevelId();
initTable();
getViolationTypeList(1);
})
function setBtns() {
let html = '<button type="button" class="layui-btn layui-btn-primary layui-btn-sm reset" style="background-color: #2F82FB;color: #FFF;" onclick="addVoi()">\n' +
'<i class="layui-icon layui-icon-add-1"></i>新增</button>' +
'<button type="button" class="layui-btn layui-btn-primary layui-btn-sm more" style="width: 120px;" onclick="openVioType()">' +
'<div class="layout" style="justify-content: space-around;"><p>违章依据配置</p><img src="../../img/common-icon/more-icon.png"></div></button>'+
'<button type="button" class="layui-btn layui-btn-primary layui-btn-sm " style="background-color: #16baaa;color: #FFF;width:144px" onclick="openNewWz()">\n' +
'<i class="layui-icon layui-icon-add-1"></i>手动下发违章</button>' ;
if (user.isSup !== '3') {
$('.btns').append(html);
}
/*if(user.nickName === '!jysp' || user.nickName === 'jysp'){
let cent = '<button type="button" class="layui-btn layui-btn-primary layui-btn-sm reset" style="background-color: #2F82FB;color: #FFF;" onclick="refreshNoticeVoiData()">刷新</button>'
$('.btns').append(cent);
$('.btns button').eq("0").css("width","60px");
$('.btns button').eq("1").css("width","60px");
$('.btns button').eq("2").css("width","60px");
$('.btns button').eq("3").css("width","120px");
$('.btns button').eq("4").css("width","60px");
}*/
}
/* function pages(pageNum, pageSize, typeNum) {
let params = getReqParams(pageNum, pageSize, typeNum);
$.ajax({
headers: {
"encrypt": sm3(JSON.stringify(params))
},
url: dataUrl + "proteam/pot/superStatistics/getSuperStatisticsList?token=" + token,
data: params,
type: 'POST',
async: false,
success: function (result) {
if (result.code === 200) {
if (result.data) {
initTable(result.data, result.limit, result.curr)
laypages(result.count, result.curr, result.limit)
}
} 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) {
let loadingMsg = layer.msg("数据加载中,请稍候...", { icon: 16, scrollbar: false, time: 0, });
tableIns = table.render({
elem: "#violationStatisticsTable",
id: "violationStatisticsTable",
// height: "full-230",
// data: dataList,
// limit: limit,
url: dataUrl + "proteam/pot/superStatistics/getSuperStatisticsList?token=" + token,
method: 'POST',
where: {
paramcode:paramcode,
xfUser:xfUser,
keyWord: '',
org: '',
ticketNo: '',
levelId: '',
createTime: getStartTime() + " - " + getEndTime(),
proName: '',
riskLevel: '',
issUser: '',
status: '',
currentUserId: user.userId + '',
isSup: user.isSup,
currentUserOrgId: user.orgId
},
height: "full-180",
page: {
layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'],
groups: 5, //只显示 5 个连续页码
limits: [30, 50, 100],
limit: 50,
curr: 1
},
response: {
statusCode: 200 //重新规定成功的状态码为 200table 组件默认为 0
},
parseData: function (res) { // res 即为原始返回的数据
return {
"code": res.code,
"msg": res.msg,
"count": res.count,
"data": res.data,
"limit": res.limit,
"curr": res.curr
};
},
toolbar: true,
drag: 'simple',
defaultToolbar: ['filter'],
cols: [
function () {
var arr = [
//表头
{
fixed: 'left',
title: "序号",
width: 70,
unresize: true,
align: "center",
style: "height:90.5px;",
templet: function (d) {
// return (page - 1) * limit + d.LAY_INDEX;
return d.LAY_NUM;
}
},
{
fixed: 'left',
field: "ticketNo",
title: "作业票编号",
width: 200,
unresize: true,
align: "center",
style: "height:90.5px;word-break: break-all;",
sort: true
},
{
fixed: 'left',
field: "proName",
title: "工程名称",
width: 200,
unresize: true,
align: "center",
style: "height:90.5px;",
sort: true
},
{
field: "teamLeader",
title: "班组长",
width: 250,
unresize: true,
align: "center",
style: "height:90.5px;",
sort: true,
templet: function (d) {
return '<div style="cursor: pointer;color: #2F82FB" ' +
'onclick="openTeamVoi(\'' + d.teamLeaderNumber + '\',\'' + d.classId + '\')"><span>' + d.teamLeader + ' </span></div>';
}
},
{
field: "riskLevel",
title: "风险等级",
width: 140,
unresize: true,
align: "center",
sort: true,
style: "height:90.5px;",
templet: function (d) {
return setRiskLevelColor(d.riskLevel);
}
},
{
field: "org",
title: "违章单位",
width: 140,
unresize: true,
align: "center",
style: "height:90.5px;",
sort: true
},
{
field: "type",
title: "违章类型",
width: 140,
unresize: true,
align: "center",
style: "height:90.5px;",
sort: true
},
{
field: "childType",
title: "违章子类型",
width: 200,
unresize: true,
align: "center",
style: "height:90.5px;",
sort: true
},
{
field: "levelId",
title: "违章等级",
width: 140,
unresize: true,
align: "center",
sort: true,
style: "height:90.5px;",
templet: function (d) {
if (d.levelId === '严重违章') {
return '<span style="color: #ff5d5d;">' + d.levelId + '</span>';
}
return '<span>' + d.levelId + '</span>';
}
},
{
field: "content",
title: "违章内容",
width: 500,
unresize: true,
align: "center",
sort: true,
style: "height:90.5px;",
templet: function (d) {
if (d.content) {
if (d.content.length > 110) {
return '<span title="' + d.content + '">' + d.content.substring(0, 110) + '...</span>'
} else {
return '<span title="' + d.content + '">' + d.content + '</span>'
}
} else {
return '';
}
}
},
{
field: "createTime",
title: "督查日期",
width: 130,
unresize: true,
align: "center",
style: "height:90.5px;",
sort: true
},
{
field: "issUser",
title: "督查人",
width: 150,
unresize: true,
align: "center",
style: "height:90.5px;",
sort: true
},
{
field: "status",
title: "状态",
width: 150,
unresize: true,
align: "center",
style: "height:90.5px;",
sort: true
}, {
field: "supType",
title: "来源",
width: 150,
unresize: true,
align: "center",
style: "height:90.5px;",
sort: true,
templet: function (d) {
if (!d.supType || d.supType === '1') {
return '值班员'
} else {
return '地市自查'
}
}
},
{
fixed: 'right',
title: "操作",
width: 200,
unresize: true,
align: "center",
style: "height:90.5px;",
templet: function (d) {
return setRoleAuth(d);
}
}
]
// 初始化筛选状态
var local = layui.data('table-filter-test'); // 获取对应的本地记录
layui.each(arr, function (index, item) {
if (item.field in local) {
item.hide = local[item.field];
}
});
return arr;
}()
],
done: function (res, curr, count) {
layer.close(loadingMsg);
$(".layui-table-main tr").each(function (index, val) {
$($(".layui-table-fixed .layui-table-body tbody tr")[index]).height($(val).height());
});
//动态监听表体高度变化,冻结行跟着改变高度
$(".layui-table-body tr").resize(function () {
$(".layui-table-body tr").each(function (index, val) {
$($(".layui-table-fixed .layui-table-body table tr")[index]).height($(val).height());
});
});
//初始化高度,使得冻结行表体高度一致
$(".layui-table-body tr").each(function (index, val) {
$($(".layui-table-fixed .layui-table-body table tr")[index]).height($(val).height());
});
table.resize("violationStatisticsTable");
// 记录筛选状态
var that = this;
that.elem.next().on('mousedown', 'input[lay-filter="LAY_TABLE_TOOL_COLS"]+', function () {
var input = $(this).prev()[0];
// 此处表名可任意定义
layui.data('table-filter-test', {
key: input.name,
value: input.checked
})
});
pageNum = res.curr, limitSize = res.limit;
},
});
}
// 地市站班会数量和占比
function getOrgNumAndRate(type) {
let dataList = [];
let params = getReqParams(null, null, type);
$.ajax({
headers: {
"encrypt": sm3(JSON.stringify(params))
},
url: dataUrl + 'proteam/pot/superStatistics/getOrgNumAndRate?token=' + token,
data: params,
type: 'POST',
async: false,
success: function (result) {
let data = result.data;
if (result.code === 500) {
return layer.alert(data.msg, { icon: 2 })
} else if (result.code === 401) {
logout(1);
} else if (result.code === 200) {
if (data && data.length > 0) {
$.each(data, function (index, item) {
dataList.push(item)
})
}
}
}, error: function () {
}
});
return dataList;
}
/*新增违章依据*/
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: ['700px', '780px'],
move: false,
closeBtn: 0,
success: function (layero, index) {
}
});
}
/**
*打开下发违章
*/
function openNewWz(){
let layerIndex = layer.open({
id: "addVio",
title: false,
type: 2,
maxmin: false,
content: '../dutyTask/violation/handViolation.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: ['700px', '780px'],
move: false,
closeBtn: 0,
success: function (layero, index) {
let iframeWin = window["layui-layer-iframe" + layerIndex];
iframeWin.setParams(id);
}
});
}
// 违章单驳回修改
function editData2(id) {
let layerIndex = layer.open({
id: "editVio",
title: false,
type: 2,
maxmin: false,
content: '../dutyTask/violation/editViolationForm2.html',
area: ['700px', '780px'],
move: false,
closeBtn: 0,
success: function (layero, index) {
let iframeWin = window["layui-layer-iframe" + layerIndex];
iframeWin.setParams(id);
}
});
}
// 违章单回撤
function reback(id) {
layer.confirm('确定回撤吗?', { 'move': false, 'title': '操作提示' }, function () {
let loadingMsg = layer.msg('数据撤回中,请稍候...', { icon: 16, scrollbar: false, time: 0 });
let url = dataUrl + 'proteam/pot/superStatistics/rebackVoiStatus';
let params = {
'id': id,
};
ajaxRequest(url, "POST", params, true, function () {
}, function (result) {
layer.close(loadingMsg); // 关闭提示层
if (result.code === 200) {
parent.layer.msg(result.msg, { icon: 1 })
query();
} else if (result.code === 500) {
layer.alert(result.msg, { icon: 2 })
}
}, function (xhr) {
layer.close(loadingMsg); // 关闭提示层
error(xhr)
});
})
}
/*违章整改页面*/
function openRectification(id, classId, type) {
console.log(id, classId, type);
let html = '../dutyTask/violation/rectifyForm.html';
if (type === '2') {
html = '../dutyTask/violation/rectifyCheckForm.html';
} else if (type === '3') {
// 地市自查
html = '../dutyTask/violation/rectifyFormByCity.html';
}
let layerIndex = layer.open({
id: "rectify",
title: false,
type: 2,
maxmin: false,
content: html,
area: ['700px', '780px'],
move: false,
closeBtn: 0,
success: function (layero, index) {
let iframeWin = window["layui-layer-iframe" + layerIndex];
iframeWin.setParams(id, classId);
}
});
}
/*通知单*/
function noticeSheet(id, classId) {
let layerIndex = parent.layer.open({
type: 2,
title: false,
offset: ["16%", "31%"],
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, classId);
}
});
}
// 值长审核页 / 查看页
function noticeSheet2(id, classId, type) {
let layerIndex = layer.open({
type: 2,
title: false,
closeBtn: 0,
content: "../../html/dutyTask/violation/noticeSheetCheck.html",
shadeClose: false,
area: ['740px', '780px'],
move: false,
success: function () {
let iframeWin = window["layui-layer-iframe" + layerIndex];
iframeWin.setParams(id, classId, type);
}
});
}
/*违章照片*/
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,
offset: ["16%", "31%"],
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 openTeamVoi(teamLeaderNumber, classId) {
let layerIndex = layer.open({
type: 2,
id: 'teamVoi',
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;'],
// closeBtn: true,
content: "violation/teamVoiDetail.html",
shadeClose: false,
area: ['1600px', '780px'],
move: false,
success: function () {
let iframeWin = window["layui-layer-iframe" + layerIndex];
iframeWin.setParams(teamLeaderNumber, classId);
}
});
}
/* 违章子类型 */
function openTypeChild() {
let obj = {
keyWord: $("#keyWord").val(),
org: formSelects.value('org', 'val').toString(),
ticketNo: $("#ticketNo").val(),
levelId: formSelects.value('levelId', 'val').toString(),
createTime: $("#createTime").val(),
proName: formSelects.value('proName', 'val').toString(),
riskLevel: formSelects.value('riskLevel', 'val').toString(),
issUser: $("#issUser").val(),
status: formSelects.value('status', 'val').toString(),
currentUserId: user.userId + '',
isSup: user.isSup,
currentUserOrgId: user.orgId
}
let layerIndex = layer.open({
type: 2,
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;'],
// closeBtn: true,
content: "violation/childType.html",
shadeClose: false,
area: ['800px', '680px'],
move: false,
success: function () {
let iframeWin = window["layui-layer-iframe" + layerIndex];
iframeWin.setParams(JSON.stringify(obj));
}
});
}
/*删除违章单*/
function delData(id, typeParam, type) {
let title = type === '1' ? '确定删除吗?' : '确定撤销吗?'
layer.confirm(title, function () {
let loadingMsg = layer.msg('数据删除中,请稍候...', { icon: 16, scrollbar: false, time: 0 });
$.ajax({
headers: {
"encrypt": sm3(JSON.stringify({
params: id,
type: typeParam
}))
},
url: dataUrl + 'proteam/pot/superStatistics/delNoticeVoiById?token=' + token,
data: {
params: id,
type: typeParam
},
type: 'post',
async: true,
success: function (result) {
layer.close(loadingMsg); // 关闭提示层
if (result.code === 200) {
parent.layer.msg('删除成功', { icon: 1 })
query()
} else if (result.code === 500) {
layer.alert(result.msg, { icon: 2 })
} else if (result.code === 401) {
logout(1)
}
}, error: function () {
layer.close(loadingMsg); // 关闭提示层
layer.msg('服务异常,请稍后重试', { icon: 16, scrollbar: false, time: 2000 });
}
});
})
}
// 刷新违章单数据
function refreshNoticeVoiData() {
let loadingMsg = layer.msg('数据刷新中,请稍候...', { icon: 16, scrollbar: false, time: 0 });
$.ajax({
headers: {
"encrypt": sm3(JSON.stringify({}))
},
url: dataUrl + 'proteam/pot/superStatistics/refreshNoticeVoiData?token=' + token,
data: {},
type: 'post',
async: true,
success: function (result) {
layer.close(loadingMsg); // 关闭提示层
if (result.code === 200) {
parent.layer.msg(result.msg, { icon: 1 })
query()
} else if (result.code === 500) {
layer.alert(result.msg, { icon: 2 })
} else if (result.code === 401) {
logout(1)
}
}, error: function () {
layer.close(loadingMsg); // 关闭提示层
layer.msg('服务异常,请稍后重试', { icon: 16, scrollbar: false, time: 2000 });
}
});
}
// 获取参数
function getReqParams(page, limit, type) {
let obj = {};
if (!type) {
obj = {
page: page + "",
limit: limit + "",
paramcode:paramcode,
xfUser:xfUser,
keyWord: $("#keyWord").val(),
org: formSelects.value('org', 'val').toString(),
ticketNo: $("#ticketNo").val(),
levelId: formSelects.value('levelId', 'val').toString(),
createTime: $("#createTime").val(),
proName: formSelects.value('proName', 'val').toString(),
riskLevel: formSelects.value('riskLevel', 'val').toString(),
issUser: $("#issUser").val(),
status: formSelects.value('status', 'val').toString(),
currentUserId: user.userId + '',
isSup: user.isSup,
currentUserOrgId: user.orgId
};
} else {
obj = {
page: '1',
limit: '50',
keyWord: '',
org: '',
ticketNo: '',
levelId: '',
createTime: getStartTime() + " - " + getEndTime(),
proName: '',
riskLevel: '',
issUser: '',
status: '',
currentUserId: user.userId + '',
isSup: user.isSup,
currentUserOrgId: user.orgId
};
}
return obj;
}
/*导出*/
function exportData(type) {
let keyWord = $("#keyWord").val(),
org = formSelects.value('org', 'val').toString(),
ticketNo = $("#ticketNo").val(),
levelId = formSelects.value('levelId', 'val').toString(),
createTime = $("#createTime").val(),
proName = formSelects.value('proName', 'val').toString(),
riskLevel = formSelects.value('riskLevel', 'val').toString(),
issUser = $("#issUser").val(),
status = formSelects.value('status', 'val').toString(),
currentUserId = user.userId + '',
isSup = user.isSup,
currentUserOrgId = user.orgId
let loadingMsg = layer.msg("数据导出中,请稍候...", { icon: 16, scrollbar: false, time: 0, });
let url = dataUrl + "proteam/pot/superStatistics/exportData?keyWord=" + keyWord + "&org=" + org + "&ticketNo=" + ticketNo +
"&levelId=" + levelId + "&createTime=" + createTime + "&proName=" + proName + "&riskLevel=" + riskLevel + "&issUser=" + issUser +
"&status=" + status + "&currentUserId=" + currentUserId + "&isSup=" + isSup + "&currentUserOrgId=" + currentUserOrgId + "&type=" + type + "&token=" + token;
let xhr = new XMLHttpRequest();
xhr.open("get", url, true);
xhr.responseType = "blob"; // 转换流
xhr.setRequestHeader("encrypt",
sm3(JSON.stringify({
keyWord: keyWord,
org: org,
ticketNo: ticketNo,
levelId: levelId,
createTime: createTime,
proName: proName,
riskLevel: riskLevel,
issUser: issUser,
status: status,
currentUserId: currentUserId,
isSup: isSup,
currentUserOrgId: currentUserOrgId,
type: type
})));
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 = "违章统计" + handleDate(createTime) + ".xlsx"; // 文件名
} else {
layer.msg("服务异常,请稍后重试", { icon: 16, scrollbar: false, time: 2000 });
}
a.click();
window.URL.revokeObjectURL(url);
};
xhr.send();
}
function reloadData(type) {
let org = formSelects.value('org', 'val');
orgList = getOrgNumAndRate();
setOrg();
formSelects.value('org', org)
table.reload('violationStatisticsTable', {
where: {
keyWord: $("#keyWord").val(),
org: formSelects.value('org', 'val').toString(),
ticketNo: $("#ticketNo").val(),
levelId: formSelects.value('levelId', 'val').toString(),
createTime: $("#createTime").val(),
proName: formSelects.value('proName', 'val').toString(),
riskLevel: formSelects.value('riskLevel', 'val').toString(),
issUser: $("#issUser").val(),
status: formSelects.value('status', 'val').toString(),
currentUserId: user.userId + '',
isSup: user.isSup,
currentUserOrgId: user.orgId
},
page: {
curr: type ? 1 : pageNum,
limit: limitSize,
groups: 5, //只显示 5 个连续页码
},
});
getViolationTypeList('');
// pages(pageNum, limitSize);
}
// 查询/重置
function query() {
let pattern = new RegExp("[%_<>]");
if (pattern.test($("#keyWord").val())) {
$("#keyWord").val('');
return layer.msg('关键字查询包含特殊字符,请重新输入', {
icon: 2,
time: 2000 //2秒关闭如果不配置默认是3秒
});
}
if (pattern.test($("#ticketNo").val())) {
$("#ticketNo").val('');
return layer.msg('作业票查询包含特殊字符,请重新输入', {
icon: 2,
time: 2000 //2秒关闭如果不配置默认是3秒
});
}
if (pattern.test($("#issUser").val())) {
$("#issUser").val('');
return layer.msg('督查人查询包含特殊字符,请重新输入', {
icon: 2,
time: 2000 //2秒关闭如果不配置默认是3秒
});
}
reloadData(1);
}
/*建管单位赋值*/
function setOrg() {
let keys = [];
$.each(orgList, function (index, item) {
let temp = {
"name": item.name + "" + item.num + "" + item.rate + "",
"value": item.code,
"titleName": item.name
};
keys.push(temp);
})
formSelects.data('org', 'local', {
arr: keys
});
layui.form.render();
}
/*标段工程赋值*/
function setBidPro() {
let keys = [];
$.each(bidProList, function (index, item) {
let temp = {
"name": item.name,
"value": item.code
};
keys.push(temp);
})
formSelects.data('proName', 'local', {
arr: keys
});
formSelects.btns('proName', ['remove'])
layui.form.render();
}
/* 风险等级赋值 */
function setRiskLevel() {
let keys = [];
$.each(riskLevelList, function (index, item) {
let temp = {
"name": item.name,
"value": item.code
};
keys.push(temp);
})
formSelects.data('riskLevel', 'local', {
arr: keys
});
layui.form.render();
}
/* 状态赋值 */
function setStatus() {
let keys = [];
$.each(voiStatusList, function (index, item) {
let temp = {
"name": item.name,
"value": item.id
};
keys.push(temp);
})
formSelects.data('status', 'local', {
arr: keys
});
layui.form.render();
}
/* 违章等级赋值 */
function setLevelId() {
let keys = [];
$.each(voiLevelList, function (index, item) {
let temp = {
"name": item.name,
"value": item.id
};
keys.push(temp);
})
formSelects.data('levelId', 'local', {
arr: keys
});
layui.form.render();
}
// 按照类型来统计违章
function getViolationTypeList(type) {
let params = getReqParams('', '', type);
$.ajax({
headers: {
"encrypt": sm3(JSON.stringify(params))
},
url: dataUrl + 'proteam/pot/superStatistics/getViolationTypeList?token=' + token,
data: params,
type: 'post',
async: true,
success: function (result) {
if (result.code === 200) {
initEchartsOne(result.data.typeList);
initEchartsTwo(result.data.levelIdList);
} else if (result.code === 500) {
layer.alert(result.msg, { icon: 2 })
} else if (result.code === 401) {
logout(1)
}
}, error: function () {
layer.msg('服务异常,请稍后重试', { icon: 16, scrollbar: false, time: 2000 });
}
});
}
// 日期处理
function handleDate(value) {
if (!value) {
return '';
} else {
let handleValue = value.replace(' - ', '~');
return handleValue;
}
}
// 设置角色权限
function setRoleAuth(d) {
let html = '',
supType = d.supType === '1' || !d.supType ? true : false;
// 通知单
if (supType && d.voiStatus !== '6' && d.voiStatus !== '7' && d.voiStatus !== '8') {
html += "<a onclick=\"noticeSheet('" + d.id + "','" + d.classId + "')\">通知单</a>"
}
// 查看 -值班员权限
if ((user.isSup === '2' && (d.voiStatus === '7' || d.voiStatus === '8')) || (user.isSup === '1' && (d.voiStatus === '8' || d.voiStatus === '7'))) {
html += "<a onclick=\"noticeSheet2('" + d.id + "','" + d.classId + "','2')\">查看</a>"
}
// 下发审核-值长权限
if ((user.isSup === '1' && isShiftSup) || (user.isSup === '1' && (user.nickName === '!jysp' || user.nickName === 'jysp'))) {
if (supType && d.voiStatus === '7') {
html += "<a onclick=\"noticeSheet2('" + d.id + "','" + d.classId + "','1')\">审核</a>";
}
}
// 回撤 - 违章单整改归档后设置 - 值长/运维管理员 权限
if (supType && d.voiStatus === '5' && ((user.isSup === '1' && isShiftSup) || ((user.nickName === '!jysp' || user.nickName === 'jysp')))) {
let result = compareTime(getNowDate2(), d.recTime);
if (!result) html += "<a onclick=\"reback('" + d.id + "')\">回撤</a>";
}
// 驳回修改 - 值班员权限
if (user.isSup === '2' && supType && d.voiStatus === '8') {
html += "<a onclick=\"editData2('" + d.id + "')\">驳回修改</a>";
}
// 撤销 - 值班员权限
if (user.isSup === '2' && (d.voiStatus === '7')) {
html += "<a onclick=\"delData('" + d.id + "','1','2')\">撤销</a>";
}
// 地市整改审核 - 值班员权限
if (user.isSup === '2' && supType && (d.voiStatus === '2' || d.voiStatus === '4')) {
html += "<a onclick=\"openRectification('" + d.id + "','" + d.classId + "','2')\">审核</a>";
}
// 地市整改 - 地市权限
if (supType && user.isSup === '3' && (d.voiStatus === '1' || d.voiStatus === '3')) {
// 值班员下发
html += "<a onclick=\"openRectification('" + d.id + "','" + d.classId + "','1')\">整改</a>"
} else if (!supType && user.isSup === '3' && d.voiStatus === '1') {
// 地市自查
html += "<a onclick=\"openRectification('" + d.id + "','" + d.classId + "','3')\">整改</a>"
}
// 详情
if (d.voiStatus !== '1' && d.voiStatus !== '7' && d.voiStatus !== '8') {
html += "<a onclick=\"viewData('" + d.id + "')\">详情</a>";
}
// 删除 - 运维管理员 (值班员下违章单)
if (supType && (user.nickName === '!jysp' || user.nickName === 'jysp')) {
if (supType && d.voiStatus === '1') {
// 违章单未处理删除
html += "<a onclick=\"delData('" + d.id + "','1','1')\">删除</a>";
} else if (supType && d.voiStatus === '5') {
// 违章单整改已归档删除
html += "<a onclick=\"delData('" + d.id + "','2','1')\">删除</a>";
}
} else if (!supType && (user.nickName === '!jysp' || user.nickName === 'jysp')) { // 删除 - 运维管理员 (地市自查下违章单)
if (!supType && d.voiStatus === '1') {
// 违章单未处理删除
html += "<a onclick=\"delData('" + d.id + "','1','1')\">删除</a>";
} else if (!supType && d.voiStatus === '5') {
// 违章单整改已归档删除
html += "<a onclick=\"delData('" + d.id + "','2','1')\">删除</a>";
}
}
return html;
}
// 当前时间 小于整改完成时间 有回撤
function compareTime(time, time2) {
let timestamp = new Date(time).getTime();
let timestamp2 = new Date(time2).getTime();
return (timestamp - timestamp2) > 86400000 * 3;
}