Commit 5dfe53c068122568774ec45625a41fe9c7bdc1ab
1 parent
51decd36
Exists in
master
导出功能
Showing
2 changed files
with
77 additions
and
0 deletions
Show diff stats
frontend/front/src/components/tableSlot/zczhkyeqExport/index.vue
0 → 100644
... | ... | @@ -0,0 +1,68 @@ |
1 | +<template> | |
2 | + <div> | |
3 | + <el-button @click="onClick">正常账户可用余额导出</el-button> | |
4 | + <el-dialog title="正常账户可用余额导出" :visible.sync="dialogVisible" width="30%"> | |
5 | + <el-form> | |
6 | + <el-form-item label="日期"> | |
7 | + <el-date-picker v-model="date" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" | |
8 | + style="width: calc(100% - 80px);"></el-date-picker> | |
9 | + </el-form-item> | |
10 | + </el-form> | |
11 | + <span slot="footer"> | |
12 | + <el-button @click="dialogVisible = false">取 消</el-button> | |
13 | + <el-button type="primary" @click="onSubmit">导 出</el-button> | |
14 | + </span> | |
15 | + </el-dialog> | |
16 | + </div> | |
17 | +</template> | |
18 | +<script> | |
19 | + | |
20 | +import { exportYchzb } from '@/api/service/current' | |
21 | + | |
22 | +export default { | |
23 | + data() { | |
24 | + return { | |
25 | + dialogVisible: false, | |
26 | + date: null | |
27 | + }; | |
28 | + }, | |
29 | + created() { | |
30 | + let today = new Date(); | |
31 | + today.setDate(today.getDate() - 1); | |
32 | + let year = today.getFullYear(); | |
33 | + let month = ("0" + (today.getMonth() + 1)).slice(-2); | |
34 | + let day = ("0" + today.getDate()).slice(-2); | |
35 | + this.date = year + '-' + month + '-' + day; | |
36 | + }, | |
37 | + methods: { | |
38 | + onClick() { | |
39 | + this.dialogVisible = true; | |
40 | + }, | |
41 | + onSubmit() { | |
42 | + if (!this.date) {this.$message.error('请选择日期!');return false;} | |
43 | + exportYchzb(this.date).then(_ref => { | |
44 | + let {data, headers} = _ref; | |
45 | + // 附件下载 | |
46 | + const blob = new Blob([data]); | |
47 | + // 附件下载 | |
48 | + const fileName = decodeURIComponent(headers['content-disposition'].split(';')[1].split('filename=')[1]); | |
49 | + saveAs(blob, fileName); | |
50 | + }).catch(err => { | |
51 | + this.$message.error(`模板下载失败:${err}`); | |
52 | + }); | |
53 | + } | |
54 | + } | |
55 | +} | |
56 | +</script> | |
57 | + | |
58 | +<style scoped lang='scss'> | |
59 | +::v-deep { | |
60 | + .el-dialog__footer { | |
61 | + text-align: center !important; | |
62 | + | |
63 | + .el-button { | |
64 | + margin-left: 20px; | |
65 | + } | |
66 | + } | |
67 | +} | |
68 | +</style> | ... | ... |