Metadata-based multi-type form generation method and apparatus, and computer device
Through metadata-based methods, forms are generated, which solves the problems of cumbersome form generation process and high maintenance costs, and achieves efficient form generation and adjustment.
Patent Information
- Application Number
- CN202411220991.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2024-11-29
AI Technical Summary
In the prior art, when building forms, the form style and content are not efficient, resulting in a cumbersome form generation process and high maintenance costs, making it difficult to respond to changes in demand quickly.
By creating a tree structure list to display system engineering information, obtain form fields, data fields and component type information of the business data model, configure data verification rules and layout styles, convert them into metadata configuration files, and generate metadata-based forms.
It simplifies form configuration management, improves form generation and adjustment efficiency, reduces maintenance costs, and achieves rapid response to demand changes.
Smart Images

Figure CN119045820A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, computer device, computer-readable storage medium and computer program product for generating multiple types of forms based on metadata. Background Art
[0002] With the popularity of digitalization and online services, the demand for forms as an important tool for data collection and user interaction continues to grow. In the daily web development process, writing form code is repetitive and cumbersome, and there is no fixed form layout and control style that can quickly generate real code, resulting in a low degree of visualization of the entire development process.
[0003] Traditional technology mainly completes form construction by using visual methods and a small amount of programming in the development platform. However, when building forms, traditional technology is not efficient in setting form styles and form contents. When adjusting the requirements of the created forms, a large number of form content adjustments will increase the maintenance cost of the form, which is not conducive to improving the efficiency of form generation. Summary of the invention
[0004] Based on this, it is necessary to provide a metadata-based multi-type form generation method, apparatus, computer device, computer-readable storage medium and computer program product that can improve the efficiency of form generation in order to address the above technical problems.
[0005] In a first aspect, the present application provides a method for generating multiple types of forms based on metadata, including:
[0006] Creating a tree structure list for a target project; the tree structure list is used to display system engineering information of the target project;
[0007] In response to a trigger operation on the system engineering information, obtaining form fields, data fields, and form component type information of each business data model corresponding to the system engineering information;
[0008] Configure data validation rule information of the form field, obtain layout style information of the form item corresponding to the form field, convert the form field, the data field, the form component type information, the data validation rule information and the layout style information into metadata to obtain a metadata configuration file;
[0009] A form corresponding to the metadata configuration file is generated according to the metadata configuration file.
[0010] In one embodiment, the obtaining of form fields, data fields, and form component type information of each business data model corresponding to the system engineering information includes:
[0011] Sending a business model list acquisition request corresponding to the system engineering information to a server, and receiving business model list information returned by the server; the business model list information includes at least one business data model;
[0012] In response to a trigger operation on each business data model in the business model list information, sending a data list acquisition request corresponding to each business data model to the server, and receiving the data list information returned by the server;
[0013] The model structures corresponding to the business data models are analyzed to determine the form fields of the business data models.
[0014] In one embodiment, the obtaining of form fields, data fields, and form component type information of each business data model corresponding to the system engineering information includes:
[0015] In response to a trigger operation on each form field corresponding to each business data model, determining a data field corresponding to each form field according to the data list information; the form field is bidirectionally bound to the data field;
[0016] According to the data fields corresponding to the form fields, the data fields of the business data models corresponding to the system engineering information are determined.
[0017] In one embodiment, the obtaining of form fields, data fields, and form component type information of each business data model corresponding to the system engineering information includes:
[0018] According to the preset mapping rules, based on the data types of the data fields of the business data models corresponding to the system engineering information, the form component type information of the form items corresponding to the form fields is determined; the mapping rules represent the mapping relationship between the data types of the data fields and the component types of the form components;
[0019] According to the form component type information of the form items corresponding to the form fields, the form component type information of each business data model corresponding to the system engineering information is determined.
[0020] In one embodiment, generating a form corresponding to the metadata configuration file according to the metadata configuration file includes:
[0021] Parsing the metadata configuration file to determine the form field, data field, form component type information and layout style information corresponding to the metadata configuration file;
[0022] A form corresponding to the metadata configuration file is generated according to the form fields, data fields, form component type information and layout style information corresponding to the metadata configuration file.
[0023] In one embodiment, the method further comprises:
[0024] Parsing the metadata configuration file to determine data validation rule information corresponding to the metadata configuration file;
[0025] In response to a data input operation on any form item in the form corresponding to the metadata configuration file, obtaining input data corresponding to the data input operation;
[0026] According to the data validation rule information corresponding to the metadata configuration file, a data validation result corresponding to the input data is determined.
[0027] In a second aspect, the present application also provides a metadata-based multi-type form generation device, including:
[0028] A creation module, used to create a tree structure list for a target project; the tree structure list is used to display system engineering information of the target project;
[0029] An acquisition module, configured to acquire form fields, data fields, and form component type information of each business data model corresponding to the system engineering information in response to a trigger operation on the system engineering information;
[0030] A conversion module, used to configure the data validation rule information of the form field, obtain the layout style information of the form item corresponding to the form field, convert the form field, the data field, the form component type information, the data validation rule information and the layout style information into metadata to obtain a metadata configuration file;
[0031] The generating module is used to generate a form corresponding to the metadata configuration file according to the metadata configuration file.
[0032] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the steps of the above method are implemented.
[0033] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0034] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0035] The above-mentioned metadata-based multi-type form generation method, device, computer equipment, computer-readable storage medium and computer program product create a tree structure list for the target project; the tree structure list is used to display the system engineering information of the target project, so that subsequent users can perform trigger operations on the system engineering information; in response to the trigger operation on the system engineering information, the form field, data field and form component type information of each business data model corresponding to the system engineering information are obtained, so as to timely respond to the trigger operation on the system engineering information and obtain accurate form field, data field and form component type information; configure the data validation rule information of the form field, obtain the layout style information of the form item corresponding to the form field, The form fields, data fields, form component type information, data validation rule information and layout style information are converted into metadata to obtain a metadata configuration file, which is convenient for automatically generating forms based on metadata and simplifies configuration management; according to the metadata configuration file, a form corresponding to the metadata configuration file is generated, which can accurately describe the form's layout style, field requirements, component type and validation rules based on the form fields, data fields, form component type information, data validation rule information and layout style information in the form of metadata, so as to generate the corresponding form; at the same time, the metadata configuration file can be flexibly adjusted and modified based on metadata, thereby improving the adjustment efficiency of the form content and further improving the efficiency of form generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 An application environment diagram of a metadata-based multi-type form generation method in one embodiment;
[0038] Figure 2 A schematic diagram of a process of generating a multi-type form based on metadata in one embodiment;
[0039] Figure 3 A schematic diagram of a process of generating a form in one embodiment;
[0040] Figure 4It is a structural block diagram of a metadata-based multi-type form generation device in one embodiment;
[0041] Figure 5 The figure is a diagram of the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0043] The metadata-based multi-type form generation method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The terminal 102 creates a tree structure list for the target project; the tree structure list is used to display the system engineering information of the target project; the terminal 102 responds to the trigger operation for the system engineering information, and obtains the form field, data field and form component type information of each business data model corresponding to the system engineering information; the terminal 102 configures the data validation rule information of the form field, obtains the layout style information of the form item corresponding to the form field, and converts the form field, data field, form component type information, data validation rule information and layout style information into metadata to obtain the metadata configuration file; the terminal 102 generates a form corresponding to the metadata configuration file according to the metadata configuration file. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices, and the Internet of Things devices can be smart TVs, smart car-mounted devices, projection devices, etc. Portable wearable devices can be smart watches, head-mounted devices, etc. The head mounted device may be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The server 104 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0044] In an exemplary embodiment, Figure 2 As shown, a method for generating multiple types of forms based on metadata is provided, and the method is applied to a terminal as an example for explanation, including the following steps S202 to S208. Among them:
[0045] Step S202, creating a tree structure list for the target project; the tree structure list is used to display the system engineering information of the target project.
[0046] Among them, the target project can refer to a collection of a series of related businesses carried out under limited time, budget and resource conditions in order to achieve a specific goal. In practical applications, the target project can include but is not limited to the screening of the operation status of power equipment in the power grid.
[0047] The tree structure list may refer to information used to display a data structure with a hierarchical relationship.
[0048] The system engineering information may refer to information of several businesses constituting the target project. In practical applications, the tree structure list may have several nodes, and each node may have corresponding system engineering information (such as business).
[0049] As an example, in order to create a form for a target project, the terminal can obtain a project business analysis file for a target task that is pre-created by relevant personnel. The project business analysis file can describe information such as the various businesses that constitute the target project and the relationship between the various businesses. For example, the target project can be composed of business 1 and business 2, where business 1 can include business 1.1 and business 1.2, and business 1.1 can include business 1.1.1 and business 1.1.2. The terminal can analyze the project business analysis file to determine information such as the various businesses of the target project and the relationship between the various businesses, and create a tree structure list for the target project. For example, the target project can be composed of business 1 and business 2, where business 1 can include business 1.1 and business 1.2, and business 1.1 can include business 1.1.1 and business 1.1.2. The tree structure list for the target project can be expressed as:
[0050] Target project;
[0051] Business 1;
[0052] Business 1.1;
[0053] Business 1.1.1;
[0054] Business 1.1.2;
[0055] Business 1.2;
[0056] Business 2.
[0057] It can be understood that the services represented by the tree structure list and the relationships between the services can be used as a kind of system engineering information.
[0058] Step S204 , in response to a trigger operation on the system engineering information, obtaining form fields, data fields and form component type information of each business data model corresponding to the system engineering information.
[0059] The trigger operation on the system engineering information may refer to a click operation of the user on the system engineering information.
[0060] Among them, the business data model can refer to a collection of information that describes business entities (such as customers, products, orders, etc.) and their attributes, relationships, and rules. In actual applications, each business of the target project can have a corresponding business data model.
[0061] The form field may refer to information representing a location in a form for a user to input or select information. In actual applications, the types of form fields may include but are not limited to text boxes, date selectors, buttons, and the like.
[0062] The data field may refer to a basic unit for storing information input or selected by a user in a form field.
[0063] Among them, the form component type information may refer to the information of the type of the form component. In actual applications, the form component type information may include the form component identification ID. The form component may be used to obtain / collect information input or selected by the user. The form component may include but is not limited to a text box, a single check box, a date selector, a drop-down list, etc.
[0064] As an example, the terminal can display the system engineering information on the display interface of the terminal, so as to show the system engineering information to the user. When the user needs to define the form fields, data fields and form component type information of each business data model corresponding to the system engineering information, the user can perform a trigger operation on the system engineering information by operating the terminal. The terminal can respond to the user's trigger operation on the system engineering information, and gradually obtain the form fields, data fields and form component type information of each business data model corresponding to the system engineering information based on the user operation.
[0065] Step S206, configure data validation rule information of the form field, obtain layout style information of the form item corresponding to the form field, convert the form field, data field, form component type information, data validation rule information and layout style information into metadata, and obtain a metadata configuration file.
[0066] Among them, data validation rule information may refer to information used to check and verify information input or selected by the user to determine whether the information input or selected by the user meets the preset information requirements. In actual applications, data validation rules may include but are not limited to required items, data types, prompt information, etc.
[0067] The form item may refer to a basic unit constituting a form. In practical applications, the form item may include but is not limited to a cell.
[0068] The layout style information may refer to information representing the organization and arrangement of each form item in the form.
[0069] Herein, metadata may refer to data that describes data.
[0070] Among them, the metadata configuration file may refer to a collection of a series of data obtained after converting form fields, data fields, form component type information, data validation rule information and layout style information into metadata. In actual applications, the form fields, data fields, form component type information, data validation rule information and layout style information in the metadata configuration file may all have unique identification information, which can be used for data differentiation and / or data parsing.
[0071] As an example, the terminal can respond to the user's triggering operation (such as a click operation, a selection operation, and an input operation, etc.) to obtain the data validation rule information configured or defined by the user for each form item, and then the terminal can configure the data validation rule information of the form field corresponding to the form item for each form item based on the data validation rule information input by the user. It can be understood that the terminal can also respond to the user's triggering operation (such as a click operation, a selection operation, and an input operation, etc.) to obtain the layout style information defined or set by the user for the form item corresponding to the form field, and then the terminal can convert the form field, data field, form component type information, data validation rule information and layout style information into metadata, and use the set of the converted data as the metadata configuration file corresponding to the target project.
[0072] Step S208: Generate a form corresponding to the metadata configuration file according to the metadata configuration file.
[0073] The form may refer to information used to record or collect business information and / or business data of each business constituting the target project.
[0074] As an example, the terminal can generate a form corresponding to the metadata configuration file by reading and parsing the metadata configuration file corresponding to the target project. The form can be used as the form corresponding to the target project. The form can be used to record or collect business information, business data, business completion status and other information of each business constituting the target project. In a specific implementation, the terminal can display the form corresponding to the metadata configuration file to the user in the display interface of the terminal.
[0075] In the above-mentioned metadata-based multi-type form generation method, a tree structure list for a target project is created; the tree structure list is used to display the system engineering information of the target project, so that subsequent users can perform trigger operations on the system engineering information; in response to the trigger operation on the system engineering information, the form field, data field and form component type information of each business data model corresponding to the system engineering information are obtained, so as to timely respond to the trigger operation on the system engineering information and obtain accurate form field, data field and form component type information; data validation rule information of the form field is configured, the layout style information of the form item corresponding to the form field is obtained, and the form field, data field, form component type information, data validation rule information and layout style information are converted into metadata to obtain a metadata configuration file, so as to facilitate automatic generation of forms based on metadata and simplify configuration management; according to the metadata configuration file, a form corresponding to the metadata configuration file is generated, and the layout style, field requirements, component type and validation rule information of the form can be accurately described based on the form field, data field, form component type information, data validation rule information and layout style information in the form of metadata, so as to generate the corresponding form, and at the same time, the metadata configuration file can be flexibly adjusted and modified based on the metadata, so as to improve the adjustment efficiency of the form content, thereby improving the generation efficiency of the form.
[0076] In an exemplary embodiment, the form fields, data fields and form component type information of each business data model corresponding to the system engineering information are obtained, including: sending a business model list acquisition request corresponding to the system engineering information to a server, and receiving the business model list information returned by the server; the business model list information includes at least one business data model; in response to a trigger operation for each business data model in the business model list information, sending a data list acquisition request corresponding to each business data model to the server, and receiving the data list information returned by the server; analyzing the model structure corresponding to each business data model, and determining the form fields of each business data model.
[0077] The business model list acquisition request may refer to information used to request a business model list from a server.
[0078] The server may refer to a server used to store information such as business model list information and data list information.
[0079] Among them, the business model list information may refer to information used to record the business data models corresponding to each business constituting the target project. In actual applications, the business model list information can be obtained by sorting the business data models corresponding to each business constituting the target project in a preset order (such as the order of business importance).
[0080] The triggering operation on each business data model in the business model list information may refer to a selection operation or a click operation by the user on the business data model in the business model list information.
[0081] The data list acquisition request may refer to information used to request data list information from a server.
[0082] The data list information may refer to type information for recording data associated with the business data model. In practical applications, the data list information may include structural information of the business data model and type information of data associated with the business data model.
[0083] The model structure corresponding to the business data model may refer to information describing business entities (such as customers, products, orders, etc.) and their attributes, relationships, and rules.
[0084] As an example, the terminal can respond to a user's click operation on the system engineering information and send a business model list acquisition request corresponding to the system engineering information to the server. The server can respond to the business model list acquisition request and send the business model list information corresponding to the business model list acquisition request to the terminal. The terminal can receive the business model list information returned by the server, wherein the business model list information includes at least one business data model. After acquiring the business model list information, the terminal can display the business model list information to the user on the display interface of the terminal. The user can perform a corresponding trigger operation by operating the terminal. The terminal can respond to the user's trigger operation on each business data model in the business model list information and send a data list acquisition request corresponding to each business data model to the server. The server can respond to the data list acquisition request and send the data list information corresponding to the data list acquisition request to the terminal. The terminal can receive the data list information returned by the server, and then the terminal can analyze the model structure corresponding to each business data model, determine the type of data required to complete each business data model, and then determine the form field of each business data model based on the type of data required to complete each business data model.
[0085] In this embodiment, a business model list acquisition request corresponding to system engineering information is sent to a server, and business model list information returned by the server is received; the business model list information includes at least one business data model; in response to a trigger operation for each business data model in the business model list information, a data list acquisition request corresponding to each business data model is sent to the server, and the data list information returned by the server is received; the model structure corresponding to each business data model is analyzed, and the form field of each business data model is determined. It can respond to user operations in a timely manner, and obtain accurate form fields based on data transmission between the terminal and the server, so that a form can be generated based on the corresponding metadata configuration file generated based on the form fields, thereby improving the efficiency of form generation.
[0086] In some embodiments, form fields, data fields and form component type information of each business data model corresponding to the system engineering information are obtained, including: responding to a trigger operation for each form field corresponding to each business data model, determining the data field corresponding to each form field according to data list information; bidirectionally binding the form field and the data field; and determining the data field of each business data model corresponding to the system engineering information according to the data field corresponding to each form field.
[0087] The triggering operation for each form field corresponding to each business data model may refer to a selection operation or a click operation of the user for each form field corresponding to each business data model.
[0088] Among them, the two-way binding of form fields and data fields can mean that when the data attributes and other information of either the form field or the data field changes, the other party will automatically synchronize and adjust according to the changes in data attributes. In actual applications, when the business changes, the business data model will also change. When the business data model changes, the form field will change. When the form field changes, the data field that establishes a two-way binding relationship with the form field will also undergo corresponding changes (data attributes, data types, etc.).
[0089] As an example, a user can perform a click operation or a selection operation on a form field through an operation terminal, and the terminal can respond to the user's trigger operation on each form field corresponding to each business data model, and determine the data field corresponding to each form field in combination with the data list information, wherein the form field and the data field are bidirectionally bound. The terminal can use the data field corresponding to each form field as the data field of each business data model corresponding to the system engineering information.
[0090] In this embodiment, by responding to the trigger operation of each form field corresponding to each business data model, the data field corresponding to each form field is determined according to the data list information; the form field and the data field are bidirectionally bound; according to the data field corresponding to each form field, the data field of each business data model corresponding to the system engineering information is determined, and it is possible to respond to user operations in a timely manner, combine the data list information and each form field, and obtain accurate data fields, so that the form can be generated based on the corresponding metadata configuration file generated by the data field in the subsequent process, thereby improving the efficiency of form generation.
[0091] In some embodiments, form fields, data fields and form component type information of each business data model corresponding to the system engineering information are obtained, including: according to a preset mapping rule, according to the data type of the data field of each business data model corresponding to the system engineering information, the form component type information of the form item corresponding to each form field is determined; the mapping rule represents the mapping relationship between the data type of the data field and the component type of the form component; according to the form component type information of the form item corresponding to each form field, the form component type information of each business data model corresponding to the system engineering information is determined.
[0092] The mapping rule may refer to information representing the mapping relationship between the data type of the data field and the component type of the form component.
[0093] As an example, the terminal can determine the form component type information of the form item corresponding to each form field according to the data type of the data field of each business data model corresponding to the system engineering information according to the preset mapping rule, and the mapping rule represents the mapping relationship between the data type of the data field and the component type of the form component, wherein the form component corresponding to the form component type information allows the data type to be written into the corresponding form item as data. The terminal can use the form component type information of the form item corresponding to each form field as the form component type information of each business data model corresponding to the system engineering information.
[0094] In this embodiment, according to the preset mapping rules, the form component type information of the form item corresponding to each form field is determined according to the data type of the data field of each business data model corresponding to the system engineering information; the mapping rules represent the mapping relationship between the data type of the data field and the component type of the form component; according to the form component type information of the form item corresponding to each form field, the form component type information of each business data model corresponding to the system engineering information is determined, and accurate form component type information can be obtained based on the preset mapping rules and the data type of the data field, so that the form can be generated based on the corresponding metadata configuration file generated based on the form component type information, thereby improving the efficiency of form generation.
[0095] In some embodiments, a form corresponding to the metadata configuration file is generated according to the metadata configuration file, including: parsing the metadata configuration file to determine the form fields, data fields, form component type information and layout style information corresponding to the metadata configuration file; generating a form corresponding to the metadata configuration file according to the form fields, data fields, form component type information and layout style information corresponding to the metadata configuration file.
[0096] As an example, the form fields, data fields, form component type information, data validation rule information and layout style information in the metadata configuration file may all have unique identification information, which may be used for data differentiation and / or data analysis. When it is necessary to generate a form corresponding to the target project based on the metadata configuration file, the terminal may read and parse the metadata configuration file through the dynamic parsing engine in the front-end page, and determine the form fields, data fields, form component type information and layout style information corresponding to the metadata configuration file according to the identification information. Then, the terminal may determine the form fields, data fields, form components and layout styles corresponding to several form items based on the form fields, data fields, form component type information and layout style information corresponding to the metadata configuration file, thereby generating a form corresponding to the metadata configuration file.
[0097] In this embodiment, the metadata configuration file is parsed to determine the form fields, data fields, form component type information and layout style information corresponding to the metadata configuration file; based on the form fields, data fields, form component type information and layout style information corresponding to the metadata configuration file, a form corresponding to the metadata configuration file is generated, the metadata configuration file can be parsed, and the corresponding form can be accurately generated based on the parsing result, thereby improving the accuracy of the form.
[0098] In some embodiments, the above method also includes: parsing the metadata configuration file to determine the data validation rule information corresponding to the metadata configuration file; in response to a data input operation for any form item in the form corresponding to the metadata configuration file, obtaining input data corresponding to the data input operation; and determining the data validation result corresponding to the input data according to the data validation rule information corresponding to the metadata configuration file.
[0099] The input data may refer to the data input into the form item by the user.
[0100] The data verification result may refer to information indicating whether the input data complies with the data verification rule information. In practical applications, the data verification result may indicate whether the input data complies with the preset information requirements.
[0101] As an example, the terminal can determine the data validation rule information corresponding to the metadata configuration file by parsing the metadata configuration file, and the user can perform a data input operation by operating the terminal. The terminal can respond to the data input operation for any form item in the form corresponding to the metadata configuration file, obtain the input data corresponding to the data input operation, and determine whether the input data complies with the data validation rule represented by the data validation rule information according to the data validation rule information corresponding to the metadata configuration file, thereby determining the data validation result corresponding to the input data. It is understandable that when the data validation result indicates that the input data does not comply with the data validation rule represented by the data validation rule information, the terminal can generate corresponding prompt information, which can be displayed to the user on the display interface of the terminal, thereby prompting the user to modify and adjust the input data.
[0102] In this embodiment, by parsing the metadata configuration file, data validation rule information corresponding to the metadata configuration file is determined; in response to a data input operation for any form item in the form corresponding to the metadata configuration file, input data corresponding to the data input operation is obtained; according to the data validation rule information corresponding to the metadata configuration file, a data validation result corresponding to the input data is determined, and the input data can be checked and verified based on the data validation rules, and the user can be promptly prompted with non-standard data in the form, thereby improving the standardization and accuracy of the form data.
[0103] In some embodiments, Figure 3As shown, a flow chart of generating a form is provided. In order to generate a form corresponding to the target project, the terminal can first select a business data model. Specifically, the terminal can create a tree structure list, which is used to display the system engineering under the current project. The user clicks on the system engineering, and the terminal can request the server for a list of business models under the current system engineering. After the terminal receives the business model list returned by the server, the user can select a specific business data model. The terminal can obtain the selected data model ID and send a data list acquisition request to the server. The terminal can construct a data list of the corresponding business data model returned by the server, wherein the data list may include a business model structure and business data information. The terminal can then generate multi-type form metadata information. Specifically, based on the business model structure, the user can select the form fields to be generated. The terminal can automatically generate the two-way bound data fields of the form corresponding to the form fields selected by the user based on the business data information. The terminal can automatically generate the component type of the form component in combination with the mapping rules of the data type and the component. The terminal can also configure the data validation rules for each form item based on the user-defined data validation rules, such as required items, data types, prompt information, etc. The terminal can organize the form configuration information such as form fields, data fields, component types, and the layout style information of the form items corresponding to the form fields into metadata to obtain a metadata configuration file, which can be saved in a preset database. When it is necessary to generate a form corresponding to a target project, the terminal can obtain and read the metadata in the metadata configuration file corresponding to the target project from the preset database, and parse the metadata in the metadata configuration file into form code. Specifically, the front-end page of the terminal can include a dynamic parsing engine responsible for reading the metadata configuration file. The terminal can determine all field information contained in the target form to be generated based on the metadata configuration file, and determine the identification ID of the target component contained in each form field configuration. The terminal can also determine the component model corresponding to the target component based on the target component identification ID. The terminal can generate a target component instance based on the configuration information and layout style information of the target component in the component model file and metadata. All form field information is looped to generate a form corresponding to the target project composed of the target components.
[0104] In the specific implementation, the use of metadata to define the structure of the form can flexibly describe the various components and their properties in the form, such as field type, name, validation rules, layout style, etc. By configuring the form as a metadata file, developers can easily edit and update the form structure without modifying the underlying code, and it is also convenient for sharing and reusing the form configuration; it supports a variety of commonly used form components, such as text boxes, single check boxes, date selectors, drop-down lists, etc. These built-in form components are configured as model files. The model file contains the identification ID of the component and can be easily added and customized through metadata file configuration without the developer writing code. In addition, developers can also add new components according to their needs, so that the form generation method can adapt to various complex business scenarios; the data validation rule configuration function can ensure that the data entered by the user conforms to the expected format and logic. Through metadata configuration, developers can specify the validation rules for each form item, such as required items, data types, prompt information, etc.; based on the mapping rules between data types and components, the corresponding form components are automatically assigned to the form fields through the data type information and mapping rules configured by metadata. For example, when the data type is a string, the corresponding form component is a text box; when the data type is a date, the corresponding form component is a date picker. Developers can modify the generated form component type to adapt to custom form scenarios. It supports associating forms with business models. If business requirements change, you can select another business model and regenerate the metadata file of the form configuration to quickly adjust the structure and function of the form and reduce maintenance costs.
[0105] In this embodiment, when building a form, the user only needs to select the business model and the form fields to be generated, and then multiple types of forms can be quickly generated according to preset rules and default configurations, making form generation more convenient and quick; by configuring the form as a metadata file, developers can easily edit and update the form structure without modifying the underlying code, which facilitates the sharing and reuse of form configurations and improves the flexibility of the form; the form is associated with the business model. If the business requirements change, you can select another business model, modify the form configuration items and rule information, and regenerate the form, thereby reducing maintenance costs.
[0106] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0107] Based on the same inventive concept, the embodiment of the present application also provides a metadata-based multi-type form generation device for implementing the metadata-based multi-type form generation method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more metadata-based multi-type form generation device embodiments provided below can refer to the limitations of the metadata-based multi-type form generation method above, and will not be repeated here.
[0108] In an exemplary embodiment, Figure 4 As shown, a multi-type form generation device based on metadata is provided, including: a creation module 402, an acquisition module 404, a conversion module 406 and a generation module 408, wherein:
[0109] The creation module 402 is used to create a tree structure list for the target project; the tree structure list is used to display the system engineering information of the target project.
[0110] The acquisition module 404 is used to acquire the form field, data field and form component type information of each business data model corresponding to the system engineering information in response to the trigger operation on the system engineering information.
[0111] The conversion module 406 is used to configure the data validation rule information of the form field, obtain the layout style information of the form item corresponding to the form field, convert the form field, the data field, the form component type information, the data validation rule information and the layout style information into metadata, and obtain a metadata configuration file.
[0112] The generating module 408 is used to generate a form corresponding to the metadata configuration file according to the metadata configuration file.
[0113] In one of the exemplary embodiments, the acquisition module 404 is further specifically used to send a business model list acquisition request corresponding to the system engineering information to the server, and receive the business model list information returned by the server; the business model list information includes at least one business data model; in response to a trigger operation for each business data model in the business model list information, send a data list acquisition request corresponding to each business data model to the server, and receive the data list information returned by the server; analyze the model structure corresponding to each business data model, and determine the form field of each business data model.
[0114] In one of the exemplary embodiments, the acquisition module 404 is further specifically used to respond to a trigger operation on each form field corresponding to each business data model, determine the data field corresponding to each form field according to the data list information; the form field is bidirectionally bound to the data field; and determine the data field of each business data model corresponding to the system engineering information according to the data field corresponding to each form field.
[0115] In one of the exemplary embodiments, the acquisition module 404 is further specifically used to determine the form component type information of the form items corresponding to the form fields according to the data types of the data fields of the business data models corresponding to the system engineering information in accordance with preset mapping rules; the mapping rules represent the mapping relationship between the data type of the data field and the component type of the form component; and the form component type information of the business data models corresponding to the system engineering information is determined according to the form component type information of the form items corresponding to the form fields.
[0116] In one of the exemplary embodiments, the above-mentioned generation module 408 is specifically used to parse the metadata configuration file, determine the form fields, data fields, form component type information and layout style information corresponding to the metadata configuration file; and generate a form corresponding to the metadata configuration file according to the form fields, data fields, form component type information and layout style information corresponding to the metadata configuration file.
[0117] In one of the exemplary embodiments, the above-mentioned device also includes a verification module, which is specifically used to parse the metadata configuration file and determine the data verification rule information corresponding to the metadata configuration file; in response to a data input operation for any form item in the form corresponding to the metadata configuration file, obtain input data corresponding to the data input operation; and determine the data verification result corresponding to the input data according to the data verification rule information corresponding to the metadata configuration file.
[0118] Each module in the above-mentioned metadata-based multi-type form generation device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.
[0119] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 5 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (Near Field Communication, NFC) or other technologies. When the computer program is executed by the processor, a multi-type form generation method based on metadata is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0120] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0121] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0122] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0123] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0124] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0125] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0126] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0127] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for generating multi-type forms based on metadata, It is characterized in that The method comprises: Creating a tree structure list for a target project; the tree structure list is used to display system engineering information of the target project; In response to a trigger operation on the system engineering information, obtaining form fields, data fields, and form component type information of each business data model corresponding to the system engineering information; Configure data validation rule information of the form field, obtain layout style information of the form item corresponding to the form field, convert the form field, the data field, the form component type information, the data validation rule information and the layout style information into metadata to obtain a metadata configuration file; A form corresponding to the metadata configuration file is generated according to the metadata configuration file.
2. The method according to claim 1, It is characterized in that The obtaining of form fields, data fields and form component type information of each business data model corresponding to the system engineering information includes: Sending a business model list acquisition request corresponding to the system engineering information to a server, and receiving business model list information returned by the server; the business model list information includes at least one business data model; In response to a trigger operation on each business data model in the business model list information, sending a data list acquisition request corresponding to each business data model to the server, and receiving the data list information returned by the server; The model structures corresponding to the business data models are analyzed to determine the form fields of the business data models.
3. The method according to claim 2, It is characterized in that The obtaining of form fields, data fields and form component type information of each business data model corresponding to the system engineering information includes: In response to a trigger operation on each form field corresponding to each business data model, determining a data field corresponding to each form field according to the data list information; the form field is bidirectionally bound to the data field; According to the data fields corresponding to the form fields, the data fields of the business data models corresponding to the system engineering information are determined.
4. The method according to claim 3, It is characterized in that The obtaining of form fields, data fields and form component type information of each business data model corresponding to the system engineering information includes: According to the preset mapping rules, based on the data types of the data fields of the business data models corresponding to the system engineering information, the form component type information of the form items corresponding to the form fields is determined; the mapping rules represent the mapping relationship between the data types of the data fields and the component types of the form components; According to the form component type information of the form items corresponding to the form fields, the form component type information of each business data model corresponding to the system engineering information is determined.
5. The method according to claim 1, It is characterized in that Generating a form corresponding to the metadata configuration file according to the metadata configuration file includes: Parsing the metadata configuration file to determine the form field, data field, form component type information and layout style information corresponding to the metadata configuration file; A form corresponding to the metadata configuration file is generated according to the form fields, data fields, form component type information and layout style information corresponding to the metadata configuration file.
6. The method according to claim 5, It is characterized in that The method further comprises: Parsing the metadata configuration file to determine data validation rule information corresponding to the metadata configuration file; In response to a data input operation on any form item in the form corresponding to the metadata configuration file, obtaining input data corresponding to the data input operation; According to the data validation rule information corresponding to the metadata configuration file, a data validation result corresponding to the input data is determined.
7. A multi-type form generation device based on metadata, It is characterized in that The device comprises: A creation module, used to create a tree structure list for a target project; the tree structure list is used to display system engineering information of the target project; An acquisition module, configured to acquire form fields, data fields, and form component type information of each business data model corresponding to the system engineering information in response to a trigger operation on the system engineering information; A conversion module, used to configure the data validation rule information of the form field, obtain the layout style information of the form item corresponding to the form field, convert the form field, the data field, the form component type information, the data validation rule information and the layout style information into metadata to obtain a metadata configuration file; The generating module is used to generate a form corresponding to the metadata configuration file according to the metadata configuration file.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Dynamic configuration management method and system under single-machine lightweight scene
CN120872405A
Data processing method and device, computer equipment and storage medium
CN120910134A
Extensible tree structure dynamic modeling method and system for steel quality standard
CN121388026A
