From b8d658b8b4c6f190f3ea073ffd6667feca710690 Mon Sep 17 00:00:00 2001 From: shijing Date: Tue, 15 Feb 2022 14:10:20 +0800 Subject: [PATCH 1/5] faceLogin --- hb_client/src/App.vue | 3 ++ .../src/components/faceLogin/tracking.vue | 8 ++--- hb_client/src/views/dashboard/index.vue | 29 ++++++------------- hb_client/src/views/login/index.vue | 6 ++-- 4 files changed, 19 insertions(+), 27 deletions(-) diff --git a/hb_client/src/App.vue b/hb_client/src/App.vue index 3e65971..20bae48 100644 --- a/hb_client/src/App.vue +++ b/hb_client/src/App.vue @@ -66,4 +66,7 @@ export default { #warningTabs .el-tabs__item{ padding: 0 10px!important; } + #loginFaceWrap .el-dialog{ + width: 780px!important;height: 720px!important; + } diff --git a/hb_client/src/components/faceLogin/tracking.vue b/hb_client/src/components/faceLogin/tracking.vue index d9869c1..98727da 100644 --- a/hb_client/src/components/faceLogin/tracking.vue +++ b/hb_client/src/components/faceLogin/tracking.vue @@ -1,11 +1,11 @@ diff --git a/hb_client/src/views/dashboard/index.vue b/hb_client/src/views/dashboard/index.vue index 1e5eb29..80b06ff 100644 --- a/hb_client/src/views/dashboard/index.vue +++ b/hb_client/src/views/dashboard/index.vue @@ -7,11 +7,8 @@
- + +
本月合同数 @@ -23,6 +20,7 @@
+
- + +
本月在制任务 @@ -55,11 +50,8 @@
- + +
本月交付产品 @@ -71,11 +63,8 @@
- + +
本月不合格产品 diff --git a/hb_client/src/views/login/index.vue b/hb_client/src/views/login/index.vue index 5b48238..7edff04 100644 --- a/hb_client/src/views/login/index.vue +++ b/hb_client/src/views/login/index.vue @@ -64,8 +64,8 @@
- -
打卡
+ +
打卡
@@ -309,6 +309,6 @@ } .testTracking{ width:100%; - height: 700px; + height: 620px; } From e93f6b6e368bafd420c52b02916b3f958591dd4f Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 15 Feb 2022 15:04:32 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=99=BB=E5=BD=95header?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/system/authentication.py | 6 +----- hb_server/apps/system/permission.py | 5 ++++- hb_server/server/settings.py | 2 +- hb_server/utils/response.py | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/hb_server/apps/system/authentication.py b/hb_server/apps/system/authentication.py index 3c85943..af3fba2 100644 --- a/hb_server/apps/system/authentication.py +++ b/hb_server/apps/system/authentication.py @@ -9,15 +9,11 @@ class CustomBackend(ModelBackend): def authenticate(self, request, username=None, password=None, **kwargs): if username is None: username = kwargs.get(UserModel.USERNAME_FIELD) - if username is None or password is None: - return try: user = UserModel._default_manager.get( Q(username=username) | Q(phone=username) | Q(email=username)) except UserModel.DoesNotExist: - # Run the default password hasher once to reduce the timing - # difference between an existing and a nonexistent user (#20760). - UserModel().set_password(password) + return None else: if user.check_password(password) and self.user_can_authenticate(user): return user diff --git a/hb_server/apps/system/permission.py b/hb_server/apps/system/permission.py index 37f85ec..bcb94ac 100644 --- a/hb_server/apps/system/permission.py +++ b/hb_server/apps/system/permission.py @@ -35,7 +35,10 @@ class RbacPermission(BasePermission): :return: """ if not request.user: - perms = ['visitor'] # 如果没有经过认证,视为游客 + if request.META.get('HTTP_AUTHORIZATION', None) == 'big_screen': + perms = ['visitor'] + else: + return False else: perms = cache.get(request.user.username + '__perms') if not perms: diff --git a/hb_server/server/settings.py b/hb_server/server/settings.py index 2890f6b..1a4a5c6 100644 --- a/hb_server/server/settings.py +++ b/hb_server/server/settings.py @@ -158,7 +158,7 @@ REST_FRAMEWORK = { 'rest_framework.authentication.SessionAuthentication', ], 'DEFAULT_PERMISSION_CLASSES': [ - 'rest_framework.permissions.IsAuthenticated', + # 'rest_framework.permissions.IsAuthenticated', 'apps.system.permission.RbacPermission' ], 'DEFAULT_RENDERER_CLASSES': [ diff --git a/hb_server/utils/response.py b/hb_server/utils/response.py index 864862c..3814076 100644 --- a/hb_server/utils/response.py +++ b/hb_server/utils/response.py @@ -48,9 +48,9 @@ class FitJSONRenderer(JSONRenderer): response_body = BaseResponse() response = renderer_context.get("response") status_code = response.status_code # Http状态异常码 - print(status_code) if status_code >= 400: # 如果http响应异常 - if isinstance(data, dict) and 'code' in data: # 如果自定义了异常码 + if isinstance(data, dict) \ + and 'code' in data and 'msg' in data: # 如果自定义了异常码 response_body = data else: response_body.data = data # data里是详细异常信息 From bfc4634281facc9a15f0ff7057c1ad144f99ecae Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 16 Feb 2022 15:21:11 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0046_alter_recordform_type.py | 18 ++++++++++++++++++ hb_server/apps/mtm/models.py | 14 ++++++++++---- hb_server/apps/mtm/serializers.py | 14 ++++++++++++++ 3 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 hb_server/apps/mtm/migrations/0046_alter_recordform_type.py diff --git a/hb_server/apps/mtm/migrations/0046_alter_recordform_type.py b/hb_server/apps/mtm/migrations/0046_alter_recordform_type.py new file mode 100644 index 0000000..d71764d --- /dev/null +++ b/hb_server/apps/mtm/migrations/0046_alter_recordform_type.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.9 on 2022-02-16 07:15 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('mtm', '0045_usedstep_need_test'), + ] + + operations = [ + migrations.AlterField( + model_name='recordform', + name='type', + field=models.IntegerField(choices=[(10, '生产记录表'), (20, '工序检查表'), (30, '入厂检查表'), (40, '成品检查表'), (50, '首件检查表')], default=1, verbose_name='表格类型'), + ), + ] diff --git a/hb_server/apps/mtm/models.py b/hb_server/apps/mtm/models.py index f8ccc83..9bb007f 100644 --- a/hb_server/apps/mtm/models.py +++ b/hb_server/apps/mtm/models.py @@ -107,11 +107,17 @@ class RecordForm(CommonAModel): """ 记录表格 """ - RF_TYPE_DO = 1 - RF_TYPE_TEST = 2 + RF_TYPE_DO = 10 + RF_TYPE_TEST = 20 + RF_TYPE_TEST_IN = 30 + RF_TYPE_TEST_GOOD = 40 + RF_TYPE_TEST_FIRST = 50 type_choices=( - (RF_TYPE_DO, '生产记录模板'), - (RF_TYPE_TEST, '检验记录模板') + (RF_TYPE_DO, '生产记录表'), + (RF_TYPE_TEST, '工序检查表'), + (RF_TYPE_TEST_IN, '入厂检查表'), + (RF_TYPE_TEST_GOOD, '成品检查表'), + (RF_TYPE_TEST_FIRST, '首件检查表'), ) name = models.CharField('表格名称', max_length=100) type = models.IntegerField('表格类型', choices=type_choices, default=1) diff --git a/hb_server/apps/mtm/serializers.py b/hb_server/apps/mtm/serializers.py index 72bc685..0bba60f 100644 --- a/hb_server/apps/mtm/serializers.py +++ b/hb_server/apps/mtm/serializers.py @@ -190,10 +190,24 @@ class RecordFormCreateSerializer(serializers.ModelSerializer): model = RecordForm fields = ['name', 'type', 'step', 'material', 'number', 'enabled'] + def validate(self, attrs): + if attrs['enabled']: + if RecordForm.objects.filter(type=attrs['type'], + enabled=True).exists(): + raise ValidationError('已存在启用的同类检查表') + return super().validate(attrs) + class RecordFormUpdateSerializer(serializers.ModelSerializer): class Meta: model = RecordForm fields = ['name', 'type', 'number', 'enabled'] + + def validate(self, attrs): + if attrs['enabled']: + if RecordForm.objects.filter(type=attrs['type'], + enabled=True).exists(): + raise ValidationError('已存在启用的同类检查表') + return super().validate(attrs) class RecordFormFieldSerializer(serializers.ModelSerializer): class Meta: From a708f261afe47704d34f908e212c19d362910d70 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 16 Feb 2022 17:09:47 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E5=88=86=E7=B1=BB2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/mtm/serializers.py | 13 ------------- hb_server/apps/pm/models.py | 13 ++++++++++++- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/hb_server/apps/mtm/serializers.py b/hb_server/apps/mtm/serializers.py index 0bba60f..2746e0f 100644 --- a/hb_server/apps/mtm/serializers.py +++ b/hb_server/apps/mtm/serializers.py @@ -190,24 +190,11 @@ class RecordFormCreateSerializer(serializers.ModelSerializer): model = RecordForm fields = ['name', 'type', 'step', 'material', 'number', 'enabled'] - def validate(self, attrs): - if attrs['enabled']: - if RecordForm.objects.filter(type=attrs['type'], - enabled=True).exists(): - raise ValidationError('已存在启用的同类检查表') - return super().validate(attrs) class RecordFormUpdateSerializer(serializers.ModelSerializer): class Meta: model = RecordForm fields = ['name', 'type', 'number', 'enabled'] - - def validate(self, attrs): - if attrs['enabled']: - if RecordForm.objects.filter(type=attrs['type'], - enabled=True).exists(): - raise ValidationError('已存在启用的同类检查表') - return super().validate(attrs) class RecordFormFieldSerializer(serializers.ModelSerializer): class Meta: diff --git a/hb_server/apps/pm/models.py b/hb_server/apps/pm/models.py index 3b59038..2a6ea86 100644 --- a/hb_server/apps/pm/models.py +++ b/hb_server/apps/pm/models.py @@ -7,7 +7,7 @@ import django.utils.timezone as timezone from django.db.models.query import QuerySet from utils.model import SoftModel, BaseModel -from apps.mtm.models import Material, Process, SubProduction, SubprodctionMaterial +from apps.mtm.models import Material, Process, RecordFormField, SubProduction, SubprodctionMaterial from apps.sam.models import Order class ProductionPlan(CommonAModel): @@ -91,6 +91,16 @@ class SubProductionPlan(CommonAModel): verbose_name = '子生产计划' verbose_name_plural = verbose_name +class FirstItem(BaseModel): + """ + 首件确认表记录条目 + """ + form_field = models.ForeignKey(RecordFormField, verbose_name='关联自定义表格字段', on_delete=models.CASCADE) + field_value = models.JSONField('录入值', null=True, blank=True) + is_hidden = models.BooleanField('是否隐藏', default=False) + is_testok = models.BooleanField('是否合格', null=True, blank=True) + subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='关联的子计划', on_delete=models.CASCADE, related_name='item_test_record') + class SubProductionProgress(BaseModel): """ 子计划生产进度统计表/物料消耗 @@ -104,3 +114,4 @@ class SubProductionProgress(BaseModel): count_real = models.PositiveIntegerField('实际消耗/产出数', default=0) count_ok = models.PositiveIntegerField('合格数量', default=0) count_notok = models.PositiveIntegerField('不合格数量', default=0) + From 77d1e9210950e0e6b158e1c6bc280d1fbc1e8c7f Mon Sep 17 00:00:00 2001 From: shijing Date: Thu, 17 Feb 2022 14:32:18 +0800 Subject: [PATCH 5/5] Form --- hb_client/src/icons/svg/bigScreen.svg | 1 + hb_client/src/router/index.js | 2 +- hb_client/src/views/dashboard/index.vue | 3 +- hb_client/src/views/mtm/materialdo.vue | 178 +++++++++++------------- 4 files changed, 87 insertions(+), 97 deletions(-) create mode 100644 hb_client/src/icons/svg/bigScreen.svg diff --git a/hb_client/src/icons/svg/bigScreen.svg b/hb_client/src/icons/svg/bigScreen.svg new file mode 100644 index 0000000..a90340b --- /dev/null +++ b/hb_client/src/icons/svg/bigScreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/hb_client/src/router/index.js b/hb_client/src/router/index.js index 6d08976..c0b6376 100644 --- a/hb_client/src/router/index.js +++ b/hb_client/src/router/index.js @@ -55,7 +55,7 @@ export const constantRoutes = [ { path: '/index', component: () => import('@/views/bigScreen/index'), - meta: { title: '大屏', icon: 'home', affix: true,keepAlive: false } + meta: { title: '大屏', icon: 'bigScreen', affix: true,keepAlive: false } }, { path: '/changepassword', diff --git a/hb_client/src/views/dashboard/index.vue b/hb_client/src/views/dashboard/index.vue index 80b06ff..dcac59e 100644 --- a/hb_client/src/views/dashboard/index.vue +++ b/hb_client/src/views/dashboard/index.vue @@ -684,7 +684,8 @@ show: false//Y轴刻度线 }, axisLabel: { - color: '#333333'//Y轴文本颜色 + color: '#333333',//Y轴文本颜色 + fontSize: 10,//字体大小 }, splitLine: { show: true, //Y轴分割线 diff --git a/hb_client/src/views/mtm/materialdo.vue b/hb_client/src/views/mtm/materialdo.vue index b42acd3..ec10a3f 100644 --- a/hb_client/src/views/mtm/materialdo.vue +++ b/hb_client/src/views/mtm/materialdo.vue @@ -3,7 +3,7 @@ - +
- - + + + +