中扬CRM客户关系管理系统
#
LSH
2023-12-02 afa3bc1e2f39f66f59ee9b15d6af16593acdc9a4
src/main/webapp/static/js/contract/contract.js
@@ -432,30 +432,28 @@
            headers: {'token': localStorage.getItem('token')},
            data: data,
            method: 'GET',
            xhrFields: {
                responseType: "blob" // 设置响应类型为二进制数据
            },
            success: function (res) {
                // 创建一个临时的下载链接
                const url = window.URL.createObjectURL(res);
                // 创建一个隐藏的 <a> 元素并设置下载链接
                const a = document.createElement("a");
                a.style.display = "none";
                a.href = url;
                let list = data.filepath.split(".")
                let suffix = "." + list[list.length - 1]//获取后缀名
                a.download = data.name + suffix; // 指定下载的文件名
                document.body.appendChild(a);
                // 触发点击事件以开始下载
                a.click();
                // 清理临时资源
                setTimeout(function () {
                    window.URL.revokeObjectURL(url);
                    document.body.removeChild(a);
                }, 100);
                location.href = res.data
                // // 创建一个临时的下载链接
                // const url = window.URL.createObjectURL(res);
                // // 创建一个隐藏的 <a> 元素并设置下载链接
                // const a = document.createElement("a");
                // a.style.display = "none";
                // a.href = url;
                //
                // let list = data.filepath.split(".")
                // let suffix = "." + list[list.length - 1]//获取后缀名
                // a.download = data.name + suffix; // 指定下载的文件名
                // document.body.appendChild(a);
                //
                // // 触发点击事件以开始下载
                // a.click();
                //
                // // 清理临时资源
                // setTimeout(function () {
                //     window.URL.revokeObjectURL(url);
                //     document.body.removeChild(a);
                // }, 100);
            }
        });
    }