成本配置改用紧凑列表增删查改,空目录不恢复固定项目
This commit is contained in:
1 parent
ba67ba790d
commit
13382e4d49
7 files changed
+88
-28
No files matched your search
@@ -72,6 +72,7 @@ function update(ledger,input,actor=ledger.actor){return atomic(ledger,()=>{
|
||||
object(input.costPresets,'常用成本');next.costPresets=FeePresets.presets(before.costPresets);
|
||||
for(const [kind,row] of Object.entries(input.costPresets)){
|
||||
if(!Object.hasOwn(FeePresets.presetDefaults,kind)&&!/^custom_[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(kind))fail('常用成本项目无效');
|
||||
if(row===null){if(!own(next.costPresets,kind))fail('成本项目已不存在,请刷新后核对',409);delete next.costPresets[kind];continue;}
|
||||
object(row,'常用成本');only(row,['amount','payer','name','enabled','byQuantity'],'常用成本');
|
||||
const value={...next.costPresets[kind]};
|
||||
if(own(row,'amount'))value.amount=amount(row.amount,'常用成本金额');
|
||||
|
||||
Reference in new issue
Block a user