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() } } }