IntelligentRecognition/ah-jjsp-web/.svn/pristine/e8/e87ef740ebdf198bbd8de9cd96c...

515 lines
16 KiB
Plaintext
Raw Permalink 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 table, form, layer, rate, util, laydate,user = getUser(),orgList,voiStatusList,formSelects;
let pageNum = 1, limitSize = 30;
let data = '';
$(function () {
layui.config({
base: "../../../js/layui/", //此处路径请自行处理, 可以使用绝对路径
}).extend({
rightPopup4: "rightPopup4",
formSelects: 'formSelects-v4'
}).use(['rate', 'laydate', 'layer', 'form', 'table', 'util','formSelects'], function () {
layer = layui.layer;
form = layui.form;
rate = layui.rate;
table = layui.table;
formSelects = layui.formSelects;
util = layui.util;
laydate = layui.laydate
//日期范围
laydate.render({
elem: '#createTime'
, type: 'date'
, range: '-'
, format: 'yyyy-MM-dd',
value: getNowTime() + ' - ' + getNowTime(),
max: Date.parse(new Date()),
});
util.event('lay-active', {
query: function () {
pages(1, limitSize);
},
release:function(){
openPage();
},
reset: function () {
$('#checkName').val('');
$('#loginName').val('');
$('#startTime').val(getNowTime() + ' ~ ' + getNowTime());
form.render();
pages(1, limitSize);
}
});
orgList = getOrgNumAndRate(1);
voiStatusList = getRiskLevelSelect('voi_status');
setOrg();
setStatus();
pages(1, 10, 1);
//触发单元格工具事件
table.on('tool(table)', function (obj) { // 双击 toolDouble
let data = obj.data;
console.log(data);
if (obj.event === 'detail') {
toAddPage(data.checkUser,data.commissioner,data.quality);
}
});
});
})
/* 状态赋值 */
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 openPage(){
let layerIndex = layer.open({
id: "addVio",
title: false,
type: 2,
maxmin: false,
content: '../../dutyTask/violation/handAddVio.html',
area: ['40%', '80%'],
move: false,
closeBtn: 0,
success: function (layero, index) {
}
});
}
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,
data: params,
type: 'POST',
async: false,
success: function (result) {
console.log(result);
if (result.code === 200) {
if (result.data) {
console.log(result);
initTable(result.data, limitSize, pageNum)
laypages(result.count, 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 getReqParams(page, limit) {
return {
page: page + "",
limit: limit + "",
keyWord: $("#keyWord").val(),
status: formSelects.value('status', 'val').toString(),
org :formSelects.value('org', 'val').toString(),
createTime : $("#createTime").val(),
issUser : $("#issUser").val(),
resource:'3',
currentUserId: user.userId + '',
isSup: user.isSup,
currentUserOrgId: user.orgId
};
}
function initTable(dataList, limit, page) {
table.render({
elem: "#table",
id: "table",
height: "full-195",
data: dataList,
cols: [
[//表头
{
title: "序号",
width: 80,
unresize: true,
align: "center",
templet: function (d) {
return (page - 1) * limit + d.LAY_INDEX;
}
},
{
field: "proName",
title: "工程名称",
unresize: false,
sort: true,
minWidth: 200,
align: "center",
},
{
field: 'createTime',
title: "检查时间",
unresize: false,
sort: true,
minWidth: 200,
align: "center"
},
{
field: 'remark2',
title: "施工内容及施工部位",
unresize: false,
sort: true,
minWidth: 200,
align: "center"
},
{
field: 'org',
title: "主送单位",
unresize: false,
sort: true,
minWidth: 200,
align: "center"
},
{
field: 'bidCode',
title: "施工单位",
unresize: false,
sort: true,
minWidth: 200,
align: "center"
},
{
field: 'signCode',
title: "监理单位",
unresize: false,
sort: true,
minWidth: 200,
align: "center"
},
{
field: 'status',
title: "状态",
unresize: false,
sort: true,
minWidth: 200,
align: "center"
},
{field:'issUser', title: "督察人",unresize: false,sort: true,minWidth: 200,align: "center"},
{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 '';
}
}
},
{
fixed: 'right',
title: "操作",
width: 200,
unresize: true,
align: "center",
style: "height:90.5px;",
templet: function (d) {
return setRoleAuth(d);
}
}
],
],
limit: limit,
done: function (res, curr, count) {
},
});
}
// 设置角色权限
function setRoleAuth(d) {
console.log(d);
var html='';
html += "<a style='cursor:pointer;color:blue' onclick=\"noticeSheet('" + d.id + "','" + d.classId + "')\"> 通知单</a>"
html += "<a style='cursor:pointer;color:blue' onclick=\"noticeSheet2('" + d.id + "','" + d.classId + "','2')\"> 查看 </a>"
if( user.isSup==1){
if(d.status=='未处理' || d.status=='已驳回'){
html += "<a style='cursor:pointer;color:blue' onclick=\"openRectification('" + d.id + "','" + d.classId + "','1')\"> 整改</a>"
}
if(d.status=='整改已归档'){
html += "<a style='cursor:pointer;color:blue' onclick=\"reback('" + d.id + "')\"> 回撤</a>";
}
if(d.status=='申诉中' || d.status=='已整改' ){
html += "<a style='cursor:pointer; color:blue' onclick=\"openRectification('" + d.id + "','" + d.classId + "','2')\"> 审核</a>";
}
html += "<a style='cursor:pointer;color:blue' onclick=\"delData('" + d.id + "','1','1')\"> 删除</a>";
}else if(user.isSup==2 ){
if(d.status=='整改已归档'){
html += "<a style='cursor:pointer;color:blue' onclick=\"reback('" + d.id + "')\"> 回撤</a>";
}
if(d.status=='申诉中' || d.status=='已整改' ){
html += "<a style='cursor:pointer; color:blue' onclick=\"openRectification('" + d.id + "','" + d.classId + "','2')\"> 审核</a>";
}
}else if(user.isSup==3){
if(d.status=='未处理' || d.status=='已驳回'){
html += "<a style='cursor:pointer;color:blue' onclick=\"openRectification('" + d.id + "','" + d.classId + "','1')\"> 整改</a>"
}
}
html += "<a style='cursor:pointer;color:blue' onclick=\"viewData('" + d.id + "')\"> 详情</a>";
return html;
}
/* 详情 */
function viewData(id) {
let layerIndex = parent.layer.open({
type: 2,
title: false,
// offset: ["16%", "31%"],
closeBtn: 0,
content: "../../html/dutyTask/violation/handViolationDetail.html",
shadeClose: false,
area: ['700px', '780px'],
move: false,
success: function () {
let iframeWin = parent.window["layui-layer-iframe" + layerIndex];
iframeWin.setParams(id);
}
});
}
/*通知单*/
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 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 noticeSheet2(id, classId, type) {
let layerIndex = layer.open({
type: 2,
title: false,
closeBtn: 0,
content:"../../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 openRectification(id, classId, type) {
console.log(id, classId, type);
let html = '../../dutyTask/violation/handRectifyForm.html';
if (type === '2') {
html = '../../dutyTask/violation/rectifyCheckForm.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 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 closePage(type) {
let index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
parent.layer.close(index); //再执行关闭
if (type === 1) {
window.parent.reloadData()
}
}
function reloadData(type) {
pages(1,10,1);
// let org = formSelects.value('org', 'val');
// orgList = getOrgNumAndRate();
// setOrg();
// formSelects.value('org', org)
// table.reload('table', {
// where: {
// page: 1 + "",
// limit: 20 + "",
// keyWord: $("#keyWord").val(),
// status: formSelects.value('status', 'val').toString(),
// org :formSelects.value('org', 'val').toString(),
// createTime : $("#createTime").val(),
// issUser : $("#issUser").val(),
// resource:'3',
// currentUserId: user.userId + '',
// isSup: user.isSup,
// currentUserOrgId: user.orgId
// },
// });
// getViolationTypeList('');
// pages(pageNum, limitSize);
}
// 地市站班会数量和占比
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 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();
}