mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: 修复模型参数保存未校验
This commit is contained in:
parent
5d726cf538
commit
00f8645cd9
|
|
@ -87,6 +87,7 @@ const rander = (form_data: any) => {
|
|||
defineExpose({ getData, rander })
|
||||
onMounted(() => {
|
||||
formValue.value.option_list = []
|
||||
formValue.value.default_value = ''
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -108,8 +108,10 @@ const validate_rules = (rule: any, value: any, callback: any) => {
|
|||
JSON.parse(model_value.value)
|
||||
} catch (e) {
|
||||
callback(new Error('JSON格式不正确'))
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
defineExpose({ validate_rules: validate_rules })
|
||||
|
|
|
|||
|
|
@ -80,8 +80,10 @@ const reset_default = (model_id: string, application_id?: string) => {
|
|||
}
|
||||
|
||||
const submit = async () => {
|
||||
emit('refresh', form_data.value)
|
||||
dialogVisible.value = false
|
||||
dynamicsFormRef.value?.validate().then(() => {
|
||||
emit('refresh', form_data.value)
|
||||
dialogVisible.value = false
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({ open, reset_default })
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@
|
|||
</el-button>
|
||||
</span>
|
||||
<span class="dialog-footer p-16">
|
||||
<el-button @click.prevent="dialogVisible = false">
|
||||
{{ $t('views.application.applicationForm.buttons.cancel') }}
|
||||
</el-button>
|
||||
<el-button type="primary" @click="submit" :loading="loading">
|
||||
{{ $t('views.application.applicationForm.buttons.confirm') }}
|
||||
</el-button>
|
||||
</span>
|
||||
<el-button @click.prevent="dialogVisible = false">
|
||||
{{ $t('views.application.applicationForm.buttons.cancel') }}
|
||||
</el-button>
|
||||
<el-button type="primary" @click="submit" :loading="loading">
|
||||
{{ $t('views.application.applicationForm.buttons.confirm') }}
|
||||
</el-button>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
|
@ -76,8 +76,8 @@ const open = (model_id: string, application_id?: string, model_setting_data?: an
|
|||
api.then((ok) => {
|
||||
model_form_field.value = ok.data
|
||||
const resp = ok.data
|
||||
.map((item: any) => ({ [item.field]: item.default_value }))
|
||||
.reduce((x, y) => ({ ...x, ...y }), {})
|
||||
.map((item: any) => ({ [item.field]: item.default_value }))
|
||||
.reduce((x, y) => ({ ...x, ...y }), {})
|
||||
model_setting_data = { ...resp, ...model_setting_data }
|
||||
// 渲染动态表单
|
||||
dynamicsFormRef.value?.render(model_form_field.value, model_setting_data)
|
||||
|
|
@ -98,15 +98,12 @@ const reset_default = (model_id: string, application_id?: string) => {
|
|||
}
|
||||
|
||||
const submit = async () => {
|
||||
dynamicsFormRef.value?.validate().then((ok) => {
|
||||
if (ok) {
|
||||
emit('refresh', form_data.value)
|
||||
dialogVisible.value = false
|
||||
}
|
||||
dynamicsFormRef.value?.validate().then(() => {
|
||||
emit('refresh', form_data.value)
|
||||
dialogVisible.value = false
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const audioPlayer = ref<HTMLAudioElement | null>(null)
|
||||
const testPlay = () => {
|
||||
const data = {
|
||||
|
|
@ -117,7 +114,7 @@ const testPlay = () => {
|
|||
.playDemoText(id as string, data, playLoading)
|
||||
.then(async (res: any) => {
|
||||
if (res.type === 'application/json') {
|
||||
const text = await res.text();
|
||||
const text = await res.text()
|
||||
MsgError(text)
|
||||
return
|
||||
}
|
||||
|
|
@ -138,10 +135,8 @@ const testPlay = () => {
|
|||
.catch((err) => {
|
||||
console.log('err: ', err)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
defineExpose({ open, reset_default })
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue