Files
lingji-work-fe/src/layouts/components/navbar/components/task-center-modal/index.vue
renxiaodong 4bab009fe6 perf: 调整
2025-09-07 17:29:14 +08:00

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>