Intelligent form verification and data management method and device based on componentized architecture

By adopting a component-based architecture and dynamic loading mechanism, combined with unified validation rule management and data mapping, the problems of high complexity in form development and poor user experience have been solved, achieving efficient form development and accurate data management, and improving user satisfaction.

CN122633224APending Publication Date: 2026-08-25SHENZHEN THINKIVE INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610726931.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-25
Publication Date
2026-08-25

AI Technical Summary

Technical Problem

Existing technologies suffer from high complexity, low efficiency, and poor user experience in form development. They also suffer from problems such as redundant component development, low code reuse rate, scattered and difficult-to-manage validation rules, complex form data structures, and lack of state management.

Method used

We adopt a component-based intelligent form validation and data management method. We dynamically load form field components through a core form container component, combined with a unified validation rule management system and data mapping mechanism, to achieve component reuse and on-demand loading, and detect form data changes through a hash algorithm.

Benefits of technology

It significantly reduces the complexity of form development, improves development efficiency and user experience, reduces code duplication rate by 80%, reduces maintenance costs by 60%, achieves form validation accuracy of 99.9%, reduces user error rate by 50%, increases completion rate by 30%, and increases satisfaction rate by 40%.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122633224A_ABST
    Figure CN122633224A_ABST
Patent Text Reader

Abstract

This invention discloses an intelligent form validation and data management method and apparatus based on a component-based architecture. The method receives and parses form field configuration information, including field identifiers and component logical names, through a core form container component; dynamically searches for and loads the corresponding form field component from a preset component registry based on the component logical name for rendering; acquires input information and calls a unified validation rule management system to validate the input data; achieves bidirectional assignment and decoupling between internal data of the form field component and external business data according to preset configuration rules through a preset data mapping mechanism; monitors the status of the core form container component, generates data fingerprints for the form data based on a hash algorithm, and compares these fingerprints to determine whether the form data has changed. This method improves development efficiency, reduces maintenance costs, simplifies the form change detection process, improves the accuracy and stability of detection, and enhances the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of data processing technology and relates to a form validation and data management method and apparatus. Specifically, it relates to an intelligent form validation and data management method and apparatus based on a component-based architecture. Background Technology

[0002] A front-end form is a UI element in a webpage or application used to collect user input. In a webpage, it primarily handles data collection. It is widely used in various business scenarios such as user registration, information submission, data configuration, and backend management.

[0003] With the increasing complexity of business needs and the continuous improvement of user requirements for interactive experience, the traditional form development method has gradually exposed the following technical defects: (1) Repetitive development of form components and low code reuse rate. In different business modules, a large number of form items (such as text input boxes, drop-down selection boxes, date pickers, etc.) need to repeatedly write similar template code, styles and interactive logic. This not only leads to low development efficiency, but also makes the code library redundant and bloated, increasing the difficulty of subsequent maintenance. (2) Validation rules are scattered and difficult to manage in a unified manner. The traditional form validation logic is usually scattered in the code of each form item. When the rules change, the developers need to make modifications in multiple places, which is very easy to cause omissions and inconsistencies. (3) The form data structure is complex and the data acquisition and setting are cumbersome. In actual business, when the data structure of the front-end form is inconsistent with the data model of the back-end interface, the developers need to write a lot of data conversion code, which is cumbersome and prone to errors. (4) Lack of a unified form state management mechanism. A fully functional form needs to manage multiple states. These states are scattered in various components and page logic. The synchronization and listening logic when the state changes is complex and easily causes error problems due to inconsistent states. In addition, there are problems such as difficulty in detecting form changes and poor user experience.

[0004] In view of this, it is necessary to provide a form validation and data management method and apparatus that can solve the technical drawbacks of existing technologies. Summary of the Invention

[0005] Therefore, the technical problem to be solved by the present invention is that the form development in the prior art is highly complex, inefficient and has a poor user experience. Therefore, the present invention proposes an intelligent form validation and data management method and device based on a component-based architecture that can significantly reduce complexity, improve form development efficiency, reduce repetitive work, simplify the form change detection process and improve user experience.

