支持耳钉货盘克重与对数同步库存及历史盘点基准

This commit is contained in:
summer committed 2026-11-08 15:47:07 +08:00
1 parent ba15795f0a
commit b6a0213a0c
28 files changed
+906 -161

No files matched your search

+7 -7
View File
@@ -25,7 +25,7 @@ function recoveryEditPanelHTML(data){
}
function recoveryEditDraft(input){
const first=input.old_lines[0],x=input.exchange||{},charge=x.charges?.[0],fee=x.fee_items?.[0],account=input.payment_account||'',recipient=account.startsWith('麦麦')?'麦麦':account.startsWith('助理2')?'助理2':'助理',method=account.replace(/^(麦麦|助理2|助理1|助理)/,'');
return {...recoveryDefaults(input.mode),mode:input.mode,date:input.date,customer:input.customer,salesperson:input.salesperson,member:input.member,note:input.note||'',old_name:first.name,incoming_weight:first.incoming_weight,melted_weight:first.melted_weight,purity:first.purity,old_lines:JSON.parse(JSON.stringify(input.old_lines)),buy_rate:input.buy_rate,buy_total:input.buy_total??'',buy_total_manual:Object.hasOwn(input,'buy_total'),melted_manual:true,depreciation_manual:Object.hasOwn(x,'depreciation_weight'),payer:input.payer,payment_method:method,payment_recipient:recipient,payout_method:method==='信用卡'?'微信':method,new_name:x.name||'足金999',new_quantity:x.quantity||'',pocket:x.pocket||state.pockets[0]||'',gold_price:x.gold_price||'0',labor_mode:x.labor_mode||'gram',labor_rate:x.labor_rate||'0',depreciation_weight:x.depreciation_weight??'',depreciation_rate:x.depreciation_rate||'0',charge_name:charge?.name||'其他收费',charge_amount:charge?.amount||'0',charges:JSON.parse(JSON.stringify(x.charges||[])),discount:x.discount||'0',rounding_mode:x.rounding_mode||'cent',material_source:x.cost_material?.mode==='pool'?'pool':'manual',material_pool_id:x.cost_material?.poolId||input.date,material_rate:x.cost_material?.rate||'',material_payer:x.cost_material_payer||input.member,cost_labor_mode:x.cost_labor?.mode||'total',cost_labor_value:x.cost_labor?.mode==='gram'?x.cost_labor.rate:x.cost_labor?.amount??'',cost_payer:x.cost_payer||input.member,labor_payer:x.cost_labor_payer||x.cost_payer||input.member,fee_note:fee?.note||'其他费用',fee_amount:fee?.amount||'0',fee_payer:fee?.payer||input.member,fee_items:JSON.parse(JSON.stringify(x.fee_items||[])),verified:false};
return {...recoveryDefaults(input.mode),mode:input.mode,date:input.date,customer:input.customer,salesperson:input.salesperson,member:input.member,note:input.note||'',old_name:first.name,incoming_weight:first.incoming_weight,melted_weight:first.melted_weight,purity:first.purity,old_lines:JSON.parse(JSON.stringify(input.old_lines)),buy_rate:input.buy_rate,buy_total:input.buy_total??'',buy_total_manual:Object.hasOwn(input,'buy_total'),melted_manual:true,depreciation_manual:Object.hasOwn(x,'depreciation_weight'),payer:input.payer,payment_method:method,payment_recipient:recipient,payout_method:method==='信用卡'?'微信':method,new_name:x.name||'足金999',new_quantity:x.quantity||'',pocket:x.pocket||state.pockets[0]||'',stockCount:x.stockCount??'',gold_price:x.gold_price||'0',labor_mode:x.labor_mode||'gram',labor_rate:x.labor_rate||'0',depreciation_weight:x.depreciation_weight??'',depreciation_rate:x.depreciation_rate||'0',charge_name:charge?.name||'其他收费',charge_amount:charge?.amount||'0',charges:JSON.parse(JSON.stringify(x.charges||[])),discount:x.discount||'0',rounding_mode:x.rounding_mode||'cent',material_source:x.cost_material?.mode==='pool'?'pool':'manual',material_pool_id:x.cost_material?.poolId||input.date,material_rate:x.cost_material?.rate||'',material_payer:x.cost_material_payer||input.member,cost_labor_mode:x.cost_labor?.mode||'total',cost_labor_value:x.cost_labor?.mode==='gram'?x.cost_labor.rate:x.cost_labor?.amount??'',cost_payer:x.cost_payer||input.member,labor_payer:x.cost_labor_payer||x.cost_payer||input.member,fee_note:fee?.note||'其他费用',fee_amount:fee?.amount||'0',fee_payer:fee?.payer||input.member,fee_items:JSON.parse(JSON.stringify(x.fee_items||[])),verified:false};
}
function recoveryEditFormDraft(form,flat){
const entry=recoveryEditEntry;if(!entry)return flat;const source=entry.draft,read=(row,name)=>recoveryText(row.querySelector('[name="'+name+'"]')?.value);
@@ -45,7 +45,7 @@ function recoveryEditingFormHTML(entry){
if(draft.pocket&&!activePocketKeys().includes(draft.pocket))html=html.replace(pocketChoice('出货货盘','pocket',draft.pocket,{blank:null}),pocketChoice('出货货盘','pocket',draft.pocket,{blank:null,historical:true}));
html=html.replace('</div></details></section><section class="panel recovery-buy-panel">',`</div>${recoveryEditRowsHTML('charge',draft.charges)}${button('+ 添加收费','recovery-edit-add-row','quiet','data-kind="charge"')}</details></section><section class="panel recovery-buy-panel">`);
html=html.replace('</div></details><p class="small recovery-formula" id="recovery-internal-preview"',`</div>${recoveryEditRowsHTML('fee',draft.fee_items)}${button('+ 添加实际费用','recovery-edit-add-row','quiet','data-kind="fee"')}</details><p class="small recovery-formula" id="recovery-internal-preview"`);
html=html.replace('<section class="panel recovery-save-panel">',`<section class="panel recovery-save-panel"><div class="note" id="recovery-edit-mode" aria-live="polite"></div>${field('修改原因','change_reason',entry.reason||'','text','required maxlength="200"')}<div id="recovery-edit-conflict" aria-live="polite">${entry.invalid?`<p class="error">记录已有变动,填写已保留,请核对最新记录。</p>${button('重新读取并核对','recovery-edit-reload','',`data-id="${e(entry.id)}"`)}${entry.latest?button('已核对最新记录,保留填写继续','recovery-edit-keep','','data-id="'+e(entry.id)+'"'):''}`:''}</div>`).replace('<button type="submit" class="primary" id="recovery-save">',`${button('取消修改','recovery-edit-close','quiet')}<button type="submit" class="primary" id="recovery-save">`);return html;
html=html.replace('<section class="panel recovery-save-panel">',`<section class="panel recovery-save-panel"><div class="note" id="recovery-edit-mode" aria-live="polite"></div>${legacyCountConfirmationHTML(entry.data.permissions)}${field('修改原因','change_reason',entry.reason||'','text','required maxlength="200"')}<div id="recovery-edit-conflict" aria-live="polite">${entry.invalid?`<p class="error">记录已有变动,填写已保留,请核对最新记录。</p>${button('重新读取并核对','recovery-edit-reload','',`data-id="${e(entry.id)}"`)}${entry.latest?button('已核对最新记录,保留填写继续','recovery-edit-keep','','data-id="'+e(entry.id)+'"'):''}`:''}</div>`).replace('<button type="submit" class="primary" id="recovery-save">',`${button('取消修改','recovery-edit-close','quiet')}<button type="submit" class="primary" id="recovery-save">`);return html;
}
function recoveryEditApproval(entry,date){return !entry.data.permissions.canDirect||entry.data.permissions.requiresApproval||state.user.role!=='owner'&&(entry.data.inputs.date!==state.today||date!==state.today);}
function syncRecoveryEditMode(form=$('#recovery-form')){const entry=recoveryEditEntry;if(!entry||form?.dataset.recoveryEdit!=='true')return;const approval=recoveryEditApproval(entry,recoveryField(form,'date')?.value),submit=$('#recovery-save'),note=$('#recovery-edit-mode');if(submit)submit.textContent=approval?'提交修改申请':'保存修改';if(note)note.textContent=approval?'麦麦同意后才更新原记录;审批前收付款、购料和库存不变。':'保存后更正原记录,并同步关联收付款、购料和库存。';}
@@ -64,7 +64,7 @@ function applyRecoveryChangeRestrictions(){
const review=$('#recovery-change-review-form')||$('#recovery-cancel-form');if(review)for(const control of review.querySelectorAll('input,textarea,button'))control.disabled=control.dataset.action==='recovery-changes-close'?busy:busy||!!pending()||!recoveryReviewEntry||recoveryReviewEntry.invalid;
}
async function submitRecoveryEdit(form){
const entry=recoveryEditEntry;if(!entry||entry.invalid||entry.user!==recoveryChangeUser()||form!==$('#recovery-form')||!entry.data.permissions.canEdit||entry.data.pending)throw new Error('请重新读取并核对回收记录后再修改。');syncRecoveryForm(form,{quote:false});rememberRecoveryEditDraft(form);const input=validateRecoveryInput(recoveryInput(recoveryFormDraft(form))),reason=recoveryText(recoveryField(form,'change_reason')?.value);if(!reason||reason.length>200)throw new Error('修改原因请填写1~200字。');if(input.mode!==entry.data.inputs.mode||input.member!==entry.data.inputs.member)throw new Error('原记录类型与归属不能修改。');const payload={...input,revision:entry.revision,reason,verified:true},url='/api/recoveries/'+encodeURIComponent(entry.id)+'/update',view=captureRecoveryChangeView();$('#recovery-form-error').innerHTML='';
const entry=recoveryEditEntry;if(!entry||entry.invalid||entry.user!==recoveryChangeUser()||form!==$('#recovery-form')||!entry.data.permissions.canEdit||entry.data.pending)throw new Error('请重新读取并核对回收记录后再修改。');syncRecoveryForm(form,{quote:false});rememberRecoveryEditDraft(form);const input=validateRecoveryInput(recoveryInput(recoveryFormDraft(form))),reason=recoveryText(recoveryField(form,'change_reason')?.value);if(!reason||reason.length>200)throw new Error('修改原因请填写1~200字。');if(input.mode!==entry.data.inputs.mode||input.member!==entry.data.inputs.member)throw new Error('原记录类型与归属不能修改。');const payload={...input,...requireLegacyCountConfirmation(form,entry.data.permissions),revision:entry.revision,reason,verified:true},url='/api/recoveries/'+encodeURIComponent(entry.id)+'/update',view=captureRecoveryChangeView();$('#recovery-form-error').innerHTML='';
try{form.querySelectorAll('input,select,textarea').forEach(control=>control.disabled=true);const result=await mutate(url,payload);await finishRecoveryChangeSave(url,payload,result,view);}catch(err){if(view.user===recoveryChangeUser())recoveryChangeError(err,{kind:'update',id:entry.id});}
}
function recoveryChangeStatus(row){return {pending:'待麦麦复核',approved:row.action==='cancel'?'已同意取消':'已同意修改',rejected:'已驳回'}[row.status]||'状态待核对';}
@@ -73,9 +73,9 @@ function recoveryChangeComparisonHTML(raw){
const request=validateRecoveryChangeRequest(raw),before=request.before,after=request.after,pair=(title,a,b)=>`<tr${String(a??'')!==String(b??'')?' class="order-change-modified"':''}><th scope="row">${e(title)}</th><td>${recoveryCompareCell(a)}</td><td>${recoveryCompareCell(b)}</td></tr>`,old=input=>input?.old_lines.map(row=>`${row.name}:来料 ${row.incoming_weight}g,熔后 ${row.melted_weight}g,成色 ${row.purity}%`).join('\n'),fees=input=>input?.exchange?.fee_items.map(row=>`${row.note}:${row.amount}元 · ${teamMemberName(row.payer)}付款`).join('\n')||'无',charges=input=>input?.exchange?.charges.map(row=>`${row.name}:${row.amount}元`).join('\n')||'无';
const x=before.exchange||{},y=after?.exchange||{},material=value=>value?.mode==='pool'?'料池 '+value.poolId:value?'手填 '+value.rate+'元/克':'无补金差重',labor=value=>value?value.mode==='gram'?value.rate+'元/克':value.amount+'元总工费':'未提供';
let rows=pair('业务日期',before.date,after?.date||'取消原记录')+pair('客户',before.customer,after?.customer)+pair('开单人',before.salesperson,after?.salesperson)+pair('归属',teamMemberName(before.member),after?teamMemberName(after.member):'沿用原身份留档')+pair('旧料逐项称重',old(before),after?old(after):'冲正原库存及关联购料')+pair('回收单价(元/克)',before.buy_rate,after?.buy_rate)+pair('回收结算额(元)',before.buy_total,after?.buy_total)+pair('实际收付款账户',accountDisplayName(before.payment_account),after?accountDisplayName(after.payment_account):'冲正原收付记录')+pair('付款人',teamMemberName(before.payer),after?teamMemberName(after.payer):'原付款流水保留')+pair('备注',before.note,after?.note);
if(before.mode==='exchange')rows+=pair('置换新货',x.name,y.name)+pair('新货克重(g)',x.quantity,y.quantity)+pair('实际货盘',pocketLabel(x.pocket),pocketLabel(y.pocket))+pair('销售金价(元/克)',x.gold_price,y.gold_price)+pair('销售工费',x.labor_rate+'元/'+(x.labor_mode==='gram'?'克':'总额'),after?y.labor_rate+'元/'+(y.labor_mode==='gram'?'克':'总额'):'取消')+pair('折旧计费克重/单价',x.depreciation_weight+'g × '+x.depreciation_rate+'元/克',after?y.depreciation_weight+'g × '+y.depreciation_rate+'元/克':'取消')+pair('附加收费',charges(before),after?charges(after):'取消')+pair('优惠(元)',x.discount,y.discount)+pair('取整方式',x.rounding_mode==='yuan'?'四舍五入到元':'保留到分',after?(y.rounding_mode==='yuan'?'四舍五入到元':'保留到分'):'取消')+pair('补金差重进货来源',material(x.cost_material),after?material(y.cost_material):'释放原耗用')+pair('料费付款人',teamMemberName(x.cost_material_payer),after?teamMemberName(y.cost_material_payer):'原来源留档')+pair('进货工费',labor(x.cost_labor),after?labor(y.cost_labor):'取消')+pair('工费付款人',teamMemberName(x.cost_labor_payer),after?teamMemberName(y.cost_labor_payer):'原来源留档')+pair('实际费用',fees(before),after?fees(after):'冲正原费用');
if(before.mode==='exchange')rows+=pair('置换新货',x.name,y.name)+pair('新货克重(g)',x.quantity,y.quantity)+pair('实际货盘',pocketLabel(x.pocket),pocketLabel(y.pocket))+pair('出库数量(对)',stockCountText(x.stockCount==null?null:Number(x.stockCount)),stockCountText(y.stockCount==null?null:Number(y.stockCount)))+pair('销售金价(元/克)',x.gold_price,y.gold_price)+pair('销售工费',x.labor_rate+'元/'+(x.labor_mode==='gram'?'克':'总额'),after?y.labor_rate+'元/'+(y.labor_mode==='gram'?'克':'总额'):'取消')+pair('折旧计费克重/单价',x.depreciation_weight+'g × '+x.depreciation_rate+'元/克',after?y.depreciation_weight+'g × '+y.depreciation_rate+'元/克':'取消')+pair('附加收费',charges(before),after?charges(after):'取消')+pair('优惠(元)',x.discount,y.discount)+pair('取整方式',x.rounding_mode==='yuan'?'四舍五入到元':'保留到分',after?(y.rounding_mode==='yuan'?'四舍五入到元':'保留到分'):'取消')+pair('补金差重进货来源',material(x.cost_material),after?material(y.cost_material):'释放原耗用')+pair('料费付款人',teamMemberName(x.cost_material_payer),after?teamMemberName(y.cost_material_payer):'原来源留档')+pair('进货工费',labor(x.cost_labor),after?labor(y.cost_labor):'取消')+pair('工费付款人',teamMemberName(x.cost_labor_payer),after?teamMemberName(y.cost_labor_payer):'原来源留档')+pair('实际费用',fees(before),after?fees(after):'冲正原费用');
const a=request.summary.before||{},b=request.summary.after||{};rows+=[['实际收客户','cashReceipt'],['实际付客户','cashPayment'],['购料成本','purchaseAmount'],['订单货品成本','goodsCost'],['实际费用','directCost'],['原账利润','profit']].map(([title,key])=>pair(title,a[key]==null?'待核实':'¥'+yuan(a[key]),after?(b[key]==null?'待核实':'¥'+yuan(b[key])):'取消后冲正')).join('');
return `<div class="table-wrap recovery-change-comparison"><table class="order-change-table" aria-label="回收更正原值与申请值"><thead><tr><th>核对项目</th><th>原值</th><th>${request.action==='cancel'?'取消后':'申请值'}</th></tr></thead><tbody>${rows}</tbody></table></div>${request.action==='cancel'?recoveryBlockedHTML(request.summary.blockedUsages||[],false)+recoveryCancellationMaterialHTML():''}`;
return `${request.summary.legacyCountNotice?'<p class="note">'+e(request.summary.legacyCountNotice)+(request.summary.legacyCountVerified?'(申请人已确认)':'')+'</p>':''}<div class="table-wrap recovery-change-comparison"><table class="order-change-table" aria-label="回收更正原值与申请值"><thead><tr><th>核对项目</th><th>原值</th><th>${request.action==='cancel'?'取消后':'申请值'}</th></tr></thead><tbody>${rows}</tbody></table></div>${request.action==='cancel'?recoveryBlockedHTML(request.summary.blockedUsages||[],false)+recoveryCancellationMaterialHTML():''}`;
}
function recoveryChangesEntryHTML(){return button(state.user.role==='owner'?'回收更正复核(…)':'回收更正申请(…)','recovery-changes-open','','id="recovery-changes-entry"');}
async function loadRecoveryChangeCount(){const node=$('#recovery-changes-entry');if(!node)return;const user=recoveryChangeUser(),title=state.user.role==='owner'?'回收更正复核':'回收更正申请';try{const data=await api('/api/recovery-changes?status=pending');if(!Number.isSafeInteger(data.counts?.pending)||data.counts.pending<0)throw new Error('数量未完整返回');if(node===$('#recovery-changes-entry')&&user===recoveryChangeUser())node.textContent=title+'('+data.counts.pending+')';}catch{if(node===$('#recovery-changes-entry')&&user===recoveryChangeUser())node.textContent=title+'(读取失败)';}}
@@ -91,10 +91,10 @@ async function openRecoveryCancel(id){
dialog.innerHTML=`${button('关闭','recovery-changes-close','dialog-close','aria-label="关闭取消回收记录"')}<h2 id="recovery-change-title">取消回收/置换记录</h2><p>正在读取…</p>`;if(!dialog.open)dialog.showModal();
try{
const response=await api('/api/recoveries/'+encodeURIComponent(id)+'/edit');if(request!==recoveryReviewRequest||user!==recoveryChangeUser()||!dialog.open)return;const data=validateRecoveryEditDetail(response,id);if(!data.permissions.canCancel||data.pending)throw new Error(data.permissions.reason||'记录已取消或有待审批申请,当前不能取消。');recoveryReviewEntry={user,data,kind:'cancel',invalid:false};
dialog.innerHTML=`${button('关闭','recovery-changes-close','dialog-close','aria-label="关闭取消回收记录"')}<h2 id="recovery-change-title">取消这笔${e(recoveryModeNames[data.inputs.mode])}记录</h2><p>${e(data.record.number)} · ${e(data.inputs.date)} · ${e(data.inputs.customer)}</p><p class="small muted">取消后冲正整套关联收付款、购料与库存,原身份和更正记录保留。系统不会发起真实退款。</p>${recoveryMaterialBatchHTML(data.record.materialBatch)}${recoveryBlockedHTML(data.blockedUsages,false)}${recoveryCancellationMaterialHTML()}<form id="recovery-cancel-form"><label>取消原因<textarea name="reason" required maxlength="200" rows="2"></textarea></label><label class="check"><input type="checkbox" name="verified" required>已核实这笔记录需要取消,并核对关联用料自动重算与实际收付款。</label><div id="recovery-cancel-error" aria-live="polite"></div><div class="form-actions">${button('返回','recovery-changes-close','quiet')}<button class="primary" type="submit">${data.permissions.requiresApproval?'提交取消申请':'确认取消记录'}</button></div></form>`;
dialog.innerHTML=`${button('关闭','recovery-changes-close','dialog-close','aria-label="关闭取消回收记录"')}<h2 id="recovery-change-title">取消这笔${e(recoveryModeNames[data.inputs.mode])}记录</h2><p>${e(data.record.number)} · ${e(data.inputs.date)} · ${e(data.inputs.customer)}</p><p class="small muted">取消后冲正整套关联收付款、购料与库存,原身份和更正记录保留。系统不会发起真实退款。</p>${recoveryMaterialBatchHTML(data.record.materialBatch)}${recoveryBlockedHTML(data.blockedUsages,false)}${recoveryCancellationMaterialHTML()}<form id="recovery-cancel-form">${legacyCountConfirmationHTML(data.permissions)}<label>取消原因<textarea name="reason" required maxlength="200" rows="2"></textarea></label><label class="check"><input type="checkbox" name="verified" required>已核实这笔记录需要取消,并核对关联用料自动重算与实际收付款。</label><div id="recovery-cancel-error" aria-live="polite"></div><div class="form-actions">${button('返回','recovery-changes-close','quiet')}<button class="primary" type="submit">${data.permissions.requiresApproval?'提交取消申请':'确认取消记录'}</button></div></form>`;
}catch(err){if(request===recoveryReviewRequest&&user===recoveryChangeUser()&&dialog.open)dialog.innerHTML=`${button('关闭','recovery-changes-close','dialog-close')}<h2 id="recovery-change-title">暂不能取消</h2><div class="error">${e(err.message)}</div>${button('重新读取','recovery-edit-cancel','',`data-id="${e(id)}"`)}`;}
}
async function submitRecoveryCancel(form){const entry=recoveryReviewEntry,data=entry?.data;if(!entry||entry.invalid||entry.kind!=='cancel'||entry.user!==recoveryChangeUser()||!data.permissions.canCancel||data.pending)throw new Error('请重新读取回收记录后核对取消。');const reason=recoveryText(form.querySelector('[name="reason"]')?.value);if(!reason||reason.length>200)throw new Error('取消原因请填写1~200字。');if(!form.querySelector('[name="verified"]')?.checked)throw new Error('请核实取消记录及关联账务,并勾选确认。');const input={revision:data.revision,reason,verified:true},url='/api/recoveries/'+encodeURIComponent(data.id)+'/cancel',view=captureRecoveryChangeView();try{const result=await mutate(url,input);await finishRecoveryChangeSave(url,input,result,view);}catch(err){if(view.user===recoveryChangeUser())recoveryChangeError(err,{kind:'cancel',id:data.id});}}
async function submitRecoveryCancel(form){const entry=recoveryReviewEntry,data=entry?.data;if(!entry||entry.invalid||entry.kind!=='cancel'||entry.user!==recoveryChangeUser()||!data.permissions.canCancel||data.pending)throw new Error('请重新读取回收记录后核对取消。');const reason=recoveryText(form.querySelector('[name="reason"]')?.value);if(!reason||reason.length>200)throw new Error('取消原因请填写1~200字。');if(!form.querySelector('[name="verified"]')?.checked)throw new Error('请核实取消记录及关联账务,并勾选确认。');const input={revision:data.revision,reason,verified:true,...requireLegacyCountConfirmation(form,data.permissions)},url='/api/recoveries/'+encodeURIComponent(data.id)+'/cancel',view=captureRecoveryChangeView();try{const result=await mutate(url,input);await finishRecoveryChangeSave(url,input,result,view);}catch(err){if(view.user===recoveryChangeUser())recoveryChangeError(err,{kind:'cancel',id:data.id});}}
function recoveryChangeOperation(url){let found=String(url).match(/^\/api\/recoveries\/([^/]+)\/(update|cancel)$/);if(found)return {id:decodeURIComponent(found[1]),kind:found[2]};found=String(url).match(/^\/api\/recovery-changes\/([^/]+)\/(approve|reject)$/);return found?{id:decodeURIComponent(found[1]),kind:found[2]}:null;}
function captureRecoveryChangeView(){return {user:recoveryChangeUser(),tab,edit:recoveryEditEntry,review:recoveryReviewEntry,dialog:$('#recovery-change-dialog'),version:recoveryReviewRequest};}
function recoveryChangeError(err,operation){const review=operation&&operation.kind!=='update',entry=review?recoveryReviewEntry:recoveryEditEntry;if([403,404,409].includes(err.status)&&entry){entry.invalid=true;const checked=review?$('#recovery-change-review-form [name="verified"]')||$('#recovery-cancel-form [name="verified"]'):recoveryField($('#recovery-form'),'verified');if(checked)checked.checked=false;}const target=$(review?(entry?.kind==='cancel'?'#recovery-cancel-error':'#recovery-change-review-error'):'#recovery-form-error');if(target)target.innerHTML=`<div class="error">${e(err.message)}${pending()?' '+button('恢复原操作','retry','danger'):operation?review?button('重新读取',operation.kind==='cancel'?'recovery-edit-cancel':'recovery-change-open','',`data-id="${e(operation.id)}"`):button('重新读取并核对','recovery-edit-reload','',`data-id="${e(operation.id)}"`):''}</div>`;if(!review&&recoveryEditEntry)rememberRecoveryEditDraft();applyRecoveryChangeRestrictions();toast(err.message,true);}