新增俩接口,新增一些变量

This commit is contained in:
Cold
2025-12-26 15:35:11 +08:00
parent 73373ad7a1
commit da615ab897
5 changed files with 295 additions and 22 deletions

View File

@@ -3,10 +3,10 @@
<el-dialog :title="(formData.id ? '修改' : '添加') + '客服账号'" v-model="isShowDialog" width="769px">
<el-form ref="formRef" :model="formData" :rules="rules" size="default" label-width="90px">
<el-row :gutter="35">
<!-- 客服ID输入框 -->
<!-- 客服账号输入框 -->
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="客服ID" prop="customerServiceId">
<el-input v-model="formData.customerServiceId" placeholder="请输入客服ID,如:CS001" clearable />
<el-form-item label="客服账号" prop="accountName">
<el-input v-model="formData.accountName" placeholder="请输入客服账号,如:cs_xhs_qixue" clearable />
</el-form-item>
</el-col>
@@ -21,6 +21,23 @@
</el-form-item>
</el-col>
</el-row>
<!-- 高级配置可选 -->
<el-collapse v-model="activeNames" class="mt20">
<el-collapse-item title="高级配置(可选)" name="advanced">
<el-form-item label="自定义提示词" prop="prompt">
<el-input
type="textarea"
v-model="formData.prompt"
:rows="8"
placeholder="留空则使用默认提示词,必须包含{knowledge}变量"
/>
<div style="color: #909399; font-size: 12px; margin-top: 5px;">
提示留空将使用系统默认提示词模板创建后也可通过"配置提示词"按钮修改
</div>
</el-form-item>
</el-collapse-item>
</el-collapse>
</el-form>
<template #footer>
@@ -42,8 +59,9 @@ import { addAccount, updateAccount } from '/@/api/customerService/account';
interface DialogFormData {
id?: string;
customerServiceId: string;
accountName: string;
platform: string;
prompt?: string;
status: number;
creator: '';
modifier: '';
@@ -56,10 +74,12 @@ const emit = defineEmits<{
const state = reactive({
loading: false,
isShowDialog: false,
activeNames: [] as string[],
formData: {
id: '',
customerServiceId: '',
accountName: '',
platform: '',
prompt: '',
status: 1,
creator: '',
modifier: '',
@@ -67,15 +87,15 @@ const state = reactive({
});
const rules: FormRules = {
customerServiceId: [
{ required: true, message: '客服ID不能为空', trigger: 'blur' },
{ min: 2, max: 50, message: '客服ID长度在 2 到 50 个字符', trigger: 'blur' },
accountName: [
{ required: true, message: '客服账号不能为空', trigger: 'blur' },
{ min: 2, max: 50, message: '客服账号长度在 2 到 50 个字符', trigger: 'blur' },
],
platform: [{ required: true, message: '请选择客服平台', trigger: 'change' }],
};
const formRef = ref<FormInstance>();
const { loading, isShowDialog, formData } = toRefs(state);
const { loading, isShowDialog, formData, activeNames } = toRefs(state);
/**
* 打开对话框
@@ -152,8 +172,9 @@ const onSubmit = async () => {
const resetForm = () => {
state.formData = {
id: '',
customerServiceId: '',
accountName: '',
platform: '',
prompt: '',
status: 1,
creator: '',
modifier: '',