[0006] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows: The first aspect of this invention provides an intelligent form validation and data management method based on a component-based architecture, the method comprising: The core form container component receives and parses the configuration information of the form fields. The configuration information includes at least a field identifier for uniquely identifying the field and a component logical name for specifying the component type. The core form container component searches for and dynamically loads the corresponding form field component from a preset component registry based on the component's logical name, so as to render the form field component. Listen for input events of the form fields, obtain input information, and call a unified validation rule management system to validate the input data; In response to a data acquisition request, a preset data mapping mechanism is used to perform bidirectional assignment and decoupling of the internal data and external business data of the form field component according to preset configuration rules; The system monitors the status of the core form container component and generates a data fingerprint for the form data based on a hash algorithm. By comparing the data fingerprint with the pre-stored baseline data fingerprint, it determines whether the form data has changed. Furthermore, the core form container component, based on the component's logical name, searches for and dynamically loads the corresponding form field component from a preset component registry to render the form field component, including: The component registry is invoked based on the form field configuration information. The field components are loaded on demand using the dynamic import() syntax of ES Module. The code of unrendered fields is loaded lazily as a separate code block to achieve dynamic component loading and lazy loading.

[0007] Furthermore, the unified validation rule management system is invoked to validate the input data. This unified validation rule management system supports parsing at least three types of validators: function format validators, object format validators, and array format validators; wherein, For the function format validator, simply call the function and pass in a parameter object containing the current field value for validation; For the object format validator, extract the configured regular expressions and / or built-in functions from the object for matching and validation; For array format validators, multiple validators contained in the array are chained together and executed in a predetermined order.

[0008] Furthermore, before calling the unified verification rule management system to verify the input data, a pre-filtering step is included: determining whether the current form field component is disabled or whether it is a non-required field with an empty value. If so, the execution of the specific validator for the value of the field component is skipped.

[0009] Furthermore, the preset mapping mechanism is set through the following steps: Each field component declares an attrMap object during configuration. The semantics of the attrMap object are the correspondence between one or more internal attribute keys of the form field component and one or more external business data attribute keys. When the form field component is a single-value component and the attrMap is not explicitly configured, the system automatically generates a default mapping relationship for it. The default mapping relationship maps the default internal attribute keys of the component to the field identifier of the component in the form configuration.

[0010] Furthermore, the step of generating a data fingerprint from the form data based on a hash algorithm, and determining whether the form data has changed by comparing the data fingerprint with a pre-stored baseline data fingerprint, includes: After form initialization or data display, extract the original form data, aggregate the current values ​​of the form field components, normalize the aggregated data, and use the MD5 hash algorithm to calculate and generate a baseline data fingerprint. When changes need to be detected, the current values ​​of all form field components are re-aggregated and the same normalization and hashing operations are performed to obtain the current data fingerprint; Compare the current data fingerprint with the baseline data fingerprint. If they are inconsistent, it is determined that the form data has been changed.

[0011] Furthermore, it also includes steps for cross-component collaboration: The event notification method provided by the core form container component enables state synchronization or data transfer between different form field components.

[0012] A second aspect of the present invention provides an intelligent form validation and data management device based on a component-based architecture, comprising: The configuration parsing module is used to receive and parse the configuration information of form fields through the core form container component. The configuration information includes at least a field identifier for uniquely identifying the field and a component logical name for specifying the component type. The dynamic rendering module is used to enable the core form container component to search for and dynamically load the corresponding form field component from the preset component registry according to the component logical name, so as to realize the rendering of the form field component. The validation module is used to listen for input events of the form fields, obtain input information, and call the unified validation rule management system to validate the input data. The data mapping module is used to respond to data acquisition requests by performing bidirectional assignment and decoupling of the internal data and external business data of the form field components according to a preset data mapping mechanism and preset configuration rules. The status monitoring and change detection module monitors the status of the core form container component and generates a data fingerprint for the form data based on a hash algorithm. By comparing the data fingerprint with the pre-stored baseline data fingerprint, it determines whether the form data has changed. A third aspect of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the intelligent form validation and data management method based on a component-based architecture as described in any of the preceding claims.

[0013] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it implements the steps of the intelligent form validation and data management method based on a component-based architecture as described in any of the preceding claims.

