From fd070e1be08e24c84cf6adbfa552319fa1dc92de Mon Sep 17 00:00:00 2001 From: zty Date: Thu, 16 May 2024 15:44:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E8=B5=84=E8=B4=A8?= =?UTF-8?q?=E6=83=85=E5=86=B5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/dist/index.html | 2 +- client/src/api/qualificationInfo.js | 2 +- client/src/router/index.js | 4 +-- .../views/informatiomCollect/qualiChange.vue | 35 +++++-------------- .../views/informatiomCollect/qualificInfo.vue | 15 ++------ client/src/views/supervisionNew/mytask.vue | 8 ++++- server/apps/exam/serializers.py | 13 ++++--- .../0039_alter_auditlog_change_reason.py | 18 ++++++++++ server/apps/information/models.py | 2 +- server/apps/information/views.py | 5 +-- server/server/settings_dev.py | 34 +++++++++--------- 11 files changed, 70 insertions(+), 68 deletions(-) create mode 100644 server/apps/information/migrations/0039_alter_auditlog_change_reason.py diff --git a/client/dist/index.html b/client/dist/index.html index fc6e042..efd420b 100644 --- a/client/dist/index.html +++ b/client/dist/index.html @@ -1 +1 @@ -vue Admin Template
\ No newline at end of file +vue Admin Template
\ No newline at end of file diff --git a/client/src/api/qualificationInfo.js b/client/src/api/qualificationInfo.js index 2ebcc11..e202f7c 100644 --- a/client/src/api/qualificationInfo.js +++ b/client/src/api/qualificationInfo.js @@ -27,7 +27,7 @@ export function getQi(id) { export function updateQi(id, data) { return request({ - url: `/info/faqch/${id}/`, + url: `/info/faq/${id}/`, method: 'put', data }) diff --git a/client/src/router/index.js b/client/src/router/index.js index 0814226..2f67332 100644 --- a/client/src/router/index.js +++ b/client/src/router/index.js @@ -412,14 +412,14 @@ export const asyncRoutes = [ component: Layout, redirect: '/infoCollect/', name: 'informationCollect', - meta: { title: '信息收集', icon: 'PT', perms: ['infoCollect'] }, + meta: { title: '信息收集', icon: 'PT'}, alwaysShow: true, children: [ { path: 'qualificInfo', name: 'qualificInfo', component: () => import('@/views/informatiomCollect/qualificInfo.vue'), - meta: { title: '资质情况', perms: ['infoCollect_QIN'] } + meta: { title: '资质情况'} }, { path: 'qualiChange', diff --git a/client/src/views/informatiomCollect/qualiChange.vue b/client/src/views/informatiomCollect/qualiChange.vue index 12cc85f..584e9c2 100644 --- a/client/src/views/informatiomCollect/qualiChange.vue +++ b/client/src/views/informatiomCollect/qualiChange.vue @@ -105,6 +105,9 @@ + + + { - console.log(response); if (response.data) { let filename = '资质变更情况统计表.xlsx'; let tableData = response.data; - console.log(tableData) + const ws = XLSX.utils.json_to_sheet(tableData.results); const wb = XLSX.utils.book_new(); XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); @@ -297,7 +299,6 @@ export default { } }, handleUpSuccess(res, file, filelist) { - console.log(res.data.path) this.Content.cie_path = res.data.path; this.Content.file = res.data.id; @@ -312,7 +313,6 @@ export default { this.tableData.results =[]; this.tableData.count =0; getMyQi(this.listQuery).then((response) => { - console.log(response); if (response.data) { this.tableData = response.data; @@ -362,25 +362,6 @@ export default { console.error(err); }); }, - // handleChange(scope) { - // this.listLoading = true; - // this.Content = Object.assign({}, scope.row); // copy obj - // this.changeTableData =[]; - // this.dialogTableVisible=true; - // getQi(scope.row.id).then((response) => { - // if (response.data.count>0) { - // this.changeTableData = response.data.results; - // console.log(this.changeTableData); - // this.listLoading = false; - // }else{ - // alert('无变更记录') - // this.dialogTableVisible=false; - // this.listLoading = false; - // return - // } - // }); - // }, - async confirm(form) { this.$refs[form].validate((valid) => { if (valid) { diff --git a/client/src/views/informatiomCollect/qualificInfo.vue b/client/src/views/informatiomCollect/qualificInfo.vue index 48b4b31..ee6ad92 100644 --- a/client/src/views/informatiomCollect/qualificInfo.vue +++ b/client/src/views/informatiomCollect/qualificInfo.vue @@ -1,7 +1,7 @@ - + + + + diff --git a/server/apps/exam/serializers.py b/server/apps/exam/serializers.py index eb8d22e..9bce0ac 100644 --- a/server/apps/exam/serializers.py +++ b/server/apps/exam/serializers.py @@ -78,7 +78,7 @@ class ExamCreateUpdateSerializer(ModelSerializer): class Meta: model = Exam - fields = ['name', 'place', 'open_time','course_name', 'certificate', + fields = ['name', 'place', 'open_time','course_name', 'certificate', 'close_time', 'proctor_name', 'proctor_phone', 'chance', 'paper', 'participant_dep', 'participant_user'] @@ -86,13 +86,18 @@ class ExamListSerializer(ModelSerializer): create_by_name = CharField(source='create_by.name', read_only=True) paper_ = PaperSerializer(source='paper', read_only=True) course_ = CourseSerializer(source='course_name', read_only=True) - participant_user = UserListSerializer(many=True, read_only=True) - - + user_count = serializers.SerializerMethodField() class Meta: model = Exam fields = '__all__' + def get_user_count(self, obj): + total_user_count = 0 + for p in obj.participant_dep.all(): + user_count = User.objects.filter(dept_id = p.id).count() + total_user_count += user_count + return total_user_count+obj.participant_user.count() + class ExamDetailSerializer(ModelSerializer): create_by_name = CharField(source='create_by.name', read_only=True) diff --git a/server/apps/information/migrations/0039_alter_auditlog_change_reason.py b/server/apps/information/migrations/0039_alter_auditlog_change_reason.py new file mode 100644 index 0000000..3c4b9e9 --- /dev/null +++ b/server/apps/information/migrations/0039_alter_auditlog_change_reason.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.12 on 2024-05-16 07:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('information', '0038_parsepdf_status'), + ] + + operations = [ + migrations.AlterField( + model_name='auditlog', + name='change_reason', + field=models.CharField(blank=True, max_length=50, null=True, verbose_name='变更原因'), + ), + ] diff --git a/server/apps/information/models.py b/server/apps/information/models.py index 11f1de1..931784a 100644 --- a/server/apps/information/models.py +++ b/server/apps/information/models.py @@ -26,7 +26,7 @@ class AuditLog(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) action = models.CharField('动作', max_length=20) instance = models.ForeignKey(Qualification, on_delete=models.CASCADE, verbose_name='实例ID') - change_reason = models.CharField('变更原因', default='', max_length=50) + change_reason = models.CharField('变更原因', null=True ,blank=True ,max_length=50) change_user = models.ForeignKey('system.user', on_delete=models.SET_NULL, verbose_name='操作人', null=True, blank=True) change_time = models.DateField('变更时间') val_new = models.JSONField('变更后完整数据', default=dict) diff --git a/server/apps/information/views.py b/server/apps/information/views.py index 44ccb71..ceaa732 100644 --- a/server/apps/information/views.py +++ b/server/apps/information/views.py @@ -484,11 +484,11 @@ class QualiChangeViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelViewSet): # 重写更新的方法 - def partial_update(self, request, pk=None): + def update(self, request, pk=None): #获取需要更新的实列 instance = self.get_object() # 数据比较 - ignore_fields = ['create_by', 'create_time', 'update_date', 'id'] + ignore_fields = ['create_by', 'create_time', 'update_date', 'id', 'change_reason'] origin_dict = QualificationSerializer(instance=instance).data diff = [] for k, v in request.data.items(): @@ -504,6 +504,7 @@ class QualiChangeViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelViewSet): action='update', instance=instance, change_time = datetime.now(), + change_reason = request.data.get('change_reason'), change_user=request.user, val_new=serializers.data, difference=diff diff --git a/server/server/settings_dev.py b/server/server/settings_dev.py index b24e194..e589130 100644 --- a/server/server/settings_dev.py +++ b/server/server/settings_dev.py @@ -1,14 +1,14 @@ from .settings import * DEBUG = True DATABASES = { - #'default': { - # 'ENGINE': 'django.db.backends.postgresql', - # 'NAME': 'cma', - # 'USER': 'postgres', - #'PASSWORD': 'zcDsj2021', - #'HOST': '49.232.14.174', - #'PORT': '5432', - #}, + 'default': { + 'ENGINE': 'django.db.backends.postgresql', + 'NAME': 'cma', + 'USER': 'postgres', + 'PASSWORD': 'zcDsj2021', + 'HOST': '49.232.14.174', + 'PORT': '5432', + }, # 'default': { # 'ENGINE': 'django.db.backends.postgresql', # 'NAME': 'cma', @@ -27,15 +27,15 @@ DATABASES = { # 'HOST': '127.0.0.1', # 'PORT': '5432', # } - 'default': { - 'ENGINE': 'django.db.backends.postgresql', - 'NAME': 'cma', - 'USER': 'cma', - 'PASSWORD': 'cma123', - 'HOST': '127.0.0.1', - # 'HOST': '1.203.161.102', - 'PORT': '5432', - } + # 'default': { + # 'ENGINE': 'django.db.backends.postgresql', + # 'NAME': 'cma', + # 'USER': 'cma', + # 'PASSWORD': 'cma123', + # 'HOST': '127.0.0.1', + # # 'HOST': '1.203.161.102', + # 'PORT': '5432', + # } }