57 lines
2.4 KiB
Vue
57 lines
2.4 KiB
Vue
<script setup lang="ts" generic="T extends KnowledgeReviewDraft">
|
|
import type { KnowledgeReviewDraft } from '#/api/knowledge';
|
|
|
|
import { computed } from 'vue';
|
|
import { Button, Form, Input, Radio, Select, Space, Tag } from 'ant-design-vue';
|
|
|
|
import { t } from '#/locales/t';
|
|
|
|
import { contentTypes } from './content-type';
|
|
|
|
defineProps<{ disabled: boolean; focusConditions?: boolean }>();
|
|
const item = defineModel<T>({ required: true });
|
|
const kindOptions = computed(() => [
|
|
{ value: 'qa', label: t('标准问答') },
|
|
{ value: 'procedure', label: t('业务流程') },
|
|
{ value: 'case', label: t('对话案例') },
|
|
]);
|
|
</script>
|
|
|
|
<template>
|
|
<Form layout="vertical">
|
|
<Form.Item :label="t('标题')">
|
|
<Input v-model:value="item.title" :maxlength="160" :disabled="disabled" />
|
|
</Form.Item>
|
|
<Space>
|
|
<Form.Item :label="t('类型')">
|
|
<Select v-model:value="item.kind" :options="kindOptions" :disabled="disabled" style="width: 140px" />
|
|
</Form.Item>
|
|
<Form.Item :label="t('分类')">
|
|
<Input v-model:value="item.category" :disabled="disabled" />
|
|
</Form.Item>
|
|
</Space>
|
|
<Form.Item :label="t('内容标记')">
|
|
<Radio.Group v-model:value="item.content_type" name="knowledge-content-type" role="radiogroup" :aria-label="t('内容标记')" :disabled="disabled">
|
|
<Space wrap>
|
|
<Radio v-for="(option, value) in contentTypes" :key="value" :value="value">
|
|
<Tag :color="option.color">{{ option.label() }}</Tag>
|
|
</Radio>
|
|
</Space>
|
|
</Radio.Group>
|
|
<Button v-if="item.content_type && !disabled" type="link" size="small" @click="item.content_type = null">{{ t('清除标记') }}</Button>
|
|
</Form.Item>
|
|
<Form.Item :label="t('完整问题')">
|
|
<Input.TextArea v-model:value="item.question" :rows="3" :maxlength="4000" :disabled="disabled" />
|
|
</Form.Item>
|
|
<Form.Item :label="t('标准答案 / 步骤')">
|
|
<Input.TextArea v-model:value="item.answer" :rows="7" :maxlength="8000" :disabled="disabled" />
|
|
</Form.Item>
|
|
<Form.Item :label="t('适用条件(必填)')">
|
|
<Input.TextArea v-model:value="item.conditions" :rows="3" :maxlength="2000" :disabled="disabled" :autofocus="focusConditions" />
|
|
</Form.Item>
|
|
<Form.Item :label="t('有效期截止日期(可选)')">
|
|
<Input v-model:value="item.valid_until" type="date" :disabled="disabled" />
|
|
</Form.Item>
|
|
</Form>
|
|
</template>
|