[0014] The technical solution of the present invention has the following advantages compared with the prior art: This invention provides an intelligent form validation and data management method based on a component-based architecture. The component-based architecture and dynamic loading mechanism enable the core form container component to dynamically render various types of form field components based on configuration information, achieving component reuse and on-demand loading. This solves the problems of repetitive component development and low code reusability in traditional development, reducing form development time by approximately 70%, code duplication rate by approximately 80%, and maintenance costs by approximately 60%. A unified validation rule management system supports validators in three formats: functions, objects, and arrays. Combined with pre-filtering logic, it achieves centralized management and flexible combination of validation rules, solving the problems of scattered and difficult-to-manage validation rules. Through a preset data mapping mechanism, using attrMap objects to establish mapping relationships between internal attributes of form field components and external business data attributes, it achieves decoupling of components and business logic, simplifies data acquisition and setting processes, and solves the problems of complex form data structures and cumbersome data operations. By generating and comparing data fingerprints based on hash algorithms, it achieves accurate detection of form data changes. Combined with an inter-component event notification mechanism, it forms a unified form state monitoring system, solving the problems of missing form state management mechanisms and difficulty in change detection. It significantly reduces the complexity of form development and improves development efficiency and user experience. Attached Figure Description

[0015] To make the content of this invention easier to understand, the invention will be further described in detail below with reference to specific embodiments and accompanying drawings, wherein... Figure 1 This is a flowchart of the intelligent form validation and data management method based on a component-based architecture provided in an embodiment of the present invention; Figure 2This is a schematic diagram of the program modules of the intelligent form validation and data management device based on a component-based architecture provided in an embodiment of the present invention. Detailed Implementation

[0016] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0017] The solution provided in this application is mainly applied to form processing scenarios in front-end web development, and is especially suitable for building enterprise-level application forms or personal account opening forms with complex interactions, multiple field types, data interaction with heterogeneous back-end interfaces, and the need to accurately detect changes in user operations.

[0018] Please see Figure 1 , Figure 1 This is a flowchart of the intelligent form validation and data management method based on a component-based architecture provided in the embodiments of this application, such as... Figure 1 As shown, the method includes: Step S101: The core form container component receives and parses the configuration information of the form fields. The configuration information includes at least a field identifier used to uniquely identify the field and a component logical name used to specify the component type.

[0019] Step S102: The core form container component searches for and dynamically loads the corresponding form field component from the preset component registry according to the component logical name, so as to realize the rendering of the form field component.

[0020] Step S103: Listen for input events of the form fields, obtain input information, and call the unified validation rule management system to validate the input data.

[0021] Step S104: In response to the data acquisition request, the internal data and external business data of the form field component are bidirectionally assigned and decoupled according to the preset data mapping mechanism and the preset configuration rules.

[0022] Step S105: Monitor the status of the core form container component and generate a data fingerprint for the form data based on a hash algorithm. By comparing the data fingerprint with the pre-stored baseline data fingerprint, determine whether the form data has changed. The intelligent form validation and data management method based on a component-based architecture provided in this application involves the following steps working together to form a complete form validation and management process. Through component-based architecture, dynamic loading, and conditional rendering, it enables flexible form construction and on-demand loading, significantly improving development efficiency and reducing maintenance difficulty. Form development time is reduced by 70%, code duplication rate by 80%, and maintenance costs by 60%. Centralized processing of various validation rules through a unified entry point ensures the standardization and maintainability of validation behavior. Form validation accuracy reaches 99.9%, system error rate is reduced by 80%, and data consistency is guaranteed. Furthermore, real-time validation status monitoring and cross-component event notification mechanisms provide immediate error feedback and field linkage, reducing form filling error rate and improving user satisfaction: form filling error rate is reduced by 50%, form completion rate is increased by 30%, and user satisfaction is increased by 40%.

