diff --git a/server/apps/ability/apps.py b/server/apps/ability/apps.py index f4be2ff..7bcdb3b 100644 --- a/server/apps/ability/apps.py +++ b/server/apps/ability/apps.py @@ -2,4 +2,4 @@ from django.apps import AppConfig class AbilityConfig(AppConfig): - name = 'ability' + name = 'apps.ability' diff --git a/server/apps/consulting/apps.py b/server/apps/consulting/apps.py index b3c0c5a..8306fe1 100644 --- a/server/apps/consulting/apps.py +++ b/server/apps/consulting/apps.py @@ -2,4 +2,4 @@ from django.apps import AppConfig class QualityConfig(AppConfig): - name = 'consulting' + name = 'apps.consulting' diff --git a/server/apps/crm/apps.py b/server/apps/crm/apps.py index d6f91d2..ede510e 100644 --- a/server/apps/crm/apps.py +++ b/server/apps/crm/apps.py @@ -2,4 +2,4 @@ from django.apps import AppConfig class CrmConfig(AppConfig): - name = 'crm' + name = 'apps.crm' diff --git a/server/apps/exam/apps.py b/server/apps/exam/apps.py index 9649087..c01c2f6 100644 --- a/server/apps/exam/apps.py +++ b/server/apps/exam/apps.py @@ -2,4 +2,4 @@ from django.apps import AppConfig class ExamConfig(AppConfig): - name = 'exam' + name = 'apps.exam' diff --git a/server/apps/ops/apps.py b/server/apps/ops/apps.py index 23b85df..84687ff 100644 --- a/server/apps/ops/apps.py +++ b/server/apps/ops/apps.py @@ -2,5 +2,5 @@ from django.apps import AppConfig class OpsConfig(AppConfig): - name = 'ops' + name = 'apps.ops' verbose_name = '系统监控' diff --git a/server/apps/quality/apps.py b/server/apps/quality/apps.py index 2455d38..c4ffb5c 100644 --- a/server/apps/quality/apps.py +++ b/server/apps/quality/apps.py @@ -2,4 +2,4 @@ from django.apps import AppConfig class QualityConfig(AppConfig): - name = 'quality' + name = 'apps.quality' diff --git a/server/apps/supervision/apps.py b/server/apps/supervision/apps.py index 7da9691..589f5aa 100644 --- a/server/apps/supervision/apps.py +++ b/server/apps/supervision/apps.py @@ -2,4 +2,4 @@ from django.apps import AppConfig class SupervisionConfig(AppConfig): - name = 'supervision' + name = 'apps.supervision' diff --git a/server/apps/supervision/migrations/0042_alter_pgoaldept_goal_value_b.py b/server/apps/supervision/migrations/0042_alter_pgoaldept_goal_value_b.py new file mode 100644 index 0000000..90df6a6 --- /dev/null +++ b/server/apps/supervision/migrations/0042_alter_pgoaldept_goal_value_b.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.12 on 2023-05-23 06:52 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('supervision', '0041_auto_20230522_1518'), + ] + + operations = [ + migrations.AlterField( + model_name='pgoaldept', + name='goal_value_b', + field=models.FloatField(blank=True, null=True, verbose_name='设定值'), + ), + ] diff --git a/server/apps/supervision/models.py b/server/apps/supervision/models.py index 86ab03f..2447f83 100644 --- a/server/apps/supervision/models.py +++ b/server/apps/supervision/models.py @@ -189,7 +189,7 @@ class PgoalDept(CommonBModel): goal_key = models.CharField('目标key值', max_length=100, default='other', blank=True) goal_value_a = models.FloatField('基础值') goal_o_file = models.ForeignKey(File, related_name='goal_o_file', verbose_name='原文件ID', on_delete=models.SET_NULL, null=True, blank=True) - goal_value_b = models.FloatField('设定值') + goal_value_b = models.FloatField('设定值', null=True, blank=True) goal_value_c = models.FloatField('实际值', null=True, blank=True) goal_file = models.ForeignKey(File, related_name='goal_file', verbose_name='当前文件ID', on_delete=models.SET_NULL, null=True, blank=True) goal_files = models.ManyToManyField(File, related_name='goal_files', verbose_name='历史文件', blank=True) diff --git a/server/apps/supervision/views.py b/server/apps/supervision/views.py index 9eae222..504fe65 100644 --- a/server/apps/supervision/views.py +++ b/server/apps/supervision/views.py @@ -434,7 +434,7 @@ class Task2ViewSet(CreateUpdateCustomMixin, ModelViewSet): return Response() @transaction.atomic - @action(methods=['put'], detail=True, perms_map = {'put':'task2'}) + @action(methods=['put'], detail=True, perms_map = {'put':'task2'}, serializer_class=serializers.Serializer) def start(self, request, *args, **kwargs): """ 开始执行 @@ -450,13 +450,13 @@ class Task2ViewSet(CreateUpdateCustomMixin, ModelViewSet): except: raise ParseError('未配置年度基础目标') for i in tds: - for k, v in enumerate(Pgoal.basedict): - pds = PgoalDept.objects.filter(task2do=i, goal_key=k) + for key in Pgoal.basedict: + pds = PgoalDept.objects.filter(task2do=i, goal_key=key) if pds.exists(): - pds.update(**{'goal_name': v, 'goal_value_a': getattr(pg, k), 'goal_o_file': getattr(pg, k+'_file')}) + pds.update(**{'goal_name': Pgoal.basedict[key], 'goal_value_a': getattr(pg, key), 'goal_o_file': getattr(pg, key+'_file')}) else: PgoalDept.objects.create(**{'year': i.task2.year, 'task2do': i, 'belong_dept': i.belong_dept, - 'goal_name': v, 'goal_key': k, 'goal_value_a': getattr(pg, k), 'goal_o_file': getattr(pg, k+'_file')}) + 'goal_name': Pgoal.basedict[key], 'goal_key': key, 'goal_value_a': getattr(pg, key), 'goal_o_file': getattr(pg, key+'_file')}) obj.state = Task2.TASK2_DOING obj.save() return Response() @@ -557,7 +557,7 @@ class Domixin: def countup_task2do(self, task2do): if task2do.task2.type == Task2.TASK2_F: - task2do.count_up = PgoalDept.objects.filter(task2do=task2do).count() + task2do.count_up = PgoalDept.objects.filter(task2do=task2do).exclude(goal_value_b=None).count() task2do.save() elif task2do.task2.type == Task2.TASK2_S: self.countnum_task2do_field(task2do) diff --git a/server/apps/system/apps.py b/server/apps/system/apps.py index 0e3baeb..7d38593 100644 --- a/server/apps/system/apps.py +++ b/server/apps/system/apps.py @@ -2,5 +2,5 @@ from django.apps import AppConfig class RbacConfig(AppConfig): - name = 'system' + name = 'apps.system' verbose_name = '系统管理' diff --git a/server/apps/system/migrations/0023_alter_user_first_name.py b/server/apps/system/migrations/0023_alter_user_first_name.py new file mode 100644 index 0000000..e3498fc --- /dev/null +++ b/server/apps/system/migrations/0023_alter_user_first_name.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.12 on 2023-05-23 06:52 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('system', '0022_delete_historicaldict'), + ] + + operations = [ + migrations.AlterField( + model_name='user', + name='first_name', + field=models.CharField(blank=True, max_length=150, verbose_name='first name'), + ), + ] diff --git a/server/apps/vod/apps.py b/server/apps/vod/apps.py index d5b0761..ed6dc55 100644 --- a/server/apps/vod/apps.py +++ b/server/apps/vod/apps.py @@ -2,4 +2,4 @@ from django.apps import AppConfig class VodConfig(AppConfig): - name = 'vod' + name = 'apps.vod' diff --git a/server/requirements.txt b/server/requirements.txt index 77fa7d5..1b1b0b1 100644 Binary files a/server/requirements.txt and b/server/requirements.txt differ diff --git a/server/server/settings.py b/server/server/settings.py index b7396ec..1934997 100644 --- a/server/server/settings.py +++ b/server/server/settings.py @@ -126,6 +126,9 @@ USE_TZ = True CORS_ALLOW_CREDENTIALS = True CORS_ORIGIN_ALLOW_ALL = True +# 默认主键 +DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' + # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.0/howto/static-files/