@@ -92,6 +95,8 @@
import msgCfm from "@/components/msgCfm/index";
import request from "@/utils/request";
import {downloadFile, post} from '@/api/dataset/dataset'
+import bus from "@/utils/bus";
+import {Button} from "element-ui";
export default {
mixins: [msgCfm],
data() {
@@ -131,6 +136,9 @@ export default {
created() {
this.handleClick()
},
+ mounted() {
+ bus.$on('task-export-topic-call', this.taskExportTopicCall)
+ },
methods: {
init() {
this.drawer = true;
@@ -171,6 +179,46 @@ export default {
format(percentage) {
return '';
},
+ taskExportTopicCall(task){
+ if(JSON.parse(task).exportStatus === 'SUCCESS'){
+ this.openMessageLoading(JSON.parse(task).exportFromName + ' ' + this.$t('excel.export') + this.$t('dataset.completed')+ this.$t('dataset.goto'), 'success', this.callbackExport)
+ }
+ if(JSON.parse(task).exportStatus === 'FAILED'){
+ this.openMessageLoading(JSON.parse(task).exportFromName + ' ' + this.$t('excel.export') + this.$t('dataset.error')+ this.$t('dataset.goto'), 'error', this.callbackExport)
+ }
+ },
+ openMessageLoading(text, type, cb) {
+ const h = this.$createElement;
+ const iconClass = `el-icon-${type || 'success'}`
+ const customClass = `de-message-${type || 'success'} de-message-export`
+ this.$message({
+ message: h("p", null, [
+ this.$t(text),
+ h(
+ Button,
+ {
+ props: {
+ type: "text",
+ size: "mini",
+ },
+ class: "btn-text",
+ on: {
+ click: () => {
+ cb();
+ },
+ },
+ },
+ this.$t('data_export.export_center'),
+ )
+ ]),
+ iconClass,
+ showClose: true,
+ customClass,
+ });
+ },
+ callbackExport() {
+ bus.$emit('data-export-center')
+ },
handleClick() {
this.tableData = []
this.drawerLoading = true
@@ -255,7 +303,16 @@ export default {
},
delAll() {
if(this.multipleSelection.length === 0 ){
- this.openMessageSuccess("请选择", 'error')
+ post(
+ '/exportCenter/deleteAll/' + this.activeName,
+ this.multipleSelection.map((ele) => ele.id),
+ true
+ ).then(
+ (res) => {
+ this.handleClick()
+ }
+ )
+ this.openMessageSuccess("commons.delete_success");
return
}
post(
diff --git a/core/frontend/src/websocket/index.js b/core/frontend/src/websocket/index.js
index 4aeb32fbe8..172c28a91a 100644
--- a/core/frontend/src/websocket/index.js
+++ b/core/frontend/src/websocket/index.js
@@ -14,6 +14,10 @@ class DeWebsocket {
{
topic: '/web-seize-topic',
event: 'web-seize-topic-call'
+ },
+ {
+ topic: '/task-export-topic',
+ event: 'task-export-topic-call'
}
]
this.timer = null