1.优化日程
2.新增文宣
This commit is contained in:
@@ -8,7 +8,7 @@ from .models import User, Approval, Department, OperationLog, Team
|
||||
from business.models import permission
|
||||
from finance.models import Income, Accounts, Payment, Reimbursement, BonusChange
|
||||
from finance.models import Invoice
|
||||
from business.models import ProjectRegistration, Case, SealApplication, PreFiling, Bid, CaseChangeRequest
|
||||
from business.models import ProjectRegistration, Case, SealApplication, PreFiling, Bid, CaseChangeRequest,Propaganda
|
||||
import datetime
|
||||
from utility.utility import flies
|
||||
from django.contrib.sessions.backends.db import SessionStore
|
||||
@@ -560,6 +560,7 @@ class PersonnelDetailsView(APIView):
|
||||
# 如果需要部门数据
|
||||
"department": list(user.department.values('id', 'username')),
|
||||
"permission_data": permission_data,
|
||||
"content": Propaganda.objects.all().first().content
|
||||
}
|
||||
return Response({'message': '详细人员信息展示成功', "data": data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ class Announcement(models.Model):
|
||||
|
||||
class LawyerFlie(models.Model):
|
||||
title = models.CharField(max_length=100) # 标题
|
||||
remark = models.CharField(max_length=200)
|
||||
remark = models.CharField(max_length=200) # 提交人
|
||||
file = models.TextField() # 文件
|
||||
times = models.CharField(max_length=100)
|
||||
is_deleted = models.BooleanField(default=False) # 软删除标记
|
||||
@@ -185,4 +185,8 @@ class permission(models.Model):
|
||||
permission_name = models.CharField(max_length=100) # 权限名称
|
||||
permission_logo = models.CharField(max_length=100) # 权限标识
|
||||
parent = models.CharField(max_length=100) # 父级
|
||||
is_deleted = models.BooleanField(default=False) # 软删除标记
|
||||
is_deleted = models.BooleanField(default=False) # 软删除标记
|
||||
|
||||
|
||||
class Propaganda(models.Model):
|
||||
content = models.TextField() # 文喧
|
||||
@@ -1,7 +1,7 @@
|
||||
from django.urls import path
|
||||
|
||||
from .models import Schedule
|
||||
from .views import registration,registrationDetail,Project,Projectquerytype,ProjectDetail,EditProject,BidRegistration,BidDetail,registrationList,caseManagement,caseManagementDetail,CaseAttachmentUpload,CaseAttachmentUpdate,Uploadinvoice,InvoiceDetail,Log,LogDetail,accumulate,preFilingLinkedCases,Application,ApplicationDetail,WarehousingRegistration,WarehousingDetail,PlatformRegistration,PlatformDetail,EditPlatformDetail,DeletePlatformDetail,bulletin,BulletinDetail,EditBulletin,deleteBulletin,Lawyersdocuments,LawyersdocumentsDetail,LwaDetail,CreateSchedule,DeleteSchedule,ScheduleDetail,handleSchedule,AddRermission,DisplayRermission,DeleteRermission,EditRermission,addRole,DeleteRole,EditRole,displayRole,modifypermissions,getRolePermissions,DeleteRegistration,EditRegistration,DeleteProject,EditBid,DeleteBid,EditCase,DeleteCase,EditApplication,DeleteApplication,EditWarehousing,DeleteWarehousing,EditLawyerFlie,EditSchedule,TransferCase,CaseChangeRequestCreate,CaseChangeRequestList,CaseChangeRequestDetail,ProjectDropdownList,CaseDropdownList,ConflictSearch,CreateCaseTag,CaseTagList,CaseTagDetail,EditCaseTag,DeleteCaseTag,CaseTagDropdownList,CaseListByTag,SetCaseTags
|
||||
from .views import registration,registrationDetail,Project,Projectquerytype,ProjectDetail,EditProject,BidRegistration,BidDetail,registrationList,caseManagement,caseManagementDetail,CaseAttachmentUpload,CaseAttachmentUpdate,Uploadinvoice,InvoiceDetail,Log,LogDetail,accumulate,preFilingLinkedCases,Application,ApplicationDetail,WarehousingRegistration,WarehousingDetail,PlatformRegistration,PlatformDetail,EditPlatformDetail,DeletePlatformDetail,bulletin,BulletinDetail,EditBulletin,deleteBulletin,Lawyersdocuments,LawyersdocumentsDetail,LwaDetail,CreateSchedule,DeleteSchedule,ScheduleDetail,handleSchedule,AddRermission,DisplayRermission,DeleteRermission,EditRermission,addRole,DeleteRole,EditRole,displayRole,modifypermissions,getRolePermissions,DeleteRegistration,EditRegistration,DeleteProject,EditBid,DeleteBid,EditCase,DeleteCase,EditApplication,DeleteApplication,EditWarehousing,DeleteWarehousing,EditLawyerFlie,EditSchedule,TransferCase,CaseChangeRequestCreate,CaseChangeRequestList,CaseChangeRequestDetail,ProjectDropdownList,CaseDropdownList,ConflictSearch,CreateCaseTag,CaseTagList,CaseTagDetail,EditCaseTag,DeleteCaseTag,CaseTagDropdownList,CaseListByTag,SetCaseTags,PropagandaEit
|
||||
urlpatterns = [
|
||||
|
||||
path('register',registration.as_view(),name='register'),
|
||||
@@ -80,5 +80,6 @@ urlpatterns = [
|
||||
path('case-tag-delete',DeleteCaseTag.as_view(),name='case-tag-delete'),
|
||||
path('case-tag-dropdown-list',CaseTagDropdownList.as_view(),name='case-tag-dropdown-list'),
|
||||
path('case-list-by-tag',CaseListByTag.as_view(),name='case-list-by-tag'),
|
||||
path('set-case-tags',SetCaseTags.as_view(),name='set-case-tags')
|
||||
path('set-case-tags',SetCaseTags.as_view(),name='set-case-tags'),
|
||||
path("PropagandaEit",PropagandaEit.as_view(),name="PropagandaEit")
|
||||
]
|
||||
@@ -8,7 +8,7 @@ from decimal import Decimal, InvalidOperation
|
||||
from User.models import User, Approval
|
||||
from User.utils import log_operation, normalize_approvers_param, build_missing_approvers_message
|
||||
from .models import PreFiling, ProjectRegistration, Bid, Case, Invoice, Caselog, SealApplication, Warehousing, \
|
||||
RegisterPlatform, Announcement, LawyerFlie, Schedule, permission, role, CaseChangeRequest, CaseTag
|
||||
RegisterPlatform, Announcement, LawyerFlie, Schedule, permission, role, CaseChangeRequest, CaseTag,Propaganda
|
||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
||||
from utility.utility import flies
|
||||
from datetime import datetime
|
||||
@@ -2977,9 +2977,10 @@ class deleteBulletin(APIView):
|
||||
|
||||
class Lawyersdocuments(APIView):
|
||||
def post(self, request, *args, **kwargs):
|
||||
token = request.META.get('token')
|
||||
title = request.data.get('title')
|
||||
file = request.FILES.getlist('file')
|
||||
remark = request.data.get('remark')
|
||||
user = User.objects.get(token=token, is_deleted=False).username
|
||||
|
||||
if not all([title, file]):
|
||||
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
|
||||
@@ -2987,7 +2988,7 @@ class Lawyersdocuments(APIView):
|
||||
date_str = now.strftime('%Y-%m-%d')
|
||||
LawyerFlie.objects.create(
|
||||
title=title,
|
||||
remark=remark,
|
||||
remark=user,
|
||||
file=json.dumps(flies(file)),
|
||||
times=date_str,
|
||||
)
|
||||
@@ -2996,7 +2997,11 @@ class Lawyersdocuments(APIView):
|
||||
|
||||
class LawyersdocumentsDetail(APIView):
|
||||
def post(self, request, *args, **kwargs):
|
||||
law = LawyerFlie.objects.filter(is_deleted=False).order_by('-times')
|
||||
title = request.data.get('title')
|
||||
obj =Q(is_deleted=False)
|
||||
if title:
|
||||
obj &= Q(title__contains=title)
|
||||
law = LawyerFlie.objects.filter(obj).order_by('-times')
|
||||
total = law.count()
|
||||
data = []
|
||||
for info in law:
|
||||
@@ -3065,16 +3070,7 @@ class CreateSchedule(APIView):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
待办创建
|
||||
优化逻辑:
|
||||
- 个人团队的待办:直接到财务团队审核
|
||||
- 团队中的待办:创建时接受多个人,按顺序一个通过后给下一个人创建待办审核,最后给财务团队审核
|
||||
|
||||
前端传参说明:
|
||||
- approvers: 审核人列表(团队类型时需要)
|
||||
* 推荐格式:用户ID数组,如 [1, 2, 3](数组顺序即为审核顺序)
|
||||
* 兼容格式:用户名数组,如 ["张三", "李四", "王五"](数组顺序即为审核顺序)
|
||||
* 字符串格式:逗号分隔的ID或用户名,如 "1,2,3" 或 "张三,李四,王五"
|
||||
* 如果不传,则使用团队配置的审核人(按团队审核人顺序)
|
||||
|
||||
:param request:
|
||||
:param args:
|
||||
:param kwargs:
|
||||
@@ -3097,14 +3093,8 @@ class CreateSchedule(APIView):
|
||||
user = User.objects.get(token=token, is_deleted=False)
|
||||
except User.DoesNotExist:
|
||||
return Response({'status': 'error', 'message': '用户不存在', 'code': 1}, status=status.HTTP_404_NOT_FOUND)
|
||||
|
||||
# 获取用户的团队信息
|
||||
team_name = user.team
|
||||
from datetime import date
|
||||
today = date.today().strftime("%Y-%m-%d")
|
||||
|
||||
# 创建待办记录(审批流程会更新状态与审核人顺序)
|
||||
schedule = Schedule.objects.create(
|
||||
|
||||
Schedule.objects.create(
|
||||
title=title,
|
||||
tiems=tiems,
|
||||
end_time=end_time,
|
||||
@@ -3112,28 +3102,7 @@ class CreateSchedule(APIView):
|
||||
state="未完成",
|
||||
submit=user.username # 记录提交人
|
||||
)
|
||||
|
||||
from User.utils import create_approval_with_team_logic
|
||||
content = f"{user.username}提交了待办:{title}"
|
||||
approval, approvers_order_json, needs_approval = create_approval_with_team_logic(
|
||||
team_name=team_name,
|
||||
approvers=approvers,
|
||||
title="待办审核",
|
||||
content=content,
|
||||
approval_type="待办",
|
||||
user_id=schedule.id,
|
||||
business_record=schedule,
|
||||
today=today
|
||||
)
|
||||
if approval is None and needs_approval:
|
||||
return Response({
|
||||
'status': 'error',
|
||||
'message': build_missing_approvers_message(team_name, approvers),
|
||||
'code': 1
|
||||
}, status=status.HTTP_400_BAD_REQUEST)
|
||||
if needs_approval:
|
||||
return Response({'message': '添加成功,已创建审批流程', 'code': 0}, status=status.HTTP_200_OK)
|
||||
return Response({'message': '添加成功,已直接抄送财务', 'code': 0}, status=status.HTTP_200_OK)
|
||||
return Response({'message': '添加成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class DeleteSchedule(APIView):
|
||||
@@ -3165,7 +3134,7 @@ class ScheduleDetail(APIView):
|
||||
:param kwargs:
|
||||
:return:
|
||||
"""
|
||||
sches = Schedule.objects.filter(state="未完成", is_deleted=False).order_by('-id')
|
||||
sches = Schedule.objects.filter().order_by('-id')
|
||||
page = request.data.get('page')
|
||||
per_page = request.data.get('per_page')
|
||||
total = len(sches)
|
||||
@@ -3238,7 +3207,7 @@ class handleSchedule(APIView):
|
||||
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
|
||||
try:
|
||||
sc = Schedule.objects.get(id=id, is_deleted=False)
|
||||
sc.state = state
|
||||
sc.state = "已完成"
|
||||
sc.save(update_fields=['state'])
|
||||
return Response({'message': '修改成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
except Schedule.DoesNotExist:
|
||||
@@ -4965,4 +4934,15 @@ class CaseListByTag(APIView):
|
||||
"total": total,
|
||||
'data': data,
|
||||
'code': 0
|
||||
}, status=status.HTTP_200_OK)
|
||||
|
||||
class PropagandaEit(APIView):
|
||||
def post(self, request):
|
||||
content = request.data.get('content')
|
||||
pro = Propaganda.objects.get(id="1")
|
||||
pro.content = content
|
||||
pro.save()
|
||||
return Response({
|
||||
'message': '更新成功',
|
||||
'code': 0
|
||||
}, status=status.HTTP_200_OK)
|
||||
Reference in New Issue
Block a user