From 169df167e7f0a658506febe59926318ccd5306cd Mon Sep 17 00:00:00 2001
From: GuLiMmo <2820890765@qq.com>
Date: Fri, 12 Jan 2024 09:09:37 +0800
Subject: [PATCH] 新增导出
---
src/views/evaluate/components/secondRoundResult.vue | 42 +++++++++++++++++++++++++++++++++++++-----
1 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/src/views/evaluate/components/secondRoundResult.vue b/src/views/evaluate/components/secondRoundResult.vue
index a4300d2..c27705a 100644
--- a/src/views/evaluate/components/secondRoundResult.vue
+++ b/src/views/evaluate/components/secondRoundResult.vue
@@ -1,5 +1,8 @@
<template>
<template v-if="!type()">
+ <div class="export_xlsx">
+ <el-button type="success" plain @click="handleExport">导出当前数据</el-button>
+ </div>
<ul class="type-list">
<li class="type-item">
<div class="title">类别</div>
@@ -26,21 +29,29 @@
</ul>
<el-dialog v-model="dialogParams.visible" :title="dialogParams.title">
<avue-crud :option="dialogOption" :table-loading="dialogLoading" :data="dialogParams.data" @on-load="onLoad">
- </avue-crud>
+ <template #menu-row>
+ <el-button type="success" plain @click="handleExport">导出当前数据</el-button>
+ </template>
+ </avue-crud>
</el-dialog>
</template>
<template v-else>
+ <div class="export_xlsx">
+ <el-button type="success" plain @click="handleExport">导出当前数据</el-button>
+ </div>
<avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page"
@current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
- <template #menu-left>
- <el-button type="success" plain icon="el-icon-download" @click="handleExport">导出</el-button>
- </template>
</avue-crud>
</template>
</template>
<script>
import { getFinallyResult, getFinallyTypeResult } from '@/api/evaluate/evaluateTask'
+import { exportBlob } from "@/api/common";
+import { downloadXls } from "@/utils/util";
+import { dateNow } from "@/utils/date";
+import NProgress from 'nprogress';
+import 'nprogress/nprogress.css';
export default {
inject: ['type'],
@@ -180,10 +191,27 @@
const { category, resultList } = result
this.dialogParams = {
visible: true,
- title: `最终结果(${category.categoryName })`,
+ title: `最终结果(${category.categoryName})`,
data: resultList
}
this.dialogLoading = false
+ },
+ handleExport() {
+ const { id } = this.params.data
+ const downloadUrl = `/evaluate/evaluateCandidateResult/exportEmp/${id}`;
+ const sectionDownloadUrl = `/evaluate/evaluateCandidateResult/exportDept/${id}`;
+ this.$confirm("是否导出数据?", "提示", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning"
+ }).then(() => {
+ NProgress.start();
+ const url = this.type() ? sectionDownloadUrl : downloadUrl;
+ exportBlob(url, {}).then(res => {
+ downloadXls(res.data, `最终评优结果(${dateNow()}).xlsx`);
+ NProgress.done();
+ })
+ });
}
},
watch: {
@@ -200,6 +228,10 @@
<style lang="scss" scoped>
$borderColor: var(--el-border-color);
+.export_xlsx {
+ margin-bottom: 10px;
+}
+
.type-list {
margin: 0;
padding: 0;
--
Gitblit v1.9.3