CN115857934A - Method for generating form page according to configuration variable file - Google Patents
Method for generating form page according to configuration variable file Download PDFInfo
- Publication number
- CN115857934A CN115857934A CN202211711555.8A CN202211711555A CN115857934A CN 115857934 A CN115857934 A CN 115857934A CN 202211711555 A CN202211711555 A CN 202211711555A CN 115857934 A CN115857934 A CN 115857934A
- Authority
- CN
- China
- Prior art keywords
- configuration
- page
- generating
- file
- generator
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Stored Programmes (AREA)
Abstract
The invention discloses a method for generating a form page according to a configuration variable file, which comprises the following steps: s1, generating a configuration file, wherein the configuration file comprises configuration items of each business form; s2, generating a form generator, wherein the form generator is used for converting the configuration information in the configuration file into a page understood by the browser; and S3, using a service page to refer to the form generator and the configuration file, and loading the service page to a browser. The invention can avoid repeated and low-efficiency form development work, save a large amount of manpower, improve the development efficiency, also generate a large amount of business codes through a machine, standardize the code format, and the generated codes have less low-level BUG, thereby reducing the maintenance cost.
Description
Technical Field
The invention relates to the technical field of software research and development, in particular to a method for generating a form page according to a configuration variable file.
Background
With the rapid development of computer technology and high-level programming languages, how to reduce the learning cost and improve the programming efficiency becomes the focus of attention of software development practitioners. With the influence of continuous updating and changing of the internet on the front-end technology, modularization, low coding and automation trend are achieved. Among many front-end business functions, filling in forms through a browser is the most common use scenario and is an important form of human-computer interaction. Currently, there are a number of relatively sophisticated form generation plug-ins available. However, these form generation plug-ins often have a number of limitations, are tied to additional business logic, rely on additional frameworks (such as VUE), and cannot be a relatively independent programming method, for example: a large number of form pages are often required to be developed in a background management system, a large number of similar or repeated form pages exist in the forms, the pages are required to be rapidly developed through effective and unified management, and the software quality and the development progress are improved. Therefore, it is important to find a more independent and efficient programming method to reduce duplicate code, low-level BUGs.
Disclosure of Invention
The invention aims to provide a method for generating a form page according to a configuration variable file, so as to overcome the defects in the prior art.
In order to achieve the purpose, the technical scheme adopted by the invention is as follows:
a method for generating a form page according to a configuration variable file comprises the following steps:
s1, generating a configuration file, wherein the configuration file comprises configuration items of each business form;
s2, generating a form generator, wherein the form generator is used for converting the configuration information in the configuration file into a page understood by the browser;
and S3, using a service page to refer to the form generator and the configuration file, and loading the service page to a browser.
Further, the content of the configuration file in step S1 includes an attribute of each element in each service form, the topmost data of the configuration file is an array, each data element is a configuration ITEM, and the configuration ITEM has a globally unique key value.
Further, the configuration ITEM at least contains the basic form configuration of the form label name, the form name value, and the form element type.
Further, the page understood by the browser is an HTML page or a DOM page.
Further, a form page is generated correspondingly to the configuration item of each business form in the configuration file, and a form field in the form page is generated correspondingly to the element of each configuration item.
Further, the form generator in step S2 further includes a rendering method for distinguishing element types of the service form and at least for different form states of addition, editing and details.
Further, the form generator further comprises callback functions of each rendered phase.
Further, the form generator also includes a function for resetting the form.
Compared with the prior art, the invention has the advantages that: the method for generating the form page according to the configuration variable file can avoid repeated and low-efficiency form development work, save a large amount of manpower, improve the development efficiency, generate a large amount of service codes through a machine, enable the code format to be standard, and enable the generated codes to have less low-level BUG, thereby reducing the maintenance cost.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flow diagram of a method of generating a form page from a configuration variable file in accordance with the present invention.
FIG. 2 is a basic abstract diagram of the invention.
FIG. 3 is a multi-profile abstract legend for the present invention.
Detailed Description
The preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings so that the advantages and features of the present invention can be more easily understood by those skilled in the art, and the scope of the present invention will be more clearly and clearly defined.
Referring to fig. 1 to fig. 3, the embodiment discloses a method for generating a form page according to a configuration variable file, including the following steps:
s1, generating a configuration file, wherein the configuration file comprises configuration items of each business form.
Specifically, the content of the configuration file is described around the attribute of each element in each form (for example, filedType represents a form tag type, and its specific code value can be divided into input, select, checkBox, radio, textarea, etc.).
In this embodiment, writing the JavaScript configuration file of each service form can distinguish a project module (as shown in fig. 3), for example, user.
In this embodiment, the topmost data of the configuration file is an array (formed by combining configuration files of respective modules), where each array element is referred to as a configuration ITEM.
Wherein the configuration ITEM provides a globally unique key value (e.g.: renderKey: 'FORMGENERATION _ USER _ ADDINFO').
The configuration ITEM should include basic form configuration, including a form label name, a form name value, a form element type, and the like.
And S2, generating a form generator, wherein the form generator is used for converting the configuration information in the configuration file into a page understood by the browser, and the page can be an HTML page or a DOM page.
Specifically, the form generator is a plug-in program for generating a web form, each form configuration in the configuration file generates a form page correspondingly, and each configured element generates a form field in the form page correspondingly.
In this embodiment, when writing a form generator, the program should explicitly input parameters, and the input parameters include a form unique key, a container (optional), a rendering type, whether to disable, form echoing data (optional), a rendering hook callback, and the like.
The form generator can generate a basic form page, distinguish form element types, and provide a corresponding rendering method for different form states such as new addition, editing, details and the like.
In this embodiment, the form generator should provide callback functions of each rendered phase, so as to facilitate the calling of the service program.
In this embodiment, the form generator should conform to the front-end JavaScript code specification.
In this embodiment, the result produced by the form generator should be an HTML string or a virtual DOM, and the output result can be inserted into a specific service page.
In this embodiment, the form generator should provide a function for resetting the form to facilitate the service program call
And S3, referring the form generator and the configuration file by adopting a service page, and loading the service page to a browser.
Specifically, the service page is a generic name of a browser page for displaying a form filling function. Each business page requires a reference form generator and configuration file. In general, business pages also need to contain web page styles and other business processes. The service page is loaded by the browser and is interpreted by a JavaScript language to become a visual browser form function page.
In the embodiment, the form generator plug-in and the configuration file are introduced into the overall project (for example, a non-frame single-page project, only the main page HTML is required to be introduced, if the front-end frame, the frame is introduced into the frame entry for mounting, and for example, for the non-single-page project, the configuration file and the form generator plug-in are required to be ensured to be loaded as required), and the introduced plug-in is named and cannot be renamed with other functions.
In this embodiment, a specific service page program code is written, which complies with the front-end code specification, and the service page should not be an excessively complex combined page, and should not have an excessively coupled page state, the program naming mode of the service page should be as strict as possible, the CLASS naming related to the form generator plug-in should meet the specification (if it is a VUE-like frame page, KEY should be added to the corresponding container HTML), and it is ensured that it is globally unique.
The embodiment is supported by JavaScript language and does not depend on any front-end framework.
The invention can avoid repeated and low-efficiency form development work, save a large amount of manpower, improve the development efficiency, also generate a large amount of business codes through a machine, standardize the code format, and the generated codes have less low-level BUG, thereby reducing the maintenance cost.
Although the embodiments of the present invention have been described with reference to the accompanying drawings, various changes or modifications may be made by the patentees within the scope of the appended claims, and within the scope of the invention, as long as they do not exceed the scope of the invention described in the claims.
Claims (8)
1. A method for generating a form page according to a configuration variable file is characterized by comprising the following steps:
s1, generating a configuration file, wherein the configuration file comprises configuration items of each business form;
s2, generating a form generator, wherein the form generator is used for converting the configuration information in the configuration file into a page understood by the browser;
and S3, using a service page to refer to the form generator and the configuration file, and loading the service page to a browser.
2. The method for generating a form page according to a configuration variable file as claimed in claim 1, wherein the content of the configuration file in step S1 includes an attribute of each element in each business form, the topmost data of the configuration file is an array, each data element is a configuration ITEM, and the configuration ITEM has a globally unique key value.
3. The method of claim 2, wherein the configuration ITEM comprises at least a basic form configuration of a form label name, a form name value, and a form element type.
4. The method of generating form pages from configuration variable files of claim 1 wherein the pages understood by the browser are HTML pages or DOM pages.
5. The method of claim 1, wherein the configuration item of each business form in the configuration file corresponds to a form page, and the element of each configuration item corresponds to a form field in the form page.
6. The method of claim 1, wherein the form generator in step S2 further comprises a rendering method for distinguishing element types of the service form and at least different form states of addition, editing and detail.
7. The method of generating form pages from a configuration variable file as recited in claim 6, wherein the form generator further comprises callback functions for each stage after rendering.
8. The method of generating form pages from a configuration variable file of claim 6 wherein the form generator further comprises a function for resetting the form.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211711555.8A CN115857934A (en) | 2022-12-29 | 2022-12-29 | Method for generating form page according to configuration variable file |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211711555.8A CN115857934A (en) | 2022-12-29 | 2022-12-29 | Method for generating form page according to configuration variable file |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115857934A true CN115857934A (en) | 2023-03-28 |
Family
ID=85656045
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211711555.8A Pending CN115857934A (en) | 2022-12-29 | 2022-12-29 | Method for generating form page according to configuration variable file |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115857934A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116775005A (en) * | 2023-08-22 | 2023-09-19 | 浪潮软件股份有限公司 | Method, device and storage medium for dynamically loading function modules js and css |
-
2022
- 2022-12-29 CN CN202211711555.8A patent/CN115857934A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116775005A (en) * | 2023-08-22 | 2023-09-19 | 浪潮软件股份有限公司 | Method, device and storage medium for dynamically loading function modules js and css |
CN116775005B (en) * | 2023-08-22 | 2024-01-30 | 浪潮软件股份有限公司 | Method, device and storage medium for dynamically loading function modules js and css |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101339500B (en) | Data binding application program interface creation method based on XML mode | |
US7774435B2 (en) | System and method for batch tuning intelligent devices | |
KR101099272B1 (en) | Web page rendering mechanism using external programmatic themes | |
US8156471B2 (en) | Multi-language execution method | |
CN101192216B (en) | Static state page control and WEB server interaction accomplishing method and the WEB server | |
US7610545B2 (en) | Annotations for tracking provenance | |
CN113126990B (en) | Page development method, device, equipment and storage medium | |
CN112711408A (en) | Vue componentization-based visualization configuration rendering method, system and terminal | |
CN103955364A (en) | Front end assembly method suitable for mobile phone | |
US7865481B2 (en) | Changing documents to include changes made to schemas | |
CN111158687B (en) | Interface generation method and device of JAVA plugin, computer equipment and storage medium | |
CN114047970A (en) | Configuration method and system of AUTOSAR (automotive open system architecture) architecture software | |
CN105589959A (en) | Form processing method and form processing system | |
CN110109671B (en) | Webpack label size and style conversion method and device | |
CN115857934A (en) | Method for generating form page according to configuration variable file | |
CN116974620A (en) | Application program generation method, operation method and corresponding device | |
US7657869B2 (en) | Integration of external tools into an existing design environment | |
CN113687827A (en) | Data list generation method, device and equipment based on widget and storage medium | |
CN113377453A (en) | Picture processing method and device and electronic equipment | |
CN115543440A (en) | Method for migrating android project to android-like system, electronic equipment and storage medium | |
CN107643892B (en) | Interface processing method, device, storage medium and processor | |
US8010563B2 (en) | Computer program product and computing system for information organization using markup languages | |
KR20050057822A (en) | Method for realization gui using xml | |
Guduric et al. | A comparison between relational and operational QVT mappings | |
CN111736833A (en) | Method and system for generating popup component, electronic device and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |