|
|
@@ -18,7 +18,7 @@
|
|
|
<el-button
|
|
|
link
|
|
|
type="primary"
|
|
|
- @click="openFile(scope.row.downloadUrl)"
|
|
|
+ @click="openFile(scope.row.downloadUrl, scope.row.suffixName)"
|
|
|
>
|
|
|
{{ scope.row.fileName }}
|
|
|
</el-button>
|
|
|
@@ -92,20 +92,34 @@ function pageChange(e) {
|
|
|
currentPage.value = e;
|
|
|
getShippingNoticeList();
|
|
|
}
|
|
|
-
|
|
|
-function openFile(baseURL) {
|
|
|
+let types = [
|
|
|
+ { type: "doc", application: "application/msword" },
|
|
|
+ {
|
|
|
+ type: "docx",
|
|
|
+ application:
|
|
|
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
|
+ },
|
|
|
+ { type: "pdf", application: "application/pdf" },
|
|
|
+];
|
|
|
+function openFile(baseURL, suffixName) {
|
|
|
axios({
|
|
|
baseURL,
|
|
|
withCredentials: true,
|
|
|
timeout: 36000,
|
|
|
responseType: "blob",
|
|
|
}).then((res) => {
|
|
|
- const blob = new window.Blob([res.data], {
|
|
|
- type: "application/pdf",
|
|
|
- });
|
|
|
- const href = URL.createObjectURL(blob);
|
|
|
- pdfUrl.value = href;
|
|
|
- pdfModal.value = true;
|
|
|
+ if (suffixName.toLowerCase() == "pdf") {
|
|
|
+ const blob = new window.Blob([res.data], {
|
|
|
+ type: "application/pdf",
|
|
|
+ });
|
|
|
+ const href = URL.createObjectURL(blob);
|
|
|
+ pdfUrl.value = href;
|
|
|
+ pdfModal.value = true;
|
|
|
+ } else {
|
|
|
+ let a = document.createElement("a");
|
|
|
+ a.setAttribute("href", baseURL);
|
|
|
+ a.click();
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
|