Merge pull request #657 from veops/dev_ui_241217

fix(ui): ci - number type attr default value display error
This commit is contained in:
Leo Song 2024-12-17 15:13:18 +08:00 committed by GitHub
commit 41ce5db1c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -95,7 +95,7 @@
attr.name, attr.name,
{ {
rules: [{ required: attr.is_required, message: $t('placeholder1') + `${attr.alias || attr.name}` }], rules: [{ required: attr.is_required, message: $t('placeholder1') + `${attr.alias || attr.name}` }],
initialValue: attr.default && attr.default.default ? attr.default.default : null, initialValue: attr.default && attr.default.default !== undefined && attr.default.default !== null ? attr.default.default : null,
}, },
]" ]"
style="width: 100%" style="width: 100%"
@ -148,6 +148,7 @@
</template> </template>
<script> <script>
import _ from 'lodash'
import moment from 'moment' import moment from 'moment'
import JsonEditor from '../../../components/JsonEditor/jsonEditor.vue' import JsonEditor from '../../../components/JsonEditor/jsonEditor.vue'
import CIReferenceAttr from '@/components/ciReferenceAttr/index.vue' import CIReferenceAttr from '@/components/ciReferenceAttr/index.vue'
@ -210,7 +211,7 @@ export default {
}, },
getChoiceDefault(attr) { getChoiceDefault(attr) {
if (!attr?.default?.default) { if (_.isNil(attr?.default?.default)) {
return attr.is_list ? [] : null return attr.is_list ? [] : null
} }

View File

@ -659,7 +659,7 @@ export default {
} else { } else {
this.$nextTick(() => { this.$nextTick(() => {
this.form.setFieldsValue({ this.form.setFieldsValue({
default_value: _record.default && _record.default.default ? _record.default.default : null, default_value: _record?.default?.default ?? null,
}) })
}) })
} }