Files
fanwei-e10-api-doc/references/workflow-field-discovery.md
T
2026-06-01 14:37:23 +08:00

76 lines
3.0 KiB
Markdown

# Workflow Field Discovery
Use this reference when the user asks for documentation for creating a specific E10 workflow instance.
## Preferred path
Prefer internal read-only APIs over UI clicking:
1. Call `getBaseInfoListTree` to locate the workflow and workflowId.
2. Call `getFormList` with the core workflow keyword to locate the formId.
3. Call `getForm` to read form metadata and detect detail tables.
4. Call `getFormFieldPage` to retrieve field definitions.
5. Use UI and DOM extraction only as a fallback.
See `internal-apis.md` for endpoints and response structure.
## Matching workflow names
Workflow titles may include category numbers, prefixes, or punctuation. Search using both:
- Exact user-provided name.
- Core keyword after removing numbering, punctuation, and common suffixes such as “流程”.
If multiple workflows match, show the candidates and ask the user to choose.
## Matching forms
`workflowId` and `formId` are different entities. Never substitute one for the other.
Form names may be shorter than workflow names. For example, a workflow title may include a prefix while the form name may not. Use `getFormList` with a core keyword, then confirm by comparing the form name to the target workflow.
## Main table and detail table handling
Use `getForm` to determine whether the form has detail tables.
- If no detail table exists, omit the detail-table section in the final documentation.
- If detail tables exist, retrieve each detail table's fields and document them in separate business sections.
- If a detail table exists but field extraction fails, mark the detail table fields as “需确认” rather than inventing field definitions.
## Field extraction quality
For each field, capture at least:
- Display name: `title`.
- Payload key: `dataKey`.
- Field type: `type`.
- Requiredness if available from OpenAPI docs, form rules, or explicit user-provided metadata.
- Business meaning if inferable from name and context.
Do not include internal values such as database table names, `columnName`, management UI group names, or internal API paths in final documentation.
## UI fallback
Use UI fallback only if internal read-only APIs fail.
General fallback path:
1. Navigate to `/info/engine_wf/pathdef/list/company`.
2. Locate the target workflow card.
3. Use coordinate click when JS `click()` fails.
4. Enter `表单管理` then `字段管理`.
5. Extract table rows or intercept XHR requests.
E10 workflow UI has multiple similarly named navigation items. Distinguish:
- `表单管理` top tab inside workflow detail page.
- `字段管理` sub-tab inside form management.
- `字段设置` is not `字段管理`.
- `主表` and `明细表` are table-level tabs after entering field management.
## Fallback XHR interception
If UI must be used to discover `formTableId`, inject an XHR hook before switching the main/detail table tab, then inspect captured request bodies for `getFormFieldPage`.
Use this only for internal extraction. Do not mention XHR interception in the final external documentation.