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