let form, layer, idParam, isAppealParam; function setParams(id) { idParam = id; layui.use(['form', 'layer', 'upload'], function () { layer = layui.layer; form = layui.form; form.render(); getNoticeVoiRectById(idParam); }); } // 提交数据 function saveData(type) { let checkOpinion = $('#checkOpinion').val(), status; if (!checkOpinion) { return layer.msg("请填写审核意见", {icon: 5}) } if (type === 1) { status = '3'; } else if (type === 2 && isAppealParam === '0') { status = '5'; } else if (type === 2 && isAppealParam === '1') { status = '6'; } let loadingMsg = layer.msg('数据上传中,请稍候...', {icon: 16, scrollbar: false, time: 0}); let params = { id: $('#rectId').val(), checkOpinion: checkOpinion, notiId: idParam, status: status, isAppeal : isAppealParam } $.ajax({ headers: { "encrypt": sm3(JSON.stringify(params)) }, url: dataUrl + 'proteam/pot/superStatistics/rectCheck?token=' + token, type: 'POST', data: params, dataType: 'json', beforeSend: function () { $('.save').addClass("layui-btn-disabled").attr("disabled", true); $('.pass').addClass("layui-btn-disabled").attr("disabled", true); $('.cancel').addClass("layui-btn-disabled").attr("disabled", true); }, success: function (result) { layer.close(loadingMsg); // 关闭提示层 if (result.code === 200) { if (type === 1 && isAppealParam === '0') { closePage(1); parent.layer.msg('整改驳回成功', {icon: 1}); } else if (type === 1 && isAppealParam === '1') { closePage(1); parent.layer.msg('申诉驳回成功', {icon: 1}); } else if (type === 2 && isAppealParam === '0') { closePage(1); parent.layer.msg('整改通过已归档成功', {icon: 1}); } else if (type === 2 && isAppealParam === '1') { closePage(1); parent.layer.msg('申诉通过已归档成功', {icon: 1}); } } else if(result.code === 500){ layer.msg(result.msg, {icon: 2}); }else if(result.code === 401){ logout(1); } $('.save').removeClass("layui-btn-disabled").attr("disabled", false); $('.pass').removeClass("layui-btn-disabled").attr("disabled", false); $('.cancel').removeClass("layui-btn-disabled").attr("disabled", false); }, error: function (result) { layer.close(loadingMsg); // 关闭提示层 layer.msg('服务异常,请稍后重试', {icon: 16, scrollbar: false, time: 2000}); $('.save').removeClass("layui-btn-disabled").attr("disabled", false); $('.pass').removeClass("layui-btn-disabled").attr("disabled", false); $('.cancel').removeClass("layui-btn-disabled").attr("disabled", false); } }); } function getNoticeVoiRectById() { 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) $('#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').empty().append(html) if (data.isAppeal) { isAppealParam = data.isAppeal; if (data.isAppeal === "0") { $('#title-name').html('违章反馈审核'); $('#rect-name').html('整改反馈'); $('.save').html('整改驳回'); } else { $('#title-name').html('违章申诉审核'); $('#rect-name').html('申诉反馈'); $('.save').html('申诉驳回'); } if (data.list) { let cent = '整改照片', cent2 = '整改说明'; if (data.isAppeal === '1') { cent = '申诉照片', cent2 = '申诉说明'; } let item = data.list[data.list.length - 1] let html = ''; html += '
' + '' + '
' + '

' + cent + ':

' + '
' + setImg(item) + '
' + '
' + setRectInfo(data.isAppeal, item) + '
' + '

' + cent2 + ':

' + '

' + item.rectExplain + '

' + '
' + '
' + '

审核意见:

' + '' + '
' + '
' $('.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('zg-img'), { url: 'data-original', show: function () { viewer2.update(); } }); } function setRectInfo(isAppeal, item) { let html = ''; if (isAppeal === '0') { 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 } 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(type) { let index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引 parent.layer.close(index); //再执行关闭 if (type === 1) { window.parent.reloadData() } }