forked from github/dataease
Merge pull request #9421 from dataease/pr@dev@fixExportData
fix(数据集): 修复数据导出中心显示问题
This commit is contained in:
commit
899e8b16d4
@ -3228,7 +3228,14 @@ export default {
|
||||
export_failed: 'Export failed',
|
||||
export_from: 'Export source',
|
||||
export_obj: 'Export object',
|
||||
export_time: 'Export time'
|
||||
export_time: 'Export time',
|
||||
sure_del_all: 'Are you sure you want to delete all export records?',
|
||||
sure_del: 'Are you sure you want to delete this export record?',
|
||||
no_failed_file: 'No failed files',
|
||||
no_file: 'No files available',
|
||||
no_task: 'No tasks available',
|
||||
download_all: 'Download All',
|
||||
download: 'Download'
|
||||
},
|
||||
link_ticket: {
|
||||
require: 'Require',
|
||||
|
@ -3220,7 +3220,14 @@ export default {
|
||||
export_failed: '匯出失敗',
|
||||
export_from: '匯出來源',
|
||||
export_obj: '匯出對象',
|
||||
export_time: '匯出時間'
|
||||
export_time: '匯出時間',
|
||||
sure_del_all: '確定刪除全部導出記錄嗎?',
|
||||
sure_del: '確定刪除該導出記錄嗎?',
|
||||
no_failed_file: '暫無失敗文件',
|
||||
no_file: '暫無文件',
|
||||
no_task: '暫無任務',
|
||||
download_all: '下載',
|
||||
download: '下載'
|
||||
},
|
||||
link_ticket: {
|
||||
require: '必選',
|
||||
|
@ -3226,7 +3226,9 @@ export default {
|
||||
sure_del: '确定删除该导出记录吗?',
|
||||
no_failed_file: '暂无失败文件',
|
||||
no_file: '暂无文件',
|
||||
no_task: '暂无任务'
|
||||
no_task: '暂无任务',
|
||||
download_all: '下载全部',
|
||||
download: '下载'
|
||||
},
|
||||
link_ticket: {
|
||||
require: '必选',
|
||||
|
@ -20,6 +20,20 @@
|
||||
:name="tab.name"
|
||||
/>
|
||||
</el-tabs>
|
||||
<de-btn
|
||||
v-show="activeName === 'SUCCESS' && multipleSelection.length === 0"
|
||||
secondary
|
||||
icon="el-icon-delete"
|
||||
@click="downLoadAll"
|
||||
>{{ $t("data_export.download_all") }}
|
||||
</de-btn>
|
||||
<de-btn
|
||||
v-show="activeName === 'SUCCESS' && multipleSelection.length !== 0"
|
||||
secondary
|
||||
icon="el-icon-delete"
|
||||
@click="downLoadAll"
|
||||
>{{ $t("data_export.download") }}
|
||||
</de-btn>
|
||||
<de-btn
|
||||
v-show="multipleSelection.length === 0"
|
||||
secondary
|
||||
@ -163,6 +177,7 @@ import request from '@/utils/request'
|
||||
import { downloadFile, post } from '@/api/dataset/dataset'
|
||||
import bus from '@/utils/bus'
|
||||
import { Button } from 'element-ui'
|
||||
import { runInContext as tableData } from 'lodash'
|
||||
export default {
|
||||
mixins: [msgCfm],
|
||||
data() {
|
||||
@ -328,6 +343,39 @@ export default {
|
||||
this.drawerLoading = false
|
||||
})
|
||||
},
|
||||
downLoadAll() {
|
||||
if (this.multipleSelection.length === 0) {
|
||||
this.tableData.forEach(item => {
|
||||
downloadFile(item.id).then((res) => {
|
||||
const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
|
||||
const link = document.createElement('a')
|
||||
link.style.display = 'none'
|
||||
link.href = URL.createObjectURL(blob)
|
||||
link.download = item.fileName // 下载的文件名
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
}).finally(() => {
|
||||
this.exportDatasetLoading = false
|
||||
})
|
||||
})
|
||||
return
|
||||
}
|
||||
this.multipleSelection.map((ele) => {
|
||||
downloadFile(ele.id).then((res) => {
|
||||
const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
|
||||
const link = document.createElement('a')
|
||||
link.style.display = 'none'
|
||||
link.href = URL.createObjectURL(blob)
|
||||
link.download = ele.fileName // 下载的文件名
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
}).finally(() => {
|
||||
this.exportDatasetLoading = false
|
||||
})
|
||||
})
|
||||
},
|
||||
downloadClick(item) {
|
||||
downloadFile(item.id).then((res) => {
|
||||
const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
|
||||
@ -354,15 +402,28 @@ export default {
|
||||
)
|
||||
},
|
||||
deleteField(item) {
|
||||
request({
|
||||
url: '/exportCenter/delete/' + item.id,
|
||||
method: 'get'
|
||||
}).then(
|
||||
(res) => {
|
||||
this.handleClick()
|
||||
}
|
||||
)
|
||||
this.openMessageSuccess('commons.delete_success')
|
||||
this.$confirm(this.$t('data_export.sure_del'), '', {
|
||||
confirmButtonText: this.$t('commons.delete'),
|
||||
cancelButtonText: this.$t('commons.cancel'),
|
||||
cancelButtonClass: 'de-confirm-fail-btn de-confirm-fail-cancel',
|
||||
confirmButtonClass: 'de-confirm-fail-btn de-confirm-fail-confirm',
|
||||
customClass: 'de-confirm de-confirm-fail',
|
||||
iconClass: 'el-icon-warning'
|
||||
})
|
||||
.then(() => {
|
||||
request({
|
||||
url: '/exportCenter/delete/' + item.id,
|
||||
method: 'get'
|
||||
}).then(
|
||||
(res) => {
|
||||
this.openMessageSuccess('commons.delete_success')
|
||||
this.handleClick()
|
||||
}
|
||||
)
|
||||
})
|
||||
.catch(() => {
|
||||
this.$info(this.$t('commons.delete_cancel'))
|
||||
})
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val
|
||||
@ -392,6 +453,7 @@ export default {
|
||||
true
|
||||
).then(
|
||||
(res) => {
|
||||
this.openMessageSuccess('commons.delete_success')
|
||||
this.handleClick()
|
||||
}
|
||||
)
|
||||
@ -399,7 +461,6 @@ export default {
|
||||
.catch(() => {
|
||||
this.$info(this.$t('commons.delete_cancel'))
|
||||
})
|
||||
this.openMessageSuccess('commons.delete_success')
|
||||
return
|
||||
}
|
||||
|
||||
@ -418,6 +479,7 @@ export default {
|
||||
true
|
||||
).then(
|
||||
(res) => {
|
||||
this.openMessageSuccess('commons.delete_success')
|
||||
this.handleClick()
|
||||
}
|
||||
)
|
||||
@ -425,7 +487,6 @@ export default {
|
||||
.catch(() => {
|
||||
this.$info(this.$t('commons.delete_cancel'))
|
||||
})
|
||||
this.openMessageSuccess('commons.delete_success')
|
||||
},
|
||||
|
||||
handleClose() {
|
||||
|
Loading…
Reference in New Issue
Block a user