[0023] In this embodiment, the core form container component (OrgForm) is the root component that receives and manages a set of form field configurations and is responsible for dynamically scheduling, rendering, and monitoring these field components. Form field components are UI components that implement specific input, selection, and upload operations, such as text input boxes, dropdown selection boxes, and file upload components. The component registry (OrgFormComponentMap) is a predefined set of mapping relationships that establishes the correspondence between component logical names and loading functions used to asynchronously load the corresponding form field components. The component registry consists of two parts: an enumeration constant table (OrgFormComponent) and a mapping table (OrgFormComponentMap). The enumeration constant table is used to register the logical name of each form field component, such as: textField (text input), typeSelect (dropdown selection), dateSelect (date selection), uploadFile (file upload), certNumber (identity number), taxResidencySelect (tax residency status), CpiProfessionalTeam (CPI professional investment team), bankCard (bank account), etc. The mapping table is used to establish the correspondence between "logical name → component loading function". The component loading function uses the dynamic `import()` syntax of ES Modules, initiating a network request to load the corresponding code only when the field is actually rendered, thus achieving on-demand lazy loading. In this embodiment, the component-based architecture is built using the Vue.js framework, implementing dynamic component loading based on a component registry. Input events refer to events triggered by form field components that represent changes in their internal data state, such as input, selection, and upload completion.

[0024] Taking a specific application scenario as an example, on the enterprise account opening information entry page, developers first prepare a configuration array containing fields such as the full name of the organization, document number, and document validity period. The core form container component receives and parses this configuration. Subsequently, based on the component logical names such as "TextField" and "CertNumber" in the configuration, it dynamically loads the corresponding text input and document number components from the component registry and renders them. When the user enters information on the interface, the system listens for input events and triggers the validation of the corresponding fields, such as validating the format of the document number. When the user clicks submit, the system responds to a data retrieval request and, through the attrMap configuration, automatically maps the cerType and cerCode attribute values ​​inside the component to the orgCertType and orgCertCode fields in the external business data. Before submission or when leaving the page, the system calculates the data fingerprint of the current form data and compares it with the baseline data fingerprint saved when the page loads or after the last display to determine whether the user has modified the form content, thereby deciding whether to prompt the user to save or prevent them from leaving.

[0025] In this embodiment, step S102 specifically includes: The component registry is invoked based on the form field configuration information. The field components are loaded on demand using the dynamic import() syntax of ES Module. The code of unrendered fields is loaded lazily as a separate code block to achieve dynamic component loading and lazy loading.

[0026] Specifically, the core container component (OrgForm) injects the entire mapping table into its `components` option using the object spread operator: `components: { ...OrgFormComponentMap}`, completing the batch registration of asynchronous components. The component registry maintains the mapping from component logic names to asynchronous loading functions. When the core form container component parses the configuration, for each field that needs to be rendered, it looks up the corresponding loading function in the registry based on its component logic name. The loading function is a function that returns an `import()` Promise, for example, `() => import('. / components / OrgTextField.vue')`. The runtime system of modern front-end frameworks such as Vue.js executes this function, thereby triggering the network loading of independent code chunks (chunks) split by build tools such as Webpack or Vite. In this way, for a complex form containing dozens of field types, the initial JavaScript load only contains the code for the core container and the fields required by the current view; the code for other field components is only loaded when the user needs it (e.g., through conditional rendering or step-by-step form switching). This approach effectively reduces the initial application package size, speeds up first-screen loading, and enables dynamic expansion and on-demand loading of form field types, significantly improving the efficiency and maintainability of large form applications. In this embodiment, the component registry is composed as described above. During initialization, the core form container uses the object spread operator `components:{ …OrgFormComponentMap}` to batch register the entire mapping table as its asynchronous components, thereby enabling their use in templates. <component :is="”field.component”">At that time, the corresponding component can be dynamically instantiated based on the value of field.component.

[0027] Further, in step S103, a unified validation rule management system is invoked to validate the input data. This unified validation rule management system supports parsing at least three types of validators: function format validators, object format validators, and array format validators. For function format validators, the function is directly called and a parameter object containing the current field value is passed in for validation. For object format validators, the configured regular expressions and / or built-in functions in the object are extracted for matching and validation. For array format validators, multiple validators contained in the array are chained together and validated in a predetermined order.

[0028] A unified validation rule management system provides a consistent execution entry point for each format. All field components inherit from the OrgComponentBase base class (via mixins or extends), and uniformly implement standard interfaces such as getValues, setValues, validateField, onNotify, and setDiffStyle, ensuring that all components expose completely consistent method signatures. Whether it's a general component or a business component, they are differentiated only through field configuration items (key, name, required, attrMap, properties, delegate, validateRule, etc.), making their processing logic in OrgForm completely consistent. The mapping table uses a single, flat key space, with common components and business components sharing the same lookup entry point. OrgForm can uniformly schedule components without distinguishing between them. When external components are injected, OrgForm can also receive customComponents passed in by the business side via provide through Vue's inject mechanism. These customComponents are then merged into $options.components in the created hook, allowing external business components to participate in the unified rendering, validation, and data retrieval process without modifying the framework code, thus providing excellent scalability.

