from django.db import models class DepartmentAnnualPerformance(models.Model): primary_department = models.CharField(max_length=255, verbose_name="一级部门", help_text="用于筛选、区分一级部门") year = models.IntegerField(verbose_name="年份", help_text="表示数据统计的年份") annual_revenue = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="年度营业收入", help_text="该年度内的总营业收入,以万元为单位") annual_revenue_completion_rate = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="年度营业收入完成率", help_text="年度营业收入与目标收入的完成比率") annual_new_revenue = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="年度新增收入", help_text="当年新增的营业收入,以万元为单位") annual_new_revenue_completion_rate = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="年度新增收入完成率", help_text="年度新增收入与新增收入目标的完成比率") annual_existing_revenue = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="年度存量收入", help_text="当年存量的营业收入,以万元为单位") annual_existing_revenue_completion_rate = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="年度存量收入完成率", help_text="年度存量收入与存量收入目标的完成比率") annual_operating_costs = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="年度营业成本", help_text="该年度的营业成本总额,以万元为单位") annual_operating_costs_utilization_rate = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="年度营业成本占用率", help_text="年度营业成本与成本限额的占用比率") annual_expenses = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="年度费用开销", help_text="该年度的总费用开销,以万元为单位") annual_expenses_utilization_rate = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="年度费用开销占用率", help_text="年度费用开销与费用限额的占用比率") operating_profit = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="营业利润", help_text="该年度的营业利润,计算方式详见描述") class Meta: verbose_name = "业务部门年度总体经营指标" verbose_name_plural = "业务部门年度总体经营指标" db_table_comment = '存储业务部门年度总体经营指标数据,包括一级部门、年份、营业收入及其完成率、新增收入及其完成率、存量收入及其完成率、营业成本及其占用率、费用开销及其占用率、营业利润等' def __str__(self): return f"{self.year} 年 {self.primary_department} 的经营指标" @staticmethod def get_field_labels(): return { 'primary_department': '一级部门', 'year': '年份', 'annual_revenue': '年度营业收入', 'annual_revenue_completion_rate': '年度营业收入完成率', 'annual_new_revenue': '年度新增收入', 'annual_new_revenue_completion_rate': '年度新增收入完成率', 'annual_existing_revenue': '年度存量收入', 'annual_existing_revenue_completion_rate': '年度存量收入完成率', 'annual_operating_costs': '年度营业成本', 'annual_operating_costs_utilization_rate': '年度营业成本占用率', 'annual_expenses': '年度费用开销', 'annual_expenses_utilization_rate': '年度费用开销占用率', 'operating_profit': '营业利润', } def get_field_label(self, field_name): field_labels = self.get_field_labels() return field_labels.get(field_name, field_name) class DepartmentMonthlyIncome(models.Model): primary_department = models.CharField(max_length=255, verbose_name="一级部门", help_text="用于筛选、区分一级部门") year_month = models.CharField(max_length=7, verbose_name="年月", help_text="格式为'YYYY-MM',表示统计数据的年月") current_month_income = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="当月收入", help_text="当月总收入,以万元为单位") monthly_income_target = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="月收入目标", help_text="当月收入目标,以万元为单位") monthly_target_completion_rate = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="月目标完成率", help_text="当月收入与月收入目标的完成比率") current_month_new_income = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="当月新增收入", help_text="当月新增的收入,以万元为单位") monthly_new_income_target = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="月新增收入目标", help_text="当月新增收入的目标,以万元为单位") monthly_new_income_completion_rate = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="月新增收入完成率", help_text="当月新增收入与月新增收入目标的完成比率") current_month_existing_income = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="当月存量收入", help_text="当月存量收入,以万元为单位") monthly_existing_income_target = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="月存量收入目标", help_text="当月存量收入的目标,以万元为单位") monthly_existing_income_completion_rate = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="月存量收入完成率", help_text="当月存量收入与月存量收入目标的完成比率") annual_accumulated_income = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="年累计收入", help_text="年度累计收入,以万元为单位") accumulated_target_completion_rate = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="累计目标完成率", help_text="年度累计收入与年度总收入目标的完成比率") class Meta: verbose_name = "业务部门收入情况" verbose_name_plural = "业务部门收入情况" db_table_comment = '存储业务部门收入情况数据,包括一级部门、年月、当月收入及其目标和完成率、新增收入及其目标和完成率、存量收入及其目标和完成率、年累计收入及其目标完成率等' def __str__(self): return f"{self.year_month} 年 {self.primary_department} 的收入情况" @staticmethod def get_field_labels(): return { 'primary_department': '一级部门', 'year_month': '年月', 'current_month_income': '当月收入', 'monthly_income_target': '月收入目标', 'monthly_target_completion_rate': '月目标完成率', 'current_month_new_income': '当月新增收入', 'monthly_new_income_target': '月新增收入目标', 'monthly_new_income_completion_rate': '月新增收入完成率', 'current_month_existing_income': '当月存量收入', 'monthly_existing_income_target': '月存量收入目标', 'monthly_existing_income_completion_rate': '月存量收入完成率', 'annual_accumulated_income': '年累计收入', 'accumulated_target_completion_rate': '累计目标完成率', } def get_field_label(self, field_name): field_labels = self.get_field_labels() return field_labels.get(field_name, field_name) class DepartmentMonthlyCost(models.Model): primary_department = models.CharField(max_length=255, verbose_name="一级部门", help_text="用于筛选、区分一级部门") year_month = models.CharField(max_length=7, verbose_name="年月", help_text="格式为'YYYY-MM',表示统计数据的年月") current_month_cost = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="当月成本(万元)", help_text="当月成本总额,以万元为单位") monthly_cost_limit = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="月成本限额(万元)", help_text="每月的成本限额,以万元为单位") monthly_cost_utilization_rate = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="月成本占用率", help_text="当月成本占用月成本限额的比率,以百分比表示") annual_accumulated_cost = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="年累计成本(万元)", help_text="年度累计成本总额,以万元为单位") accumulated_cost_utilization_rate = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="累计成本占用率", help_text="年累计成本占用年度成本限额的比率,以百分比表示") class Meta: verbose_name = "业务部门成本情况" verbose_name_plural = "业务部门成本情况" db_table_comment = '存储业务部门成本情况数据,包括一级部门、年月、当月成本及其限额和占用率、年累计成本及其占用率等' def __str__(self): return f"{self.year_month} 年 {self.primary_department} 的成本情况" @staticmethod def get_field_labels(): return { 'primary_department': '一级部门', 'year_month': '年月', 'current_month_cost': '当月成本(万元)', 'monthly_cost_limit': '月成本限额(万元)', 'monthly_cost_utilization_rate': '月成本占用率', 'annual_accumulated_cost': '年累计成本(万元)', 'accumulated_cost_utilization_rate': '累计成本占用率', } def get_field_label(self, field_name): field_labels = self.get_field_labels() return field_labels.get(field_name, field_name) class DepartmentMonthlyProfit(models.Model): primary_department = models.CharField(max_length=255, verbose_name="一级部门", help_text="用于筛选、区分一级部门") year_month = models.CharField(max_length=7, verbose_name="年月", help_text="格式为'YYYY-MM',表示统计数据的年月") operating_profit = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="营业利润", help_text="当月的营业利润,计算方式如描述,以万元为单位") annual_operating_profit = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="年累计营业利润", help_text="当年的累计营业利润,以万元为单位") class Meta: verbose_name = "业务部门利润情况" verbose_name_plural = "业务部门利润情况" db_table_comment = '存储业务部门利润情况数据,包括一级部门、年月、当月营业利润和年累计营业利润等' def __str__(self): return f"{self.year_month} 年 {self.primary_department} 的利润情况" @staticmethod def get_field_labels(): return { 'primary_department': '一级部门', 'year_month': '年月', 'operating_profit': '营业利润', 'annual_operating_profit': '年累计营业利润', } def get_field_label(self, field_name): field_labels = self.get_field_labels() return field_labels.get(field_name, field_name) class DepartmentProjectProgress(models.Model): primary_department = models.CharField(max_length=255, verbose_name="一级部门", help_text="用于筛选、区分一级部门") project_name = models.CharField(max_length=255, verbose_name="项目名称", help_text="项目的名称") project_type = models.CharField(max_length=255, verbose_name="项目类型", help_text="项目的类型,如开发、研究等") project_manager = models.CharField(max_length=255, verbose_name="负责人", help_text="负责项目的人员") project_status = models.CharField(max_length=255, verbose_name="项目状态", help_text="项目当前的状态,如进行中、已完成、暂停等") project_progress = models.CharField(max_length=255, verbose_name="项目进度", help_text="项目的完成进度,通常以百分比表示") project_nature = models.CharField(max_length=255, verbose_name="项目性质", help_text="项目的性质,如内部项目、外包项目等") contract_date = models.DateField(verbose_name="签约时间", help_text="项目签约的日期") target_amount = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="标的金额(元)", help_text="项目的标的金额,以元为单位") contract_rate = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="合同费率", help_text="项目合同中约定的费率") revenue = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="收入(元)", help_text="项目实际产生的收入,以元为单位") cost_rate = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="成本费率", help_text="项目成本的费率") cost = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="成本(元)", help_text="项目的实际成本,以元为单位") net_income = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="净收入(元)", help_text="项目的净收入,计算为收入减去成本") transaction_amount = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="成交金额(元)", help_text="项目的成交金额,以元为单位") total_tax_inclusive_amount = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="价税合计金额(元)", help_text="项目的价税合计金额,以元为单位") payment_received = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="回款金额(元)", help_text="项目实际已回款的金额,以元为单位") class Meta: verbose_name = "业务部门项目进度" verbose_name_plural = "业务部门项目进度" db_table_comment = '存储业务部门项目进度数据,包括一级部门、项目名称、项目类型、负责人、项目状态、项目进度、项目性质、签约时间、标的金额、合同费率、收入、成本费率、成本、净收入、成交金额、价税合计金额和回款金额等' def __str__(self): return f"{self.primary_department} 部门的项目 {self.project_name} 进度" @staticmethod def get_field_labels(): return { 'primary_department': '一级部门', 'project_name': '项目名称', 'project_type': '项目类型', 'project_manager': '负责人', 'project_status': '项目状态', 'project_progress': '项目进度', 'project_nature': '项目性质', 'contract_date': '签约时间', 'target_amount': '标的金额(元)', 'contract_rate': '合同费率', 'revenue': '收入(元)', 'cost_rate': '成本费率', 'cost': '成本(元)', 'net_income': '净收入(元)', 'transaction_amount': '成交金额(元)', 'total_tax_inclusive_amount': '价税合计金额(元)', 'payment_received': '回款金额(元)', } def get_field_label(self, field_name): field_labels = self.get_field_labels() return field_labels.get(field_name, field_name) class DepartmentProjectSettlement(models.Model): primary_department = models.CharField(max_length=255, verbose_name="一级部门", help_text="用于筛选、区分一级部门") project_name = models.CharField(max_length=255, verbose_name="项目名称", help_text="项目的名称") revenue = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="营业收入(元)", help_text="项目的总营业收入") operating_costs = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="营业成本(元)", help_text="项目的总营业成本") taxes_and_surcharges = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="税金及附加(元)", help_text="项目相关的税金及附加费用,根据公式计算") operating_profit = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="营业利润(元)", help_text="项目的营业利润,计算为营业收入减去营业成本和税金及附加") company_retention = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="公司留存(元)", help_text="项目为公司留存的部分收益") project_commission = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="项目提成(元)", help_text="项目团队的提成金额") project_provision_fund = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="项目公积金(元)", help_text="从营业利润中提取的项目公积金") class Meta: verbose_name = "业务部门项目结算情况" verbose_name_plural = "业务部门项目结算情况" db_table_comment = '存储业务部门项目结算情况数据,包括一级部门、项目名称、营业收入、营业成本、税金及附加、营业利润、公司留存、项目提成和项目公积金等' def __str__(self): return f"{self.primary_department} 部门的项目 {self.project_name} 结算情况" @staticmethod def get_field_labels(): return { 'primary_department': '一级部门', 'project_name': '项目名称', 'revenue': '营业收入(元)', 'operating_costs': '营业成本(元)', 'taxes_and_surcharges': '税金及附加(元)', 'operating_profit': '营业利润(元)', 'company_retention': '公司留存(元)', 'project_commission': '项目提成(元)', 'project_provision_fund': '项目公积金(元)', } def get_field_label(self, field_name): field_labels = self.get_field_labels() return field_labels.get(field_name, field_name) class DepartmentProjectPayment(models.Model): primary_department = models.CharField(max_length=255, verbose_name="一级部门", help_text="用于筛选、区分一级部门") project_name = models.CharField(max_length=255, verbose_name="项目名称", help_text="项目的名称") project_type = models.CharField(max_length=255, verbose_name="项目类型", help_text="项目的类型") project_manager = models.CharField(max_length=255, verbose_name="负责人", help_text="负责项目的人员") total_tax_inclusive_amount = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="价税合计金额(元)", help_text="项目的价税合计金额,累计数") payment_received = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="回款金额(元)", help_text="项目的回款金额,累计数") outstanding_payment_amount = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="待回款金额(元)", help_text="计算得出的待回款金额,价税合计金额减去回款金额") receivable_net_income = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="应收净收入(元)", help_text="应收的净收入,累计数") actual_net_income = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="实收净收入(元)", help_text="实际收到的净收入,累计数") outstanding_net_income = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="待收净收入(元)", help_text="待收净收入,计算为应收净收入减去实收净收入") class Meta: verbose_name = "业务部门项目回款情况" verbose_name_plural = "业务部门项目回款情况" # 添加模型注释 db_table_comment = '存储业务部门项目回款情况,包括一级部门、项目名称、项目类型、负责人、价税合计金额、回款金额、待回款金额、应收净收入、实收净收入和待收净收入等' def __str__(self): return f"Department Project Payment for {self.project_name} in {self.primary_department}" @staticmethod def get_field_labels(): return { 'primary_department': '一级部门', 'project_name': '项目名称', 'project_type': '项目类型', 'project_manager': '负责人', 'total_tax_inclusive_amount': '价税合计金额(元)', 'payment_received': '回款金额(元)', 'outstanding_payment_amount': '待回款金额(元)', 'receivable_net_income': '应收净收入(元)', 'actual_net_income': '实收净收入(元)', 'outstanding_net_income': '待收净收入(元)', } def get_field_label(self, field_name): field_labels = self.get_field_labels() return field_labels.get(field_name, field_name) class DepartmentRevenueStructure(models.Model): primary_department = models.CharField(max_length=255, verbose_name="一级部门", help_text="用于筛选、区分一级部门") year_month = models.CharField(max_length=7, verbose_name="年月", help_text="格式为'YYYY-MM',表示统计数据的年月") project_type = models.CharField(max_length=255, verbose_name="项目类型", help_text="项目的分类类型") total_tax_inclusive_amount = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="价税合计金额", help_text="当月按项目类型的价税合计金额") percentage = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="占比", help_text="该项目类型的价税合计金额占当月总收入的百分比") cumulative_tax_inclusive_amount = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="累计价税合计金额", help_text="从年初到当前月的累计价税合计金额") cumulative_percentage = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="累计占比", help_text="该项目类型的累计价税合计金额占当年1月至当月的") class Meta: verbose_name = "业务部门收入结构" verbose_name_plural = "业务部门收入结构" # 添加模型注释 db_table_comment = '存储业务部门收入结构数据,包括一级部门、年月、项目类型、价税合计金额、占比、累计价税合计金额和累计占比等' def __str__(self): return f"Department Revenue Structure for {self.primary_department} in {self.year_month}" @staticmethod def get_field_labels(): return { 'primary_department': '一级部门', 'year_month': '年月', 'project_type': '项目类型', 'total_tax_inclusive_amount': '价税合计金额', 'percentage': '占比', 'cumulative_tax_inclusive_amount': '累计价税合计金额', 'cumulative_percentage': '累计占比', } def get_field_label(self, field_name): field_labels = self.get_field_labels() return field_labels.get(field_name, field_name) class DepartmentProfitStructure(models.Model): primary_department = models.CharField(max_length=255, verbose_name="一级部门", help_text="用于筛选、区分一级部门") year_month = models.CharField(max_length=7, verbose_name="年月", help_text="格式为'YYYY-MM',表示统计数据的年月") project_type = models.CharField(max_length=255, verbose_name="项目类型", help_text="项目的分类类型") net_receivable_income = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="应收净收入(元)", help_text="当月按项目类型的应收净收入") percentage = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="占比", help_text="该项目类型的应收净收入占当月总利润的百分比") cumulative_net_receivable_income = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="累计应收净收入(元)", help_text="从年初到当前月的累计应收净收入") cumulative_percentage = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="累计占比", help_text="该项目类型的累计应收净收入占当年1月至当月的") class Meta: verbose_name = "业务部门利润结构" verbose_name_plural = "业务部门利润结构" # 添加模型注释 db_table_comment = '存储业务部门利润结构数据,包括一级部门、年月、项目类型、应收净收入、占比、累计应收净收入和累计占比等' def __str__(self): return f"Department Profit Structure for {self.primary_department} in {self.year_month}" @staticmethod def get_field_labels(): return { 'primary_department': '一级部门', 'year_month': '年月', 'project_type': '项目类型', 'net_receivable_income': '应收净收入(元)', 'percentage': '占比', 'cumulative_net_receivable_income': '累计应收净收入(元)', 'cumulative_percentage': '累计占比', } def get_field_label(self, field_name): field_labels = self.get_field_labels() return field_labels.get(field_name, field_name) class DepartmentProjectManagerIncomeCommission(models.Model): primary_department = models.CharField(max_length=255, verbose_name="一级部门", help_text="用于筛选、区分一级部门") name = models.CharField(max_length=255, verbose_name="姓名", help_text="项目经理的姓名") year_month = models.CharField(max_length=7, verbose_name="年月", help_text="格式为'YYYY-MM',表示统计数据的年月") current_month_income = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="当月收入", help_text="当月销售收入,按月累计,单位:元") monthly_income_target = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="月收入目标", help_text="当月收入目标,单位:元") monthly_target_completion_rate = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="月目标完成率", help_text="当月收入与月收入目标的比率") annual_accumulated_income = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="年累计收入", help_text="年度累计销售收入,单位:元") annual_target_completion_rate = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="累计目标完成率", help_text="项目经理年累计收入与部门收入目标比率") current_month_commission = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="当月提成", help_text="当月已发放的提成金额,单位:元") current_month_accrued_commission = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="当月计提提成", help_text="当月计提的提成金额,单位:元") annual_accumulated_commission = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="年累计提成", help_text="年度累计已发放的提成金额,单位:元") annual_accumulated_accrued_commission = models.DecimalField(max_digits=15, decimal_places=2, verbose_name="年累计计提提成", help_text="年度累计计提的提成金额,单位:元") class Meta: verbose_name = "业务部门项目经理收入完成及提成情况" verbose_name_plural = "业务部门项目经理收入完成及提成情况" # 添加模型注释 db_table_comment = '存储业务部门项目经理收入完成及提成情况数据,包括一级部门、姓名、年月、当月收入、月收入目标、月目标完成率、年累计收入、累计目标完成率、当月提成、当月计提提成、年累计提成和年累计计提提成等' def __str__(self): return f"Income Commission for {self.name} in {self.year_month}" @staticmethod def get_field_labels(): return { 'primary_department': '一级部门', 'name': '姓名', 'year_month': '年月', 'current_month_income': '当月收入', 'monthly_income_target': '月收入目标', 'monthly_target_completion_rate': '月目标完成率', 'annual_accumulated_income': '年累计收入', 'annual_target_completion_rate': '累计目标完成率', 'current_month_commission': '当月提成', 'current_month_accrued_commission': '当月计提提成', 'annual_accumulated_commission': '年累计提成', 'annual_accumulated_accrued_commission': '年累计计提提成', } def get_field_label(self, field_name): field_labels = self.get_field_labels() return field_labels.get(field_name, field_name) class DepartmentAttendance(models.Model): primary_department = models.CharField(max_length=255, verbose_name="一级部门", help_text="用于筛选、区分一级部门") year_month = models.CharField(max_length=7, verbose_name="年月", help_text="格式为'YYYY-MM',表示统计数据的年月") late = models.IntegerField(verbose_name="迟到", help_text="当月累计迟到次数") early_departure = models.IntegerField(verbose_name="早退", help_text="当月累计早退次数") absenteeism = models.IntegerField(verbose_name="旷工", help_text="当月累计旷工天数") annual_leave = models.IntegerField(verbose_name="年假", help_text="当月使用的年假天数") personal_leave = models.IntegerField(verbose_name="事假", help_text="当月使用的事假天数") sick_leave = models.IntegerField(verbose_name="病假", help_text="当月使用的病假天数") other_leave = models.IntegerField(verbose_name="其他", help_text="当月使用的其他类型假期的天数") total_days = models.IntegerField(verbose_name="合计", help_text="当月总假期天数,包括年假、事假、病假和其他类型假期") class Meta: verbose_name = "业务部门出勤情况" verbose_name_plural = "业务部门出勤情况" # 添加模型注释 db_table_comment = '存储业务部门出勤情况数据,包括一级部门、年月、迟到、早退、旷工、年假、事假、病假、其他假期和合计等' def __str__(self): return f"Attendance for {self.primary_department} in {self.year_month}" @staticmethod def get_field_labels(): return { 'primary_department': '一级部门', 'year_month': '年月', 'late': '迟到', 'early_departure': '早退', 'absenteeism': '旷工', 'annual_leave': '年假', 'personal_leave': '事假', 'sick_leave': '病假', 'other_leave': '其他', 'total_days': '合计', } def get_field_label(self, field_name): field_labels = self.get_field_labels() return field_labels.get(field_name, field_name)