From 4a4d8c87e741193aff4c53e3990744955c764b88 Mon Sep 17 00:00:00 2001 From: "Hiyoung.Tsui" <992896924@qq.com> Date: Thu, 19 Jul 2018 11:04:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AdminAccountList.vue | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/components/AdminAccountList.vue b/src/components/AdminAccountList.vue index f965e1d..5599c14 100644 --- a/src/components/AdminAccountList.vue +++ b/src/components/AdminAccountList.vue @@ -3,6 +3,7 @@
修改权限 + 下载所有
@@ -51,6 +52,7 @@ 返回 + 下载个人 @@ -72,6 +74,7 @@ export default { return { accountListVisible: true, accounts: [], + accountSelectedId: 0, accountPerformance: [ { label: '进度', children: [{label: '任务总数:'}, {label: '未标注:'}, {label: '标注中:'}, {label: '已完成:'}] }, { label: '图片质量', children: [{label: '准确率:'}] }, @@ -198,6 +201,7 @@ export default { }, clickAccountRow(row) { var id = row.account_id + this.accountSelectedId = id // request data var data; this.$http.get(config.apiUrl + '/accounts/performance/' + id).then(res => { @@ -232,6 +236,36 @@ export default { for (var i = 1; i <= 12; i++) { this.accountPerformance[i].children[0].label = '准确率:' } + }, + allResultDownload() { + this.$http.get(config.apiUrl + '/download/?').then(res => { + console.log(res) + this.download(res.body, 'all.csv') + }, res => { + this.$message.error(res.body.message) + // eslint-disable-next-line + console.log(res) + }) + }, + accountResultDownload() { + this.$http.get(config.apiUrl + '/download/?account_id=' + this.accountSelectedId).then(res => { + this.download(res.body, this.accountSelectedId + '.csv') + }, res => { + this.$message.error(res.body.message) + // eslint-disable-next-line + console.log(res) + }) + }, + download(data, filename) { + if (!data) return + + var url = window.URL.createObjectURL(new Blob([data])) + var link = document.createElement('a') + link.style.display = 'none' + link.href = url + link.setAttribute('download', filename) + document.body.appendChild(link) + link.click() } } }