|
|
@@ -292,7 +292,11 @@ function actionRenderer(e) {
|
|
|
html += getGridBtn("edit", "修改物流", "changeExpress('" + record.ctid + "')");
|
|
|
html += getGridBtn("dis", "问题反馈", "setIssueContent('" + record.ctid + "')");
|
|
|
if (!!record.attachments) {
|
|
|
- html += getGridBtn("view", "下载附件", "downAtta('" + record.attachments + "')");
|
|
|
+ let url = record.attachments;
|
|
|
+ if (url.indexOf("http:") == -1 && url.indexOf("https:") == -1) {
|
|
|
+ url = "https://dfdiyfile.oss-cn-fuzhou.aliyuncs.com/" + url;
|
|
|
+ }
|
|
|
+ html += getGridBtn("view", "下载附件", "downAtta('" + url + "')");
|
|
|
}
|
|
|
html += getGridBtn("word", "重新打单", "rePlaceOrder('" + record.ctid + "','" + record.seller_memo + "')");
|
|
|
|
|
|
@@ -315,13 +319,50 @@ function saveIssueFn() {
|
|
|
});
|
|
|
}
|
|
|
function downAtta(url) {
|
|
|
- if (!!url) {
|
|
|
- const link = document.createElement('a');
|
|
|
- link.href = url;
|
|
|
- document.body.appendChild(link);
|
|
|
- link.click();
|
|
|
- document.body.removeChild(link);
|
|
|
+ var pdata = "url=" + url;
|
|
|
+
|
|
|
+ var xhr = new XMLHttpRequest(); // 创建XMLHttpRequest实例
|
|
|
+ xhr.open('POST', "../plug/uploadFileOss.aspx"); // 打开下载文件请求
|
|
|
+ xhr.responseType = "blob";
|
|
|
+ xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
|
|
|
+ xhr.onloadstart = function () {
|
|
|
+ };
|
|
|
+ xhr.onprogress = function (event) {
|
|
|
+
|
|
|
+ };
|
|
|
+ xhr.onerror = function () {
|
|
|
+ progressHide();
|
|
|
}
|
|
|
+ xhr.ontimeout = function () {
|
|
|
+ progressHide();
|
|
|
+ }
|
|
|
+ xhr.onloadend = function () {
|
|
|
+ if (xhr.status === 200) {
|
|
|
+ try {
|
|
|
+ let blob = xhr.response;
|
|
|
+ let fileName = xhr.getResponseHeader("Content-Disposition").split('filename=')[1];
|
|
|
+ fileName = decodeURIComponent(fileName);
|
|
|
+
|
|
|
+ let url = URL.createObjectURL(blob);
|
|
|
+ let a = document.createElement('a');
|
|
|
+ a.href = url;
|
|
|
+ a.download = fileName;
|
|
|
+ document.body.appendChild(a);
|
|
|
+ a.click();
|
|
|
+ document.body.removeChild(a);
|
|
|
+ window.URL.revokeObjectURL(url);
|
|
|
+ } catch (e) {
|
|
|
+ progressHide();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+ progressHide();
|
|
|
+
|
|
|
+ };
|
|
|
+ xhr.send(pdata); // 发送下载文件请求
|
|
|
}
|
|
|
|
|
|
function onBeforeOpen(e) {
|