Merge pull request #9947 from dataease/pr@dev-v2_export_data

feat: 新增导出中心功能
This commit is contained in:
taojinlong 2024-05-29 15:25:41 +08:00 committed by GitHub
commit 1055c7da17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 9 deletions

View File

@ -203,14 +203,13 @@ const downloadViewDetails = () => {
}
exportLoading.value = true
exportExcelDownload(chart, () => {
console.log('aa')
openMessageLoading(exportData)
exportLoading.value = false
})
}
const exportData = () => {
// bus.$emit('data-export-center')
useEmitt().emitter.emit('data-export-center')
}
const openMessageLoading = cb => {

View File

@ -51,9 +51,6 @@ const handleClose = () => {
drawer.value = false
clearInterval(timer)
}
onMounted(() => {
eventBus.on('task-export-topic-call', taskExportTopicCall)
})
onUnmounted(() => {
clearInterval(timer)
@ -156,6 +153,7 @@ const taskExportTopicCall = task => {
'success',
callbackExport
)
return
}
if (JSON.parse(task).exportStatus === 'FAILED') {
openMessageLoading(JSON.parse(task).exportFromName + ' 导出失败,前往', 'error', callbackExport)
@ -329,6 +327,8 @@ const delAll = () => {
})
}
eventBus.on('task-export-topic-call', taskExportTopicCall)
defineExpose({
init
})

View File

@ -23,10 +23,17 @@ export default {
if (!isLoginStatus()) {
return
}
if (stompClient !== null && stompClient != undefined && stompClient.connected) {
if (stompClient && stompClient.connected) {
return
}
const socket = new SockJS(basePath + '/websocket?userId=' + wsCache.get('user.uid'))
let prefix = '/'
if (window.DataEaseBi?.baseUrl) {
prefix = window.DataEaseBi.baseUrl
} else {
const href = window.location.href
prefix = href.substring(0, href.indexOf('#'))
}
const socket = new SockJS(prefix + 'websocket?userId=' + wsCache.get('user.uid'))
stompClient = Stomp.over(socket)
const heads = {
userId: wsCache.get('user.uid')
@ -47,7 +54,7 @@ export default {
}
function disconnect() {
if (stompClient !== null && stompClient != undefined && !stompClient.connected) {
if (stompClient && stompClient.connected) {
stompClient.disconnect(
function () {
console.log('断开连接')
@ -66,7 +73,7 @@ export default {
disconnect()
return
}
if (stompClient !== null && stompClient != undefined && !stompClient.connected) {
if (!stompClient || !stompClient.connected) {
connection()
}
}, 5000)