From 5db16f4fc27495cf313141861bc00908ced24c22 Mon Sep 17 00:00:00 2001 From: shilixia <2309368887@qq.com> Date: Tue, 14 Sep 2021 09:02:14 +0800 Subject: [PATCH] shebei --- hb_client/src/views/equipment/index.vue | 97 +++++++++++-------- .../em/migrations/0004_equipment_count.py | 18 ++++ hb_server/apps/em/models.py | 3 + hb_server/apps/mtm/models.py | 2 +- hb_server/apps/mtm/serializers.py | 2 +- 5 files changed, 79 insertions(+), 43 deletions(-) create mode 100644 hb_server/apps/em/migrations/0004_equipment_count.py diff --git a/hb_client/src/views/equipment/index.vue b/hb_client/src/views/equipment/index.vue index 1826b5e..6feaa63 100644 --- a/hb_client/src/views/equipment/index.vue +++ b/hb_client/src/views/equipment/index.vue @@ -109,47 +109,39 @@ + + + + - - + + + + + + - - - - - - + + + + - - - - - - - - - - - - + + + + + + + + - - - + + + + + + + + + + + - + + + + + - + + + + + + + + + + +
取消 @@ -244,13 +264,7 @@ export default { '2':'检验工具', }, - typeoptions: [{ - value: 1, - label: '生产设备' - }, { - value: 2, - label: '检验工具' - }], + options: [{ value: 0, label: '运转正常' @@ -370,6 +384,7 @@ export default { } }); } else { + this.equipment.type=1; createEquipment(this.equipment).then((res) => { if (res.code >= 200) { this.getList(); diff --git a/hb_server/apps/em/migrations/0004_equipment_count.py b/hb_server/apps/em/migrations/0004_equipment_count.py new file mode 100644 index 0000000..427dc68 --- /dev/null +++ b/hb_server/apps/em/migrations/0004_equipment_count.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.6 on 2021-09-13 08:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('em', '0003_equipment_type'), + ] + + operations = [ + migrations.AddField( + model_name='equipment', + name='count', + field=models.IntegerField(default=0, verbose_name='数量'), + ), + ] diff --git a/hb_server/apps/em/models.py b/hb_server/apps/em/models.py index b55b489..d51e3e8 100644 --- a/hb_server/apps/em/models.py +++ b/hb_server/apps/em/models.py @@ -4,6 +4,7 @@ from django.db.models.base import Model import django.utils.timezone as timezone from django.db.models.query import QuerySet from apps.system.models import CommonAModel, CommonBModel, Organization, User, Dict, File +#from apps.mtm.models import Process from utils.model import SoftModel, BaseModel from simple_history.models import HistoricalRecords @@ -32,8 +33,10 @@ class Equipment(CommonBModel): state = models.CharField('设备状态', max_length=11, choices=state_choices, default=1) parameter = models.TextField('技术参数', null=True, blank=True) place = models.CharField('存放位置', max_length=50, null=True, blank=True) + count = models.IntegerField('数量', default=0) keeper = models.ForeignKey(User, verbose_name='保管人', on_delete=models.CASCADE, null=True, blank=True) description = models.CharField('描述', max_length=200, blank=True, null=True) + #process = models.ForeignKey(Process, verbose_name='工序', on_delete=models.CASCADE, null=True, blank=True) class Meta: verbose_name = '设备信息' diff --git a/hb_server/apps/mtm/models.py b/hb_server/apps/mtm/models.py index 6ff1701..f964756 100644 --- a/hb_server/apps/mtm/models.py +++ b/hb_server/apps/mtm/models.py @@ -24,7 +24,7 @@ class Material(CommonAModel): ) name = models.CharField('物料名称', max_length=100, unique=True) number = models.CharField('编号', max_length=100, unique=True) - specification = models.CharField('规格型号', max_length=100, null=True, blank=True) + specification = models.CharField('型号', max_length=100, null=True, blank=True) type = models.CharField('物料类型', choices= type_choices, max_length=20, default=1) sort_str = models.CharField('排序字符', max_length=100, null=True, blank=True) processes = models.JSONField('工艺流程', default=list, blank=True) diff --git a/hb_server/apps/mtm/serializers.py b/hb_server/apps/mtm/serializers.py index 68b214b..43e5bb8 100644 --- a/hb_server/apps/mtm/serializers.py +++ b/hb_server/apps/mtm/serializers.py @@ -50,7 +50,7 @@ class StepSimpleSerializer(serializers.ModelSerializer): fields = ['id', 'name', 'sort'] class StepDetailSerializer(serializers.ModelSerializer): - equipments_ = EquipmentSimpleSerializer(source='equipments', many=True) + class Meta: model = Step fields = '__all__'