Form automatic generation method and device, computer equipment and storage medium
Through the form automatic generation plug-in integrating the information interaction library and form template engine, user-defined configuration and automatic matching are achieved, solving the problem of insufficient flexibility and maintainability of form generation solutions in the existing technology, and improving development efficiency and system scalability.
Patent Information
- Application Number
- CN202510505457.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2025-08-08
AI Technical Summary
The existing form generation solutions have limitations in flexibility, maintainability and versatility. Traditional manual development methods are time-consuming and difficult to maintain. The low-code platform customization capabilities are limited, while library learning costs based on specific frameworks are high and cross-frame compatibility is poor.
The form automatic generation plug-in is used to integrate the information interaction library and form template engine, obtain custom configuration information through user interaction, automatically match configuration files and form templates, generate form pages, support flexible responses in different business scenarios, and is suitable for a variety of front-end frameworks.
Improves the flexibility and maintainability of form generation, simplifies the development process, reduces manual coding workload, enhances the scalability of the system, and avoids compatibility issues during project migration.
Smart Images

Figure CN120447895A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer R&D management technology, and specifically relates to a form automatic generation method, device, computer equipment and storage medium. Background Art
[0002] In the field of front-end development, automated form generation has always been a key area for improving development efficiency. For example, the development of a financial leasing business system involves a large number of complex business forms, such as lease applications, contract approvals, and expense settlements. These forms often require complex field validation logic, dynamic display rules, and custom styling requirements. Traditional manual development methods are not only time-consuming and labor-intensive, but also difficult to maintain and expand. Therefore, the current use of automated form generation methods not only improves development efficiency, but also ensures form consistency and maintainability, reducing development costs associated with business adjustments.
[0003] Currently, there are two main types of automated form generation solutions on the market: low-code / no-code platforms and form generation libraries based on specific frameworks.
[0004] On the one hand, low-code / no-code platforms offer form generation capabilities through visual interfaces, allowing users to quickly build forms by making simple modifications based on predefined templates. However, these platforms offer limited customization capabilities and often struggle to meet complex business requirements, such as advanced validation logic or specific style adjustments. Furthermore, the code generated by low-code platforms is bloated and lacks maintainability, making subsequent optimization and expansion difficult.
[0005] On the other hand, form generation libraries based on specific frameworks (such as Vue.js or React.js) adopt a component-based approach, offering flexibility and allowing developers to build and customize forms based on their needs. However, these libraries often rely on a specific front-end technology stack, requiring developers to have in-depth knowledge of the corresponding framework to use them effectively, resulting in a high learning curve. Furthermore, because these libraries are designed for specific frameworks, cross-framework compatibility is poor. If a project needs to be migrated to another technology stack, the original form functionality may not be reusable and will need to be redeveloped. Summary of the Invention
[0006] The embodiments of the present application provide an automatic form generation solution based on the limitations of existing form generation solutions in terms of flexibility, maintainability and versatility, so as to improve development efficiency and enhance the scalability of the system.
[0007] In order to solve the above technical problems, the present application provides a method for automatically generating a form, which adopts the following technical solutions:
[0008] A method for automatically generating a form, comprising:
[0009] Receive form generation instructions and call the preset form automatic generation plug-in to load the information interaction library and form template engine;
[0010] Initiate an interaction request to the user through the information interaction library and ask the user whether to customize the form fields;
[0011] When the user needs to customize the form fields, obtain the customized configuration information uploaded by the user;
[0012] Search for the target custom configuration file that matches the custom configuration information from the preset custom folder;
[0013] Search the form template engine for the target form template that matches the custom configuration information;
[0014] Generate form pages through the form automatic generation plug-in based on the target custom configuration file and target form template.
[0015] In order to solve the above technical problems, the embodiment of the present application further provides a form automatic generation device, which adopts the following technical solution:
[0016] A form automatic generation device, comprising:
[0017] The information loading module is used to receive the form generation instruction and call the preset form automatic generation plug-in to load the information interaction library and form template engine;
[0018] The interaction request module is used to initiate an interaction request to the user through the information interaction library and ask the user whether to customize the form fields;
[0019] The configuration information module is used to obtain the custom configuration information uploaded by the user when the user needs to customize the form fields;
[0020] A first matching module is used to search a preset custom configuration file for a target custom configuration file that matches the custom configuration information;
[0021] A second matching module is used to search the form template engine for a target form template that matches the custom configuration information;
[0022] The form generation module is used to generate form pages through the form automatic generation plug-in based on the target custom configuration file and target form template.
[0023] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:
[0024] A computer device includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of any one of the above-mentioned methods for automatically generating a form when executing the computer-readable instructions.
[0025] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:
[0026] A computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of any one of the above-mentioned methods for automatically generating a form.
[0027] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0028] The present application discloses a method, device, computer equipment and storage medium for automatic form generation, which belongs to the field of computer R&D management technology and is applied to the form page generation of financial leasing business systems. The present application integrates an information interaction library and a form template engine through a form automatic generation plug-in, so that the system can interact with users and support users to personalize form fields. When users need to customize forms, the system can automatically retrieve matching configuration files and form templates to achieve dynamic form generation based on user needs. This method not only improves the adaptability of the form, enabling it to flexibly respond to different business scenarios, but also simplifies the form development process and greatly reduces the workload of manual code writing. In addition, the present application constructs forms based on custom configuration files and template libraries. Developers can adjust the form content by maintaining and extending the configuration files without modifying the core code, thereby improving the maintainability of the system. At the same time, the method is applicable to different front-end frameworks or technology stacks, enhancing the versatility of the form generation solution, avoiding the compatibility issues of traditional form libraries based on specific frameworks during project migration, thereby improving development efficiency and enhancing the scalability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the solutions in this application, a brief introduction will be given below to the drawings required for use in the description of the embodiments of this application. Obviously, the drawings described below are some embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0030] Figure 1 shows an exemplary system architecture diagram in which the present application can be applied;
[0031] Figure 2 A flowchart showing an embodiment of a method for automatically generating a form according to the present application is shown;
[0032] Figure 3 A schematic structural diagram of an embodiment of a form automatic generation device according to the present application is shown;
[0033] Figure 4 A schematic structural diagram of an embodiment of a computer device according to the present application is shown. DETAILED DESCRIPTION
[0034] Unless otherwise defined, all technical and scientific terms used herein have the same meanings as commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of the application are for the purpose of describing specific embodiments only and are not intended to limit this application. The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of this application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0035] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0036] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0037] like Figure 1 As shown, system architecture 100 may include a terminal device 101, a network 102, and a server 103. Terminal device 101 may be a laptop computer 1011, a tablet computer 1012, or a mobile phone 1013. Network 102 is a medium for providing a communication link between terminal device 101 and server 103. Network 102 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0038] The user can use the terminal device 101 to interact with the server 103 via the network 102 to receive or send messages, etc. Various communication client applications can be installed on the terminal device 101, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0039] The terminal device 101 can be various electronic devices with a display screen and supporting web browsing. In addition to the laptop computer 1011, tablet computer 1012 or mobile phone 1013, the terminal device 101 can also be an e-book reader, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV) player, a laptop computer and a desktop computer, etc.
[0040] The server 103 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal device 101 .
[0041] It should be noted that the automatic form generation method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the automatic form generation device is generally set in the server / terminal device.
[0042] It should be understood that Figure 1 The numbers of terminal devices, networks and servers in the embodiment are merely illustrative. The above system may have any number of terminal devices, networks and servers according to implementation requirements.
[0043] Continue to refer Figure 2 , shows a flow chart of an embodiment of a method for automatically generating a form according to the present application. The method for automatically generating a form includes the following steps:
[0044] S201, receiving a form generation instruction, calling a preset form automatic generation plug-in to load an information interaction library and a form template engine;
[0045] Specifically, when the form auto-generation plug-in is activated, the system first loads the necessary JavaScript modules to ensure proper functioning. The information interaction library is the inquirer dependency library, and the form template engine is the ejs template engine. The inquirer dependency library is used for user interaction, while the ejs template engine is used to generate the final HTML form page. During this phase, the plug-in initializes the basic operating environment, such as checking the existence of the config and output directories and automatically creating them if they do not exist. Furthermore, the plug-in loads a default list of form templates to provide options for subsequent user interaction.
[0046] S202, initiating an interaction request to the user through the information interaction library, and asking the user whether to customize the form fields;
[0047] Specifically, the plug-in uses the inquirer dependency library to initiate an interactive request to the user in the command line interface (CLI). First, the system will ask the user whether to create a new form template or modify an existing template. If the user chooses to create a new template, the plug-in will guide them to the config directory (custom folder) and prompt them to create a new configuration file; if the user chooses to use an existing template, the inquirer will list all available template files in the config directory for the user to choose. After the user selects a template, the system further asks the user whether they need to customize the form fields. This interactive process ensures that users can flexibly select the appropriate form template according to their needs and decide whether to perform personalized configuration to improve the adaptability and flexibility of the form.
[0048] S203, when the user needs to customize the form fields, obtain the customized configuration information uploaded by the user;
[0049] Specifically, if the user chooses to customize the form fields, the plug-in will guide the user to the config directory to open or create the corresponding configuration file. In the configuration file, the user can define the various fields of the form in the prescribed format, such as field name, type (text box, drop-down box, radio button, etc.), whether it is required, default value, etc. Users can edit these configuration files manually, or they can enter the field information through the CLI prompt, and the plug-in will automatically write it to the configuration file. For example, a user can define a contact form that includes name (text box), phone (text box in the format of a phone number), and message (text area), and specify that name and phone are required fields. After obtaining the custom configuration information uploaded by the user, the plug-in will perform format verification to ensure the integrity and correctness of the field definition, and then store it in the config directory for use in subsequent form generation processes.
[0050] S204, searching for a target custom configuration file that matches the custom configuration information from a preset custom folder;
[0051] Specifically, the custom folder is the config directory, and the plug-in will search for a target configuration file in the config directory that matches the custom configuration provided by the user. The matching rules can be based on the file name, file path, or specific key fields provided by the user during the interaction phase. For example, if the user wants to use a specific template configuration, the plug-in will check whether the configuration file exists in the config directory and read the field definition content. In addition, the plug-in also supports a default configuration file mechanism, that is, if the user does not specify a specific configuration file, the system will automatically select the most matching default configuration file to load. To enhance scalability, the plug-in also allows users to store multiple configuration files in the config directory to adapt to the needs of different scenarios. For example, a user_registration.json file may be dedicated to the user registration form, while feedback_form.json is suitable for the user feedback form. Through this mechanism, the plug-in ensures that users can flexibly use different configuration files for form generation, thereby improving the applicability and reusability of the system.
[0052] S205, searching for a target form template that matches the custom configuration information from the form template engine;
[0053] Specifically, the plug-in will call the ejs template engine and search for a form template that matches the profile selected by the user in the template directory (usually located in the templates folder). ejs allows JavaScript code to be embedded in HTML files, so the plug-in can dynamically generate HTML code based on the user's configuration by parsing the template file. During the search process, the system will match the name, identifier, or metadata of the template file to ensure that the correct template is selected. For example, if the user selects the user_registration.json configuration file in the config directory, the plug-in may search for user_registration.ejs as a matching template file in the templates directory. If no exact matching template is found, the system may provide a common default template and prompt the user to modify it. In addition, the plug-in supports extended template functionality, allowing developers to pre-define multiple templates and select the most suitable template based on different configuration files to ensure that the style and structure of the form page meet business needs.
[0054] S206, generating a form page through a form automatic generation plug-in based on the target custom configuration file and the target form template.
[0055] Specifically, the plug-in combines the target custom configuration file in the config directory with the form template in the templates directory, and generates the final HTML form page through the EJS template engine. First, the plug-in parses the field definitions in the configuration file and passes the data of these fields to the EJS template. In the EJS template, developers can use the <%=%> syntax to insert variables, such as generating an input text box. The system will traverse all fields and dynamically fill in the HTML code in the template file. For example, if a "name" field is defined in the configuration file, the plug-in may generate the following code:
[0056] <label for="name"> Name:< / label>
[0057] <input type="text"id="name"name="name"required>
[0058] The generated form page is saved in the output directory for developers to use directly or modify. Furthermore, the plugin supports automatic integration of the generated form page into front-end projects, such as embedding it into the user management module of a backend management system. Throughout this process, EJS provides a high degree of flexibility, allowing developers to customize the form structure and style according to business needs, making the automatic form generation solution both efficient and scalable.
[0059] For example, in financial leasing systems, forms are the core interaction medium, involved in multiple key processes such as lease applications, contract approvals, and fee settlements. Traditional form development methods typically require developers to manually write HTML, CSS, and JavaScript, which is time-consuming and difficult to maintain. The automatic form generation method provided in this application can significantly improve development efficiency while enhancing the system's flexibility and scalability.
[0060] When a developer in a financial leasing business system needs to create a new lease application form, they first activate the automatic form generation plug-in. The plug-in automatically loads the inquirer for user interaction and initializes EJS as the form template engine. Next, the plug-in uses the inquirer to initiate an interaction request to the developer via the command-line interface, asking whether they want to create a new form template or modify an existing one. For example, the developer can choose to create a new "lease application form" template or modify the existing "contract approval form" template.
[0061] If the developer decides to customize the form fields, the plugin will direct them to the config directory and create or modify the corresponding configuration file. In this configuration file, the developer can define the form fields, such as "Tenant Name" (text box), "Lease Amount" (numeric input box), "Lease Term" (drop-down selection box), etc., and specify which fields are required. For example, the lease amount must be a positive integer, and the lease term can be 12 months, 24 months, or 36 months. The plugin will verify the correctness of these configurations and store them for subsequent use.
[0062] During form generation, the plugin searches for a matching custom configuration file in the config directory and then finds a form template that matches that configuration file in the templates directory. For example, if the user selects the "Lease Application Form" configuration file, the plugin automatically retrieves the lease_application.ejs template file in the templates directory, which likely contains form layout and styles specific to the lease business.
[0063] Finally, the plugin uses the EJS template engine to map the fields in the configuration file to the form template and dynamically generate a complete HTML page. For example, for the "Tenant Name" field, EJS may generate the following HTML code:
[0064] <label for="lessee_name"> Lessee Name:< / label>
[0065] <input type="text"id="lessee_name"name="lessee_name"required>
[0066] The generated complete form page is exported to the output directory for front-end developers to directly integrate into the management backend of the financial leasing business system. For example, this form can be embedded in the lease application module, allowing users to fill in the lease application information and submit it to the backend system for approval.
[0067] In the above embodiments, the present application improves the adaptability of the form, enabling it to flexibly respond to different business scenarios, simplifies the form development process, and significantly reduces the workload of manual code writing. In addition, the present application builds forms based on custom configuration files and template libraries. Developers can adjust the form content by maintaining and extending the configuration files without modifying the core code, thereby improving the maintainability of the system. At the same time, the method is applicable to different front-end frameworks or technology stacks, enhancing the versatility of the form generation solution, and avoiding the compatibility issues of traditional form libraries based on specific frameworks during project migration, thereby improving development efficiency and enhancing the scalability of the system.
[0068] Furthermore, after the step of initiating an interaction request to the user through the information interaction library, the method further includes:
[0069] Obtaining the interaction request response uploaded by the user, and parsing the interaction request response to obtain the interaction mode selected by the user, where the interaction mode includes using an existing form template and creating a new form template;
[0070] When the interaction mode is to use an existing form template, the form template engine is called to list all historical form templates and determine to use the existing form template among the historical form templates;
[0071] When the interaction mode is to create a new form template, a custom configuration file corresponding to the new form template is created in the custom folder;
[0072] Fill in the custom configuration information into the custom configuration file corresponding to the new form template.
[0073] In this embodiment, after the system initiates an interaction request to the user through the information interaction library, it further obtains the interaction request response uploaded by the user and parses the interaction method selected by the user, that is, decides whether to use an existing form template or create a new form template. When the user chooses to use an existing template, the system will call the form template engine, list all historical form templates in the templates directory, and provide the user with a list of templates to choose from, ensuring that the user can quickly modify and reuse based on the existing form structure. If the user chooses to create a new form template, the system will create a new custom configuration file in the config directory and guide the user to fill in the configuration information of the form field, such as field name, input type, whether it is required, default value, etc. After the configuration file is created, the system will perform format verification on the configuration information filled in by the user to ensure that it complies with established specifications. Then, the system will bind the new configuration file to the corresponding ejs template to ensure that the user's configuration information can be correctly parsed during the form generation phase and dynamically generate an HTML form page that meets business needs.
[0074] The above steps ensure the flexibility of the form generation process, allowing users to quickly reuse existing templates or create new form templates based on specific needs, thereby improving development efficiency, lowering the technical threshold for form customization, and ensuring the standardization and maintainability of the form structure.
[0075] Furthermore, the steps of creating a custom configuration file corresponding to a new form template in a custom folder specifically include:
[0076] Create an initial configuration file in a custom folder;
[0077] Identify the field content and field format of each field in the custom configuration information;
[0078] Set field configuration items in the initial configuration file based on field content and field format;
[0079] Fill in the custom configuration information into the field configuration item to generate a custom configuration file corresponding to the new form template.
[0080] In this embodiment, when the user chooses to create a new form template, the system first creates an initial configuration file in the config directory. This file serves as the basic structure of the form template and contains the necessary metadata and default fields. Subsequently, the system parses the custom configuration information entered by the user and identifies the field content (such as "name", "telephone", "address") and field format (such as text box, numeric input box, drop-down menu) of each field. Based on the recognition results, the system sets the corresponding field configuration items in the initial configuration file, including field name, input type, whether it is required, default value, verification rules, etc. For example, if the user defines a "telephone" field, the system will generate the following configuration items in the configuration file:
[0081] {
[0082] "name":"phone",
[0083] "type":"text",
[0084] "required":true,
[0085] "validation":"phone"
[0086] }
[0087] All parsed field configuration items are eventually written into a new configuration file and associated with the EJS template so that the form generation plug-in can dynamically read these configurations and render a complete HTML form page.
[0088] Through the above steps, this solution implements the automated configuration of custom form templates, allowing users to easily define form fields without manually writing code, thereby improving form development efficiency. At the same time, it ensures the standardization and consistency of form field formats and improves the maintainability of the system.
[0089] Furthermore, after the step of asking the user whether to customize the form fields, the following steps are further included:
[0090] When the user does not need to customize the form fields, the fixed configuration form template is found from the form template engine;
[0091] Generate form pages using fixed configuration form templates.
[0092] In this embodiment, when the user chooses not to customize the form fields, the system will directly search for fixed-configuration form templates from the form template engine. These fixed templates are pre-defined standardized forms that are suitable for common business scenarios, such as user registration, login, order submission, etc. The system will automatically match the fixed template that suits the current needs, and parse the template through the ejs template engine to generate the corresponding HTML form page. For example, in the rental application scenario, the fixed template contains basic fields such as "tenant name", "lease amount", and "lease term", and the field format, required items and other rules are preset. The generated form page is then stored in the output directory for developers to directly integrate into the system front end.
[0093] Through the above steps, when automatically generating forms, users who do not need custom fields are provided with the ability to quickly generate standardized forms, which reduces configuration work, improves development efficiency, and ensures the standardization and consistency of the forms.
[0094] Furthermore, the step of searching the preset custom folder for a target custom configuration file that matches the custom configuration information specifically includes:
[0095] Parse custom configuration information and obtain key fields in the custom configuration information;
[0096] Traverse the custom folders and obtain the key elements of each custom configuration file;
[0097] Compare the key fields in the custom configuration information with the key elements of each custom configuration file one by one, and count the number of key information matching items;
[0098] The custom profile corresponding to the largest number of key information matching items is determined as the target custom profile.
[0099] In this embodiment, to accurately identify the custom configuration file that best matches the user's needs, the system first parses the custom configuration information entered by the user and extracts key fields, such as field names, field types, and validation rules. Next, the system traverses all custom configuration files in the config directory and extracts key elements from each file, such as defined fields, data format requirements, and default values. The system then compares the key fields entered by the user with the key elements of each configuration file and counts the number of matches. For example, if a user's custom fields include "name," "phone number," and "email address," and an existing configuration file also contains the same three fields, the number of matches is high, indicating a relatively high match. By comparing the number of matches across all available configuration files, the system identifies the configuration file with the highest match as the target custom configuration file and prioritizes it for generating the final form page. If the number of matches is the same, further filtering is performed according to pre-set priority rules to ensure that the configuration file that best meets the user's needs is selected.
[0100] Through the above steps, the solution can intelligently match the most appropriate custom configuration file, avoiding users from repeatedly creating similar form configurations, improving the automation and efficiency of form generation, and ensuring the uniformity and maintainability of the form structure.
[0101] Furthermore, the step of searching the form template engine for a target form template that matches the custom configuration information specifically includes:
[0102] Initialize the form template engine;
[0103] Extract information of each form template in the form template engine to obtain information of several form templates;
[0104] Calculate the matching degree between the key fields in the custom configuration information and the information of each form template;
[0105] The form template with the highest matching degree is determined as the target form template.
[0106] In this embodiment, to ensure that the generated form page meets user needs, the system first initializes the form template engine, enabling it to load, parse, and match form templates. After initialization, the system extracts all available form templates from the templates directory and parses their structural information, including field names, field types (such as text boxes, radio buttons, check boxes, etc.), field validation rules (such as required fields, format restrictions, etc.), layout design, and applicable business scenarios (such as user registration, lease applications, contract management, etc.). This information is organized into a standardized form template data set by the system.
[0107] Subsequently, the system calculates the matching degree between the custom configuration information provided by the user and each form template. The matching degree can be calculated based on multiple dimensions such as field consistency, data type similarity, and business scenario relevance. For example, if the user's custom profile contains fields such as "customer name", "ID number", and "rental amount", the system will look for the template with the most of these fields in the template collection and calculate the matching ratio. If the field matching degree of a template reaches the set threshold (such as more than 80%), the system will give priority to the template as the target form template. If the matching degree of multiple templates is the same, the system will further perform weighted sorting based on factors such as frequency of use, last update time, and recommendation level to ensure that the template that best meets business needs is selected. Finally, the form template with the highest matching degree is determined, and the final form page is generated in combination with the custom profile.
[0108] Through the above steps, the most appropriate form template can be matched efficiently, the workload of users manually adjusting templates can be reduced, the intelligence and automation level of form generation can be improved, and the structural rationality and data consistency of the form page can be ensured, thereby optimizing the maintainability and scalability of the system.
[0109] Furthermore, based on the target custom configuration file and the target form template, the steps of generating a form page through the form automatic generation plug-in specifically include:
[0110] Parse the target custom configuration file and identify each field in the target custom configuration file;
[0111] Get the field type and field attributes of each field in the target custom configuration file;
[0112] According to the field types and field attributes in the target custom configuration file, encode each field to obtain the HTML code snippet corresponding to each field;
[0113] Identify the position of each field in the target form template and obtain field position information of each field in the target form template;
[0114] According to the field position information, the HTML code snippet corresponding to each field is embedded into the target form template, and the target form template is rendered through the form automatic generation plug-in to obtain the form page.
[0115] In this embodiment, the system first parses the target custom configuration file and extracts all field information, including field name, field type (such as text box, drop-down menu, date picker, etc.), and field attributes (such as required, default value, and validation rules). The system then iterates over all fields in the configuration file and generates a corresponding HTML code snippet for each field. For example, if the target custom configuration file contains a "Customer Name" field and its type is a text input box, the system will generate the following HTML code snippet:
[0116] <label for="customer_name"> Customer Name:< / label>
[0117] <input type="text"id="customer_name"name="customer_name"required>
[0118] The system then identifies the intended location of each field in the target form template. For example, a template might contain a placeholder like {% field_customer_name %}, indicating where the "Customer Name" field should be inserted. The system then parses the template structure, determines the specific location of each field, and embeds the previously generated HTML code snippet into the corresponding location in the template based on the field location information.
[0119] After all field code snippets are embedded, the system invokes the form auto-generation plug-in and uses the EJS template engine to render the entire form template, ultimately generating a complete HTML form page. During the rendering process, EJS dynamically populates field content and formats it according to the form template's style requirements, ensuring the generated form is aesthetically pleasing, standardized, and easy to integrate. The generated form page is ultimately exported to the output directory for developers to use or further modify.
[0120] Through the above steps, the solution can intelligently generate form pages that meet user needs, achieve seamless integration of custom configuration and template rendering, improve form development efficiency, reduce manual coding work, and improve the maintainability and consistency of form pages.
[0121] In the above embodiment, the present application discloses a method for automatic form generation, which belongs to the field of computer R&D management technology and is applied to the form page generation of the financial leasing business system. The present application integrates an information interaction library and a form template engine through a form automatic generation plug-in, so that the system can interact with users and support users to personalize the form fields. When users need to customize forms, the system can automatically retrieve matching configuration files and form templates to achieve dynamic form generation based on user needs. This method not only improves the adaptability of the form, enabling it to flexibly respond to different business scenarios, but also simplifies the form development process and greatly reduces the workload of manual code writing. In addition, the present application constructs forms based on custom configuration files and template libraries. Developers can adjust the form content by maintaining and extending the configuration files without modifying the core code, thereby improving the maintainability of the system. At the same time, the method is applicable to different front-end frameworks or technology stacks, enhances the versatility of the form generation solution, avoids the compatibility issues of traditional form libraries based on specific frameworks during project migration, thereby improving development efficiency and enhancing the scalability of the system.
[0122] In this embodiment, the electronic device (eg Figure 1 The server shown in the figure) can receive instructions or obtain data through a wired connection or a wireless connection. It should be noted that the above-mentioned wireless connection method may include but is not limited to 3G / 4G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or to be developed in the future.
[0123] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned custom configuration information, the above-mentioned custom configuration information can also be stored in a node of a blockchain.
[0124] The blockchain referred to in this application is a new application model for computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Blockchain is essentially a decentralized database, a series of data blocks generated using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity of this information (to prevent counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, the platform product service layer, and the application service layer.
[0125] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.
[0126] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0127] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware via computer-readable instructions. The computer-readable instructions can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes in the above-described method embodiments. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0128] It should be understood that although the steps in the flowcharts of the accompanying drawings are shown in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the flowcharts of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0129] Further references Figure 3 , as a response to the above Figure 2 The present application provides an embodiment of a form automatic generation device, which is similar to the embodiment of the present invention. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0130] like Figure 3 As shown, the form automatic generation device 300 described in this embodiment includes:
[0131] The information loading module 301 is used to receive a form generation instruction and call a preset form automatic generation plug-in to load an information interaction library and a form template engine;
[0132] The interaction request module 302 is used to initiate an interaction request to the user through the information interaction library and inquire the user whether to customize the form fields;
[0133] Configuration information module 303, used to obtain the custom configuration information uploaded by the user when the user needs to customize the form fields;
[0134] A first matching module 304 is configured to search a preset custom folder for a target custom configuration file that matches the custom configuration information;
[0135] The second matching module 305 is used to search the form template engine for a target form template that matches the custom configuration information;
[0136] The form generation module 306 is configured to generate a form page through a form automatic generation plug-in based on a target custom configuration file and a target form template.
[0137] Furthermore, the form automatic generation device 300 further includes:
[0138] The request response module is used to obtain the interaction request response uploaded by the user, and parse the interaction request response to obtain the interaction mode selected by the user, where the interaction mode includes using an existing form template and creating a new form template;
[0139] A first interaction module is configured to, when the interaction mode is to use an existing form template, call a form template engine to list all historical form templates and determine to use an existing form template among the historical form templates;
[0140] The second interaction module is used to create a custom configuration file corresponding to the new form template in a custom folder when the interaction mode is to create a new form template;
[0141] The configuration filling module is used to fill in the custom configuration information into the custom configuration file corresponding to the new form template.
[0142] Furthermore, the second interaction module specifically includes:
[0143] Initial configuration unit, used to create an initial configuration file in a custom folder;
[0144] A first field identification unit is used to identify the field content and field format of each field in the custom configuration information;
[0145] Configuration item unit, used to set field configuration items in the initial configuration file based on field content and field format;
[0146] The custom configuration unit is used to fill in the custom configuration information into the field configuration item and generate a custom configuration file corresponding to the new form template.
[0147] Furthermore, the form automatic generation device 300 further includes:
[0148] The fixed configuration module is used to search for a fixed configuration form template from the form template engine when the user does not need to customize the form fields;
[0149] Fixed form module, used to generate form pages through fixed configuration form templates.
[0150] Furthermore, the first matching module 304 specifically includes:
[0151] The key field unit is used to parse the custom configuration information and obtain the key fields in the custom configuration information;
[0152] The key element unit is used to traverse the custom folder and obtain the key elements of each custom configuration file;
[0153] An element comparison unit is used to compare the key fields in the custom configuration information with the key elements of each custom configuration file one by one, and count the number of key information matching items;
[0154] The first matching unit is configured to determine a custom profile corresponding to a maximum number of key information matching items as a target custom profile.
[0155] Furthermore, the second matching module 305 specifically includes:
[0156] Initialization unit, used to initialize the form template engine;
[0157] The template information unit is used to extract information of each form template in the form template engine to obtain information of a plurality of form templates;
[0158] A matching unit is used to calculate the matching degree between the key fields in the custom configuration information and the information of each form template;
[0159] The second matching unit is configured to determine the form template with the highest matching degree as the target form template.
[0160] Furthermore, the form generation module 306 specifically includes:
[0161] The second field identification unit is used to parse the target custom configuration file and identify each field in the target custom configuration file;
[0162] A field processing unit is used to obtain the field type and field attributes of each field in the target custom configuration file;
[0163] The field encoding unit is used to encode each field according to the field type and field attributes in the target custom configuration file to obtain the HTML code snippet corresponding to each field;
[0164] A field position unit is used to identify the position of each field in the target form template and obtain the field position information of each field in the target form template;
[0165] The code embedding unit is used to embed the HTML code snippets corresponding to each field into the target form template according to the field position information, and render the target form template through the form automatic generation plug-in to obtain the form page.
[0166] In the above embodiment, the present application discloses a form automatic generation device, which belongs to the field of computer R&D management technology and is applied to the form page generation of the financial leasing business system. The present application integrates the information interaction library and the form template engine through the form automatic generation plug-in, so that the system can interact with the user and support the user to personalize the form fields. When the user needs to customize the form, the system can automatically retrieve the matching configuration file and form template to realize dynamic form generation based on user needs. This method not only improves the adaptability of the form, enabling it to flexibly respond to different business scenarios, but also simplifies the form development process and greatly reduces the workload of manual code writing. In addition, the present application constructs the form based on the custom configuration file and template library. Developers can adjust the form content by maintaining and extending the configuration file without modifying the core code, thereby improving the maintainability of the system. At the same time, the method is applicable to different front-end frameworks or technology stacks, enhances the versatility of the form generation solution, avoids the compatibility issues of the traditional form library based on a specific framework during project migration, thereby improving development efficiency and enhancing the scalability of the system.
[0167] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.
[0168] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 4 with a memory 41, a processor 42, and a network interface 43, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to a microprocessor, an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a digital signal processor (DSP), an embedded device, etc.
[0169] The computer device may be a desktop computer, notebook computer, PDA, cloud server, etc. The computer device may interact with the user via a keyboard, mouse, remote control, touchpad, or voice control device.
[0170] The memory 41 includes at least one type of readable storage medium, including flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, a magnetic disk, an optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as the hard disk or memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash memory card, etc. equipped on the computer device 4. Of course, the memory 41 may also include both the internal storage unit of the computer device 4 and its external storage device. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as the computer-readable instructions of the automatic form generation method. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or are to be output.
[0171] In some embodiments, the processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to execute computer-readable instructions stored in the memory 41 or process data, such as computer-readable instructions for executing the automatic form generation method.
[0172] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.
[0173] The present application also provides an embodiment, namely, a computer device, comprising a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the above-mentioned user insurance demand assessment method are implemented, namely, the following steps are implemented:
[0174] A method for automatically generating a form, comprising:
[0175] Receive form generation instructions and call the preset form automatic generation plug-in to load the information interaction library and form template engine;
[0176] Initiate an interaction request to the user through the information interaction library and ask the user whether to customize the form fields;
[0177] When the user needs to customize the form fields, obtain the customized configuration information uploaded by the user;
[0178] Search for the target custom configuration file that matches the custom configuration information from the preset custom folder;
[0179] Search the form template engine for the target form template that matches the custom configuration information;
[0180] Generate form pages through the form automatic generation plug-in based on the target custom configuration file and target form template.
[0181] The present application also provides another embodiment, namely, a computer-readable storage medium storing computer-readable instructions. The computer-readable instructions can be executed by at least one processor to cause the at least one processor to perform the steps of the above-mentioned method for automatically generating a form, namely, to achieve:
[0182] A method for automatically generating a form, comprising:
[0183] Receive form generation instructions and call the preset form automatic generation plug-in to load the information interaction library and form template engine;
[0184] Initiate an interaction request to the user through the information interaction library and ask the user whether to customize the form fields;
[0185] When the user needs to customize the form fields, obtain the customized configuration information uploaded by the user;
[0186] Search for the target custom configuration file that matches the custom configuration information from the preset custom folder;
[0187] Search the form template engine for the target form template that matches the custom configuration information;
[0188] Generate form pages through the form automatic generation plug-in based on the target custom configuration file and target form template.
[0189] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0190] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected via a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices.
[0191] It should be noted that the non-Company's software tools or components appearing in the various embodiments of this application are merely examples and do not represent actual use.
[0192] Obviously, the embodiments described above are only some of the embodiments of the present application, rather than all of the embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions described in the aforementioned specific embodiments, or to make equivalent replacements for some of the technical features therein. Any equivalent structure made using the contents of the present application specification and the accompanying drawings, directly or indirectly used in other related technical fields, is also within the scope of patent protection of the present application.
Claims
1. A method for automatically generating a form, characterized in that: include: Receive form generation instructions and call the preset form automatic generation plug-in to load the information interaction library and form template engine; Initiate an interaction request to the user through the information interaction library and ask the user whether to customize the form fields; When the user needs to customize the form fields, obtain the customized configuration information uploaded by the user; Searching for a target custom configuration file that matches the custom configuration information from a preset custom folder; Searching for a target form template matching the custom configuration information from the form template engine; Based on the target custom configuration file and the target form template, a form page is generated through the form automatic generation plug-in.
2. The method for automatically generating a form according to claim 1, wherein: After the step of initiating an interaction request to the user through the information interaction library, the method further includes: Obtaining an interaction request response uploaded by the user, and parsing the interaction request response to obtain an interaction mode selected by the user, wherein the interaction mode includes using an existing form template and creating a new form template; When the interaction mode is to use an existing form template, calling the form template engine to list all historical form templates, and determining the existing form template to be used among the historical form templates; When the interaction mode is to create a new form template, creating a custom configuration file corresponding to the new form template in the custom folder; Fill the custom configuration information into the custom configuration file corresponding to the new form template.
3. The automatic form generation method according to claim 2, wherein: The step of creating a custom configuration file corresponding to the new form template in the custom folder specifically includes: Create an initial configuration file in the custom folder; Identify the field content and field format of each field in the custom configuration information; Setting field configuration items in the initial configuration file according to the field content and the field format; Fill the custom configuration information into the field configuration item to generate a custom configuration file corresponding to the new form template.
4. The method for automatically generating a form according to claim 1, wherein: After the step of asking the user whether to customize the form fields, the method further includes: When the user does not need to customize the form fields, a fixed configuration form template is searched from the form template engine; The form page is generated using the fixed configuration form template.
5. The method for automatically generating a form according to claim 1, wherein: The step of searching for a target custom configuration file that matches the custom configuration information from a preset custom folder specifically includes: Parsing the custom configuration information to obtain key fields in the custom configuration information; Traversing the custom folders to obtain key elements of each custom configuration file; Compare the key fields in the custom configuration information with the key elements of each custom configuration file one by one, and count the number of key information matching items; The custom profile corresponding to the largest number of key information matching items is determined as the target custom profile.
6. The method for automatically generating a form according to claim 5, wherein: The step of searching the form template engine for a target form template that matches the custom configuration information specifically includes: Initializing the form template engine; Extracting information of each form template in the form template engine to obtain information of a plurality of form templates; Calculating the matching degree between the key fields in the custom configuration information and each of the form template information; The form template with the highest matching degree is determined as the target form template.
7. The method for automatically generating a form according to claim 1, wherein: The step of generating a form page through the form automatic generation plug-in based on the target custom configuration file and the target form template specifically includes: Parsing the target custom configuration file and identifying each field in the target custom configuration file; Obtain the field type and field attributes of each field in the target custom configuration file; According to the field types and field attributes in the target custom configuration file, encode each field to obtain the HTML code snippet corresponding to each field; Identify the position of each field in the target form template and obtain field position information of each field in the target form template; The HTML code snippets corresponding to the various fields are embedded into the target form template according to the field position information, and the target form template is rendered by the form automatic generation plug-in to obtain the form page.
8. A form automatic generation device, characterized in that: include: The information loading module is used to receive the form generation instruction and call the preset form automatic generation plug-in to load the information interaction library and form template engine; An interaction request module, configured to initiate an interaction request to the user through the information interaction library and inquire the user whether to customize the form fields; The configuration information module is used to obtain the custom configuration information uploaded by the user when the user needs to customize the form fields; A first matching module is used to search a preset custom configuration file for a target custom configuration file that matches the custom configuration information; A second matching module, configured to search the form template engine for a target form template that matches the custom configuration information; The form generation module is used to generate a form page through the form automatic generation plug-in based on the target custom configuration file and the target form template.
9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the form automatic generation method according to any one of claims 1 to 7 when executing the computer-readable instructions.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the method for automatically generating a form according to any one of claims 1 to 7.
Citation Information
Cited By
Daily end data file processing method, system and device and readable storage medium
CN121051076A