let idParam, layer; function setParams(id) { layui.use(['layer'], function () { layer = layui.layer; idParam = id; getNoticeVoiDetailById(idParam) }); } function getNoticeVoiDetailById() { let loadingMsg = layer.msg("数据加载中,请稍候...", {icon: 16, scrollbar: false, time: 0,}); $.ajax({ headers: { "encrypt": sm3(JSON.stringify({ id: idParam })) }, url: dataUrl + 'proteam/pot/superStatistics/getNoticeVoiRectById?token=' + token, data: { id: idParam }, type: 'POST', async: false, success: function (result) { layer.close(loadingMsg); if (result.code === 200) { setData(result.data); } else if (result.code === 500) { layer.alert(result.msg, {icon: 2}) } else if (result.code === 401) { logout(1) } }, error: function () { layer.close(loadingMsg); setData(null); } }); } /*页面赋值*/ function setData(data) { $('#status').html(data.status) $('#createTime').html(data.createTime) $('#voiType').html(data.voiType) $('#levelId').html(data.levelId) $('#type').html(data.type) $('#org').html(data.org) $('#workContent').html(data.workContent) $('#sgUnit').html(data.sgUnit) $('#jlUnit').html(data.jlUnit) $('#vioUsers').html(data.vioUsers) $('#voiYj').html(data.voiYj) $('#content').html(data.content) $('#recRequirement').html(data.recRequirement) let imgPath = data.imgPath, imgPathArr = imgPath.split(','), html = '' $.each(imgPathArr, function (index, item) { let path = photoUrl + item + '?token=' + token html += '' }) $('.supervision-img').append(html) if (data.list) { let html = ''; $.each(data.list, function (index, item) { let cent = '整改照片', cent2 = '整改说明'; if (!item.dutyUnit) { cent = '申诉照片', cent2 = '申诉说明'; } html += '
' + '
' + '

' + (index + 1) + '

' + '
' + '
' + '' + '
' + '

' + cent + ':

' + '
' + setImg(item) + '
' + '
' + setRectInfo(item.dutyUnit, item) + '
' + '

' + cent2 + ':

' + '

' + item.rectExplain + '

' + '
' + '
' + '

审核意见:

' + '

' + setValue2(item.checkOpinion) + '

' + '
' + '
' + '
' + '
' }) $('.rect-content').empty().append(html) } let viewer = new Viewer(document.getElementById('dc-img'), { url: 'data-original', show: function () { viewer.update(); } }); let viewer2 = new Viewer(document.getElementById('rect-content'), { url: 'data-original', show: function () { viewer2.update(); } }); } function setRectInfo(dutyUnit, item) { let html = ''; if (dutyUnit) { html += '
' + '

责任单位:' + item.dutyUnit + '

' + '

责任人:' + item.dutyUser + '

' + '
' + '
' + '

整改完成时间:' + item.rectFinshTime + '

' + '

联系人及电话:' + item.contactPhone + '

' + '
'; } return html; } function setImg(data) { let imgPath = data.imagePath, imgPathArr = imgPath.split(','), html = '' $.each(imgPathArr, function (index, item) { if (item && item.indexOf("jpg") > 0) { // 照片 let path = photoUrl + item + '?token=' + token html += '' } else if (item && item.indexOf("docx") > 0) { // 文件 let obj = { fileName: item } console.log(JSON.stringify(obj)) html += "
" + "
" + "" + "

整改附件

" + "
"; } }) return html; } /*下载整改文件*/ 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 closePage() { let index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引 parent.layer.close(index); //再执行关闭 }