let idParam, layer, serNo, org, status,classIdParam; function setParams(id,classId) { idParam = id; classIdParam = classId; layui.use(['layer'], function () { layer = layui.layer; getNoticeVoiDetailById() }) } function getNoticeVoiDetailById() { let loadingMsg = layer.msg("数据加载中,请稍候...", {icon: 16, scrollbar: false, time: 0,}); $.ajax({ headers: { "encrypt": sm3(JSON.stringify({ id: idParam, classId: classIdParam })) }, url: dataUrl + 'proteam/pot/superStatistics/getNoticeSheet?token=' + token, data: { id: idParam, classId: classIdParam }, type: 'POST', async: true, success: function (result) { layer.close(loadingMsg); if (result.code === 200) { setVoiRectNoticeData(result); status = result.data.noticeVioEntity.status; if (result.data.noticeVioEntity.status === '5') { $('.voi-rect-feedback').removeAttr('style'); setVoiRectFeedbackData(result); } } else if (result.code === 500) { layer.alert(result.msg, {icon: 2}) } else if (result.code === 401) { logout(1) } }, error: function () { layer.close(loadingMsg); } }); } /*违章整改通知单(远程督查)赋值*/ function setVoiRectNoticeData(result) { let html = ''; if (result.data.noticeVioEntity) { let obj = result.data.noticeVioEntity; $('#voiRectNoticeNo').html(obj.serNo); serNo = obj.serNo, org = obj.org; html += '' html += '检查项目' + obj.proName + '' html += '检查时间' + obj.createTime + '' html += '施工内容及施工部位' + (obj.workContent ? obj.workContent : '') + '' html += '主送单位' + obj.org + '' html += '施工单位' + (obj.sgUnit ? obj.sgUnit : '') + '' html += '监理单位' + (obj.jlUnit ? obj.jlUnit : '') + '' html += '序号发现问题违反条款' let imgPath = obj.imgPath, imgPathArr = imgPath.split(','), cent = '' $.each(imgPathArr, function (index, item) { let path = photoUrl + item + '?token=' + token cent += '' }) html += '1' + obj.content + '' + obj.voiYj + '' html += cent html += '整改要求' + obj.recRequirement + '' html += '签发单位' + obj.issuingUnit + '' } $('#table1').empty().append(html); let viewer = new Viewer(document.getElementById('table1'), { url: 'data-original', show: function () { viewer.update(); } }); } /*违章整改反馈单赋值*/ function setVoiRectFeedbackData(result) { let html = '', cent = ''; if (result.data.noticeVoiRectEntity) { let obj = result.data.noticeVioEntity; let obj2 = result.data.noticeVoiRectEntity; $('#voiRectFeedbackNo').html(obj.serNo); html += 'col style="width: 5%"/>' html += '受检项目' + obj.proName + '' html += '受检时间' + obj.createTime + '' html += '主送单位' + obj.org + '' html += '序号被查问题整改措施责任单位
(部门)责任人整改完
成时间' html += '1' + obj.content.substring(obj.content.indexOf("】") + 1, obj.content.length) + '' + obj2.rectExplain + '' + obj2.dutyUnit + '' + obj2.dutyUser + '' + obj2.rectFinshTime + '' html += '联系人' + obj2.contactPhone + '' cent += '' let imgPath = obj.imgPath, imgPathArr = imgPath.split(','), imgCent = '', imagePath = obj2.imagePath, imgPathArr2 = imagePath.split(','), imgCent2 = '' $.each(imgPathArr, function (index, item) { let path = photoUrl + item + '?token=' + token imgCent += '' }) $.each(imgPathArr2, function (index, item) { let html = ''; // let path = photoUrl + item + '?token=' + token // imgCent2 += '' if (item && item.indexOf("jpg") > 0) { // 照片 let path = photoUrl + item + '?token=' + token html += '' } else if (item && item.indexOf("docx") > 0) { // 文件 let obj = { fileName: item } html += "
" + "
" + "" + "

整改附件

" + "
"; } imgCent2 += html; }) cent += '
' + imgCent + '
' + imgCent2 + '' cent += '' + obj.content.substring(obj.content.indexOf("】") + 1, obj.content.length) + '' + obj2.status + '' } $('#table2').empty().append(html); $('#table3').empty().append(cent); let viewer = new Viewer(document.getElementById('table1'), { url: 'data-original', show: function () { viewer.update(); } }); let viewer2 = new Viewer(document.getElementById('table3'), { url: 'data-original', show: function () { viewer2.update(); } }); } /*下载整改文件*/ function uploadRectFile(obj) { let fileName = obj.fileName; let downloadFileName = '整改附件_' + getNowDate() + '.' + fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length); let loadingMsg = layer.msg('整改文件下载中,请稍候...', {icon: 16, scrollbar: false, time: 0}); let url = dataUrl + 'proteam/pot/superStatistics/uploadRectFile?token=' + token + '&fileName=' + encodeURIComponent(fileName); let xhr = new XMLHttpRequest(); xhr.open("get", url, true); xhr.responseType = "blob"; // 转换流 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 = downloadFileName; // 文件名 } else if (this.status === 401) { localStorage.removeItem("token"); backLogin(); } else { layer.msg('整改文件下载发生异常,请稍后重试', {icon: 16, scrollbar: false, time: 2000}); } a.click() window.URL.revokeObjectURL(url) }; xhr.send(); } function downLoadNoticeSheet() { let fileName = '违章通知单'; if (status === '5') { fileName = '违章整改反馈单'; } let loadingMsg = layer.msg("通知单导出中,请稍候...", {icon: 16, scrollbar: false, time: 0}); let url = dataUrl + 'proteam/pot/superStatistics/downLoadNoticeSheet?token=' + token + "&id=" + idParam + "&classId=" + classIdParam; let xhr = new XMLHttpRequest(); xhr.open("get", url, true); xhr.responseType = "blob"; // 转换流 xhr.setRequestHeader("encrypt", sm3(JSON.stringify({ id: idParam, classId: classIdParam, }))); 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 = serNo + fileName + "(" + org.replace('供电', '') + ")" + ".docx"; // 文件名 } else { layer.msg("服务异常,请稍后重试", {icon: 16, scrollbar: false, time: 2000}); } a.click(); window.URL.revokeObjectURL(url); }; xhr.send(); } // 关闭页面 function closePage() { let index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引 parent.layer.close(index); //再执行关闭 }