fix: interval field check

This commit is contained in:
wangruidong 2024-10-16 10:57:43 +08:00 committed by Bryan
parent 19cd497095
commit 6fb7fe8fa1
3 changed files with 3 additions and 12 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<el-input v-model="iValue" v-bind="$attrs" v-on="$listeners"> <el-input v-bind="$attrs" v-on="$listeners">
<template slot="append">{{ iUnit }}</template> <template slot="append">{{ iUnit }}</template>
</el-input> </el-input>
</template> </template>
@ -30,9 +30,6 @@ export default {
computed: { computed: {
iUnit() { iUnit() {
return this.displayMapper[this.unit] || this.unit return this.displayMapper[this.unit] || this.unit
},
iValue() {
return this.$attrs.value ? this.$attrs.value : this.defaultValue
} }
} }
} }

View File

@ -4,7 +4,7 @@ import InputWithUnit from '@/components/Form/FormFields/InputWithUnit.vue'
import store from '@/store' import store from '@/store'
const validatorInterval = (rule, value, callback) => { const validatorInterval = (rule, value, callback) => {
if (parseInt(value) < 1) { if (isNaN(parseInt(value, 10)) || parseInt(value) < 1) {
return callback(new Error(i18n.t('EnsureThisValueIsGreaterThanOrEqualTo1'))) return callback(new Error(i18n.t('EnsureThisValueIsGreaterThanOrEqualTo1')))
} }
callback() callback()

View File

@ -73,13 +73,7 @@ export default {
btn.loading = true btn.loading = true
} }
}) })
if (form.value.interval && typeof form.value.interval === 'number') {
form.value.interval = parseInt(form.value.interval, 10) form.value.interval = parseInt(form.value.interval, 10)
} else {
form.value.interval = 24
}
this.$refs.form.$refs.form.dataForm.submitForm('form', false) this.$refs.form.$refs.form.dataForm.submitForm('form', false)
}, },
handleSubmitSuccess(res) { handleSubmitSuccess(res) {