修复:职务编辑表单中 0 值被 || '' 误转为空字符串
openEdit() 中三个奖励字段从 OR 运算符改为显式 null 检查: - max_reward: pos.max_reward !== null ... - daily_reward_limit 同上 - recipient_daily_limit 同上 - max_persons 改用 JS ?? 空值合并运算符 根本原因:0 在 JS 中是 falsy,pos.max_reward || '' 会将 0 变成 '', 提交到后端后 nullable 规则将空字符串解析为 null 覆盖掉用户的 0 设置。
This commit is contained in:
@@ -44,10 +44,10 @@
|
||||
icon: pos.icon || '',
|
||||
rank: pos.rank,
|
||||
level: pos.level,
|
||||
max_persons: pos.max_persons || '',
|
||||
max_reward: pos.max_reward || '',
|
||||
daily_reward_limit: pos.daily_reward_limit || '',
|
||||
recipient_daily_limit: pos.recipient_daily_limit || '',
|
||||
max_persons: pos.max_persons ?? '',
|
||||
max_reward: pos.max_reward !== null && pos.max_reward !== undefined ? pos.max_reward : '',
|
||||
daily_reward_limit: pos.daily_reward_limit !== null && pos.daily_reward_limit !== undefined ? pos.daily_reward_limit : '',
|
||||
recipient_daily_limit: pos.recipient_daily_limit !== null && pos.recipient_daily_limit !== undefined ? pos.recipient_daily_limit : '',
|
||||
sort_order: pos.sort_order,
|
||||
};
|
||||
this.showForm = true;
|
||||
|
||||
Reference in New Issue
Block a user