longz
2026-04-21 fe748fb9aad28affe3d8dbdedebe6bdc7afeed5b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<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>