fix: add ways/cronmessage error

This commit is contained in:
engigu
2025-08-31 13:52:37 +08:00
parent caecb06afb
commit 9f1a69fe05
+40 -39
View File
@@ -6,7 +6,8 @@ import { Input } from '@/components/ui/input'
import { Textarea } from '@/components/ui/textarea' import { Textarea } from '@/components/ui/textarea'
import { Label } from '@/components/ui/label' import { Label } from '@/components/ui/label'
import { CONSTANT } from '@/constant' import { CONSTANT } from '@/constant'
import { validateForm, createValidationState, type InputConfig } from '@/util/validation' import { createValidationState } from '@/util/validation'
// import { validateForm, createValidationState, type InputConfig } from '@/util/validation'
import { toast } from 'vue-sonner' import { toast } from 'vue-sonner'
import { request } from '@/api/api' import { request } from '@/api/api'
import { import {
@@ -112,50 +113,50 @@ const initFormData = () => {
formData.value = newFormData formData.value = newFormData
} }
// 获取所有输入字段配置 // // 获取所有输入字段配置
const getAllInputConfigs = (): InputConfig[] => { // const getAllInputConfigs = (): InputConfig[] => {
const config = currentChannelConfig.value // const config = currentChannelConfig.value
if (!config) return [] // if (!config) return []
const configs: InputConfig[] = [] // const configs: InputConfig[] = []
// 基本输入字段 // // 基本输入字段
if (config.inputs) { // if (config.inputs) {
configs.push(...config.inputs.map((input: any) => ({ // configs.push(...config.inputs.map((input: any) => ({
col: input.col, // col: input.col,
label: input.label, // label: input.label,
subLabel: input.subLabel, // subLabel: input.subLabel,
type: input.type, // type: input.type,
required: input.required !== false, // required: input.required !== false,
minLength: input.minLength, // minLength: input.minLength,
maxLength: input.maxLength // maxLength: input.maxLength
}))) // })))
} // }
// 任务指令输入字段 // // 任务指令输入字段
if (config.taskInsInputs) { // if (config.taskInsInputs) {
configs.push(...config.taskInsInputs.map((input: any) => ({ // configs.push(...config.taskInsInputs.map((input: any) => ({
col: input.col, // col: input.col,
label: input.label, // label: input.label,
subLabel: input.subLabel, // subLabel: input.subLabel,
type: input.type, // type: input.type,
required: input.required !== false, // required: input.required !== false,
minLength: input.minLength, // minLength: input.minLength,
maxLength: input.maxLength // maxLength: input.maxLength
}))) // })))
} // }
return configs // return configs
} // }
// 校验表单 // // 校验表单
const validateFormData = () => { // const validateFormData = () => {
const inputConfigs = getAllInputConfigs() // const inputConfigs = getAllInputConfigs()
const result = validateForm(formData.value, inputConfigs) // const result = validateForm(formData.value, inputConfigs)
validationState.setErrors(result.errors) // validationState.setErrors(result.errors)
return result.isValid // return result.isValid
} // }
// 监听渠道模式变化 // 监听渠道模式变化
const handleChannelModeChange = () => { const handleChannelModeChange = () => {