diff --git a/backend/app/services/oa_publish.py b/backend/app/services/oa_publish.py index bd58cf49..2f9442c9 100644 --- a/backend/app/services/oa_publish.py +++ b/backend/app/services/oa_publish.py @@ -88,6 +88,8 @@ CONDITION_ELIGIBLE_TYPES = frozenset( "person", "ownerPerson", "post", + "dept", + "ownerDept", } ) diff --git a/backend/tests/test_oa_publish.py b/backend/tests/test_oa_publish.py index 805b4e8b..572cdf05 100644 --- a/backend/tests/test_oa_publish.py +++ b/backend/tests/test_oa_publish.py @@ -357,6 +357,47 @@ class TestConditionPublish(unittest.TestCase): ) self.assertTrue(any("发起人" in e and "包含" in e for e in errs)) + def test_dept_condition_field_allowed(self): + errs = validate_condition_rules_against_form( + { + "rule": [ + { + "type": "dept", + "field": "Fdept", + "title": "部门", + "useInCondition": True, + "$required": True, + "props": {"multiple": True}, + } + ] + }, + _condition_flow( + rules=[ + {"field": "Fdept", "op": "contains", "value": ["d1", "d2"]} + ] + ), + ) + self.assertEqual(errs, []) + + def test_owner_dept_condition_field_allowed(self): + errs = validate_condition_rules_against_form( + { + "rule": [ + { + "type": "ownerDept", + "field": "Fod", + "title": "归属部门", + "useInCondition": True, + "$required": True, + } + ] + }, + _condition_flow( + rules=[{"field": "Fod", "op": "contains", "value": ["d1"]}] + ), + ) + self.assertEqual(errs, []) + if __name__ == "__main__": unittest.main()