|
|
@@ -26,6 +26,7 @@ export class OperationsPayrollComponent implements OnInit{
|
|
|
clearRewardCoach():void{this.rewardCoachId.set(0);this.openRewards();}isManager():boolean{return this.sessions.session()?.operationsRole==='ops-manager'||this.sessions.session()?.isSuperAdmin===true;}
|
|
|
async load(refresh=false):Promise<void>{this.loading.set(true);this.error.set('');try{const [overview,page,rates,standards]=await Promise.all([this.operations.payrollOverview(this.month(),this.storeId(),this.search(),refresh),this.operations.payrolls(),this.operations.payRates(),this.operations.teachingStandards()]);this.overview.set(overview);this.page.set(page);this.rates.set(rates.items);this.standards.set(standards);this.mappingSelections.set(Object.fromEntries(standards.mappings.map((row)=>[row.courseId,row.categoryKey||row.suggestedCategoryKey])));}catch(error){this.error.set(error instanceof Error?error.message:'工资数据加载失败');}finally{this.loading.set(false);}}
|
|
|
async refreshLive():Promise<void>{if(this.tab()==='rewards'){this.openRewards();return;}if(this.refreshing())return;this.refreshing.set(true);this.error.set('');try{this.overview.set(await this.operations.payrollOverview(this.month(),this.storeId(),this.search(),true));this.message.set('实时上课记录已刷新');}catch(error){this.error.set(error instanceof Error?error.message:'实时工资数据刷新失败,当前继续显示缓存');}finally{this.refreshing.set(false);}}
|
|
|
+ async resetFilters():Promise<void>{this.search.set('');this.storeId.set(0);this.rewardCoachId.set(0);await this.applyFilters();}
|
|
|
async applyFilters():Promise<void>{if(this.tab()==='rewards'){this.openRewards();return;}await this.load(true);}
|
|
|
async open(row:PayrollSummary):Promise<void>{this.loading.set(true);this.error.set('');try{this.selectedCoachId.set(0);this.detail.set(await this.operations.payrollDetail(row.objectId));}catch(error){this.error.set(error instanceof Error?error.message:'工资单加载失败');}finally{this.loading.set(false);}}
|
|
|
coachLabel(name:string,coachId:number):string{const value=String(name||'').trim();return !value||value===String(coachId)?`陪练 ${coachId}`:value;}
|