<template>
|
<div>
|
<p>异步导出任务入队(无 RabbitMQ 时后端仅记录日志并返回 taskId)。</p>
|
<el-button v-permission="'exports:enqueue'" type="primary" @click="enqueue">发起导出</el-button>
|
<p v-if="taskId">taskId: {{ taskId }}</p>
|
</div>
|
</template>
|
|
<script setup lang="ts">
|
import { ref } from "vue";
|
import { ElMessage } from "element-plus";
|
import http from "../api/http";
|
|
const taskId = ref("");
|
|
async function enqueue() {
|
try {
|
const { data } = await http.post("/exports/enqueue", {
|
type: "appointment",
|
criteria: { status: "PENDING_APPROVAL" },
|
});
|
taskId.value = data.result?.taskId || "";
|
ElMessage.success("已入队");
|
} catch (e: unknown) {
|
ElMessage.error(e instanceof Error ? e.message : "失败");
|
}
|
}
|
</script>
|