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 = {