master
xy 1 year ago
parent a713428e23
commit eb9a4919f1

@ -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);
}

@ -61,6 +61,8 @@
:auto-upload="false">
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<el-button style="margin-left: 10px;" size="small" type="success" @click="uploadData"></el-button>
<el-button style="margin-left: 10px;" size="small" type="primary" icon="el-icon-download" @click="downloadTemplate"></el-button>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件</div>
</el-upload>
</template>
@ -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)
}
})
}
},
};
</script>

@ -73,6 +73,8 @@
:auto-upload="false">
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<el-button style="margin-left: 10px;" size="small" type="success" @click="uploadData"></el-button>
<el-button style="margin-left: 10px;" size="small" type="primary" icon="el-icon-download" @click="downloadTemplate"></el-button>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件</div>
</el-upload>
</template>
@ -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)
}
})
}
},
};
</script>

@ -67,6 +67,8 @@
:auto-upload="false">
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<el-button style="margin-left: 10px;" size="small" type="success" @click="uploadData"></el-button>
<el-button style="margin-left: 10px;" size="small" type="primary" icon="el-icon-download" @click="downloadTemplate"></el-button>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件</div>
</el-upload>
</template>
@ -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)
}
})
}
},
};
</script>

@ -64,6 +64,8 @@
:auto-upload="false">
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<el-button style="margin-left: 10px;" size="small" type="success" @click="uploadData"></el-button>
<el-button style="margin-left: 10px;" size="small" type="primary" icon="el-icon-download" @click="downloadTemplate"></el-button>
<div slot="tip" class="el-upload__tip">只能上传xls/xlsx文件</div>
</el-upload>
</template>
@ -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)
}
})
}
},
};
</script>

Loading…
Cancel
Save