IntelligentRecognition/ah-jjsp-web/.svn/pristine/62/62c958fe4899bfa0597fb812239...

558 lines
18 KiB
Plaintext
Raw Normal View History

2024-05-24 16:09:40 +08:00
let table, form, layer, laydate, util;
let user = getUser();
let type = 5;
let pageNum = 1, limitSize = 10;
// 是否是值长管理员
let isShiftSup = user.roleName === '值长管理员' ? true : false;
setBtn();
$(function () {
layui.use(['layer', 'laydate', 'form', 'table', 'util'], function () {
layer = layui.layer;
form = layui.form;
laydate = layui.laydate;
table = layui.table;
util = layui.util;
form.render();
laydate.render({
elem: '#workDay', //指定元素 元素选择器
type: 'date', //选择时间类型 可选值:year(年) month(年月) date(年月日) time(时分秒) datetime(年月日时分秒)
trigger: 'click',
format: 'yyyy-MM-dd', //时间格式 常用时间格式:yyyy-MM-dd HH:mm:ss
btns: ['now', 'confirm'], //选择框右下角显示的按钮 清除-现在-确定
});
laydate.render({
elem: '#workDay4', //指定元素 元素选择器
type: 'date', //选择时间类型 可选值:year(年) month(年月) date(年月日) time(时分秒) datetime(年月日时分秒)
trigger: 'click',
format: 'yyyy-MM-dd', //时间格式 常用时间格式:yyyy-MM-dd HH:mm:ss
btns: ['now', 'confirm'], //选择框右下角显示的按钮 清除-现在-确定
});
laydate.render({
elem: '#workDay5', //指定元素 元素选择器
type: 'date', //选择时间类型 可选值:year(年) month(年月) date(年月日) time(时分秒) datetime(年月日时分秒)
trigger: 'click',
format: 'yyyy-MM-dd', //时间格式 常用时间格式:yyyy-MM-dd HH:mm:ss
btns: ['now', 'confirm'], //选择框右下角显示的按钮 清除-现在-确定
});
laydate.render({
elem: '#workDay6', //指定元素 元素选择器
type: 'date', //选择时间类型 可选值:year(年) month(年月) date(年月日) time(时分秒) datetime(年月日时分秒)
trigger: 'click',
format: 'yyyy-MM-dd', //时间格式 常用时间格式:yyyy-MM-dd HH:mm:ss
btns: ['now', 'confirm'], //选择框右下角显示的按钮 清除-现在-确定
});
$('#workDay').val(getNowTime())
$('#workDay4').val(getNowTime())
$('#workDay5').val(getNowTime())
$('#workDay6').val(getNowTime())
typeData(type);
$('.content_left ul li').click(function () {
if (type !== this.value) {
changItem(this, $(this).parent(), 'checkBtn');
type = this.value;
typeData(type);
}
});
table.on('rowDouble(table)', function (obj) {
let data = obj.data;
if ((data.status === '未处理' || data.status === '已驳回') && user.isSup === '3') {
openRectification(data.id, d.classId, '1')
} else if ((data.status === '申诉中' || data.status === '已整改') && user.isSup === '2') {
openRectification(data.id, d.classId, '2');
}
})
});
});
function setBtn() {
let html = '';
if (user.isSup !== '3') {
html += '<li class="item unCheckBtn" value="2" onclick="choosePage(this,2)">资源监测通知</li>' +
'<li class="item unCheckBtn" value="3" onclick="choosePage(this,3,\'video-table\',\'voi-page5\')">视频诊断通知</li>' +
'<li class="item unCheckBtn" value="4" onclick="choosePage(this,4,\'alarm-table\',\'voi-page6\')">告警记录</li>'
}
$('.content_left ul').append(html);
}
function pages(pageNum, pageSize, typeNum) {
let params = getReqParams(pageNum, pageSize);
$.ajax({
headers: {
"encrypt": sm3(JSON.stringify(params))
},
// url: dataUrl + "proteam/pot/superStatistics/getSuperStatisticsList?token=" + token,
url: dataUrl + "proteam/pot/superStatistics/getVioNoticeByDirector?token=" + token,
type: 'POST',
data: params,
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 changItem(dom, parentDom, css) {
let item = $(dom);
if (!item.hasClass(css)) {
$.each(parentDom.children(), function (index, item) {
$(item).removeClass(css);
});
}
item.addClass(css);
}
/**
* 根据类型加载不同数据
* @param typeData 数据类型
*/
function typeData(typeData) {
switch (typeData) {
case 1:
if (isEmpty(table.cache.table1)) {
pages(1, limitSize);
} else {
table.reload('table1')
}
break;
case 5:
if (isEmpty(table.cache.table1)) {
pages(1, limitSize);
} else {
table.reload('table1')
}
break;
default:
break;
}
}
function initTable(dataList, limit, page) {
table.render({
elem: "#table",
id: 'table',
height: "full-90",
data: dataList,
limit: limit,
cols: [
[{
field: "number",
type: "numbers",
title: "序号",
minWidth: 50,
unresize: true,
align: "center",
}, {
field: "ticketNo",
title: "作业票编号",
unresize: true,
minWidth: 200,
align: "center"
}, {
field: "proName",
title: "工程名称",
unresize: true,
minWidth: 200,
align: "center",
}, {
field: "riskLevel",
title: "风险等级",
unresize: true,
minWidth: 50,
align: "center",
templet: function (d) {
return setRiskLevelColor(d.riskLevel);
}
}, {
field: 'org',
title: "违章单位",
unresize: true,
minWidth: 100,
align: "center",
}, {
field: 'type',
title: "违章类型",
unresize: true,
minWidth: 100,
align: "center",
}, {
field: 'content',
title: "违章内容",
unresize: true,
minWidth: 50,
align: "center",
}, {
field: 'createTime',
title: "督查日期",
unresize: true,
minWidth: 100,
align: "center",
}, {
field: 'issUser',
title: "督查人",
unresize: true,
minWidth: 100,
align: "center",
}, {
field: 'status',
title: "状态",
unresize: true,
minWidth: 50,
align: "center",
},
{
title: "操作",
width: 200,
unresize: true,
align: "center",
templet: function (d) {
// return setRoleAuth(d);
return "<a onclick=\"noticeSheet('" + d.id + "','" + d.classId + "')\">通知单</a>";
}
}]
],
done: function (res, curr, count) {
console.log(res);
}
});
}
// 获取参数
function getReqParams(page, limit) {
return {
page: page + "",
limit: limit + "",
currentUserId: user.userId + '',
isSup: user.isSup,
currentUserOrgId: user.orgId,
keyWord: ''
};
}
function reloadData() {
typeData(1);
}
/*违章整改页面*/
function openRectification(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: ['50%', '100%'],
move: false,
closeBtn: 0,
success: function (layero, index) {
let iframeWin = window["layui-layer-iframe" + layerIndex];
iframeWin.setParams(id, classId);
}
});
}
/* 详情 */
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 delData(id, typeParam) {
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 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) {
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 compareTime(time, time2) {
let timestamp = new Date(time).getTime();
let timestamp2 = new Date(time2).getTime();
return (timestamp - timestamp2) > 86400000 * 3;
}
// 设置角色权限
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) {
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;
}