Skip to content

Commit

Permalink
Merge pull request #4359 from jumpserver/pr@dev@fix_show_NaN
Browse files Browse the repository at this point in the history
fixed: Fixed NaN issue when setting timing interval
  • Loading branch information
ZhaoJiSen authored Sep 17, 2024
2 parents 4221bdb + 49ea7d0 commit aa605ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/components/Form/FormFields/InputWithUnit.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<el-input v-bind="$attrs" v-on="$listeners">
<el-input v-model="iValue" v-bind="$attrs" v-on="$listeners">
<template slot="append">{{ iUnit }}</template>
</el-input>
</template>
Expand All @@ -15,6 +15,7 @@ export default {
},
data() {
return {
defaultValue: 24,
displayMapper: {
'second': this.$t('Second'), // 'sec' is the default value of 'unit
'min': this.$t('Minute'), // 'min' is the default value of 'unit
Expand All @@ -29,6 +30,9 @@ export default {
computed: {
iUnit() {
return this.displayMapper[this.unit] || this.unit
},
iValue() {
return this.$attrs.value ? this.$attrs.value : this.defaultValue
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/views/assets/Cloud/Account/components/TimingPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ export default {
btn.loading = true
}
})
form.value.interval = parseInt(form.value.interval, 10)
if (form.value.interval && typeof form.value.interval === 'number') {
form.value.interval = parseInt(form.value.interval, 10)
} else {
form.value.interval = 24
}
this.$refs.form.$refs.form.dataForm.submitForm('form', false)
},
handleSubmitSuccess(res) {
Expand Down

0 comments on commit aa605ad

Please sign in to comment.