77 lines
1.5 KiB
Vue
77 lines
1.5 KiB
Vue
<template>
|
|
<Modal
|
|
v-model:open="visible"
|
|
title="任务中心"
|
|
wrapClassName="task-center-modal"
|
|
width="860px"
|
|
:mask-closable="false"
|
|
:footer="null"
|
|
@cancel="onClose"
|
|
centered
|
|
>
|
|
<Tabs v-model:activeKey="activeTab" @change="handleTabClick">
|
|
<TabPane key="1" tab="导入"> </TabPane>
|
|
<TabPane key="2" tab="导出"> </TabPane>
|
|
</Tabs>
|
|
<div class="content">
|
|
<component :is="activeTab === '1' ? ImportTask : ExportTask" ref="componentRef" />
|
|
</div>
|
|
</Modal>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { Checkbox, Modal, Button, Tabs, notification } from 'ant-design-vue';
|
|
const { TabPane } = Tabs;
|
|
|
|
import ExportTask from './components/export-task';
|
|
import ImportTask from './components/import-task';
|
|
|
|
const visible = ref(false);
|
|
const componentRef = ref(null);
|
|
const activeTab = ref('1');
|
|
|
|
let timer = null;
|
|
|
|
const handleTabClick = (key) => {
|
|
// activeTab.value = key;
|
|
nextTick(() => {
|
|
getData();
|
|
});
|
|
};
|
|
|
|
const getData = () => {
|
|
componentRef.value?.init();
|
|
};
|
|
|
|
const open = () => {
|
|
visible.value = true;
|
|
nextTick(() => {
|
|
getData();
|
|
});
|
|
|
|
timer = setInterval(() => {
|
|
getData();
|
|
}, 10000);
|
|
};
|
|
const onClose = () => {
|
|
activeTab.value = '0';
|
|
|
|
clearTimer();
|
|
componentRef.value?.unloadComp?.();
|
|
notification.destroy();
|
|
visible.value = false;
|
|
};
|
|
const clearTimer = () => {
|
|
if (timer) {
|
|
clearInterval(timer);
|
|
timer = null;
|
|
}
|
|
};
|
|
|
|
defineExpose({ open });
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
@import './style.scss';
|
|
</style>
|