Background
The network product management system involves many query functions with similar features and UI.
We aim to modularize these functions to reduce development costs for both frontend and backend.
- Ant Design components: https://ant-design.antgroup.com/components/overview-cn
- Formily: https://formilyjs.org/zh-CN/guide/scenes/login-register
- Formily + Ant Design: https://antd.formilyjs.org/zh-CN/components/form-item
- JSON Schema Specification: https://json-schema.apifox.cn
Solution 1: Frontend Maintains Templates
Templates are maintained within the frontend codebase.
Each new feature still requires frontend–backend joint development before deployment.
Pros
- High flexibility
- Supports complex interactions and custom displays
Cons
- Each new feature requires both frontend and backend effort
- Estimated frontend workload: ~15min per configuration
Example — Custom Query

1 | // /components/config.tsx |
1 | // /components/Comp.tsx |
Solution 2: Backend Maintains Templates
Templates are stored and managed on the backend.
The frontend fetches the configuration and renders forms dynamically.
(Note: requires a new route since the rendering logic differs from the existing query tool.)
Pros
- Only one-time frontend development; future updates require no frontend effort
Cons
- Lower flexibility
- Estimated initial frontend workload: ~4 days

Template Definition
JSON Schema defines JSON data structures — types, formats, and constraints — similar to XML Schema for XML.
It can validate whether a JSON object matches the expected schema.
This approach uses JSON Schema to describe templates for better scalability and compatibility with open-source libraries like Formily.
TODO: Should query results also be configurable via template?
Example — Custom Query

1 | const list = [ |
Issues Encountered
Formily does not re-render fields with the same name when switching templates.
Reference: https://github.com/alibaba/formily/issues/399
Attempted solutions:
- Adding a
keytoFormProviderorSchemaField(ineffective) FormProviderkey caused internal state loss (validation failed to sync)
1 | <FormProvider form={form}> |
Final fix:
Prefix each field name with the template ID using lodash.mapKeys.
1 | // FIXME: Formily doesn't re-render identical field names across templates |