From 8c2c34a2f86b748487b362ef43291d7495c8ad14 Mon Sep 17 00:00:00 2001 From: zty Date: Mon, 25 Mar 2024 17:11:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=83=BD=E5=8A=9B=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E5=92=8C=E5=A4=96=E9=83=A8=E7=9B=91=E7=9D=A3=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0054_auto_20240325_1351.py | 30 +++++++++++++++++++ .../migrations/0055_auto_20240325_1352.py | 23 ++++++++++++++ .../migrations/0056_oinspect_file_path.py | 18 +++++++++++ .../0057_alter_oinspect_file_path.py | 18 +++++++++++ .../migrations/0058_oinspect_result_date.py | 18 +++++++++++ .../0059_alter_oinspect_result_date.py | 20 +++++++++++++ .../migrations/0060_auto_20240325_1526.py | 25 ++++++++++++++++ .../migrations/0061_auto_20240325_1640.py | 25 ++++++++++++++++ .../migrations/0062_auto_20240325_1641.py | 25 ++++++++++++++++ .../0063_alter_oinspect_result_date.py | 20 +++++++++++++ server/apps/supervision/models.py | 10 +++++++ server/apps/supervision/views.py | 2 ++ 12 files changed, 234 insertions(+) create mode 100644 server/apps/supervision/migrations/0054_auto_20240325_1351.py create mode 100644 server/apps/supervision/migrations/0055_auto_20240325_1352.py create mode 100644 server/apps/supervision/migrations/0056_oinspect_file_path.py create mode 100644 server/apps/supervision/migrations/0057_alter_oinspect_file_path.py create mode 100644 server/apps/supervision/migrations/0058_oinspect_result_date.py create mode 100644 server/apps/supervision/migrations/0059_alter_oinspect_result_date.py create mode 100644 server/apps/supervision/migrations/0060_auto_20240325_1526.py create mode 100644 server/apps/supervision/migrations/0061_auto_20240325_1640.py create mode 100644 server/apps/supervision/migrations/0062_auto_20240325_1641.py create mode 100644 server/apps/supervision/migrations/0063_alter_oinspect_result_date.py diff --git a/server/apps/supervision/migrations/0054_auto_20240325_1351.py b/server/apps/supervision/migrations/0054_auto_20240325_1351.py new file mode 100644 index 0000000..abbf020 --- /dev/null +++ b/server/apps/supervision/migrations/0054_auto_20240325_1351.py @@ -0,0 +1,30 @@ +# Generated by Django 3.2.12 on 2024-03-25 05:51 + +import datetime +from django.db import migrations, models +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('supervision', '0053_record_dept_top_yes'), + ] + + operations = [ + migrations.AddField( + model_name='pt', + name='a_class', + field=models.BooleanField(default=True, verbose_name='A类'), + ), + migrations.AddField( + model_name='pt', + name='certificate_date', + field=models.DateField(default=datetime.datetime(2024, 3, 25, 5, 51, 35, 612834, tzinfo=utc), verbose_name='证书日期'), + ), + migrations.AddField( + model_name='pt', + name='field', + field=models.CharField(choices=[('建工', '建工'), ('建材', '建材'), ('环境', '环境'), ('食农', '食农')], default='建工', help_text="(('建工', '建工'), ('建材', '建材'), ('环境', '环境'), ('食农', '食农'))", max_length=100, verbose_name='领域'), + ), + ] diff --git a/server/apps/supervision/migrations/0055_auto_20240325_1352.py b/server/apps/supervision/migrations/0055_auto_20240325_1352.py new file mode 100644 index 0000000..c3a0c08 --- /dev/null +++ b/server/apps/supervision/migrations/0055_auto_20240325_1352.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.12 on 2024-03-25 05:52 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('supervision', '0054_auto_20240325_1351'), + ] + + operations = [ + migrations.AlterField( + model_name='pt', + name='certificate_date', + field=models.DateField(verbose_name='证书日期'), + ), + migrations.AlterField( + model_name='pt', + name='field', + field=models.CharField(choices=[('建工', '建工'), ('建材', '建材'), ('环境', '环境'), ('食农', '食农')], help_text="(('建工', '建工'), ('建材', '建材'), ('环境', '环境'), ('食农', '食农'))", max_length=100, verbose_name='领域'), + ), + ] diff --git a/server/apps/supervision/migrations/0056_oinspect_file_path.py b/server/apps/supervision/migrations/0056_oinspect_file_path.py new file mode 100644 index 0000000..8741fd0 --- /dev/null +++ b/server/apps/supervision/migrations/0056_oinspect_file_path.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.12 on 2024-03-25 05:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('supervision', '0055_auto_20240325_1352'), + ] + + operations = [ + migrations.AddField( + model_name='oinspect', + name='file_path', + field=models.CharField(default='/', max_length=100, verbose_name='附件路径'), + ), + ] diff --git a/server/apps/supervision/migrations/0057_alter_oinspect_file_path.py b/server/apps/supervision/migrations/0057_alter_oinspect_file_path.py new file mode 100644 index 0000000..02d4242 --- /dev/null +++ b/server/apps/supervision/migrations/0057_alter_oinspect_file_path.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.12 on 2024-03-25 05:59 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('supervision', '0056_oinspect_file_path'), + ] + + operations = [ + migrations.AlterField( + model_name='oinspect', + name='file_path', + field=models.CharField(max_length=100, verbose_name='附件路径'), + ), + ] diff --git a/server/apps/supervision/migrations/0058_oinspect_result_date.py b/server/apps/supervision/migrations/0058_oinspect_result_date.py new file mode 100644 index 0000000..630f769 --- /dev/null +++ b/server/apps/supervision/migrations/0058_oinspect_result_date.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.12 on 2024-03-25 06:12 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('supervision', '0057_alter_oinspect_file_path'), + ] + + operations = [ + migrations.AddField( + model_name='oinspect', + name='result_date', + field=models.DateField(null=True, verbose_name='检查结果日期'), + ), + ] diff --git a/server/apps/supervision/migrations/0059_alter_oinspect_result_date.py b/server/apps/supervision/migrations/0059_alter_oinspect_result_date.py new file mode 100644 index 0000000..599c419 --- /dev/null +++ b/server/apps/supervision/migrations/0059_alter_oinspect_result_date.py @@ -0,0 +1,20 @@ +# Generated by Django 3.2.12 on 2024-03-25 06:57 + +import datetime +from django.db import migrations, models +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('supervision', '0058_oinspect_result_date'), + ] + + operations = [ + migrations.AlterField( + model_name='oinspect', + name='result_date', + field=models.DateField(default=datetime.datetime(2024, 3, 25, 6, 57, 32, 270729, tzinfo=utc), verbose_name='检查结果日期'), + ), + ] diff --git a/server/apps/supervision/migrations/0060_auto_20240325_1526.py b/server/apps/supervision/migrations/0060_auto_20240325_1526.py new file mode 100644 index 0000000..30a5ddd --- /dev/null +++ b/server/apps/supervision/migrations/0060_auto_20240325_1526.py @@ -0,0 +1,25 @@ +# Generated by Django 3.2.12 on 2024-03-25 07:26 + +import datetime +from django.db import migrations, models +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('supervision', '0059_alter_oinspect_result_date'), + ] + + operations = [ + migrations.AlterField( + model_name='oinspect', + name='result_date', + field=models.DateField(default=datetime.datetime(2024, 3, 25, 7, 26, 18, 849071, tzinfo=utc), verbose_name='检查结果日期'), + ), + migrations.AlterField( + model_name='pt', + name='field', + field=models.CharField(choices=[(0, '建工'), (10, '建材'), (20, '环境'), (30, '食农')], help_text="((0, '建工'), (10, '建材'), (20, '环境'), (30, '食农'))", max_length=100, verbose_name='领域'), + ), + ] diff --git a/server/apps/supervision/migrations/0061_auto_20240325_1640.py b/server/apps/supervision/migrations/0061_auto_20240325_1640.py new file mode 100644 index 0000000..1492909 --- /dev/null +++ b/server/apps/supervision/migrations/0061_auto_20240325_1640.py @@ -0,0 +1,25 @@ +# Generated by Django 3.2.12 on 2024-03-25 08:40 + +import datetime +from django.db import migrations, models +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('supervision', '0060_auto_20240325_1526'), + ] + + operations = [ + migrations.AlterField( + model_name='oinspect', + name='result_date', + field=models.DateField(default=datetime.datetime(2024, 3, 25, 8, 40, 44, 398224, tzinfo=utc), verbose_name='检查结果日期'), + ), + migrations.AlterField( + model_name='pt', + name='field', + field=models.PositiveSmallIntegerField(choices=[(0, '建工'), (10, '建材'), (20, '环境'), (30, '食农')], help_text="((0, '建工'), (10, '建材'), (20, '环境'), (30, '食农'))", max_length=100, verbose_name='领域'), + ), + ] diff --git a/server/apps/supervision/migrations/0062_auto_20240325_1641.py b/server/apps/supervision/migrations/0062_auto_20240325_1641.py new file mode 100644 index 0000000..fa86cb2 --- /dev/null +++ b/server/apps/supervision/migrations/0062_auto_20240325_1641.py @@ -0,0 +1,25 @@ +# Generated by Django 3.2.12 on 2024-03-25 08:41 + +import datetime +from django.db import migrations, models +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('supervision', '0061_auto_20240325_1640'), + ] + + operations = [ + migrations.AlterField( + model_name='oinspect', + name='result_date', + field=models.DateField(default=datetime.datetime(2024, 3, 25, 8, 41, 50, 369386, tzinfo=utc), verbose_name='检查结果日期'), + ), + migrations.AlterField( + model_name='pt', + name='field', + field=models.PositiveSmallIntegerField(choices=[(0, '建工'), (10, '建材'), (20, '环境'), (30, '食农')], default=0, help_text="((0, '建工'), (10, '建材'), (20, '环境'), (30, '食农'))", verbose_name='领域'), + ), + ] diff --git a/server/apps/supervision/migrations/0063_alter_oinspect_result_date.py b/server/apps/supervision/migrations/0063_alter_oinspect_result_date.py new file mode 100644 index 0000000..d8c4d5b --- /dev/null +++ b/server/apps/supervision/migrations/0063_alter_oinspect_result_date.py @@ -0,0 +1,20 @@ +# Generated by Django 3.2.12 on 2024-03-25 08:47 + +import datetime +from django.db import migrations, models +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('supervision', '0062_auto_20240325_1641'), + ] + + operations = [ + migrations.AlterField( + model_name='oinspect', + name='result_date', + field=models.DateField(default=datetime.datetime(2024, 3, 25, 8, 47, 23, 896413, tzinfo=utc), verbose_name='检查结果日期'), + ), + ] diff --git a/server/apps/supervision/models.py b/server/apps/supervision/models.py index ab8b1a7..2196ebe 100644 --- a/server/apps/supervision/models.py +++ b/server/apps/supervision/models.py @@ -2,6 +2,7 @@ from django.db import models from utils.model import BaseModel from apps.system.models import CommonAModel, CommonBModel, Organization, User, Dict, File, CommonADModel, CommonBDModel from django.contrib.postgres.fields import JSONField +from django.utils import timezone # Create your models here. class Content(CommonAModel): @@ -244,12 +245,19 @@ class Pt(CommonBDModel): (20, '被暂停'), (30, '已被撤销认可资格') ) + field_choices = ((0,'建工'), + (10,'建材'), + (20,'环境'), + (30,'食农')) name = models.CharField('名称', max_length=100) number = models.CharField('编号', max_length=100) organizer = models.CharField('组织方', max_length=100) params = models.TextField('参加参数名称') result = models.PositiveSmallIntegerField('结果', choices=pt_result_choices, default=10, help_text=str(pt_result_choices)) handle_result = models.PositiveSmallIntegerField('处理结果', choices = pt_hresult_choices, default=0, help_text=str(pt_hresult_choices)) + certificate_date = models.DateField('证书日期') + field = models.PositiveSmallIntegerField('领域', choices=field_choices, help_text=str(field_choices),default=0) + a_class = models.BooleanField('A类', default=True) task2do = models.ForeignKey('supervision.task2do', verbose_name= '关联任务执行', on_delete=models.SET_NULL, null=True, blank=True) @@ -285,4 +293,6 @@ class Oinspect(CommonBDModel): checker = models.CharField('检查方', max_length=100) date_inspect = models.DateField('检查日期') result = models.TextField('检查结果') + result_date = models.DateField('检查结果日期', default=timezone.now()) + file_path = models.CharField('附件路径', max_length=100) task2do = models.ForeignKey('supervision.task2do', verbose_name= '关联任务执行', on_delete=models.SET_NULL, null=True, blank=True) \ No newline at end of file diff --git a/server/apps/supervision/views.py b/server/apps/supervision/views.py index 69e7e21..b559a8f 100644 --- a/server/apps/supervision/views.py +++ b/server/apps/supervision/views.py @@ -839,6 +839,8 @@ class OinspectViewSet(ImpMixin, Domixin, CreateUpdateCustomMixin, ModelViewSet): data['checker'] = sheet['c'+str(i)].value data['date_inspect'] = self.format_date(i, sheet['d'+str(i)].value) data['result'] = sheet['e'+str(i)].value + data['result_date'] = self.format_date(i, sheet['f'+str(i)].value) + data['file_path'] = sheet['g'+str(i)].value return data @action(methods=['post'], detail=False, perms_map = {'post':'task2do'}, serializer_class=ImpSerializer)