更新模型类型字段名称,统一为 modelType,以提高代码一致性和可读性。涉及多个组件和接口的相应调整,确保功能正常。

This commit is contained in:
2026-05-12 16:43:46 +08:00
parent 75cc91a4fb
commit 77aaeebf1d
5 changed files with 41 additions and 33 deletions

View File

@@ -17,8 +17,8 @@
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="模型类型" prop="modelsType">
<el-select v-model="state.ruleForm.modelsType" placeholder="请选择模型类型" clearable style="width: 100%">
<el-form-item label="模型类型" prop="modelType">
<el-select v-model="state.ruleForm.modelType" placeholder="请选择模型类型" clearable style="width: 100%">
<el-option v-for="t in modelTypeOptions" :key="String(t.id)" :label="t.label" :value="typeOptionValue(t.id)"></el-option>
</el-select>
</el-form-item>
@@ -279,7 +279,7 @@ const state = reactive({
ruleForm: {
id: '',
modelName: '',
modelsType: null as number | string | null,
modelType: null as number | string | null,
baseUrl: '',
httpMethod: 'POST',
headMsg: '',
@@ -299,7 +299,7 @@ const state = reactive({
},
rules: {
modelName: [{ required: true, message: '请输入模型名称', trigger: 'blur' }],
modelsType: [
modelType: [
{
validator: (_rule: unknown, value: unknown, callback: (e?: Error) => void) => {
if (value === null || value === undefined || value === '') {
@@ -528,7 +528,7 @@ const fillFormFromDetailRow = (row: Record<string, unknown>) => {
state.ruleForm = {
id: row.id as string,
modelName: String(row.modelName ?? ''),
modelsType: row.modelsType !== undefined && row.modelsType !== null ? typeOptionValue(row.modelsType as number | string) : null,
modelType: row.modelType !== undefined && row.modelType !== null ? typeOptionValue(row.modelType as number | string) : null,
baseUrl: String(row.baseUrl ?? ''),
httpMethod: String(row.httpMethod || 'POST'),
headMsg: String(row.headMsg || ''),
@@ -605,7 +605,7 @@ const openDialog = async (type: string, row?: Record<string, unknown>) => {
state.ruleForm = {
id: '',
modelName: '',
modelsType: null,
modelType: null,
baseUrl: '',
httpMethod: 'POST',
headMsg: '',
@@ -659,7 +659,7 @@ const onSubmit = () => {
const responseBody = responseBodyField ? { [responseBodyField.key.trim()]: responseBodyField.value } : {};
const submitData = {
modelName: state.ruleForm.modelName,
modelsType: state.ruleForm.modelsType as number | string,
modelType: state.ruleForm.modelType as number | string,
baseUrl: state.ruleForm.baseUrl,
httpMethod: state.ruleForm.httpMethod || 'POST',
headMsg: state.ruleForm.headMsg,