[0029] When a field needs validation, the system retrieves the `validateRule` object configured for that field and iterates through its properties. For each validator corresponding to a property, its format type is first determined. If the validator is a function, it is called directly, passing in a parameter object containing the current field value, field name, and configuration object. After execution, the function returns an object containing the validation status and message. If the validator is an object, its `reg` property is checked; if `reg` is a regular expression, the `test` method is executed on the current value; if `reg` is a function, the function is called and its return value is processed. If the validator is an array, each sub-validator in the array (which can also be a function or an object) is iterated sequentially, using a "short-circuit" mechanism: if a sub-validator fails, the execution of subsequent sub-validators is immediately stopped, and the failure result is returned. This approach provides high flexibility and expressiveness for form validation. Developers can freely choose the simplest or most expressive format to write rules based on the complexity of the validation logic, while a unified execution entry point ensures consistency in validation behavior, facilitating centralized management and maintenance. As a specific implementation, for function-based format validators, their parameter object must at least contain `value` (the current field value), `msg` (the configured default error message), `field` (the complete field configuration object), and `ref` (a reference to the current component instance). For object-based format validators, if their `reg` property is a function, the function's return value can be a boolean value or an object formatted as `{ state: boolean, msg: string}`, and the system will normalize the return value. For array-based format validators, their chained execution feature allows for easy implementation of multi-layered compound validation logic such as "first non-empty, then format, then length".

[0030] Furthermore, before calling the unified validation rule management system to validate the input data, a pre-filtering step is included: determining whether the current form field component is disabled, or whether it is a non-required field with an empty value. If so, the execution of the specific validator for that field component's value is skipped. That is, before executing the specific validator logic, the unified validation rule management system performs a series of precondition checks. First, it checks the disabled state of the current form field component. If it is true, it indicates that the field is not interactive, and its value does not need to participate in business validation, so it is skipped directly. Second, it checks the required flag and current value of the field. If the field is non-required (e.g., required is not equal to a specific flag such as "1") and the current value is empty (e.g., empty string, null, undefined), it is considered not to need validation and is also skipped. Only when the field is not disabled and (is a required field or, although not required, has a value) will the subsequent specific validator logic be executed. This approach effectively avoids unnecessary validation calculations on invalid or unvalidated data, reduces meaningless error messages (e.g., a non-required empty field triggering a "format error"), and improves the performance of the validation system and the user experience. As a specific implementation, pre-filtering logic can be integrated into the base class method of the form field component. During validation, this method receives an `options` parameter, which may include an `isAction` flag to distinguish between real-time validation triggered by user interaction and validation triggered by active submission. For required but empty fields, in non-active submission scenarios, the validation status may be marked without immediately displaying error messages, thus optimizing the user experience.

[0031] In this embodiment, the preset mapping mechanism in step S104 is set through the following steps: each field component declares an attrMap (data mapping) object when it is configured. The semantics of the attrMap object is the correspondence between one or more internal attribute keys of the form field component and one or more external business data attribute keys. When the form field component is a single-value component and the attrMap is not explicitly configured, the system automatically generates a default mapping relationship for it. The default mapping relationship maps the default internal attribute keys of the component to the field identifier of the component in the form configuration.

