|
|
@@ -158,6 +158,9 @@ function actionRenderer(e) {
|
|
|
}
|
|
|
html += getGridBtn("view", "下载附件", "downAddressFile('" + url + "')");
|
|
|
}
|
|
|
+ if (record.authCount > 0) {
|
|
|
+ html += getGridBtn("view", "授权下载", "downAuth('" + record.tid + "','" + record.ctid + "')");
|
|
|
+ }
|
|
|
return html;
|
|
|
}
|
|
|
|
|
|
@@ -676,4 +679,56 @@ function downAddressFile(url) {
|
|
|
xhr.send(pdata); // 发送下载文件请求
|
|
|
}
|
|
|
|
|
|
+function downAuth(ctid, tid) {
|
|
|
+ postAjax("getCellFile", { tid: tid, ctid: ctid, type: "AUTH_FILE" }, function (data) {
|
|
|
+ for (var i = 0; i < data.length; i++) {
|
|
|
+ downAttaLocal(data[i].url)
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+function downAttaLocal(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); // 发送下载文件请求
|
|
|
+}
|