|
@@ -356,6 +356,7 @@ import obj from "@/assets/images/obj.jpg";
|
|
|
import osgb from "@/assets/images/osgb.jpg";
|
|
|
import { ElMessage, ElMessageBox, genFileId } from "element-plus";
|
|
|
import { ui18n } from "@/i18n";
|
|
|
+import saveAs from "@/util/file-serve";
|
|
|
import { windowOpen } from "@/util";
|
|
|
import { getUrlData } from "@/store/user";
|
|
|
import groupingSvg from "@/assets/images/grouping.svg";
|
|
@@ -643,9 +644,23 @@ const floadileUrl = (record) => {
|
|
|
dialogDowm.value.show = true;
|
|
|
// return windowOpen({url: record.fileUrl, library: true});
|
|
|
} else {
|
|
|
- hanleDown();
|
|
|
+ dialogDowm.value.url =record.fileUrl;
|
|
|
+ var suffix = record.fileUrl && record.fileUrl.match(/.[^.]+$/)[0] || '.docx';//.txt
|
|
|
+ console.log("downloadFile", record, dialogDowm.value.url);
|
|
|
+ downloadFile(dialogDowm.value.url, record.name+suffix);
|
|
|
}
|
|
|
};
|
|
|
+function downloadFile(sourceUrl, fileName,) {
|
|
|
+ console.log("downloadFile", sourceUrl, fileName + getExtension(sourceUrl));
|
|
|
+ saveAs(getUrlSrc({type: 102}) +'/'+ sourceUrl, fileName);
|
|
|
+}
|
|
|
+function getExtension (name) {
|
|
|
+ try {
|
|
|
+ return name.substring(name.lastIndexOf("."))
|
|
|
+ } catch (error) {
|
|
|
+ return ".docx"
|
|
|
+ }
|
|
|
+}
|
|
|
const handleExceed = (files) => {
|
|
|
const file = files[0];
|
|
|
if (!beforeUpload(file)) {
|
|
@@ -703,7 +718,8 @@ const handleCurrentChange = (newPage) => {
|
|
|
initData();
|
|
|
};
|
|
|
// 下载资源
|
|
|
-const hanleDown = () => {
|
|
|
+const hanleDown = (record) => {
|
|
|
+ var suffix = record.filesUrl && record.filesUrl.match(/.[^.]+$/)[0];//.txt
|
|
|
const item = dialogDowm.value.data;
|
|
|
const a = document.createElement("a");
|
|
|
a.href = dialogDowm.value.url;
|