Skip to content

Commit 00f8645

Browse files
committed
fix: 修复模型参数保存未校验
1 parent 5d726cf commit 00f8645

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

ui/src/components/dynamics-form/constructor/items/SingleSelectConstructor.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ const rander = (form_data: any) => {
8787
defineExpose({ getData, rander })
8888
onMounted(() => {
8989
formValue.value.option_list = []
90+
formValue.value.default_value = ''
9091
})
9192
</script>
9293
<style lang="scss" scoped>

ui/src/components/dynamics-form/items/JsonInput.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,10 @@ const validate_rules = (rule: any, value: any, callback: any) => {
108108
JSON.parse(model_value.value)
109109
} catch (e) {
110110
callback(new Error('JSON格式不正确'))
111+
return false
111112
}
112113
}
114+
return true
113115
}
114116
115117
defineExpose({ validate_rules: validate_rules })

ui/src/views/application/component/AIModeParamSettingDialog.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ const reset_default = (model_id: string, application_id?: string) => {
8080
}
8181
8282
const submit = async () => {
83-
emit('refresh', form_data.value)
84-
dialogVisible.value = false
83+
dynamicsFormRef.value?.validate().then(() => {
84+
emit('refresh', form_data.value)
85+
dialogVisible.value = false
86+
})
8587
}
8688
8789
defineExpose({ open, reset_default })

ui/src/views/application/component/TTSModeParamSettingDialog.vue

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
</el-button>
2929
</span>
3030
<span class="dialog-footer p-16">
31-
<el-button @click.prevent="dialogVisible = false">
32-
{{ $t('views.application.applicationForm.buttons.cancel') }}
33-
</el-button>
34-
<el-button type="primary" @click="submit" :loading="loading">
35-
{{ $t('views.application.applicationForm.buttons.confirm') }}
36-
</el-button>
37-
</span>
31+
<el-button @click.prevent="dialogVisible = false">
32+
{{ $t('views.application.applicationForm.buttons.cancel') }}
33+
</el-button>
34+
<el-button type="primary" @click="submit" :loading="loading">
35+
{{ $t('views.application.applicationForm.buttons.confirm') }}
36+
</el-button>
37+
</span>
3838
</div>
3939
</template>
4040
</el-dialog>
@@ -76,8 +76,8 @@ const open = (model_id: string, application_id?: string, model_setting_data?: an
7676
api.then((ok) => {
7777
model_form_field.value = ok.data
7878
const resp = ok.data
79-
.map((item: any) => ({ [item.field]: item.default_value }))
80-
.reduce((x, y) => ({ ...x, ...y }), {})
79+
.map((item: any) => ({ [item.field]: item.default_value }))
80+
.reduce((x, y) => ({ ...x, ...y }), {})
8181
model_setting_data = { ...resp, ...model_setting_data }
8282
// 渲染动态表单
8383
dynamicsFormRef.value?.render(model_form_field.value, model_setting_data)
@@ -98,15 +98,12 @@ const reset_default = (model_id: string, application_id?: string) => {
9898
}
9999
100100
const submit = async () => {
101-
dynamicsFormRef.value?.validate().then((ok) => {
102-
if (ok) {
103-
emit('refresh', form_data.value)
104-
dialogVisible.value = false
105-
}
101+
dynamicsFormRef.value?.validate().then(() => {
102+
emit('refresh', form_data.value)
103+
dialogVisible.value = false
106104
})
107105
}
108106
109-
110107
const audioPlayer = ref<HTMLAudioElement | null>(null)
111108
const testPlay = () => {
112109
const data = {
@@ -117,7 +114,7 @@ const testPlay = () => {
117114
.playDemoText(id as string, data, playLoading)
118115
.then(async (res: any) => {
119116
if (res.type === 'application/json') {
120-
const text = await res.text();
117+
const text = await res.text()
121118
MsgError(text)
122119
return
123120
}
@@ -138,10 +135,8 @@ const testPlay = () => {
138135
.catch((err) => {
139136
console.log('err: ', err)
140137
})
141-
142138
}
143139
144-
145140
defineExpose({ open, reset_default })
146141
</script>
147142

0 commit comments

Comments
 (0)