From eb9a4919f11a3ca1ef2cdd3251556272bed04c07 Mon Sep 17 00:00:00 2001
From: xy <271556543@qq.com>
Date: Wed, 26 Mar 2025 10:23:28 +0800
Subject: [PATCH] init
---
src/utils/index.js | 13 +++++++++++++
.../MiddleSchoolIndicator.vue | 16 +++++++++++++++-
src/views/School/School.vue | 16 ++++++++++++++--
src/views/Score/Score.vue | 16 +++++++++++++++-
src/views/Specialty/Specialty.vue | 18 ++++++++++++++++--
5 files changed, 73 insertions(+), 6 deletions(-)
diff --git a/src/utils/index.js b/src/utils/index.js
index 13a8ced..e50044e 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -183,3 +183,16 @@ export function formatFileSize(size) {
return temp.toFixed(2) + "GB";
}
}
+
+export function download(url) {
+ var downloadLink = document.createElement("a");
+ downloadLink.href = url;
+ downloadLink.download = name; // 设置下载文件的名称
+ downloadLink.target = "_blank";
+ // 将下载链接添加到页面并模拟点击下载
+ document.body.appendChild(downloadLink);
+ downloadLink.click();
+
+ // 清理下载链接
+ document.body.removeChild(downloadLink);
+}
diff --git a/src/views/MiddleSchoolIndicator/MiddleSchoolIndicator.vue b/src/views/MiddleSchoolIndicator/MiddleSchoolIndicator.vue
index 6e679b6..fe7f9e8 100644
--- a/src/views/MiddleSchoolIndicator/MiddleSchoolIndicator.vue
+++ b/src/views/MiddleSchoolIndicator/MiddleSchoolIndicator.vue
@@ -61,6 +61,8 @@
:auto-upload="false">
选取文件
上传到服务器
+ 模版下载
+
只能上传xls/xlsx文件
@@ -314,7 +316,7 @@ import VxeUI from "vxe-pc-ui";
import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings";
-import { deepCopy } from "@/utils";
+import {deepCopy, download as downloadByTA} from "@/utils";
import { download } from "@/utils/downloadRequest";
import {
destroy,
@@ -327,6 +329,7 @@ import axios from "axios";
import { getToken } from "@/utils/auth";
import { index as schoolIndex } from "@/api/school/school";
+import {getparameter} from "@/api/system/dictionary";
export default {
name: "MiddleSchoolIndicator",
@@ -607,6 +610,17 @@ export default {
this.loading = false;
}
},
+
+ downloadTemplate() {
+ getparameter({
+ number: 'download_url'
+ }).then(({ detail }) => {
+ const url = detail?.find(i => i.value === 'middle_school_indicator')?.remark
+ if (url) {
+ downloadByTA(url)
+ }
+ })
+ }
},
};
diff --git a/src/views/School/School.vue b/src/views/School/School.vue
index 683b242..8cda387 100644
--- a/src/views/School/School.vue
+++ b/src/views/School/School.vue
@@ -73,6 +73,8 @@
:auto-upload="false">
选取文件
上传到服务器
+ 模版下载
+
只能上传xls/xlsx文件
@@ -395,7 +397,7 @@ import RichTextModal from "@/components/RichTextModal/index.vue";
import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings";
-import { deepCopy } from "@/utils";
+import { deepCopy, download as downloadByTA } from "@/utils";
import { destroy, index, save } from "@/api/school/school";
import AddSchool from "./components/AddSchool.vue";
import ShowSchool from "./components/ShowSchool.vue";
@@ -495,7 +497,6 @@ export default {
},
},
created() {
- console.log(this.$route)
this.select['filter[3][value]'] = this.$route.meta?.params?.from
this.getArea();
this.getSchoolType();
@@ -733,6 +734,17 @@ export default {
this.loading = false;
}
},
+
+ downloadTemplate() {
+ getparameter({
+ number: 'download_url'
+ }).then(({ detail }) => {
+ const url = detail?.find(i => i.value === (this.$route.meta?.params?.from == 1 ? 'school' : 'independent_school'))?.remark
+ if (url) {
+ downloadByTA(url)
+ }
+ })
+ }
},
};
diff --git a/src/views/Score/Score.vue b/src/views/Score/Score.vue
index 374efcd..7547b2f 100644
--- a/src/views/Score/Score.vue
+++ b/src/views/Score/Score.vue
@@ -67,6 +67,8 @@
:auto-upload="false">
选取文件
上传到服务器
+ 模版下载
+
只能上传xls/xlsx文件
@@ -292,7 +294,7 @@ import VxeUI from "vxe-pc-ui";
import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings";
-import { deepCopy } from "@/utils";
+import {deepCopy, download as downloadByTA} from "@/utils";
import { download } from "@/utils/downloadRequest";
import { destroy, index, save } from "@/api/score/score";
import AddScore from "./components/AddScore.vue";
@@ -301,6 +303,7 @@ import axios from "axios";
import { getToken } from "@/utils/auth";
import { index as areaIndex } from "@/api/area/area";
import { index as schoolIndex } from "@/api/school/school";
+import {getparameter} from "@/api/system/dictionary";
export default {
name: "Score",
@@ -614,6 +617,17 @@ export default {
this.loading = false;
}
},
+
+ downloadTemplate() {
+ getparameter({
+ number: 'download_url'
+ }).then(({ detail }) => {
+ const url = detail?.find(i => i.value === 'score')?.remark
+ if (url) {
+ downloadByTA(url)
+ }
+ })
+ }
},
};
diff --git a/src/views/Specialty/Specialty.vue b/src/views/Specialty/Specialty.vue
index c8351b5..ff9c3dc 100644
--- a/src/views/Specialty/Specialty.vue
+++ b/src/views/Specialty/Specialty.vue
@@ -64,6 +64,8 @@
:auto-upload="false">
选取文件
上传到服务器
+ 模版下载
+
只能上传xls/xlsx文件
@@ -256,7 +258,7 @@ import VxeUI from "vxe-pc-ui";
import { authMixin } from "@/mixin/authMixin";
import { uploadSize } from "@/settings";
-import { deepCopy } from "@/utils";
+import {deepCopy, download as downloadByTA, download as downloadByA} from "@/utils";
import { download } from "@/utils/downloadRequest";
import { destroy, index, save } from "@/api/specialty/specialty";
import AddSpecialty from "./components/AddSpecialty.vue";
@@ -265,7 +267,8 @@ import axios from "axios";
import { getToken } from "@/utils/auth";
import { index as schoolIndex } from "@/api/school/school";
-import {index as areaIndex} from "@/api/area/area";
+import { index as areaIndex} from "@/api/area/area";
+import {getparameter} from "@/api/system/dictionary";
export default {
name: "Specialty",
@@ -568,6 +571,17 @@ export default {
this.loading = false;
}
},
+
+ downloadTemplate() {
+ getparameter({
+ number: 'download_url'
+ }).then(({ detail }) => {
+ const url = detail?.find(i => i.value === 'specialty')?.remark
+ if (url) {
+ downloadByTA(url)
+ }
+ })
+ }
},
};