IntelligentRecognition/ah-jjsp-web/.svn/pristine/8e/8ed43247d1493ef7a2f17e5f0d6...

554 lines
19 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, tableIns, classIdParam, bidNameParam, ticketNoParam, buildCodeParam, user = getUser(),tableHeight;
let teamNameParam = null, riskLevelParam = null,bidCodeParam = null,signCodeParam = null;
let pageNum = 1, limitSize = 10; // 默认第一页分页数量为10
// 是否是值长管理员
let isShiftSup = user.roleName === '值长管理员' ? true : false;
setBtns();
function setBtns(){
let html = ''
if(user.isSup !== '3'){
$('.btn-box').css('height','60px')
tableHeight = 'full-170'
html += '<button type="button" class="layui-btn layui-btn-primary" style="background-color: #2F82FB;color: #FFF;font-size: 16px;" onclick="openViolationForm()">违章单下发</button>';
}else{
tableHeight = 'full-110'
$('.table-box2').css('height','calc(100% - 50px)')
}
$('.btn-box').append(html)
}
function setParams(classId, bidName, ticketNo, buildCode,teamName, riskLevel, bidCode, signCode) {
classIdParam = classId;
bidNameParam = bidName;
ticketNoParam = ticketNo;
buildCodeParam = buildCode;
teamNameParam = teamName;
riskLevelParam = riskLevel;
bidCodeParam = bidCode;
signCodeParam = signCode;
layui.use(['form', 'layer', 'table'], function () {
form = layui.form;
layer = layui.layer;
table = layui.table;
pages(1, 10, 1);
})
}
function pages(pageNum, pageSize, typeNum) {
let params = getReqParams(pageNum, pageSize, typeNum);
$.ajax({
headers: {
"encrypt": sm3(JSON.stringify(params))
},
url: dataUrl + "proteam/pot/superStatistics/getVoiRecordList?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: [10, 20, 50, 100, 200, 500],
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",
height: tableHeight,
data: dataList,
limit: limit,
cols: [
[
//表头
{
title: "序号",
width: 80,
unresize: true,
align: "center",
templet: function (d) {
return (page - 1) * limit + d.LAY_INDEX;
}
},
{
field: "ticketNo",
title: "作业票编号",
width: 200,
unresize: true,
align: "center",
sort: true
},
{
field: "proName",
title: "工程名称",
width: 230,
unresize: true,
align: "center",
sort: true
},
{
field: "riskLevel",
title: "风险等级",
width: 140,
unresize: true,
align: "center",
sort: true,
templet: function (d) {
return setRiskLevelColor(d.riskLevel);
}
},
{
field: "org",
title: "违章单位",
width: 140,
unresize: true,
align: "center",
sort: true
},
{
field: "levelId",
title: "违章等级",
width: 150,
unresize: true,
align: "center",
sort: true,
templet: function (d) {
if (d.levelId === '严重违章') {
return '<span style="color: #ff5d5d;">' + d.levelId + '</span>';
}
return '<span>' + d.levelId + '</span>';
}
},
{
field: "content",
title: "违章内容",
width: 260,
unresize: true,
align: "center",
sort: true
},
{
field: "createTime",
title: "督查日期",
width: 150,
unresize: true,
align: "center",
sort: true
},
{
field: "issUser",
title: "督查人",
width: 150,
unresize: true,
align: "center",
sort: true
},
{
field: "status",
title: "状态",
width: 160,
unresize: true,
align: "center",
sort: true
},
{
title: "操作",
width: 200,
unresize: true,
align: "center",
templet: function (d) {
return setRoleAuth(d);
}
}
],
],
done: function (res, curr, count) {
layer.close(loadingMsg);
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 openViolationForm() {
let layerIndex = parent.layer.open({
id: "violationForm",
title: false,
type: 2,
maxmin: false,
content: '../dutyTask/remotePatrol/violationForm.html',
area: ['700px', '780px'],
closeBtn: 0,
success: function (layero, index) {
let iframeWin = parent.window["layui-layer-iframe" + layerIndex];
iframeWin.setParams(classIdParam, bidNameParam, ticketNoParam, buildCodeParam,teamNameParam,riskLevelParam,bidCodeParam,signCodeParam);
},
end:function (){
reloadData();
}
});
}
/*修改违章单*/
function editData(id) {
let layerIndex = layer.open({
id: "editVio",
title: false,
type: 2,
maxmin: false,
content: '../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: '../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 })
reloadData();
} else if (result.code === 500) {
layer.alert(result.msg, { icon: 2 })
}
}, function (xhr) {
layer.close(loadingMsg); // 关闭提示层
error(xhr)
});
})
}
/*违章整改页面*/
function openRectification(id,classId, type) {
let html = '../violation/rectifyForm.html';
if (type === '2') {
html = '../violation/rectifyCheckForm.html';
}else if(type === '3'){
html = '../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,
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: "../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,
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, 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 })
reloadData()
} 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 + "",
classId: classIdParam,
currentUserId: user.userId + '',
isSup: user.isSup,
currentUserOrgId: user.orgId
};
} else {
obj = {
page: '1',
limit: '10',
classId: classIdParam,
currentUserId: user.userId + '',
isSup: user.isSup,
currentUserOrgId: user.orgId
};
}
return obj;
}
function reloadData() {
pages(pageNum, limitSize);
}
// 关闭页面
function closePage() {
let index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
parent.layer.close(index); //再执行关闭
}
// 设置角色权限
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;
}