fix: add ways/cronmessage error

This commit is contained in:
engigu
2025-08-31 13:47:29 +08:00
parent 7bd3ad8323
commit ee2f9480c2
4 changed files with 20 additions and 9 deletions
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, reactive } from 'vue'
import { ref, reactive, watch } from 'vue'
import { toast } from 'vue-sonner'
import { request } from '@/api/api'
import { generateBizUniqueID } from '@/util/uuid'
@@ -32,6 +32,7 @@ const formData = reactive({
url: ''
})
// 加载状态
const loading = ref(false)
@@ -56,8 +57,8 @@ const handleSubmit = async () => {
window.location.reload()
}, 1000)
} else {
toast.success(rsp.data.msg)
}
toast.error(rsp.data.msg)
}
} finally {
loading.value = false
}
@@ -72,7 +73,11 @@ const handleCancel = () => {
<template>
<CronMessageForm
v-model="formData"
:model-value="formData"
@update:model-value="(val) => {
console.log('Received update:model-value:', val);
Object.assign(formData, val);
}"
mode="add"
:loading="loading"
@submit="handleSubmit"
@@ -48,7 +48,7 @@ watch(() => props.modelValue, (newValue) => {
// 监听本地数据变化,同步到外部
watch(localFormData, (newValue) => {
emit('update:modelValue', { ...newValue })
emit('update:modelValue', newValue)
}, { deep: true })
// 可用的发信任务列表
@@ -105,7 +105,7 @@ loadAvailableTasks()
<div class="space-y-1">
<Label for="task_id" class="text-sm">关联发信任务</Label>
<Select v-model="localFormData.task_id">
<Select :model-value="localFormData.task_id" @update:model-value="(val) => localFormData.task_id = String(val || '')">
<SelectTrigger class="h-8">
<SelectValue placeholder="选择要关联的发信任务" />
</SelectTrigger>
@@ -44,12 +44,17 @@ const formData = reactive({
url: ''
})
// 加载状态
const loading = ref(false)
// 提交表单
const handleSubmit = async () => {
if (!props.cronMessage) return
if (!props.cronMessage) {
toast.error('未找到要编辑的定时消息')
return
}
loading.value = true
try {
@@ -103,7 +108,8 @@ watch(
<template>
<CronMessageForm
v-model="formData"
:model-value="formData"
@update:model-value="(val) => Object.assign(formData, val)"
mode="edit"
:loading="loading"
@submit="handleSubmit"
@@ -221,7 +221,7 @@ const handleTest = async () => {
// 保存数据
const handleSave = async () => {
if (!validateFormData()) { return }
// if (!validateFormData()) { return }
let postData = getFinalData()