[0032] Specifically, the core of the data mapping mechanism lies in the declaration and application of attrMap objects. In form field configuration, the mapping explicitly specifies the correspondence between internal attributes (such as value, startDate) and external business attributes (such as userName, contractStart). For simple single-value input components (such as text input boxes), if no attrMap is configured, the system will generate a default mapping of {value: field.key}, mapping the component's internal value attribute to an external attribute named after the field identifier key. This simplifies the configuration for the most common scenarios. When retrieving (writing) data, the system iterates through the attrMap, reads the component's internal attribute values, and writes them to the result object with their corresponding external attribute keys. When setting (echoing) data, the process is reversed; the system writes the values ​​back to the component's internal attributes based on the reverse mapping between the external business data object and the attrMap. This approach completely decouples the component's internal data structure from the external business interface contract, allowing the same set of form UI components to adapt to various backend data models through different attrMap configurations, greatly improving component reusability and business adaptation flexibility. As a specific implementation method, for scenarios that require aggregating multiple internal attributes into a single nested outer object, an additional `attrKey` can be configured on top of `attrMap`. When writing data, the system first wraps the key-value pairs mapped by `attrMap` into an object with `attrKey` as the key. When displaying data, the system first retrieves the nested object corresponding to `attrKey` from the external data, and then performs a reverse assignment based on `attrMap`. Furthermore, when displaying data, the system checks if a computed property with the same name as the internal attribute key exists on the component instance. If it does, it skips directly assigning the property to avoid breaking the reactive derivation logic of computed properties in frameworks like Vue.js.

[0033] Specifically, in this embodiment, step S105, which generates a data fingerprint of the form data based on a hash algorithm and determines whether the form data has changed by comparing the data fingerprint with a pre-stored baseline data fingerprint, includes: after form initialization or data display, extracting the original form data, aggregating the current values ​​of the form field components, normalizing the aggregated data, and using the MD5 hash algorithm to calculate and generate a baseline data fingerprint; when it is necessary to detect changes, re-aggregating the current values ​​of all form field components and performing the same normalization and hash operation to obtain the current data fingerprint; comparing the current data fingerprint with the baseline data fingerprint, and if the two are inconsistent, it is determined that the form data has changed.

[0034] Change detection relies on the generation and comparison of data fingerprints. The generation of the form data fingerprint (hashKey) is accomplished by the `OrgForm.getFormHashKey()` method. When establishing a baseline, the system iterates through all rendered form field components, calling their data retrieval methods (such as `getValues` or the dedicated `getDiffParam` method) to collect the current values. Next, the collected data is normalized; for example, null, undefined, and empty arrays are uniformly converted to empty strings, and the values ​​of fields in a hidden state and not subject to mandatory submission are cleared. Then, the normalized data object is serialized into a deterministic string using `JSON.stringify`, and finally, the string is hashed using the MD5 algorithm to generate a fixed-length baseline data fingerprint, which is then stored. At any subsequent point where change detection is needed, the system repeats the above aggregation, normalization, serialization, and hashing process to generate the current data fingerprint and performs a simple string equality comparison with the stored baseline data fingerprint. This approach enables fast, accurate, and low-overhead detection of changes in the overall data state of the form. Due to the avalanche effect of MD5 hashing, even a small change in any field value will result in a completely different final fingerprint, ensuring the accuracy of detection. Furthermore, the fixed length of the fingerprint and the efficiency of the comparison allow this method to be called frequently without performance concerns. As a specific implementation, normalization also includes stabilization operations when merging multi-field return values. For example, using the lodash.mergeWith library in conjunction with the custom merge function arrayMergeCustomizer, which specifies a concat strategy rather than overwriting when merging array properties, null values ​​(such as undefined, null, and empty strings) are replaced by non-null values ​​during the merging process. This ensures that regardless of the field traversal order, the final merged object has a consistent structure, making the serialized string stable and preventing meaningless fingerprint changes due to the merging order.

[0035] For normalization processing during data fingerprint generation, in addition to handling null values ​​and hidden fields, dedicated methods of component instances (such as getDiffParam) can be called to obtain simplified data for difference comparison. This method can be overridden by the component to exclude internal temporary states or attributes that do not participate in business changes, thereby generating more stable data fingerprints with more business meaning. In change detection, in addition to overall fingerprint comparison, the setFormDiffStyle method can be called to reverse-parse the original data based on attrMap, compare the current value with the original value of each attribute at the component level, and highlight the changed fields on the UI.

[0036] The intelligent form validation and data management method based on component-based architecture provided in this embodiment also includes a cross-component collaboration step: using the event notification method provided by the core form container component to achieve state synchronization or data transfer between different form field components.

