From d6d0b7befbb8ed2371bfd6f3796ac53479c1e78a Mon Sep 17 00:00:00 2001 From: kgdxpr Date: Thu, 28 Dec 2023 16:54:49 +0800 Subject: [PATCH] 'commit' --- WebRoot/view/tb/org/task_list.html | 65 +++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 5 deletions(-) diff --git a/WebRoot/view/tb/org/task_list.html b/WebRoot/view/tb/org/task_list.html index 485b274e..e2901ad3 100644 --- a/WebRoot/view/tb/org/task_list.html +++ b/WebRoot/view/tb/org/task_list.html @@ -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 = '
'; + html += '
'; + html += '
' + 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); + } + } + });