Pārlūkot izejas kodu

代下单新增授权文件下载

zhuyiyi 1 mēnesi atpakaļ
vecāks
revīzija
a45fb477c2
2 mainītis faili ar 57 papildinājumiem un 4 dzēšanām
  1. 0 4
      SiteCore/Handler/sync.order.cs
  2. 57 0
      Web/EDelivery/js/WaitingOrder.js

+ 0 - 4
SiteCore/Handler/sync.order.cs

@@ -2616,10 +2616,6 @@ namespace SiteCore.Handler
                         if (userid == 3542 && entity.seller_memo != "")
                         {
                             string userPost = CurrentUser.UserPost.Post.Code;
-                            if (CurrentUser.UserID == 73)
-                            {
-                                userPost = "SysAdmin";
-                            }
                             designApiResponseVo response = designHelper.API_GetPrintData_CreateOrder(entity, userPost);
                             LogHelper.addLog(entity.ctid, 3542, "手动派单:" + response.msg, entity.OrderState);
                             if (response.msg != "设计共创:成功")

+ 57 - 0
Web/EDelivery/js/WaitingOrder.js

@@ -351,6 +351,9 @@ function actionRenderer(e) {
         html += getGridBtn("view", "付款图片", "viewPayImg('" + id + "')");
     }
     html += getGridBtn("edit", "查看报价", "GetToQuote('" + id + "')");
+    if (record.authCount > 0) {
+        html += getGridBtn("view", "授权下载", "downAuth('" + record.tid + "','" + record.ctid + "')");
+    }
     return html;
 }
 
@@ -669,4 +672,58 @@ function testMultiExport() {
     } else {
         mini.alert("请选择要下载的记录!");
     }
+}
+function downAuth(ctid, tid) {
+    postAjax("getCellFile", { tid: tid, ctid: ctid, type: "AUTH_FILE" }, function (data) {
+        for (var i = 0; i < data.length; i++) {
+            downAtta(data[i].url)
+        }
+    });
+}
+
+function downAtta(url) {
+    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); // 发送下载文件请求
 }