XH_Digital_Management/application/busi_tbl/views.py

667 lines
33 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from django.shortcuts import render
from common.utils.page_helper import paginate_query_and_assign_numbers
from .models import *
def department_annual_performance_list_view(request):
# 声明查询集
query_set = DepartmentAnnualPerformance.objects.all().order_by('-year')
# 获取查询参数
year = request.GET.get('year', '')
primary_department = request.GET.get('primary_department', '')
# 根据提供的参数进行筛选
if year:
query_set = query_set.filter(year__icontains=year)
if primary_department:
query_set = query_set.filter(primary_department__icontains=primary_department)
# 对查询结果进行分页每页10条记录
items = paginate_query_and_assign_numbers(
request=request,
queryset=query_set,
per_page=10
)
# 构建上下文查询参数字符串
query_params = '&year={}&primary_department={}'.format(year, primary_department)
fields = [
{"label": "一级部门", "field": "primary_department", "type": "text", "is_show": 1, "is_add": 1},
{"label": "年份", "field": "year", "type": "number", "is_show": 1, "is_add": 1},
{"label": "年度营业收入", "field": "annual_revenue", "type": "number", "is_show": 1, "is_add": 1},
{"label": "年度营业收入完成率", "field": "annual_revenue_completion_rate", "type": "number", "is_show": 1,
"is_add": 1},
{"label": "年度新增收入", "field": "annual_new_revenue", "type": "number", "is_show": 1, "is_add": 1},
{"label": "年度新增收入完成率", "field": "annual_new_revenue_completion_rate", "type": "number", "is_show": 1,
"is_add": 1},
{"label": "年度存量收入", "field": "annual_existing_revenue", "type": "number", "is_show": 1, "is_add": 1},
{"label": "年度存量收入完成率", "field": "annual_existing_revenue_completion_rate", "type": "number",
"is_show": 1, "is_add": 1},
{"label": "年度营业成本", "field": "annual_operating_costs", "type": "number", "is_show": 1, "is_add": 1},
{"label": "年度营业成本占用率", "field": "annual_operating_costs_utilization_rate", "type": "number",
"is_show": 1, "is_add": 1},
{"label": "年度费用开销", "field": "annual_expenses", "type": "number", "is_show": 1, "is_add": 1},
{"label": "年度费用开销占用率", "field": "annual_expenses_utilization_rate", "type": "number", "is_show": 1,
"is_add": 1},
{"label": "营业利润", "field": "operating_profit", "type": "number", "is_show": 1, "is_add": 1},
]
# 准备上下文
context = {
'items': items,
'id_name': 'year',
'query_params': query_params,
'model_config': {"app_label": "your_app_label", "model_name": "DepartmentAnnualPerformance",
"html_name": "department_annual_performance_list"},
'breadcrumb_list': [{"title": "首页", "name": "index"}, {"title": "经营管理", "name": "index"},
{"title": "年度总体经营指标", "name": "department_annual_performance_list"}],
'filters': [
{"type": "text", "id": "year", "name": "year", "label": "年份", "placeholder": "请输入年份"},
{"type": "text", "id": "primary_department", "name": "primary_department", "label": "一级部门",
"placeholder": "请输入一级部门"}
],
'table_columns': fields,
'show_button': {"add": True, "modify": True, "download": True, "upload": True},
}
return render(request, 'busi_tbl/fd_list.html', context)
def department_monthly_income_list_view(request):
# 声明查询集
query_set = DepartmentMonthlyIncome.objects.all().order_by('-year_month')
# 获取查询参数
year_month = request.GET.get('year_month', '')
primary_department = request.GET.get('primary_department', '')
# 根据提供的参数进行筛选
if year_month:
query_set = query_set.filter(year_month__icontains=year_month)
if primary_department:
query_set = query_set.filter(primary_department__icontains=primary_department)
# 对查询结果进行分页每页10条记录
items = paginate_query_and_assign_numbers(
request=request,
queryset=query_set,
per_page=10
)
# 构建上下文查询参数字符串
query_params = '&year_month={}&primary_department={}'.format(year_month, primary_department)
fields = [
{"label": "一级部门", "field": "primary_department", "type": "text", "is_show": 1, "is_add": 1},
{"label": "年月", "field": "year_month", "type": "text", "is_show": 1, "is_add": 1},
{"label": "当月收入", "field": "current_month_income", "type": "number", "is_show": 1, "is_add": 1},
{"label": "月收入目标", "field": "monthly_income_target", "type": "number", "is_show": 1, "is_add": 1},
{"label": "月目标完成率", "field": "monthly_target_completion_rate", "type": "number", "is_show": 1,
"is_add": 1},
{"label": "当月新增收入", "field": "current_month_new_income", "type": "number", "is_show": 1, "is_add": 1},
{"label": "月新增收入目标", "field": "monthly_new_income_target", "type": "number", "is_show": 1, "is_add": 1},
{"label": "月新增收入完成率", "field": "monthly_new_income_completion_rate", "type": "number", "is_show": 1,
"is_add": 1},
{"label": "当月存量收入", "field": "current_month_existing_income", "type": "number", "is_show": 1,
"is_add": 1},
{"label": "月存量收入目标", "field": "monthly_existing_income_target", "type": "number", "is_show": 1,
"is_add": 1},
{"label": "月存量收入完成率", "field": "monthly_existing_income_completion_rate", "type": "number",
"is_show": 1, "is_add": 1},
{"label": "年累计收入", "field": "annual_accumulated_income", "type": "number", "is_show": 1, "is_add": 1},
{"label": "累计目标完成率", "field": "accumulated_target_completion_rate", "type": "number", "is_show": 1,
"is_add": 1},
]
# 准备上下文
context = {
'items': items,
'id_name': 'year_month',
'query_params': query_params,
'model_config': {"app_label": "your_app_label", "model_name": "DepartmentMonthlyIncome",
"html_name": "department_monthly_income_list"},
'breadcrumb_list': [{"title": "首页", "name": "index"}, {"title": "收入管理", "name": "index"},
{"title": "收入情况", "name": "department_monthly_income_list"}],
'filters': [
{"type": "text", "id": "year_month", "name": "year_month", "label": "年月", "placeholder": "请输入年月"},
{"type": "text", "id": "primary_department", "name": "primary_department", "label": "一级部门",
"placeholder": "请输入一级部门"}
],
'table_columns': fields,
'show_button': {"add": True, "modify": True, "download": True, "upload": True},
}
return render(request, 'busi_tbl/fd_list.html', context)
def department_monthly_cost_list_view(request):
# 声明查询集
query_set = DepartmentMonthlyCost.objects.all().order_by('-year_month')
# 获取查询参数
year_month = request.GET.get('year_month', '')
primary_department = request.GET.get('primary_department', '')
# 根据提供的参数进行筛选
if year_month:
query_set = query_set.filter(year_month__icontains=year_month)
if primary_department:
query_set = query_set.filter(primary_department__icontains=primary_department)
# 对查询结果进行分页每页10条记录
items = paginate_query_and_assign_numbers(
request=request,
queryset=query_set,
per_page=10
)
# 构建上下文查询参数字符串
query_params = '&year_month={}&primary_department={}'.format(year_month, primary_department)
fields = [
{"label": "一级部门", "field": "primary_department", "type": "text", "is_show": 1, "is_add": 1},
{"label": "年月", "field": "year_month", "type": "text", "is_show": 1, "is_add": 1},
{"label": "当月成本(万元)", "field": "current_month_cost", "type": "number", "is_show": 1, "is_add": 1},
{"label": "月成本限额(万元)", "field": "monthly_cost_limit", "type": "number", "is_show": 1, "is_add": 1},
{"label": "月成本占用率", "field": "monthly_cost_utilization_rate", "type": "number", "is_show": 1,
"is_add": 1},
{"label": "年累计成本(万元)", "field": "annual_accumulated_cost", "type": "number", "is_show": 1, "is_add": 1},
{"label": "累计成本占用率", "field": "accumulated_cost_utilization_rate", "type": "number", "is_show": 1,
"is_add": 1},
]
# 准备上下文
context = {
'items': items,
'id_name': 'year_month',
'query_params': query_params,
'model_config': {"app_label": "your_app_label", "model_name": "DepartmentMonthlyCost",
"html_name": "department_monthly_cost_list"},
'breadcrumb_list': [{"title": "首页", "name": "index"}, {"title": "成本管理", "name": "index"},
{"title": "成本情况", "name": "department_monthly_cost_list"}],
'filters': [
{"type": "text", "id": "year_month", "name": "year_month", "label": "年月", "placeholder": "请输入年月"},
{"type": "text", "id": "primary_department", "name": "primary_department", "label": "一级部门",
"placeholder": "请输入一级部门"}
],
'table_columns': fields,
'show_button': {"add": True, "modify": True, "download": True, "upload": True},
}
return render(request, 'busi_tbl/fd_list.html', context)
def department_monthly_profit_list_view(request):
# 声明查询集
query_set = DepartmentMonthlyProfit.objects.all().order_by('-year_month')
# 获取查询参数
year_month = request.GET.get('year_month', '')
primary_department = request.GET.get('primary_department', '')
# 根据提供的参数进行筛选
if year_month:
query_set = query_set.filter(year_month__icontains=year_month)
if primary_department:
query_set = query_set.filter(primary_department__icontains=primary_department)
# 对查询结果进行分页每页10条记录
items = paginate_query_and_assign_numbers(
request=request,
queryset=query_set,
per_page=10
)
# 构建上下文查询参数字符串
query_params = '&year_month={}&primary_department={}'.format(year_month, primary_department)
fields = [
{"label": "一级部门", "field": "primary_department", "type": "text", "is_show": 1, "is_add": 1},
{"label": "年月", "field": "year_month", "type": "text", "is_show": 1, "is_add": 1},
{"label": "营业利润", "field": "operating_profit", "type": "number", "is_show": 1, "is_add": 1},
{"label": "年累计营业利润", "field": "annual_operating_profit", "type": "number", "is_show": 1, "is_add": 1},
]
# 准备上下文
context = {
'items': items,
'id_name': 'year_month',
'query_params': query_params,
'model_config': {"app_label": "your_app_label", "model_name": "DepartmentMonthlyProfit",
"html_name": "department_monthly_profit_list"},
'breadcrumb_list': [{"title": "首页", "name": "index"}, {"title": "利润管理", "name": "index"},
{"title": "利润情况", "name": "department_monthly_profit_list"}],
'filters': [
{"type": "text", "id": "year_month", "name": "year_month", "label": "年月", "placeholder": "请输入年月"},
{"type": "text", "id": "primary_department", "name": "primary_department", "label": "一级部门",
"placeholder": "请输入一级部门"}
],
'table_columns': fields,
'show_button': {"add": True, "modify": True, "download": True, "upload": True},
}
return render(request, 'busi_tbl/fd_list.html', context)
def department_project_progress_list_view(request):
# 声明查询集
query_set = DepartmentProjectProgress.objects.all().order_by('-contract_date')
# 获取查询参数
primary_department = request.GET.get('primary_department', '')
project_name = request.GET.get('project_name', '')
# 根据提供的参数进行筛选
if primary_department:
query_set = query_set.filter(primary_department__icontains=primary_department)
if project_name:
query_set = query_set.filter(project_name__icontains=project_name)
# 对查询结果进行分页每页10条记录
items = paginate_query_and_assign_numbers(
request=request,
queryset=query_set,
per_page=10
)
# 构建上下文查询参数字符串
query_params = '&primary_department={}&project_name={}'.format(primary_department, project_name)
fields = [
{"label": "一级部门", "field": "primary_department", "type": "text", "is_show": 1, "is_add": 1},
{"label": "项目名称", "field": "project_name", "type": "text", "is_show": 1, "is_add": 1},
{"label": "项目类型", "field": "project_type", "type": "text", "is_show": 1, "is_add": 1},
{"label": "负责人", "field": "project_manager", "type": "text", "is_show": 1, "is_add": 1},
{"label": "项目状态", "field": "project_status", "type": "text", "is_show": 1, "is_add": 1},
{"label": "项目进度", "field": "project_progress", "type": "text", "is_show": 1, "is_add": 1},
{"label": "项目性质", "field": "project_nature", "type": "text", "is_show": 1, "is_add": 1},
{"label": "签约时间", "field": "contract_date", "type": "date", "is_show": 1, "is_add": 1},
{"label": "标的金额(元)", "field": "target_amount", "type": "number", "is_show": 1, "is_add": 1},
{"label": "合同费率", "field": "contract_rate", "type": "number", "is_show": 1, "is_add": 1},
{"label": "收入(元)", "field": "revenue", "type": "number", "is_show": 1, "is_add": 1},
{"label": "成本费率", "field": "cost_rate", "type": "number", "is_show": 1, "is_add": 1},
{"label": "成本(元)", "field": "cost", "type": "number", "is_show": 1, "is_add": 1},
{"label": "净收入(元)", "field": "net_income", "type": "number", "is_show": 1, "is_add": 1},
{"label": "成交金额(元)", "field": "transaction_amount", "type": "number", "is_show": 1, "is_add": 1},
{"label": "价税合计金额(元)", "field": "total_tax_inclusive_amount", "type": "number", "is_show": 1,
"is_add": 1},
{"label": "回款金额(元)", "field": "payment_received", "type": "number", "is_show": 1, "is_add": 1},
]
# 准备上下文
context = {
'items': items,
'id_name': 'project_name',
'query_params': query_params,
'model_config': {"app_label": "your_app_label", "model_name": "DepartmentProjectProgress",
"html_name": "department_project_progress_list"},
'breadcrumb_list': [{"title": "首页", "name": "index"}, {"title": "项目管理", "name": "index"},
{"title": "项目进度", "name": "department_project_progress_list"}],
'filters': [
{"type": "text", "id": "primary_department", "name": "primary_department", "label": "一级部门",
"placeholder": "请输入一级部门"},
{"type": "text", "id": "project_name", "name": "project_name", "label": "项目名称",
"placeholder": "请输入项目名称"}
],
'table_columns': fields,
'show_button': {"add": True, "modify": True, "download": True, "upload": True},
}
return render(request, 'busi_tbl/fd_list.html', context)
def department_project_settlement_list_view(request):
# 声明查询集
query_set = DepartmentProjectSettlement.objects.all().order_by('-primary_department')
# 获取查询参数
primary_department = request.GET.get('primary_department', '')
project_name = request.GET.get('project_name', '')
# 根据提供的参数进行筛选
if primary_department:
query_set = query_set.filter(primary_department__icontains=primary_department)
if project_name:
query_set = query_set.filter(project_name__icontains=project_name)
# 对查询结果进行分页每页10条记录
items = paginate_query_and_assign_numbers(
request=request,
queryset=query_set,
per_page=10
)
# 构建上下文查询参数字符串
query_params = '&primary_department={}&project_name={}'.format(primary_department, project_name)
fields = [
{"label": "一级部门", "field": "primary_department", "type": "text", "is_show": 1, "is_add": 1},
{"label": "项目名称", "field": "project_name", "type": "text", "is_show": 1, "is_add": 1},
{"label": "营业收入(元)", "field": "revenue", "type": "number", "is_show": 1, "is_add": 1},
{"label": "营业成本(元)", "field": "operating_costs", "type": "number", "is_show": 1, "is_add": 1},
{"label": "税金及附加(元)", "field": "taxes_and_surcharges", "type": "number", "is_show": 1, "is_add": 1},
{"label": "营业利润(元)", "field": "operating_profit", "type": "number", "is_show": 1, "is_add": 1},
{"label": "公司留存(元)", "field": "company_retention", "type": "number", "is_show": 1, "is_add": 1},
{"label": "项目提成(元)", "field": "project_commission", "type": "number", "is_show": 1, "is_add": 1},
{"label": "项目公积金(元)", "field": "project_provision_fund", "type": "number", "is_show": 1, "is_add": 1},
]
# 准备上下文
context = {
'items': items,
'id_name': 'project_name',
'query_params': query_params,
'model_config': {"app_label": "your_app_label", "model_name": "DepartmentProjectSettlement",
"html_name": "department_project_settlement_list"},
'breadcrumb_list': [{"title": "首页", "name": "index"}, {"title": "项目管理", "name": "index"},
{"title": "项目结算情况", "name": "department_project_settlement_list"}],
'filters': [
{"type": "text", "id": "primary_department", "name": "primary_department", "label": "一级部门",
"placeholder": "请输入一级部门"},
{"type": "text", "id": "project_name", "name": "project_name", "label": "项目名称",
"placeholder": "请输入项目名称"}
],
'table_columns': fields,
'show_button': {"add": True, "modify": True, "download": True, "upload": True},
}
return render(request, 'busi_tbl/fd_list.html', context)
def department_project_payment_list_view(request):
# 声明查询集
query_set = DepartmentProjectPayment.objects.all().order_by('-primary_department')
# 获取查询参数
primary_department = request.GET.get('primary_department', '')
project_name = request.GET.get('project_name', '')
# 根据提供的参数进行筛选
if primary_department:
query_set = query_set.filter(primary_department__icontains=primary_department)
if project_name:
query_set = query_set.filter(project_name__icontains=project_name)
# 对查询结果进行分页每页10条记录
items = paginate_query_and_assign_numbers(
request=request,
queryset=query_set,
per_page=10
)
# 构建上下文查询参数字符串
query_params = '&primary_department={}&project_name={}'.format(primary_department, project_name)
fields = [
{"label": "一级部门", "field": "primary_department", "type": "text", "is_show": 1, "is_add": 1},
{"label": "项目名称", "field": "project_name", "type": "text", "is_show": 1, "is_add": 1},
{"label": "项目类型", "field": "project_type", "type": "text", "is_show": 1, "is_add": 1},
{"label": "负责人", "field": "project_manager", "type": "text", "is_show": 1, "is_add": 1},
{"label": "价税合计金额(元)", "field": "total_tax_inclusive_amount", "type": "number", "is_show": 1,
"is_add": 1},
{"label": "回款金额(元)", "field": "payment_received", "type": "number", "is_show": 1, "is_add": 1},
{"label": "待回款金额(元)", "field": "outstanding_payment_amount", "type": "number", "is_show": 1, "is_add": 1},
{"label": "应收净收入(元)", "field": "receivable_net_income", "type": "number", "is_show": 1, "is_add": 1},
{"label": "实收净收入(元)", "field": "actual_net_income", "type": "number", "is_show": 1, "is_add": 1},
{"label": "待收净收入(元)", "field": "outstanding_net_income", "type": "number", "is_show": 1, "is_add": 1},
]
# 准备上下文
context = {
'items': items,
'id_name': 'project_name',
'query_params': query_params,
'model_config': {"app_label": "your_app_label", "model_name": "DepartmentProjectPayment",
"html_name": "department_project_payment_list"},
'breadcrumb_list': [{"title": "首页", "name": "index"}, {"title": "项目管理", "name": "index"},
{"title": "项目回款情况", "name": "department_project_payment_list"}],
'filters': [
{"type": "text", "id": "primary_department", "name": "primary_department", "label": "一级部门",
"placeholder": "请输入一级部门"},
{"type": "text", "id": "project_name", "name": "project_name", "label": "项目名称",
"placeholder": "请输入项目名称"}
],
'table_columns': fields,
'show_button': {"add": True, "modify": True, "download": True, "upload": True},
}
return render(request, 'busi_tbl/fd_list.html', context)
def department_revenue_structure_list_view(request):
# 声明查询集
query_set = DepartmentRevenueStructure.objects.all().order_by('-year_month')
# 获取查询参数
primary_department = request.GET.get('primary_department', '')
year_month = request.GET.get('year_month', '')
# 根据提供的参数进行筛选
if primary_department:
query_set = query_set.filter(primary_department__icontains=primary_department)
if year_month:
query_set = query_set.filter(year_month__icontains=year_month)
# 对查询结果进行分页每页10条记录
items = paginate_query_and_assign_numbers(
request=request,
queryset=query_set,
per_page=10
)
# 构建上下文查询参数字符串
query_params = '&primary_department={}&year_month={}'.format(primary_department, year_month)
fields = [
{"label": "一级部门", "field": "primary_department", "type": "text", "is_show": 1, "is_add": 1},
{"label": "年月", "field": "year_month", "type": "text", "is_show": 1, "is_add": 1},
{"label": "项目类型", "field": "project_type", "type": "text", "is_show": 1, "is_add": 1},
{"label": "价税合计金额", "field": "total_tax_inclusive_amount", "type": "number", "is_show": 1, "is_add": 1},
{"label": "占比", "field": "percentage", "type": "number", "is_show": 1, "is_add": 1},
{"label": "累计价税合计金额", "field": "cumulative_tax_inclusive_amount", "type": "number", "is_show": 1,
"is_add": 1},
{"label": "累计占比", "field": "cumulative_percentage", "type": "number", "is_show": 1, "is_add": 1},
]
# 准备上下文
context = {
'items': items,
'id_name': 'year_month',
'query_params': query_params,
'model_config': {"app_label": "your_app_label", "model_name": "DepartmentRevenueStructure",
"html_name": "department_revenue_structure_list"},
'breadcrumb_list': [{"title": "首页", "name": "index"}, {"title": "收入管理", "name": "index"},
{"title": "收入结构", "name": "department_revenue_structure_list"}],
'filters': [
{"type": "text", "id": "primary_department", "name": "primary_department", "label": "一级部门",
"placeholder": "请输入一级部门"},
{"type": "text", "id": "year_month", "name": "year_month", "label": "年月", "placeholder": "请输入年月"}
],
'table_columns': fields,
'show_button': {"add": True, "modify": True, "download": True, "upload": True},
}
return render(request, 'busi_tbl/fd_list.html', context)
def department_profit_structure_list_view(request):
# 声明查询集
query_set = DepartmentProfitStructure.objects.all().order_by('-year_month')
# 获取查询参数
primary_department = request.GET.get('primary_department', '')
year_month = request.GET.get('year_month', '')
# 根据提供的参数进行筛选
if primary_department:
query_set = query_set.filter(primary_department__icontains=primary_department)
if year_month:
query_set = query_set.filter(year_month__icontains=year_month)
# 对查询结果进行分页每页10条记录
items = paginate_query_and_assign_numbers(
request=request,
queryset=query_set,
per_page=10
)
# 构建上下文查询参数字符串
query_params = '&primary_department={}&year_month={}'.format(primary_department, year_month)
fields = [
{"label": "一级部门", "field": "primary_department", "type": "text", "is_show": 1, "is_add": 1},
{"label": "年月", "field": "year_month", "type": "text", "is_show": 1, "is_add": 1},
{"label": "项目类型", "field": "project_type", "type": "text", "is_show": 1, "is_add": 1},
{"label": "应收净收入(元)", "field": "net_receivable_income", "type": "number", "is_show": 1, "is_add": 1},
{"label": "占比", "field": "percentage", "type": "number", "is_show": 1, "is_add": 1},
{"label": "累计应收净收入(元)", "field": "cumulative_net_receivable_income", "type": "number", "is_show": 1,
"is_add": 1},
{"label": "累计占比", "field": "cumulative_percentage", "type": "number", "is_show": 1, "is_add": 1},
]
# 准备上下文
context = {
'items': items,
'id_name': 'year_month',
'query_params': query_params,
'model_config': {"app_label": "your_app_label", "model_name": "DepartmentProfitStructure",
"html_name": "department_profit_structure_list"},
'breadcrumb_list': [{"title": "首页", "name": "index"}, {"title": "利润管理", "name": "index"},
{"title": "利润结构", "name": "department_profit_structure_list"}],
'filters': [
{"type": "text", "id": "primary_department", "name": "primary_department", "label": "一级部门",
"placeholder": "请输入一级部门"},
{"type": "text", "id": "year_month", "name": "year_month", "label": "年月", "placeholder": "请输入年月"}
],
'table_columns': fields,
'show_button': {"add": True, "modify": True, "download": True, "upload": True},
}
return render(request, 'busi_tbl/fd_list.html', context)
def department_project_manager_income_commission_list_view(request):
# 声明查询集
query_set = DepartmentProjectManagerIncomeCommission.objects.all().order_by('-year_month')
# 获取查询参数
primary_department = request.GET.get('primary_department', '')
name = request.GET.get('name', '')
# 根据提供的参数进行筛选
if primary_department:
query_set = query_set.filter(primary_department__icontains=primary_department)
if name:
query_set = query_set.filter(name__icontains=name)
# 对查询结果进行分页每页10条记录
items = paginate_query_and_assign_numbers(
request=request,
queryset=query_set,
per_page=10
)
# 构建上下文查询参数字符串
query_params = '&primary_department={}&name={}'.format(primary_department, name)
fields = [
{"label": "一级部门", "field": "primary_department", "type": "text", "is_show": 1, "is_add": 1},
{"label": "姓名", "field": "name", "type": "text", "is_show": 1, "is_add": 1},
{"label": "年月", "field": "year_month", "type": "text", "is_show": 1, "is_add": 1},
{"label": "当月收入", "field": "current_month_income", "type": "number", "is_show": 1, "is_add": 1},
{"label": "月收入目标", "field": "monthly_income_target", "type": "number", "is_show": 1, "is_add": 1},
{"label": "月目标完成率", "field": "monthly_target_completion_rate", "type": "number", "is_show": 1,
"is_add": 1},
{"label": "年累计收入", "field": "annual_accumulated_income", "type": "number", "is_show": 1, "is_add": 1},
{"label": "累计目标完成率", "field": "annual_target_completion_rate", "type": "number", "is_show": 1,
"is_add": 1},
{"label": "当月提成", "field": "current_month_commission", "type": "number", "is_show": 1, "is_add": 1},
{"label": "当月计提提成", "field": "current_month_accrued_commission", "type": "number", "is_show": 1,
"is_add": 1},
{"label": "年累计提成", "field": "annual_accumulated_commission", "type": "number", "is_show": 1, "is_add": 1},
{"label": "年累计计提提成", "field": "annual_accumulated_accrued_commission", "type": "number", "is_show": 1,
"is_add": 1},
]
# 准备上下文
context = {
'items': items,
'id_name': 'year_month',
'query_params': query_params,
'model_config': {"app_label": "your_app_label", "model_name": "DepartmentProjectManagerIncomeCommission",
"html_name": "department_project_manager_income_commission_list"},
'breadcrumb_list': [{"title": "首页", "name": "index"}, {"title": "收入管理", "name": "index"},
{"title": "项目经理收入完成及提成情况",
"name": "department_project_manager_income_commission_list"}],
'filters': [
{"type": "text", "id": "primary_department", "name": "primary_department", "label": "一级部门",
"placeholder": "请输入一级部门"},
{"type": "text", "id": "name", "name": "name", "label": "姓名", "placeholder": "请输入姓名"}
],
'table_columns': fields,
'show_button': {"add": True, "modify": True, "download": True, "upload": True},
}
return render(request, 'busi_tbl/fd_list.html', context)
def department_attendance_list_view(request):
# 声明查询集
query_set = DepartmentAttendance.objects.all().order_by('-year_month')
# 获取查询参数
primary_department = request.GET.get('primary_department', '')
year_month = request.GET.get('year_month', '')
# 根据提供的参数进行筛选
if primary_department:
query_set = query_set.filter(primary_department__icontains=primary_department)
if year_month:
query_set = query_set.filter(year_month__icontains=year_month)
# 对查询结果进行分页每页10条记录
items = paginate_query_and_assign_numbers(
request=request,
queryset=query_set,
per_page=10
)
# 构建上下文查询参数字符串
query_params = '&primary_department={}&year_month={}'.format(primary_department, year_month)
fields = [
{"label": "一级部门", "field": "primary_department", "type": "text", "is_show": 1, "is_add": 1},
{"label": "年月", "field": "year_month", "type": "text", "is_show": 1, "is_add": 1},
{"label": "迟到", "field": "late", "type": "number", "is_show": 1, "is_add": 1},
{"label": "早退", "field": "early_departure", "type": "number", "is_show": 1, "is_add": 1},
{"label": "旷工", "field": "absenteeism", "type": "number", "is_show": 1, "is_add": 1},
{"label": "年假", "field": "annual_leave", "type": "number", "is_show": 1, "is_add": 1},
{"label": "事假", "field": "personal_leave", "type": "number", "is_show": 1, "is_add": 1},
{"label": "病假", "field": "sick_leave", "type": "number", "is_show": 1, "is_add": 1},
{"label": "其他", "field": "other_leave", "type": "number", "is_show": 1, "is_add": 1},
{"label": "合计", "field": "total_days", "type": "number", "is_show": 1, "is_add": 1},
]
# 准备上下文
context = {
'items': items,
'id_name': 'year_month',
'query_params': query_params,
'model_config': {"app_label": "your_app_label", "model_name": "DepartmentAttendance",
"html_name": "department_attendance_list"},
'breadcrumb_list': [{"title": "首页", "name": "index"}, {"title": "考勤管理", "name": "index"},
{"title": "出勤情况", "name": "department_attendance_list"}],
'filters': [
{"type": "text", "id": "primary_department", "name": "primary_department", "label": "一级部门",
"placeholder": "请输入一级部门"},
{"type": "text", "id": "year_month", "name": "year_month", "label": "年月", "placeholder": "请输入年月"}
],
'table_columns': fields,
'show_button': {"add": True, "modify": True, "download": True, "upload": True},
}
return render(request, 'busi_tbl/fd_list.html', context)