[0037] Specifically, the core form container component provides a centralized event notification method (e.g., `postNotify`). When a form field component needs to communicate with other components (e.g., after successfully uploading a business license, the OCR recognition result is populated back into the organization name field), this method can be called to publish an event. Upon receiving the event, the core form container component iterates through all currently registered form field component instances and broadcasts the event by calling a predefined notification handling hook (e.g., `onNotify`) on each instance. Each component listens for events of interest in its own notification handling hook and executes corresponding state update or data loading logic. This approach enables forms to support complex business logic, improving form interactivity and business adaptability. To handle component initialization timing issues, if the target component is not yet mounted (i.e., its instance is not yet ready) when an event is published, the core form container component can temporarily store the event in a failure map (e.g., `postNotifyFailMap`). Once the target component is mounted, the temporarily stored event is retrieved from the map and re-posted, thus ensuring reliable cross-component communication.

[0038] The intelligent form validation and data management method based on a component-based architecture provided in this embodiment also supports multi-language switching, which is achieved in the following way: The framework organizes language files according to "modular internationalization resources," providing three language packs under the `components / form / ` directory: `components / i18n / `, `models / i18n / `, and `utils / i18n / `. These correspond to component documentation, field configuration documentation, and utility method documentation, respectively. Each language pack provides versions in three languages: `zh_CN.js` (Simplified Chinese), `zh_TC.js` (Traditional Chinese), and `en_US.js` (English). The field component base class calls `$t()` in `initProps` to perform runtime replacement on `field.name`. For example, it automatically replaces the placeholder "(English)" with `$t('orgMall.common.inputTip')`, enabling multilingual switching of field names. Field configurations allow direct use of `$t` expressions or language keys, which are evaluated by the business model classes (`BaseInfoField`, `TaxRelatedField`, `PersonField`, etc.) during instantiation using the current `i18n` instance, allowing the same field definition to be reused in a multilingual environment. When switching languages, Vue I18n triggers a reactive update, and field names, placeholders, error messages, unit text, etc. are refreshed synchronously without needing to rebuild the form instance, further improving processing efficiency.

[0039] This embodiment further provides an intelligent form validation and data management device based on a component-based architecture. Figure 2 This is a schematic diagram of the program modules of the intelligent form verification and data management device based on a component-based architecture in this application embodiment. In this embodiment, the intelligent form verification and data management device 200 based on a component-based architecture includes: The configuration parsing module 201 is used to receive and parse the configuration information of form fields through the core form container component. The configuration information includes at least a field identifier used to uniquely identify the field and a component logical name used to specify the component type.

[0040] The dynamic rendering module 202 is used to enable the core form container component to search for and dynamically load the corresponding form field component from the preset component registry according to the component logical name, so as to realize the rendering of the form field component.

[0041] The validation module 203 is used to listen for input events of form fields, obtain input information, and call a unified validation rule management system to validate the input data.

[0042] The data mapping module 204 is used to respond to data acquisition requests and, through a preset data mapping mechanism, perform bidirectional assignment and decoupling of internal data and external business data of form field components according to preset configuration rules.

[0043] The status monitoring and change detection module 205 monitors the status of the core form container component and generates a data fingerprint for the form data based on a hash algorithm. By comparing the data fingerprint with the pre-stored baseline data fingerprint, it determines whether the form data has changed.

[0044] Through the aforementioned modules, this device implements all the functions of an intelligent form validation and data management method based on a component-based architecture, achieving the technical effects of reducing development complexity, improving efficiency, and increasing user satisfaction.

[0045] This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps of the component-based intelligent form validation and data management method described in the above embodiments. This electronic device, by executing the stored program instructions, can deploy and run the aforementioned intelligent form system.

[0046] Furthermore, embodiments of this application also provide a computer-readable storage medium storing a computer program thereon. When executed by a processor, this computer program implements the steps of the intelligent form validation and data management method based on a component-based architecture as described in the above embodiments. The storage medium includes: a USB flash drive, a portable hard drive, and a read-only memory (ROM). Various media capable of storing program code, such as only memory, random access memory (RAM), magnetic disks, or optical disks, are used. Once the program instructions on these media are loaded and executed, the computer device can possess the aforementioned intelligent form processing capabilities.

[0047] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.< / component>

Claims

