feat: 新增导出中心功能

This commit is contained in:
taojinlong 2024-05-27 19:04:59 +08:00
parent 10cc106874
commit 50eaa9218a
8 changed files with 33 additions and 23 deletions

View File

@ -83,6 +83,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>com.fit2cloud</groupId>
<artifactId>quartz-spring-boot-starter</artifactId>

View File

@ -38,6 +38,7 @@
"lodash-es": "^4.17.21",
"mathjs": "^11.6.0",
"mitt": "^3.0.0",
"net": "^1.0.2",
"normalize.css": "^8.0.1",
"nprogress": "^0.2.0",
"pinia": "^2.0.32",
@ -63,6 +64,8 @@
"@types/element-resize-detector": "^1.1.3",
"@types/jquery": "^3.5.16",
"@types/lodash-es": "^4.17.6",
"@types/sockjs-client": "^1.5.4",
"@types/stompjs": "^2.3.9",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
"@vitejs/plugin-vue": "^4.0.0",
@ -80,6 +83,8 @@
"postcss-scss": "^4.0.6",
"prettier": "^2.8.4",
"rimraf": "^4.1.2",
"sockjs-client": "^1.6.1",
"stompjs": "^2.3.3",
"stylelint": "^15.2.0",
"stylelint-config-html": "^1.1.0",
"stylelint-config-recommended": "^10.0.1",
@ -96,6 +101,7 @@
"vite-plugin-style-import-secondary": "^2.0.0",
"vite-plugin-stylelint": "^4.2.0",
"vite-plugin-svg-icons": "^2.0.1",
"vue-tsc": "^1.0.24"
"vue-tsc": "^1.0.24",
"xss": "^1.0.14"
}
}

View File

@ -313,12 +313,7 @@ const showBarTooltipPosition = computed(() => {
}
})
const exportData = () => {
// bus.$emit('data-export-center')
}
const openMessageLoading = cb => {
console.log('bb')
const iconClass = `el-icon-loading`
const customClass = `de-message-loading de-message-export`
ElMessage({
@ -348,13 +343,17 @@ const openMessageLoading = cb => {
})
}
const callbackExport = () => {
useEmitt().emitter.emit('data-export-center')
}
const exportAsExcel = () => {
const viewDataInfo = dvMainStore.getViewDataDetails(element.value.id)
const chartExtRequest = dvMainStore.getLastViewRequestInfo(element.value.id)
const viewInfo = dvMainStore.getViewDetails(element.value.id)
const chart = { ...viewInfo, chartExtRequest, data: viewDataInfo }
exportExcelDownload(chart, () => {
openMessageLoading(exportData)
openMessageLoading(callbackExport)
})
}
const exportAsImage = () => {

View File

@ -214,7 +214,6 @@ const exportData = () => {
}
const openMessageLoading = cb => {
console.log('bb')
const iconClass = `el-icon-loading`
const customClass = `de-message-loading de-message-export`
ElMessage({

View File

@ -14,6 +14,7 @@ import { setupCustomComponent } from '@/custom-component'
import { installDirective } from '@/directive'
import '@/utils/DateUtil'
import '@/permission'
import WebSocketPlugin from '../../websocket'
const setupAll = async () => {
const app = createApp(App)
installDirective(app)
@ -23,6 +24,7 @@ const setupAll = async () => {
setupElementPlus(app)
setupCustomComponent(app)
setupElementPlusIcons(app)
app.use(WebSocketPlugin)
app.mount('#app')
}

View File

@ -1,8 +1,9 @@
<script lang="ts" setup>
import { ref, h, onUnmounted } from 'vue'
import { ref, h, onUnmounted, onMounted } from 'vue'
import { EmptyBackground } from '@/components/empty-background'
import { ElButton, ElMessage, ElMessageBox, ElTabPane, ElTabs } from 'element-plus-secondary'
import { RefreshLeft } from '@element-plus/icons-vue'
import eventBus from '@/utils/eventBus'
import {
exportTasks,
exportRetry,
@ -50,6 +51,9 @@ const handleClose = () => {
drawer.value = false
clearInterval(timer)
}
onMounted(() => {
eventBus.on('task-export-topic-call', taskExportTopicCall)
})
onUnmounted(() => {
clearInterval(timer)
@ -148,25 +152,13 @@ const init = () => {
const taskExportTopicCall = task => {
if (JSON.parse(task).exportStatus === 'SUCCESS') {
openMessageLoading(
JSON.parse(task).exportFromName +
' ' +
t('excel.export') +
t('dataset.completed') +
t('dataset.goto'),
JSON.parse(task).exportFromName + ' 导出成功,前往',
'success',
callbackExport
)
}
if (JSON.parse(task).exportStatus === 'FAILED') {
openMessageLoading(
JSON.parse(task).exportFromName +
' ' +
t('excel.export') +
t('dataset.error') +
t('dataset.goto'),
'error',
callbackExport
)
openMessageLoading(JSON.parse(task).exportFromName + ' 导出失败,前往', 'error', callbackExport)
}
}

View File

@ -75,6 +75,13 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>

View File

@ -63,6 +63,7 @@ public class WhitelistUtils {
|| StringUtils.startsWithAny(requestURI, "/share/proxyInfo")
|| StringUtils.startsWithAny(requestURI, "/xpackComponent/content/")
|| StringUtils.startsWithAny(requestURI, "/geo/")
|| StringUtils.startsWithAny(requestURI, "/websocket")
|| StringUtils.startsWithAny(requestURI, "/map/");
}
}