Files
short-drama-agent-front/src/features/workflows/ConfirmAction.vue
T

59 lines
2.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import { ref } from 'vue'
import { DialogTrigger } from 'reka-ui'
import { AppDialog } from '../../components/ui'
/** 耗费模型额度或覆盖结果的动作必须经过明确确认。 */
const props = defineProps<{
label: string
description: string
disabled?: boolean
acknowledgement?: boolean
primary?: boolean
}>()
const emit = defineEmits<{ confirm: [] }>()
const open = ref(false)
const acknowledged = ref(false)
/** 发出事件后关闭弹窗,操作状态由项目级锁负责。 */
function confirm() {
if (props.disabled || (props.acknowledgement && !acknowledged.value)) return
emit('confirm')
open.value = false
acknowledged.value = false
}
</script>
<template>
<AppDialog v-model:open="open" :title="label" :description="description">
<template #trigger
><DialogTrigger
class="button"
:class="primary ? 'button-primary' : 'button-secondary'"
:disabled="disabled"
>{{ label }}</DialogTrigger
></template
>
<p class="mt-5 text-sm leading-6 text-muted">
此操作会提交到真实后端可能调用模型并产生费用请勿在其他页面或终端同时启动相同工作流
</p>
<label v-if="acknowledgement" class="mt-5 flex items-start gap-3 text-sm leading-6"
><input
v-model="acknowledged"
class="mt-1 accent-accent"
type="checkbox"
/>我已确认后台任务停止当前没有同项目的生成或拆解任务在运行</label
>
<div class="dialog-footer mt-6">
<button class="button button-secondary" @click="open = false">取消</button
><button
class="button button-primary"
:disabled="disabled || (acknowledgement && !acknowledged)"
@click="confirm"
>
确认{{ label }}
</button>
</div>
</AppDialog>
</template>