From 5b785dfd79dec33eb1418ac18d4bbe0cac6392a3 Mon Sep 17 00:00:00 2001 From: zty Date: Fri, 14 Jun 2024 17:38:27 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=EF=BC=9Auser/view=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=88=9B=E5=BB=BA=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/views/system/userExam.vue | 8 +++++--- server/apps/system/views.py | 7 +++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/client/src/views/system/userExam.vue b/client/src/views/system/userExam.vue index f3f736c..1a51b10 100644 --- a/client/src/views/system/userExam.vue +++ b/client/src/views/system/userExam.vue @@ -115,7 +115,7 @@
取消 - 确认 + 确认
@@ -516,9 +516,11 @@ export default { updateUser(this.user.id, this.user).then((res) => { if (res.code >= 200) { this.getList(); - this.dialogVisible = false; + this.dialogVisible = true; + this.impForm.file = '' this.$message.success("成功"); - } + }; + this.impForm.file = '' }); } else { createUser(this.user).then((res) => { diff --git a/server/apps/system/views.py b/server/apps/system/views.py index 1985414..7e941a3 100644 --- a/server/apps/system/views.py +++ b/server/apps/system/views.py @@ -109,7 +109,7 @@ class ImpMixin: data_list = self.build_data(sheet, start) serializer = mySerializer(data=data_list, many=True, context={'request': request}) if serializer.is_valid(): - serializer.save(create_by=request.user, belong_dept=request.user.dept) + serializer.save() else: return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) @@ -348,9 +348,8 @@ class UserExamViewset(ImpMixin, ModelViewSet): for row in sheet.iter_rows(min_row=start, values_only=True): # 假设第一行是表头,从第二行开始读取数据 if row[0] is not None: dept = Organization.objects.get(name=row[2]) - user_depts = get_child_queryset2(self.request.user.dept).order_by('sort') - serializer = OrganizationSerializer(user_depts, many=True) - depts = any(i.id==dept.id for i in serializer.data) + user_depts = get_child_queryset2(self.request.user.dept).order_by('sort') + depts = any(i.name==dept.name for i in user_depts) if depts is False: return Response({'msg': f'本公司下不存在此部门{row[2]}'}) serializer_data = {