1. A method for intelligent form validation and data management based on a component-based architecture, characterized in that, The method includes: The core form container component receives and parses the configuration information of the form fields. The configuration information includes at least a field identifier for uniquely identifying the field and a component logical name for specifying the component type. The core form container component searches for and dynamically loads the corresponding form field component from a preset component registry based on the component's logical name, thereby rendering the form field component. Listen for input events of the form field components, obtain input information, and call a unified validation rule management system to validate the input data; In response to a data acquisition request, a preset data mapping mechanism is used to perform bidirectional assignment and decoupling of the internal data and external business data of the form field component according to preset configuration rules; The system monitors the status of the core form container component and generates a data fingerprint for the form data based on a hash algorithm. By comparing the data fingerprint with the pre-stored baseline data fingerprint, it determines whether the form data has changed.

2. The intelligent form validation and data management method based on a component-based architecture according to claim 1, characterized in that, The core form container component, based on the component's logical name, searches for and dynamically loads the corresponding form field component from a preset component registry to render the form field component, including: The component registry is invoked based on the form field configuration information. The field components are loaded on demand using the dynamic import() syntax of ES Module. The code of unrendered fields is loaded lazily as a separate code block to achieve dynamic component loading and lazy loading.

3. The intelligent form validation and data management method based on a component-based architecture according to claim 2, characterized in that, The input data is validated by calling a unified validation rule management system. This system supports parsing at least three validators: function format validators, object format validators, and array format validators. For the function format validator, simply call the function and pass in a parameter object containing the current field value for validation; For the object format validator, extract the configured regular expressions and / or built-in functions from the object for matching and validation; For array format validators, multiple validators contained in the array are chained together and executed in a predetermined order.

4. The intelligent form validation and data management method based on a component-based architecture according to claim 3, characterized in that, Before calling the unified verification rule management system to verify the input data, a pre-filtering step is also included: determining whether the current form field component is disabled or whether it is a non-required field with an empty value. If so, the execution of the specific validator for the value of the field component is skipped.

5. The intelligent form validation and data management method based on a component-based architecture according to any one of claims 1-4, characterized in that, The preset mapping mechanism is set through the following steps: Each field component declares an attrMap object during configuration. The semantics of the attrMap object are the correspondence between one or more internal attribute keys of the form field component and one or more external business data attribute keys. When the form field component is a single-value component and the attrMap is not explicitly configured, the system automatically generates a default mapping relationship for it. The default mapping relationship maps the default internal attribute keys of the component to the field identifier of the component in the form configuration.

6. The intelligent form validation and data management method based on a component-based architecture according to claim 5, characterized in that, The process of generating a data fingerprint from the form data based on a hash algorithm, and determining whether the form data has changed by comparing the data fingerprint with a pre-stored baseline data fingerprint, includes: After form initialization or data display, extract the original form data, aggregate the current values ​​of the form field components, normalize the aggregated data, and use the MD5 hash algorithm to calculate and generate a baseline data fingerprint. When changes need to be detected, the current values ​​of all form field components are re-aggregated and the same normalization and hashing operations are performed to obtain the current data fingerprint; Compare the current data fingerprint with the baseline data fingerprint. If they are inconsistent, it is determined that the form data has been changed.

7. The intelligent form validation and data management method based on a component-based architecture according to claim 6, characterized in that, It also includes steps for cross-component collaboration: The event notification method provided by the core form container component enables state synchronization or data transfer between different form field components.

8. A smart form validation and data management device based on a component-based architecture, characterized in that, include: The configuration parsing module is used to receive and parse the configuration information of form fields through the core form container component. The configuration information includes at least a field identifier for uniquely identifying the field and a component logical name for specifying the component type. The dynamic rendering module is used to enable the core form container component to search for and dynamically load the corresponding form field component from the preset component registry according to the component logical name, so as to realize the rendering of the form field component. The validation module is used to listen for input events of the form fields, obtain input information, and call the unified validation rule management system to validate the input data. The data mapping module is used to respond to data acquisition requests by performing bidirectional assignment and decoupling of the internal data and external business data of the form field components according to a preset data mapping mechanism and preset configuration rules. The status monitoring and change detection module monitors the status of the core form container component and generates a data fingerprint for the form data based on a hash algorithm. By comparing the data fingerprint with the pre-stored baseline data fingerprint, it determines whether the form data has changed.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the intelligent form validation and data management method based on a component-based architecture as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the intelligent form validation and data management method based on a component-based architecture as described in any one of claims 1 to 7.