1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
| <template>
| <avue-crud v-model:page="page" :option="option" :table-loading="loading" :data="data" @current-change="currentChange"
| @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
| <template #menu="{ row }">
| <referrerPopover :params="{ userId: row.userId, evaluateTaskId: params.data.id }">
| <el-button type="success" icon="el-icon-view" text>推荐人预览</el-button>
| </referrerPopover>
| </template>
| <template #menu-left>
| <el-button type="success" plain icon="el-icon-download" @click="handleExport">导出当前数据</el-button>
| </template>
| </avue-crud>
| </template>
|
| <script>
| import referrerPopover from './referrerPopover.vue'
| import { getCandidateResult } 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 {
| components: {
| referrerPopover
| },
| props: {
| params: {
| type: Object,
| default: () => {
| return {
| data: {}
| }
| }
| }
| },
| data() {
| return {
| loading: true,
| query: {},
| page: {
| pageSize: 10,
| currentPage: 1,
| total: 0
| },
| option: {
| height: '400',
| calcHeight: 30,
| tip: false,
| searchShow: true,
| searchMenuSpan: 6,
| border: true,
| index: true,
| viewBtn: false,
| addBtn: false,
| editBtn: false,
| delBtn: false,
| viewBtn: false,
| header: true,
| menuWidth: 150,
| // menu: false,
| dialogClickModal: false,
| column: [
| {
| label: '姓名',
| prop: 'userName',
| type: 'input'
| },
| {
| label: '部门',
| prop: 'deptName',
| type: 'input'
| },
| {
| label: '职位',
| prop: 'postName',
| type: 'input'
| },
| {
| label: '票数',
| prop: 'voteNum',
| type: 'input',
| formatter: (_row, value) => {
| return value + '票'
| }
| },
| ]
| },
| data: []
| }
| },
| methods: {
| handleExport() {
| const { id } = this.params.data
| const downloadUrl = `/evaluate/evaluateTaskReferrer/export/${id}`;
| this.$confirm("是否导出数据?", "提示", {
| confirmButtonText: "确定",
| cancelButtonText: "取消",
| type: "warning"
| }).then(() => {
| NProgress.start();
| exportBlob(downloadUrl, {}).then(res => {
| downloadXls(res.data, `第一轮候选结果(${dateNow()}).xlsx`);
| NProgress.done();
| })
| });
| },
| currentChange(currentPage) {
| this.page.currentPage = currentPage;
| },
| sizeChange(pageSize) {
| this.page.pageSize = pageSize;
| },
| refreshChange() {
| this.onLoad(this.page, this.query);
| },
| onLoad(page, params = {}) {
| this.loading = true;
|
| const { id } = this.params.data
|
| const {
| } = this.query;
|
| let values = {
| ...this.query,
| ...params
| };
| getCandidateResult(page.currentPage, page.pageSize, id).then(res => {
| const data = res.data.data;
| this.page.total = data.total;
| this.data = data.records;
| this.loading = false;
| });
| },
| },
| watch: {
| 'params.data': {
| handler(value) {
| this.onLoad(this.page)
| },
| deep: true
| }
| }
| }
| </script>
|
| <style lang="scss" scoped></style>
|
|