增加在“联系人信息”这里,可以多选的js代码,并增加一个清空多选的按钮。

This commit is contained in:
2025-11-11 13:12:38 +08:00
parent f0cbf2c2ec
commit 40be56a31b
3 changed files with 185 additions and 156 deletions

View File

@@ -356,16 +356,19 @@ def equipment_images(request):
def contact_list(request):
# 获取筛选参数
branch_id = request.GET.get('branch')
branches_param = request.GET.get('branches') # 支持多机构选择使用逗号分隔的ID字符串
category = request.GET.get('category')
contact_name = request.GET.get('contact_name')
# 构建查询条件
filters = Q()
# 分支机构筛选
if branch_id:
filters &= Q(branch_id=branch_id)
# 分支机构筛选(支持多选)
if branches_param:
# 将逗号分隔的字符串转换为ID列表
branch_ids = [bid.strip() for bid in branches_param.split(',') if bid.strip().isdigit()]
if branch_ids:
filters &= Q(branch_id__in=branch_ids)
# 联系人类别筛选
if category:
@@ -386,7 +389,7 @@ def contact_list(request):
'contacts': contacts,
'branches': branches,
'categories': categories,
'selected_branch': branch_id,
'selected_branches': branches_param, # 传递选中的机构ID字符串
'selected_category': category,
'selected_contact_name': contact_name
}