Merge pull request #9414 from dataease/pr@dev@fixExportData

fix(数据集): 修复数据导出中心显示问题
This commit is contained in:
taojinlong 2024-04-28 17:35:52 +08:00 committed by GitHub
commit ef3be4eaf6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 78 additions and 26 deletions

View File

@ -50,7 +50,6 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
@ -375,6 +374,7 @@ public class ExportCenterService {
}
private void startViewTask(ExportTask exportTask, PanelViewDetailsRequest request) {
String dataPath = exportData_path + exportTask.getId();
File directory = new File(dataPath);
boolean isCreated = directory.mkdir();
@ -382,7 +382,6 @@ public class ExportCenterService {
try {
exportTask.setExportStatus("IN_PROGRESS");
exportTaskMapper.updateByPrimaryKey(exportTask);
findExcelData(request);
String snapshot = request.getSnapshot();
List<Object[]> details = request.getDetails();

View File

@ -545,6 +545,16 @@ export function exportExcelDownload(chart, snapshot, width, height, loadingWrapp
request.proxy = { userId: panelInfo.proxy }
}
method(request).then((res) => {
if (!token && linkToken) {
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 = excelName + '.xlsx' // 下载的文件名
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
loadingWrapper && (loadingWrapper.val = false)
callBack && callBack(res)
}).catch((error) => {

View File

@ -3220,7 +3220,12 @@ export default {
export_failed: '导出失败',
export_from: '导出来源',
export_obj: '导出对象',
export_time: '导出时间'
export_time: '导出时间',
sure_del_all: '确定删除全部导出记录吗?',
sure_del: '确定删除该导出记录吗?',
no_failed_file: '暂无失败文件',
no_file: '暂无文件',
no_task: '暂无任务'
},
link_ticket: {
require: '必选',

View File

@ -62,7 +62,7 @@
<div class="name-content">
<div class="fileName">{{ scope.row.fileName }}</div>
<div
v-if="activeName==='FAILED'"
v-if="scope.row.exportStatus==='FAILED'"
class="failed"
>{{ $t("data_export.export_failed") }}</div>
<div
@ -72,11 +72,11 @@
</div>
</div>
<div
v-if="activeName==='FAILED'"
v-if="scope.row.exportStatus==='FAILED'"
class="red-line"
/>
<el-progress
v-if="activeName==='IN_PROGRESS'"
v-if="scope.row.exportStatus==='IN_PROGRESS'"
:percentage="+scope.row.exportPogress"
/>
</template>
@ -212,7 +212,7 @@ export default {
this.timer = setInterval(() => {
if (this.activeName === 'IN_PROGRESS') {
post(
'/exportCenter/exportTasks/' + this.activeName, {}, true
'/exportCenter/exportTasks/' + this.activeName, {}, false
).then(
(res) => {
this.tabList.forEach(item => {
@ -286,6 +286,14 @@ export default {
bus.$emit('data-export-center')
},
handleClick() {
if (this.activeName === 'ALL') {
this.description = this.$t('data_export.no_file')
} else if (this.activeName === 'FAILED') {
this.description = this.$t('data_export.no_failed_file')
} else {
this.description = this.$t('data_export.no_task')
}
this.tableData = []
this.drawerLoading = true
post(
@ -369,27 +377,54 @@ export default {
},
delAll() {
if (this.multipleSelection.length === 0) {
post(
'/exportCenter/deleteAll/' + this.activeName,
this.multipleSelection.map((ele) => ele.id),
true
).then(
(res) => {
this.handleClick()
}
)
this.$confirm(this.$t('data_export.sure_del_all'), '', {
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(() => {
post(
'/exportCenter/deleteAll/' + this.activeName,
this.multipleSelection.map((ele) => ele.id),
true
).then(
(res) => {
this.handleClick()
}
)
})
.catch(() => {
this.$info(this.$t('commons.delete_cancel'))
})
this.openMessageSuccess('commons.delete_success')
return
}
post(
'/exportCenter/delete',
this.multipleSelection.map((ele) => ele.id),
true
).then(
(res) => {
this.handleClick()
}
)
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(() => {
post(
'/exportCenter/delete',
this.multipleSelection.map((ele) => ele.id),
true
).then(
(res) => {
this.handleClick()
}
)
})
.catch(() => {
this.$info(this.$t('commons.delete_cancel'))
})
this.openMessageSuccess('commons.delete_success')
},

View File

@ -215,7 +215,7 @@
:key="item.id"
:label="item.nameAlias"
:value="item.id"
:disabled="!item.driverClass"
:disabled="disabledDriver(item)"
/>
</el-select>
</el-form-item>
@ -1122,6 +1122,9 @@ export default {
}
})
},
disabledDriver(item) {
return !item.driverClass && item.id.indexOf('default') === -1
},
reloadStatus(statusMap = {}) {
this.form.apiConfiguration.forEach(ele => {
ele.status = statusMap[ele.name] || ele.status