Commit 1d21a7d0 by 宋珺琪

导出调整为接口

parent 2a7ff3bb
...@@ -5,12 +5,14 @@ ...@@ -5,12 +5,14 @@
<div style="display: flex"> <div style="display: flex">
<download-excel class="export-excel-wrapper" :data="scoreTj" :fields="json_fields" <download-excel class="export-excel-wrapper" :data="scoreTj" :fields="json_fields"
name="单位分数统计.xls"> name="单位分数统计.xls">
<el-button></el-button> <el-button>单位导</el-button>
</download-excel> </download-excel>
<el-button @click="personExport('null')">人员导出</el-button>
</div> </div>
<section class="content-el"> <section class="content-el">
<el-table ref="filterTable" :data="scoreTj" v-loading="loading"> <el-table ref="filterTable" :data="scoreTj" v-loading="loading">
<el-table-column prop="clazz" label="单位" width="400" show-overflow-tooltip="true"> <el-table-column prop="clazz" label="单位" width="400" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click="handleClazzClick(scope.row)" style="padding:0"> <el-button @click="handleClazzClick(scope.row)" style="padding:0">
{{ scope.row.clazz }} {{ scope.row.clazz }}
...@@ -30,6 +32,7 @@ ...@@ -30,6 +32,7 @@
class="dialogLand" class="dialogLand"
append-to-body append-to-body
> >
<el-button type="primary" size="medium" @click="personExport(clazz.clazz)" >导 出</el-button>
<el-table ref="filterTable" :data="scoreTjXq" v-loading="loadingDialog"> <el-table ref="filterTable" :data="scoreTjXq" v-loading="loadingDialog">
<el-table-column prop="studentId" label="ip" width="150"></el-table-column> <el-table-column prop="studentId" label="ip" width="150"></el-table-column>
<el-table-column prop="studentName" label="姓名" width="150"></el-table-column> <el-table-column prop="studentName" label="姓名" width="150"></el-table-column>
...@@ -49,12 +52,6 @@ ...@@ -49,12 +52,6 @@
:total="pagination.total"> :total="pagination.total">
</el-pagination> </el-pagination>
</el-row> </el-row>
<div style="display: flex;justify-content: end">
<download-excel class="export-excel-wrapper" :data="scoreTjXq" :fields="json_fieldsTwo"
name="单位分数统计.xls">
<el-button type="primary" size="medium">导 出</el-button>
</download-excel>
</div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
...@@ -102,6 +99,27 @@ export default { ...@@ -102,6 +99,27 @@ export default {
this.loading = true //数据加载则遮罩表格 this.loading = true //数据加载则遮罩表格
}, },
methods: { methods: {
//导出
personExport(text){
this.$axios(`/api/listAllStudentScoreTj/${text}`,{
loading: true,
loadingText: "正在导出...",
responseType: "blob",
}).then((res) => {
if (!res.data) return;
console.log(res)
const blob = new Blob([res.data], {
type: "application/vnd.ms-excel",
});
const href = URL.createObjectURL(blob); //创建新的URL表示指定的blob对象
console.log(href);
const a = document.createElement("a"); //创建a标签
a.style.display = "none";
a.href = href; // 指定下载链接
a.download = "人员导出"; //指定下载文件名
a.click(); //触发下载
});
},
getScoreTj() { getScoreTj() {
let studentId = this.$cookies.get("cid") let studentId = this.$cookies.get("cid")
this.$axios(`/api/scoreDwTj`).then(res => { this.$axios(`/api/scoreDwTj`).then(res => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment