main
kgdxpr 2 years ago
parent 96473180e2
commit d6d0b7befb

@ -110,6 +110,7 @@
var $ = layui.jquery;
var common = layui.common;
var laytpl = layui.laytpl;
var element = layui.element;
tableRender();
@ -142,14 +143,26 @@
{ title: '发布时间', field: 'publish_time', align: 'center', width: "10%" },
{ title: '截止时间', field: 'deadline_time', align: 'center', width: "10%" },
{ title: '填报格式', field: 'job_type_name', align: 'center', width: "10%" },
{ title: '填报进度', align: 'center', width: "10%", templet: '#progress-Templet' },
// { title: '填报进度', align: 'center', width: "10%", templet: '#progress-Templet' },
{
title: '填报进度', align: 'center', width: "10%", templet: function () {
var html = '<div class="layui-progress layui-progress-big" lay-showPercent="true" lay-filter="rate">';
html += '<div class="layui-progress-bar layui-bg-blue" lay-percent="30%"></div>';
html += '<div>'
return html;
}
},
{ title: '保存状态', field: 'is_save_name', align: 'center', width: "8%" },
{ title: '发布状态', field: 'publish_state_name', align: 'center', width: "8%" },
{ title: '操作', align: 'left', width: "18%", toolbar: '#table-bar' }
]],
skin: 'line',
toolbar: '#table-toolbar',
defaultToolbar: []
defaultToolbar: [],
done: function () {
element.render();
element.progress('rate', '75%');
}
});
}
@ -168,7 +181,7 @@
window.postpone(obj);
} else if (obj.event === 'del') {
window.del(obj);
}else if(obj.event==='exportStruct'){
} else if (obj.event === 'exportStruct') {
window.exportStruct(obj);
}
});
@ -231,10 +244,11 @@
}
window.export = function (obj) {
window.location = "/QingLong/Excel/" + obj.data.upload_excel_filename;
openDownloadDialog("/QingLong/Excel/" + obj.data.upload_excel_filename, obj.data.job_name + ".xlsx");
// window.location = "/QingLong/Excel/" + obj.data.upload_excel_filename;
}
window.exportStruct=function (obj){
window.exportStruct = function (obj) {
window.location = "/QingLong/collect/exportTableStructExcel?job_id=" + obj.data.job_id;
}
@ -313,6 +327,47 @@
window.location = "./upload_excel.html";
}
function openDownloadDialog(url, saveName) {
if (window.navigator.msSaveBlob) {
try {
//创建XMLHttpRequest对象
var xhr = new XMLHttpRequest();
//配置请求方式、请求地址以及是否同步
xhr.open('POST', url, true);
//设置请求结果类型为blob
xhr.responseType = 'blob';
//请求成功回调函数
xhr.onload = function (e) {
if (this.status == 200) {//请求成功
//获取blob对象
var blob = this.response;
//获取blob对象地址并把值赋给容器
window.navigator.msSaveBlob(blob, saveName);
}
};
xhr.send();
} catch (e) {
console.log(e);
}
} else {
if (typeof url == 'object' && url instanceof Blob) {
url = URL.createObjectURL(url); // 创建blob地址
}
var aLink = document.createElement('a');
aLink.href = url;
aLink.download = saveName || '';
var event;
if (window.MouseEvent) {
event = new MouseEvent('click');
}
else {
event = document.createEvent('MouseEvents');
event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
}
aLink.dispatchEvent(event);
}
}
});
</script>
</body>

Loading…
Cancel
Save