feat: 新增 AI 辅助,重构登录页与环境变量命名
This commit is contained in:
1 parent
085764e6b2
commit
75cbee2fa6
37 files changed
+1854
-989
No files matched your search
@@ -92,6 +92,18 @@
|
||||
<el-descriptions-item label="当前任务">{{ detail.taskName }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<!-- AI 摘要:按需生成,未开启 AI 时接口不存在,失败不影响审批 -->
|
||||
<div class="todo-approve__ai">
|
||||
<div class="todo-approve__ai-header">
|
||||
<span>AI 摘要</span>
|
||||
<el-button link type="primary" :loading="aiLoading" @click="handleAiSummary">
|
||||
<template #icon><MagicStick /></template>
|
||||
{{ aiSummary ? "重新生成" : "生成摘要" }}
|
||||
</el-button>
|
||||
</div>
|
||||
<el-alert v-if="aiSummary" :closable="false" type="info" :description="aiSummary" />
|
||||
</div>
|
||||
|
||||
<el-tabs class="todo-approve__tabs">
|
||||
<el-tab-pane label="申请信息">
|
||||
<FormDetail
|
||||
@@ -165,7 +177,7 @@
|
||||
<script setup lang="ts">
|
||||
import { useFullscreen } from "@vueuse/core";
|
||||
import { ElMessage, type FormInstance } from "element-plus";
|
||||
import { Refresh } from "@element-plus/icons-vue";
|
||||
import { MagicStick, Refresh } from "@element-plus/icons-vue";
|
||||
|
||||
import WorkflowAPI from "@/api/workflow";
|
||||
import type {
|
||||
@@ -225,6 +237,10 @@ const detail = ref<TaskDetailData>();
|
||||
/** 审批意见(通过/驳回共用) */
|
||||
const comment = ref("");
|
||||
|
||||
/** AI 摘要与生成状态 */
|
||||
const aiSummary = ref("");
|
||||
const aiLoading = ref(false);
|
||||
|
||||
/** 当前任务在流程走向中的位置(节点ID精确匹配,当前环节高亮进行中,之前为已完成;未匹配时不高亮) */
|
||||
const currentStageIndex = computed(() => {
|
||||
const stages = detail.value?.stages;
|
||||
@@ -251,6 +267,7 @@ async function openApprove(taskId: string): Promise<void> {
|
||||
approveState.loading = true;
|
||||
closeRejectMode();
|
||||
comment.value = "";
|
||||
aiSummary.value = "";
|
||||
try {
|
||||
detail.value = await WorkflowAPI.task.getDetail(taskId);
|
||||
approveState.title = `【${detail.value.taskName}】审批办理`;
|
||||
@@ -259,6 +276,23 @@ async function openApprove(taskId: string): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成当前任务的 AI 摘要
|
||||
*/
|
||||
async function handleAiSummary(): Promise<void> {
|
||||
if (!detail.value?.taskId) {
|
||||
return;
|
||||
}
|
||||
aiLoading.value = true;
|
||||
try {
|
||||
aiSummary.value = await WorkflowAPI.task.aiSummary(detail.value.taskId);
|
||||
} catch {
|
||||
ElMessage.error("AI 摘要生成失败,请确认已开启 AI 配置");
|
||||
} finally {
|
||||
aiLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切入驳回模式并加载可驳回的历史节点
|
||||
*/
|
||||
@@ -325,5 +359,19 @@ onMounted(() => {
|
||||
margin-top: 16px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
&__ai {
|
||||
margin-top: 12px;
|
||||
|
||||
&-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user