From ec64f67041772df9a5cbca37bdf02229bb27f179 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 16 Nov 2021 10:26:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E5=AE=9A=E8=A1=A8=E8=BE=BE=E5=BC=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...32_alter_recordformfield_rule_expression.py | 18 ++++++++++++++++++ hb_server/apps/mtm/models.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 hb_server/apps/mtm/migrations/0032_alter_recordformfield_rule_expression.py diff --git a/hb_server/apps/mtm/migrations/0032_alter_recordformfield_rule_expression.py b/hb_server/apps/mtm/migrations/0032_alter_recordformfield_rule_expression.py new file mode 100644 index 0000000..1f55b4a --- /dev/null +++ b/hb_server/apps/mtm/migrations/0032_alter_recordformfield_rule_expression.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.6 on 2021-11-16 02:24 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('mtm', '0031_auto_20211116_0841'), + ] + + operations = [ + migrations.AlterField( + model_name='recordformfield', + name='rule_expression', + field=models.TextField(default='', verbose_name='判定表达式'), + ), + ] diff --git a/hb_server/apps/mtm/models.py b/hb_server/apps/mtm/models.py index ef0426c..c3fb34f 100644 --- a/hb_server/apps/mtm/models.py +++ b/hb_server/apps/mtm/models.py @@ -154,7 +154,7 @@ class RecordFormField(CommonAModel): high_rule = models.IntegerField('上限规则', choices=high_rule_choices, null=True, blank=True) low_limit = models.FloatField('下限值', null=True, blank=True) low_rule = models.IntegerField('下限规则', choices=low_rule_choices, null=True, blank=True) - rule_expression = models.JSONField('判定表达式', default=list, help_text='判定表达式, 格式为[{"expression":"{value} > 3 and {value}<10"}] 其中{}用于填充的字段key,运算时会换算成实际的值,符合条件返回true,表达式只支持简单的运算或datetime/time运算.以首次匹配成功的条件为准,所以多个条件不要有冲突' ) + rule_expression = models.TextField('判定表达式', default='') class Meta: verbose_name = '记录表格字段'