Skip to content

fix:修复bool默认无效 --bug=150687052 【CMDB】[前端]业务拓扑中自定义字段bool字段默认值无效#8600

Open
elizabevil wants to merge 1 commit intoTencentBlueKing:v3.14.xfrom
elizabevil:v3.14.x-fix-boolDefault
Open

fix:修复bool默认无效 --bug=150687052 【CMDB】[前端]业务拓扑中自定义字段bool字段默认值无效#8600
elizabevil wants to merge 1 commit intoTencentBlueKing:v3.14.xfrom
elizabevil:v3.14.x-fix-boolDefault

Conversation

@elizabevil
Copy link
Contributor

修复的问题:

  • 业务拓扑中自定义字段bool字段默认值无效

修复方案[后端]:

  • fillLostBoolFieldValue处 同时判断default与option字段
  • 优先使用default,其次为option,且保持option与default值同步

@elizabevil elizabevil closed this Jan 19, 2026
@elizabevil elizabevil reopened this Jan 19, 2026
@elizabevil elizabevil force-pushed the v3.14.x-fix-boolDefault branch from e05371f to 1be0ad9 Compare January 20, 2026 10:10
}
field.Default = field.Option
}
field.Option = field.Default
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里option为什么要改成default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

前端使用option存储默认值,而非default
后端适配兼容使用option与default(目的是保持一致)

}
field.Default = field.Option
}
field.Option = field.Default
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是给实例加默认值的,在这里改field数据没有用

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里只是适配兼容使用option与default
并不修改数据库实际值(新增/修改 去真正修改)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我知道你这里在做什么,我的意思是这个没用,真正需要处理的是属性的数据,不然还是会出现用户设置了default=true,前端看到默认值为false,结果创建实例的时候又是true的情况

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

大佬 有合适的方案吗?最好兼容已有历史数据(当前仅修改前端option->default只能解决新增数据)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants