'
}
$('#riskConsumptionTable tbody').empty().append(html);
// 默认选中一行数据展示
if (data && data.length > 0) {
if (selType === '2') {
$('#indexIframe').removeAttr('style');
$('#no-ticket-file').css('display', 'none');
$('#essCondition-box').removeAttr('style')
$('#riskConsumptionTable tbody tr:nth-child(1)').css('background-color', '#a1bbf3')
selObj = $('#riskConsumptionTable tbody tr:nth-child(1)')
status = $('#riskConsumptionTable tbody tr:nth-child(1)').attr('status')
ticketNo = $('#riskConsumptionTable tbody tr:nth-child(1)').attr('ticketNo')
ticketId = $('#riskConsumptionTable tbody tr:nth-child(1)').attr('ticketId')
bidNo = $('#riskConsumptionTable tbody tr:nth-child(1)').attr('bidNo')
selType = '2';
setEssConditionData();
}
} else {
if (selType === '2') {
selObj = null, status = '', ticketNo = '', ticketId = '', bidNo = '', selType = '2';
$('#essCondition-box').css('display', 'none');
$('#indexIframe').css('display', 'none');
$('#no-ticket-file').removeAttr('style');
}
}
}
// 表格选中
function selTrData(that, type) {
$('#indexIframe').removeAttr('style');
$('#no-ticket-file').css('display', 'none');
$('#essCondition-box').removeAttr('style');
$('#permitTable tbody tr').css('background-color', 'transparent')
$('#riskConsumptionTable tbody tr').css('background-color', 'transparent')
$(that).css('background-color', '#a1bbf3')
status = $(that).attr('status');
ticketNo = $(that).attr('ticketNo')
ticketId = $(that).attr('ticketId')
bidNo = $(that).attr('bidNo')
selType = type + '';
selObj = $(that)
$('#openBtn').css('display','none')
$('#closeBtn').css('display','none')
$('#openBtn2').css('display','none')
$('#closeBtn2').css('display','none')
setEssConditionData();
}
// 赋值必备条件
function setEssConditionData() {
let value = 'block'
if (user.isSup !== '3') {
value = 'none'
}
let html = '';
if (status === '新开票') {
for (let i = 1; i <= 5; i++) {
changeStyle(i, 1)
}
} else {
for (let i = 1; i <= 5; i++) {
changeStyle(i, 2)
}
}
if (status === '新开票' && user.isSup === '3') {
html += '
' +
'
许可人:
' +
'
' +
'' +
'' +
'
' +
'
';
} else if (status === '许可') {
html += '
' +
'
许可人:
' +
'
许可工作时间:
' +
'
';
} else if (status === '不许可') {
html += '
' +
'
许可人:张三
' +
'
';
} else if (status === '未销号') {
html += '
' +
'
许可人:
' +
'
许可工作时间:
' +
'' +
'
';
} else if (status === '已销号') {
html += '
' +
'
许可人:张三
' +
'
许可工作时间:
' +
'
风险销号时间:
' +
'
';
}
$('#permit-box').empty().append(html)
if (status !== '新开票') {
getTicketEssenCondition();
}
// 加载作业票文件、班组骨干、准入人员、已编制安全技术措施
viewTicket();
resetRadio();
getBackboneByIdList();
getAccessPeopleByIdList();
getSgProgramAjax();
}
function setTicketEssenConditionData(data) {
$('#radioValue1').html(data.radioOne === '1' ? '是' : '否');
$('#radioValue2').html(data.radioTwo === '1' ? '是' : '否');
$('#radioValue3').html(data.radioThree === '1' ? '是' : '否');
$('#radioValue4').html(data.radioFour === '1' ? '是' : '否');
$('#radioValue5').html(data.radioFive === '1' ? '是' : '否');
$('#permitUser').html(data.permitUser);
$('#permitTime').html(data.permitTime);
$('#cancelTime').html(data.cancelTime);
}
function changeStyle(index, type) {
if (type === 1) {
$('#table-' + index + ' tr:nth-child(1)').find('td').eq(1).removeAttr('style');
$('#table-' + index + ' tr:nth-child(1)').find('td').eq(2).css('display', 'none');
} else if (type === 2) {
$('#table-' + index + ' tr:nth-child(1)').find('td').eq(1).css('display', 'none');
$('#table-' + index + ' tr:nth-child(1)').find('td').eq(2).removeAttr('style');
}
}
// 许可/不许可
function permit(type) {
let permitUser = $('#permitUser').val();
if (!permitUser) {
return layer.msg('请输入许可人', {icon: 7})
}
let radio1 = $('input[name="radio1"]:checked').val()
let radio2 = $('input[name="radio2"]:checked').val()
let radio3 = $('input[name="radio3"]:checked').val()
let radio4 = $('input[name="radio4"]:checked').val()
let radio5 = $('input[name="radio5"]:checked').val()
let params = {
ticketNo: ticketNo,
radioOne: radio1,
radioTwo: radio2,
radioThree: radio3,
radioFour: radio4,
radioFive: radio5,
permitUser: permitUser,
type: type + '',
}
premitAjax(params);
}
// 销号
function cancelNumber() {
let params = {
ticketNo: ticketNo,
type: '3',
}
premitAjax(params);
}
// 更新表格、必备条件数据
function reloadTableData(type) {
if (type === '1') {
status = '许可';
} else if (type === '2') {
status = '不许可';
} else if (type === '3') {
status = '已销号';
}
setEssConditionData();
if (selType === '1') {
selObj.attr('status', status).find('td').eq(4).html(status)
} else if (selType === '2') {
selObj.attr('status', status).find('td').eq(5).html(status)
}
}
// 预览作业票文件
function viewTicket() {
sessionStorage.setItem("fileId", ticketId);
sessionStorage.setItem("fileType", '2');
let href = '../../pdfjs/web/viewer.html'
$('#indexIframe').attr('src', href)
}
// 骨干成绩单
function openBackboneScore() {
let layerIndex = layer.open({
id: "backboneScore",
title: false,
type: 2,
maxmin: false,
content: '../dutyTask/backboneScore/backboneScore.html',
area: ['100%', '100%'],
move: false,
closeBtn: 0,
success: function (layero, index) {
}
});
}
// 作业许可及销号列表
function openTicketEssenCondition() {
let layerIndex = layer.open({
id: "ticketEssenCondition",
title: false,
type: 2,
maxmin: false,
content: '../dutyTask/backboneScore/ticketEssenCondition.html',
area: ['100%', '100%'],
move: false,
closeBtn: 0,
success: function (layero, index) {
}
});
}
// 作业人员准入信息
function setPersonAccessInfo(data) {
$('#table-2 tr:not(:first)').remove();
let html = '', accessNum = 0, noAccessNum = 0;
if (data && data.length > 0) {
data.forEach(function (item, index) {
let className = item.accessInfo === '1' ? 'access-td' : 'no-access-td';
let accessValue = item.accessInfo === '1' ? '准入' : '未准入';
item.accessInfo === '1' ? accessNum++ : noAccessNum++;
if (index < 5) {
html += '
' + (index + 1) + '
' + item.name + '
' + accessValue + '
'
} else {
html += '
' + (index + 1) + '
' + item.name + '
' + accessValue + '
'
}
})
} else {
html += '
暂无数据
'
}
if (data && data.length > 5) {
$('#openBtn').css('display', 'block');
}
$('#accessNum').html(accessNum);
$('#noAccessNum').html(noAccessNum);
$('#table-person').after(html);
}
// 班组骨干
function setBackboneScoreInfo(data) {
$('#table-3 tr:not(:first)').remove();
let html = '', passNum = 0, noPassNum = 0;
if (data && data.length > 0) {
data.forEach(function (item, index) {
let className = item.isPass === '1' ? 'access-td' : 'no-access-td';
let accessValue = item.isPass === '1' ? '已通过' : '未通过';
item.isPass === '1' ? passNum++ : noPassNum++;
if (index < 5) {
html += '
' + (index + 1) + '
' + item.name + '
' + item.workType + '
' + accessValue + '
'
} else {
html += '
' + (index + 1) + '
>
' + item.name + '
' + item.workType + '
' + accessValue + '
'
}
})
} else {
html += '
暂无数据
'
}
if (data && data.length > 5) {
$('#openBtn2').css('display', 'block');
}
$('#passNum').html(passNum);
$('#noPassNum').html(noPassNum);
$('#table-person2').after(html);
}
// 已编制安全技术措施赋值
function setProgramData(result) {
$('#table-5 tr:not(:first)').remove();
let html = ''
if (result && result !== 'null') {
let data = JSON.parse(result);
if (data.length) {
$.each(data, function (index, item) {
let obj = {
'fileId': item.fileId,
'fileName': item.fileName
}
if (item.fileName.indexOf("pdf") > 0) {
html += "
" + item.fileName + "
"
} else if (item.fileName.indexOf("doc") > 0 || item.fileName.indexOf("docx") > 0) {
html += "