feat(oa): add person select control with contains conditions and print
Register FormCreate person field (dept-aligned UI), enable contains-only workflow conditions, and format person values in print/related summary. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
85322c39e4
commit
cf069c74ec
13 files changed
+618
-15
No files matched your search
@@ -104,7 +104,7 @@ def _format_value(typ: str, raw: Any) -> Tuple[str, bool]:
|
||||
else:
|
||||
n = 0
|
||||
return f"已关联 {n} 条", False
|
||||
if typ == "dept":
|
||||
if (typ == "dept" or typ == "person"):
|
||||
if isinstance(raw, list):
|
||||
names = []
|
||||
for x in raw:
|
||||
|
||||
@@ -61,6 +61,30 @@ class TestFlatten(unittest.TestCase):
|
||||
self.assertEqual(by_label["部门"], "中科兴皖 / 研发")
|
||||
self.assertEqual(by_label["多部门"], "中科兴皖 / 研发、中科兴皖 / 质量")
|
||||
|
||||
def test_person_formats_names(self):
|
||||
schema = {
|
||||
"rule": [
|
||||
{"type": "person", "field": "p1", "title": "协同人"},
|
||||
{
|
||||
"type": "person",
|
||||
"field": "p2",
|
||||
"title": "多人",
|
||||
"props": {"multiple": True},
|
||||
},
|
||||
]
|
||||
}
|
||||
data = {
|
||||
"p1": {"id": "u1", "name": "张三"},
|
||||
"p2": [
|
||||
{"id": "u1", "name": "张三"},
|
||||
{"id": "u2", "name": "李四"},
|
||||
],
|
||||
}
|
||||
fields = flatten_form_fields_for_summary(schema, data)
|
||||
by_label = {f["label"]: f["value"] for f in fields}
|
||||
self.assertEqual(by_label["协同人"], "张三")
|
||||
self.assertEqual(by_label["多人"], "张三、李四")
|
||||
|
||||
def test_related_approval_field_includes_related_ids(self):
|
||||
schema = {
|
||||
"rule": [
|
||||
|
||||
Reference in new issue
Block a user