Files
short-drama-agent-front/src/features/create-drama/review/ManualReviewIssueEditor.vue
T

116 lines
5.3 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 { computed } from 'vue'
import { NButton, NFormItem, NInput, NSelect } from 'naive-ui'
import { Trash2 } from '@lucide/vue'
import WorkspaceSectionHeading from '../../../components/ui/WorkspaceSectionHeading.vue'
import WorkspaceActionTooltip from '../../../components/ui/WorkspaceActionTooltip.vue'
import ContextNotice from '../../../components/ui/ContextNotice.vue'
import { reviewCategoryOptions } from './model'
import type { DramaReviewPreview, ManualReviewDraft } from './types'
/** 人工补充表单只使用正式剧集和当前角色选项。 */
const props = defineProps<{
/** 表单行显示序号。 */ order: number
/** 当前正式正文。 */ episodes: DramaReviewPreview['episodes']
/** 当前正式角色名称。 */ characters: string[]
/** 读取或写入期间只读。 */ disabled: boolean
/** 用户尝试提交后才提供的错误。 */ error?: string
}>()
/** 尚未保存的证据草稿,确认前不转换为审核事实。 */
const draft = defineModel<ManualReviewDraft>({ required: true })
/** 删除只影响当前草稿。 */
const emit = defineEmits<{ remove: [] }>()
/** 集数选项直接来自预检,不伪造缺少的集号。 */
const episodeOptions = computed(() =>
props.episodes.map(episode => ({ label: `第 ${episode.episode} 集`, value: episode.episode }))
)
/** 角色名称来自正式项目,提交保留原值。 */
const characterOptions = computed(() => props.characters.map(name => ({ label: name, value: name })))
</script>
<template>
<!-- 以下是单条人工补充的标题与删除入口 -->
<section class="manual-review-editor">
<WorkspaceSectionHeading :title="`补充证据 ${order}`">
<template #actions>
<WorkspaceActionTooltip :label="`删除第 ${order} 条补充证据`">
<NButton
class="workspace-action-button icon-button"
:disabled="disabled"
:aria-label="`删除第 ${order} 条补充证据`"
@click="emit('remove')"
>
<template #icon><Trash2 :size="16" aria-hidden="true" /></template>
</NButton>
</WorkspaceActionTooltip>
</template>
</WorkspaceSectionHeading>
<!-- 以下是逐行填写的真实原文与错误说明,不自动把模型推断升级为事实 -->
<div class="mt-4 grid gap-4">
<NFormItem label="所属剧集" required
><NSelect
v-model:value="draft.episode"
:options="episodeOptions"
:disabled="disabled"
:aria-label="`补充证据 ${order} 所属剧集`"
/></NFormItem>
<NFormItem label="问题分类" required
><NSelect
v-model:value="draft.category"
:options="reviewCategoryOptions"
:disabled="disabled"
:aria-label="`补充证据 ${order} 问题分类`"
/></NFormItem>
<NFormItem label="问题名称" required
><NInput
v-model:value="draft.code"
:disabled="disabled"
placeholder="例如:坠落前缺少支撑变化"
:input-props="{ 'aria-label': `补充证据 ${order} 问题名称` }"
/></NFormItem>
<NFormItem label="引用原文" required
><NInput
v-model:value="draft.sourceQuote"
type="textarea"
:autosize="{ minRows: 3, maxRows: 8 }"
:disabled="disabled"
placeholder="粘贴所选剧集中的逐字原文,不能填写事件编号或自行改写的内容"
:input-props="{ 'aria-label': `补充证据 ${order} 引用原文` }"
/></NFormItem>
<NFormItem label="问题说明" required
><NInput
v-model:value="draft.message"
type="textarea"
:autosize="{ minRows: 2, maxRows: 6 }"
:disabled="disabled"
:input-props="{ 'aria-label': `补充证据 ${order} 问题说明` }"
/></NFormItem>
<NFormItem label="修改建议" required
><NInput
v-model:value="draft.suggestion"
type="textarea"
:autosize="{ minRows: 2, maxRows: 6 }"
:disabled="disabled"
:input-props="{ 'aria-label': `补充证据 ${order} 修改建议` }"
/></NFormItem>
<NFormItem label="涉及角色(可选)"
><NSelect
:value="draft.subjectRef || null"
:options="characterOptions"
clearable
:disabled="disabled"
:aria-label="`补充证据 ${order} 涉及角色`"
@update:value="draft.subjectRef = $event ?? ''"
/></NFormItem>
</div>
<ContextNotice v-if="error" type="error" title="请核对这条补充证据" emphasized>{{ error }}</ContextNotice>
</section>
</template>
<style scoped>
@reference "../../../styles/styles.css";
.manual-review-editor {
@apply min-w-0;
}
</style>