CN114356291A - Method, device, equipment and medium for generating form based on configuration file - Google Patents

Method, device, equipment and medium for generating form based on configuration file Download PDF

Info

Publication number
CN114356291A
CN114356291A CN202210038232.0A CN202210038232A CN114356291A CN 114356291 A CN114356291 A CN 114356291A CN 202210038232 A CN202210038232 A CN 202210038232A CN 114356291 A CN114356291 A CN 114356291A
Authority
CN
China
Prior art keywords
label
target
tag
configuration file
data content
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
Application number
CN202210038232.0A
Other languages
Chinese (zh)
Inventor
袁世琦
韩杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Telecom Corp Ltd
Original Assignee
China Telecom Corp Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by China Telecom Corp Ltd filed Critical China Telecom Corp Ltd
Priority to CN202210038232.0A priority Critical patent/CN114356291A/en
Publication of CN114356291A publication Critical patent/CN114356291A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure provides a method, a device, equipment and a medium for generating a form based on a configuration file, and relates to the technical field of computers. The method comprises the following steps: acquiring a configuration file of a form to be generated in a target platform, and acquiring data content of a form label to be generated by analyzing the configuration file; acquiring a target label format used by a target interface library on a target platform; and generating a form in a target label format according to the data content of each label. The method and the device split the style and the display content of the form by using the mode of importing the configuration file, solve the problems that a form framework cannot be reused and each form needs to be subjected to independent attribute and check rule to construct, improve the degree of freedom of form generation and reduce the code maintenance cost.

Description

Method, device, equipment and medium for generating form based on configuration file
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a medium for generating a form based on a configuration file.
Background
In the prior art, a form page is created when the form is developed each time, data in a specified format is required to be used for generating the form, the format of an attribute value is strictly required, and the form is only suitable for a specific framework. In addition, form components need to be written repeatedly, and each form item needs separate properties and validation rules to control. Therefore, for the same type of components, a large amount of repeated codes can be generated by using the prior art to create the form, so that the form code amount is huge, the form logic is redundant, and the maintenance of the codes at the later stage is inconvenient.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The present disclosure provides a method, an apparatus, a device, and a medium for generating a form based on a configuration file, which overcome, at least to some extent, the problem in the related art that a form framework cannot be reused.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to an aspect of the present disclosure, there is provided a method for generating a form based on a configuration file, including: acquiring a configuration file of a form to be generated, wherein the form to be generated is the form to be generated in a target platform; analyzing the configuration file to obtain the data content of at least one label in the form to be generated; acquiring a target label format used by a target interface library on the target platform; and generating the form in the target label format according to the data content of each label.
In an embodiment of the present disclosure, the obtaining a target tag format used by a target interface library on the target platform includes: acquiring identification information of a target interface library on the target platform; matching the identification information of the target interface library with the identification information of a plurality of pre-enumerated interface libraries, wherein each pre-enumerated interface library corresponds to one type of label format; and determining a target label format used by the target interface library according to the matching result.
In an embodiment of the present disclosure, the configuration file at least includes a tag name, a tag type, and tag attribute description information of each tag.
In an embodiment of the present disclosure, the configuration file further includes operation attribute information of each tag, where the operation attribute information includes: the system comprises a first operation attribute parameter and a second operation attribute parameter, wherein a parameter value of the first operation attribute parameter is used for indicating whether each tag is optional, and a parameter value of the second operation attribute parameter is used for indicating whether each tag is forbidden.
In an embodiment of the present disclosure, the generating the form in the target tag format according to the data content of each tag includes: converting the data content of each label into a character string in the target label format; and generating a form which accords with the target interface library on the target platform according to the converted character string.
In an embodiment of the present disclosure, after generating the form in the target label format according to the data content of each label, the method further includes: judging whether the size information of the form exceeds the size information of the current display interface or not according to the data content of each label; and if so, displaying the data content of each label in the form in a column-divided display mode.
In an embodiment of the present disclosure, the displaying, in a column-by-column display manner, data content of each tag in the form includes: and displaying the data content of each label in the form in a column display mode according to the label type of each label.
According to still another aspect of the present disclosure, there is provided an electronic device including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the above-described method of generating a form based on a configuration file via execution of the executable instructions.
According to yet another aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the above-described method of generating a form based on a configuration file.
The embodiment of the disclosure provides a method, a device, equipment and a medium for generating a form based on a configuration file, which are used for acquiring the configuration file of the form to be generated in a target platform and acquiring the data content of a form label to be generated by analyzing the configuration file; acquiring a target label format used by a target interface library on the target platform; generating a form in the target label format according to the data content of each label, and isolating service logic and codes by taking the configuration file as a data source for generating the form, so that the degree of freedom of form generation is improved; by matching with an interface library used by the platform, the generated form keeps consistent with the overall style of the platform, the form generation mode is cross-platform, and the portability is strong.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty.
FIG. 1 is a flow diagram illustrating a method for generating a form based on a configuration file in an embodiment of the disclosure;
FIG. 2 is a flow diagram illustrating an embodiment of a method for generating a form based on a configuration file in an embodiment of the disclosure;
FIG. 3 is a flow diagram illustrating an embodiment of a method for generating a form based on a configuration file in an embodiment of the disclosure;
FIG. 4 is a flow diagram illustrating an exemplary embodiment of a method for generating a form based on a configuration file in an embodiment of the disclosure;
FIG. 5a shows a schematic diagram of a form in a prior art embodiment;
FIG. 5b is a schematic diagram of a horizontal column form in an embodiment of the present disclosure;
FIG. 5c is a diagram illustrating another vertical column form in an embodiment of the present disclosure;
FIG. 6 is a flow diagram illustrating an exemplary embodiment of a method for generating a form based on a configuration file in accordance with an embodiment of the disclosure;
FIG. 7 is a schematic diagram illustrating an apparatus for generating a form based on a configuration file according to an embodiment of the present disclosure;
FIG. 8 is a block diagram of an electronic device according to an embodiment of the disclosure;
FIG. 9 is a schematic diagram of a computer-readable storage medium in an embodiment of the disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
For ease of understanding, the following first explains several terms to which the disclosure relates:
JavaScript: JS, for short, is a lightweight, interpreted or just-in-time, programming language with function priority.
Vue: progressive JavaScript framework. Unlike other large frames, Vue is designed to be applied layer by layer from the bottom up. Vue, the core library only focuses on the viewing layer, not only is it easy to get on hand, but also it is easy to integrate with third party libraries or existing projects.
Element: a set of Vue 2.0.0-based desktop end-of-line component libraries for developers, designers, and product managers. The Vue can be well matched for project development, and a plurality of components with uniform styles and beautiful appearance are provided.
iView: a set of open source UI component library based on a progressive framework (Vue. js) of a user interface mainly serves background and middle products of a computer interface.
UI (user interface): user Interface, User Interface.
A UI library: the front end UI library is also called a UI component library. Including component libraries such as Element, iView, and the like.
HTML: hyper Text Markup Language, hypertext Markup Language, is a Markup Language. The document format on the network can be unified through the labels, so that the scattered Internet resources are connected into a logic whole. HTML text is descriptive text consisting of HTML commands that can specify words, graphics, animations, sounds, tables, links, etc.
DOM node: DOM Nodes, according to the HTML DOM standard of W3C (World Wide Web Consortium), all contents in an HTML document are Nodes: the whole document is a document node; each HTML element is an element node; the text within the HTML element is a text node; each HTML attribute is an attribute node; the annotations are annotation nodes.
Json: JavaScript Object Notation, which is a JavaScript Object Notation, Json refers to a data format similar to a JavaScript Object, and different from Json, attribute names and string values of the Json data format need to be referred to by double quotation marks, and reading data errors may be caused by using a single quotation mark or without using a quotation mark. Another data format of Json is array, which is the same literal quantity as an array in JavaScript.
Js: js uses an event-driven and non-blocking I/O model, so that the JavaScript operation environment based on the Chrome V8 engine is light and efficient.
The present exemplary embodiment will be described in detail below with reference to the drawings and examples.
First, a method for generating a form based on a configuration file is provided in the embodiments of the present disclosure, and the method may be performed by any electronic device with computing processing capability.
Fig. 1 is a flowchart illustrating a method for generating a form based on a configuration file in an embodiment of the present disclosure, and as shown in fig. 1, the method for generating a form based on a configuration file in an embodiment of the present disclosure includes the following steps:
s102, obtaining a configuration file of a form to be generated, wherein the form to be generated is the form to be generated in the target platform.
It should be noted that the form to be generated in the embodiment of the present invention may be a form page in a front end page. Wherein, the front page comprises the following three parts: a structural layer, a presentation layer, and a behavior layer. In the front-end page, a structural layer is created by a markup language such as HTML; the presentation layer is responsible for creation by the CSS. The behavior layer is created by JavaScript. In HTML, generally, Form tags are referred to as forms. The configuration file in the embodiment of the invention can be a file in a Json format, which is created by business personnel according to the requirement of the display content of the form, and comprises data in a front-end page in the form. The target platform in the embodiment of the invention is configured with node.
In the embodiment of the disclosure, the form is generated by using a mode of importing the configuration file and combining the configured UI library, so that the degree of freedom of form generation is improved, and the code maintenance cost is reduced.
And S104, analyzing the configuration file to obtain the data content of at least one label in the form to be generated.
It should be noted that parsing the configuration file in the embodiment of the present invention refers to parsing data in the configuration file by node. js, where the configuration file is a file in a Json format created by a service person according to a requirement of a form display content, and includes data in a front-end page in the form; the form to be generated in the embodiment of the invention is a form page in a front-end page; the labels in the embodiment of the invention can be form labels in the front-end page, which describe the semantic meaning of the web page content, but the labels do not contain information about the form content; the data content of the tag may be parameter information of the tag.
For example, a profile includes an input tag: and obtaining the data content type of the Input label in the form to be generated as the text and the name as the user name after node.
In the embodiment of the disclosure, the data content of the tag in the form is acquired by analyzing the configuration file, the service logic and the code are isolated, and the degree of freedom of generating the form is improved.
In one embodiment of the present disclosure, the configuration file at least includes a tag name, a tag type, and tag attribute description information of each tag.
In specific implementation, name may be used to represent the tag name, type may be used to represent the tag type, and label may be used to represent the tag attribute description information.
For example, a certain profile contains the following information:
< label for ═ enabled "> tag ═ input type ═ text" name ═ enabled "/>;
in the p-tag, label is a tag attribute description, name is a tag name, and type is a tag type. the type is "text" as the label type is text label type, the name is "enabled" as the label name enabled, and the label for is "enabled" as the label attribute is optional.
According to the method and the device, the basic information required by the form is defined by using the label name, the label type and the label attribute description information, and the problem that the form cannot be displayed due to lack of related label attributes is solved.
In an embodiment of the present disclosure, the configuration file further includes operation attribute information of each tag, and the operation attribute information may include: the tag comprises a first operation attribute parameter and a second operation attribute parameter, wherein a parameter value of the first operation attribute parameter is used for indicating whether each tag is optional, and a parameter value of the second operation attribute parameter is used for indicating whether each tag is forbidden.
It should be noted that, the operation attribute information is validated by label attribute description information label binding. And assigning an operation attribute information to the tag attribute description information, wherein the operation attribute information can be a first operation attribute parameter enable representing optional operation or a second operation attribute parameter disable representing disable operation.
In a specific implementation, the first operation attribute parameter may be enable, and when the enable is included in the tag, the first operation attribute parameter indicates that the tag is optional; the second operational property parameter may be disable, indicating disablement when included in the tag. For example, < p > < label for ═ enabled "> optionally </label > < input type ═ text" name ═ enabled "/>; < p > < label for ═ disabled "> disabled </label > < input type ═ text" name ═ disabled "/>".
The embodiment enriches the forms generated by setting parameters for the operation attribute information, can limit the corresponding operation attribute according to the requirements, and improves the practicability and diversity of the forms.
And S106, acquiring a target label format used by a target interface library on the target platform.
It should be noted that, in the embodiment of the present invention, a node. The target interface library in the embodiment of the invention is one of various UI libraries configured by the business personnel on the target platform and more in need of selection. The target label format in the embodiment of the invention is the label format of the target interface library.
For example, the target platform is configured with node. js front-end development environment and Element UI library and iView UI library; and the target interface library is an Element UI library selected by the service personnel according to the requirement. The target label format is in an Element UI library, the format of an input box is el-input, the format of a radio box is el-radio, the format of a multi-selection box is el-checkbox, the format of a switch is el-switch, the format of a selector is el-select, and the format of date selection is el-date-picker.
In one embodiment of the disclosure, the target platform obtains a package json file through a static module packaging tool Webpack of a modern JavaScript application. Json file defines various modules required by the form and configuration information (such as metadata of UI library name, UI library version and the like) of the form, and the package json file is generated in node js when the operating environment of the target platform is configured. Json file is read by the target platform, and information using a UI library (equivalent to the target interface library) on the target platform is acquired. The target platform can obtain target label formats of various UI libraries, and the target label formats used by the target interface library can be determined by using the information of the UI libraries on the target platform.
As shown in table 1, if the Element component library is used on the target platform, the target tag format of the Input box is < el-Input >, and if the iView component library is used on the target platform, the target tag format of the Input box is < Input >. All UI component libraries may be used and this disclosure is not particularly limited.
TABLE 1
Input box Radio frame Multi-selection frame Switch with a switch body Selector device Date selection
Element <el-input> <el-radio> <el-checkbox> <el-switch> <el-select> <el-date-picker>
iView <Input> <Radio> <Checkbox> <Switch> <Select> <DatePicker>
According to the embodiment, the pre-configured label format of the UI library is used, so that the data volume of the matched labels is reduced, and the form generation efficiency is improved.
And S108, generating a form in a target label format according to the data content of each label.
It should be noted that each tag in the embodiment of the present invention refers to a form tag in a configuration file, which describes semantic meaning of web page content and also includes how to display information about the form content; the data content of the tag can be parameter information of the tag, namely information about the form content; the form is a form page in the front-end page, the form style is constructed in advance, and the displayed form can be rendered and generated in the target platform only by acquiring the data content of the tag.
In one embodiment of the present disclosure, a tag composition form of < p > < label for ═ enabled "> < label-input type ═ text" name ═ enabled "/>, is generated according to type ═ text," enabled ", label for ═ enabled", and a target tag format for an Element component library.
The method and the device split the style and the display content of the form by using the mode of importing the configuration file, solve the problems that a form framework cannot be reused and each form needs to be subjected to independent attribute and check rule to construct, improve the degree of freedom of form generation and reduce the code maintenance cost.
In an embodiment of the present disclosure, as shown in fig. 2, the method for generating a form based on a configuration file provided in the embodiment of the present disclosure may determine a target tag format used by a target interface library through the following steps, and may accurately match the target tag format used by the target interface library:
s202, obtaining the identification information of the target interface library on the target platform.
It should be noted that the identification information of the target interface library on the target platform may be a UI library name, and exists in a package json file.
And S204, matching the identification information of the target interface library with the identification information of a plurality of pre-enumerated interface libraries, wherein each pre-enumerated interface library corresponds to one type of label format.
It should be noted that the identification information of the pre-enumerated interface libraries may be tags appearing in the form, tags not belonging to the form tags are discarded, and enumeration is not performed. Therefore, the number of matched labels is reduced, and the matching efficiency is improved.
In an embodiment of the present disclosure, the identification information of the target interface library on the target platform is obtained as an Element, and a format of a form tag corresponding to a pre-enumerated Element component library may be: an input box el-input, a radio box el-radio, a multi-box el-checkbox, a switch el-switch, a selector el-select, and a date select el-date-picker.
And S206, determining the target label format used by the target interface library according to the matching result.
In an embodiment of the disclosure, according to the matching result being an Element component, determining that the target label format used by the target interface library is an input box el-input, a radio box el-radio, a multi-selection box el-checkbox, a switch el-switch, a selector el-select, and a date selection el-date-picker.
According to the method and the device, the labels in the form are enumerated in advance, the logical redundancy of the form is reduced, and the code splicing efficiency is improved.
In an embodiment of the present disclosure, as shown in fig. 3, the method for generating a form based on a configuration file provided in the embodiment of the present disclosure may generate a form in a target tag format by the following steps, and may convert the tag format of the configuration file to generate a target tag format conforming to a target interface library, and render the target tag format onto a page:
s302, converting the data content of each label into a character string in a target label format.
It should be noted that, when the conversion is performed, a fuzzy matching or regular matching mode is adopted, and the input in the configuration file can be matched to the el-input in the Element component through the fuzzy matching or regular matching mode, so that the value of the input in the configuration file is written into the el-input box.
In one embodiment of the present disclosure, an item of data content in a configuration file is < p > < label for ═ enabled "> optional </label > < input type ═ text" name ═ enabled "/>, and a character string converted into a format of an Element component library is < p > < label for ═ optional </label > < el-input type ═ text" name ═ enabled "/>.
And S304, generating a form conforming to the target interface library on the target platform according to the converted character string.
In one embodiment of the disclosure, a form is generated by putting < label for ═ enabled "> optionally </label > < el-input type ═ text" name ═ enabled "/> into a position where an actual business requirement needs to be rendered.
According to the method and the system, through tag format conversion, the configuration file is used as a data source for generating the form, the business logic and the codes are isolated, and the form can be generated by business personnel at will, so that the code maintenance cost is reduced, and the form style displayed on a page by the whole platform is unified.
In an embodiment of the present disclosure, as shown in fig. 4, after generating a form in a target tag format according to data content of each tag, the method for generating a form based on a configuration file provided in the embodiment of the present disclosure may further include the following steps:
s402, judging whether the size information of the form exceeds the size information of the current display interface according to the data content of each label.
It should be noted that, in the common form, the data content showing each tag is shown in a row and column, and when the length of the data content of each tag exceeds the size of the current display interface, the interface cannot show all the data content. As shown in fig. 5a, the data content has four items of user name, occupation, input search and effective range, which occupy a page table and are displayed on a page, and when other data content exceeds the page length, the data content cannot be placed on a page display.
And S404, if so, displaying the data content of each label in the form in a column-dividing display mode.
In the embodiment of the present application, in order to solve the problem that one interface cannot completely display the data content due to too much data content, the data may be displayed in horizontal columns, as shown in fig. 5 b. FIG. 5b is a schematic diagram of a horizontal column form in an embodiment of the disclosure. In the horizontal column form of FIG. 5b, the user's basic information is a column, the asset information is a column, and the contact information is a column. Clicking the basic information of the user can display the basic information column of the user: name, please enter the input box of the name. The browse switching mode may switch the horizontal form to the vertical form as shown in FIG. 5 c. In the vertical column form of fig. 5c, a collapse button in each column can be clicked to hide the columns, reducing the page length occupied by each column. Clicking the browse switching mode may again switch to the horizontal column form.
In an embodiment, if more than three tags are set according to the size of the current display interface, the data content of each tag in the form is displayed in a column display mode. For example, the data content of the tag in the configuration file includes a user name, a job, an input search, and an effective range, and if the maximum value of the tag exceeds three preset single pages, the data content of the four tags, i.e., the user name, the job, the input search, and the effective range, in the form is displayed in a column-division display mode.
In one embodiment, the displaying the data content of each tag in the form by a column-divided display manner may include: and displaying the data content of each label in the form in a column display mode according to the label type of each label.
According to the method and the device, the data content length of each label is combined with the size of the current display interface to make judgment, exclusive scene display is made for the form of which the size information exceeds the size of the display interface, and the user experience is improved.
In an embodiment of the present disclosure, as shown in fig. 6, a specific example of the method for generating a form based on a configuration file provided in the embodiment of the present disclosure includes the following steps:
s602: importing a configuration file in a target platform (configured with node. js front-end development environment, an Element UI library, an iView UI library, a Vuetify UI library, a Vux UI library, a Mini UI library, an Ant-design UI library and a Cube-UI UI library), wherein the configuration file is obtained by uploading a Json format and attributes specified by type, label and name according to actual service requirements;
s604: a target platform reads a configuration file through node.js, traverses data (equivalent to the data in the configuration file), and determines basic information (equivalent to the data content of a tag in the form) of a form item according to specified attributes such as type, label, name and the like;
s606: reading a package json file by a target platform through a Webpack, acquiring a UI (equivalent to the target interface library) used by the target platform through the package json file, and performing regular matching (or fuzzy matching) on the target platform according to a fixed use format of labels in different UI libraries (equivalent to a target label format used by the target interface library);
s608: the target platform reads the parameters (corresponding to the operation attribute information of the tag) of the extended function, such as whether Enable is optional (corresponding to the first operation attribute parameter) and Disable is forbidden (corresponding to the second operation attribute parameter);
s610: concatenating (converting) the finally parsed data (corresponding to the data content of the tag) into a character string of a predetermined format (corresponding to the target tag format);
s612: HTML elements in a string format (corresponding to the data contents of the tags) are inserted into the designated positions of the Dom nodes (corresponding to the form frames).
According to the method and the device, the configuration file is used as a data source for generating the form, the service logic and the code are isolated, and the freedom degree of the form generation is improved; multiple times of mapping matching is carried out through the UI library used by the platform, the generated form is consistent with the integral style of the platform, the form generating mode is cross-platform, and the transportability is strong; the scene expansion is carried out on a large form with more form items, and modes such as subfield form viewing, support folding and unfolding, common scrolling viewing, label page switching viewing and the like are provided.
Based on the same inventive concept, an apparatus for generating a form based on a configuration file is also provided in the embodiments of the present disclosure, as described in the following embodiments. Because the principle of the embodiment of the apparatus for solving the problem is similar to that of the embodiment of the method, the embodiment of the apparatus can be implemented by referring to the implementation of the embodiment of the method, and repeated details are not described again.
Fig. 7 is a schematic diagram illustrating an apparatus for generating a form based on a configuration file according to an embodiment of the present disclosure, and as shown in fig. 7, the apparatus includes:
the file obtaining module 71 is configured to obtain a configuration file of a form to be generated, where the form to be generated is a form to be generated in a target platform;
the analysis file module 72 is used for analyzing the configuration file to obtain the data content of at least one label in the form to be generated;
an obtain tag format module 73, configured to obtain a target tag format used by a target interface library on a target platform;
and a form generation module 74, configured to generate a form in the target tag format according to the data content of each tag.
In one embodiment of the present disclosure, the get tag format module 73 is further configured to: acquiring identification information of a target interface library on a target platform; matching the identification information of the target interface library with the identification information of a plurality of pre-enumerated interface libraries, wherein each pre-enumerated interface library corresponds to one type of label format; and determining a target label format used by the standard interface library according to the matching result.
In an embodiment of the present disclosure, the configuration file acquired by the acquiring file module 71 at least includes a tag name, a tag type, and tag attribute description information of each tag.
Further, in an embodiment of the present disclosure, the configuration file acquired by the acquiring file module 71 further includes operation attribute information of each tag, where the operation attribute information includes: the tag comprises a first operation attribute parameter and a second operation attribute parameter, wherein a parameter value of the first operation attribute parameter is used for indicating whether each tag is optional, and a parameter value of the second operation attribute parameter is used for indicating whether each tag is forbidden.
In one embodiment of the present disclosure, the generate forms module 74 is further configured to: converting the data content of each label into a character string in a target label format; and generating a form which accords with the target interface library on the target platform according to the converted character string.
In an embodiment of the present disclosure, the apparatus for generating a form based on a configuration file further includes:
the judging module is used for judging whether the size information of the form exceeds the size information of the current display interface or not according to the data content of each label;
a column dividing module: and the display device is used for displaying the data content of each label in the form in a column display mode.
In one embodiment of the present disclosure, the column module is further configured to: and displaying the data content of each label in the form in a column display mode according to the label type of each label.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
An electronic device 800 according to this embodiment of the disclosure is described below with reference to fig. 8. The electronic device 800 shown in fig. 8 is only an example and should not bring any limitations to the functionality and scope of use of the embodiments of the present disclosure.
As shown in fig. 8, electronic device 800 is in the form of a general purpose computing device. The components of the electronic device 800 may include, but are not limited to: the at least one processing unit 810, the at least one memory unit 820, and a bus 830 that couples the various system components including the memory unit 820 and the processing unit 810.
Wherein the storage unit stores program code that is executable by the processing unit 810 to cause the processing unit 810 to perform steps according to various exemplary embodiments of the present disclosure as described in the "exemplary methods" section above in this specification.
For example, the processing unit 810 may perform the following steps of the above method embodiments: acquiring a configuration file of a form to be generated, wherein the form to be generated is the form to be generated in a target platform; analyzing the configuration file to obtain the data content of at least one label in the form to be generated; acquiring a target label format used by a target interface library on a target platform; and generating a form in a target label format according to the data content of each label.
For example, the processing unit 810 may further perform the following steps in obtaining a target tag format used by a target interface library on a target platform: acquiring identification information of a target interface library on a target platform; matching the identification information of the target interface library with the identification information of a plurality of pre-enumerated interface libraries, wherein each pre-enumerated interface library corresponds to one type of label format; and determining a target label format used by the target interface library according to the matching result.
For example, the configuration file executed by the processing unit 810 in the step at least includes the tag name, the tag type, and the tag attribute description information of each tag.
Further, the processing unit 810 executes that the configuration file in the step further includes operation attribute information of each tag, where the operation attribute information includes: the tag comprises a first operation attribute parameter and a second operation attribute parameter, wherein a parameter value of the first operation attribute parameter is used for indicating whether each tag is optional, and a parameter value of the second operation attribute parameter is used for indicating whether each tag is forbidden.
For example, the processing unit 810 executes the steps of generating a form in a target tag format according to the data content of each tag, including: converting the data content of each label into a character string in a target label format; and generating a form which accords with the target interface library on the target platform according to the converted character string.
For example, after the processing unit 810 generates a form in a target tag format according to the data content of each tag, the following steps may be further performed: judging whether the size information of the form exceeds the size information of the current display interface or not according to the data content of each label; and if so, displaying the data content of each label in the form in a column display mode.
Further, the processing unit 810 performs the step of displaying the data content of each tag in the form in a column-by-column display manner: and displaying the data content of each label in the form in a column display mode according to the label type of each label.
The storage unit 820 may include readable media in the form of volatile memory units such as a random access memory unit (RAM)8201 and/or a cache memory unit 8202, and may further include a read only memory unit (ROM) 8203.
The storage unit 820 may also include a program/utility 8204 having a set (at least one) of program modules 8205, such program modules 8205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 830 may be any of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 800 may also communicate with one or more external devices 840 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 800, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 800 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 850. Also, the electronic device 800 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 860. As shown, the network adapter 860 communicates with the other modules of the electronic device 800 via the bus 830. It should be appreciated that although not shown, other hardware and/or software modules may be used in conjunction with the electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium, which may be a readable signal medium or a readable storage medium. Fig. 9 is a schematic diagram of a computer-readable storage medium in an embodiment of the disclosure, and as shown in fig. 9, the computer-readable storage medium 900 has a program product stored thereon, which is capable of implementing the above-mentioned method of the disclosure. In some possible embodiments, various aspects of the disclosure may also be implemented in the form of a program product comprising program code for causing a terminal device to perform the steps according to various exemplary embodiments of the disclosure described in the "exemplary methods" section above of this specification, when the program product is run on the terminal device.
For example, the program product in the embodiments of the present disclosure, when executed by a processor, implements a method comprising: acquiring a configuration file of a form to be generated, wherein the form to be generated is the form to be generated in a target platform; analyzing the configuration file to obtain the data content of at least one label in the form to be generated; acquiring a target label format used by a target interface library on a target platform; and generating a form in a target label format according to the data content of each label.
In some embodiments, the program product in the embodiments of the present disclosure, when executed by a processor, may further implement a method of: acquiring identification information of a target interface library on a target platform; matching the identification information of the target interface library with the identification information of a plurality of pre-enumerated interface libraries, wherein each pre-enumerated interface library corresponds to one type of label format; and determining a target label format used by the target interface library according to the matching result.
In some embodiments, the program product in the embodiments of the present disclosure, when executed by a processor, may further implement a method of: and acquiring a configuration file of the form to be generated, wherein the configuration file at least comprises the label name, the label type and the label attribute description information of each label.
Further, in some embodiments, the program product in the embodiments of the present disclosure, when executed by a processor, may further implement a method comprising: obtaining a configuration file of a form to be generated, wherein the configuration file also comprises operation attribute information of each label, and the operation attribute information comprises: the tag comprises a first operation attribute parameter and a second operation attribute parameter, wherein a parameter value of the first operation attribute parameter is used for indicating whether each tag is optional, and a parameter value of the second operation attribute parameter is used for indicating whether each tag is forbidden.
In some embodiments, the program product in the embodiments of the present disclosure, when executed by a processor, may further implement a method of: converting the data content of each label into a character string in a target label format; and generating a form which accords with the target interface library on the target platform according to the converted character string.
In some embodiments, the program product in the embodiments of the present disclosure, when executed by a processor, may further implement a method of: judging whether the size information of the form exceeds the size information of the current display interface or not according to the data content of each label; and if so, displaying the data content of each label in the form in a column display mode.
In some embodiments, the program product in the embodiments of the present disclosure, when executed by a processor, may further implement a method of: and displaying the data content of each label in the form in a column display mode according to the label type of each label.
More specific examples of the computer-readable storage medium in the present disclosure may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
In the present disclosure, a computer readable storage medium may include a propagated data signal with readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Alternatively, program code embodied on a computer readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
In particular implementations, program code for carrying out operations of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + +, or the like, as well as conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Moreover, although the steps of the methods of the present disclosure are depicted in the drawings in a particular order, this does not require or imply that the steps must be performed in this particular order, or that all of the depicted steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

Claims (10)

1. A method for generating a form based on a configuration file, comprising:
acquiring a configuration file of a form to be generated, wherein the form to be generated is the form to be generated in a target platform;
analyzing the configuration file to obtain the data content of at least one label in the form to be generated;
acquiring a target label format used by a target interface library on the target platform;
and generating the form in the target label format according to the data content of each label.
2. The method for generating a form based on a configuration file of claim 1, wherein the obtaining a target label format used by a target interface library on the target platform comprises:
acquiring identification information of a target interface library on the target platform;
matching the identification information of the target interface library with the identification information of a plurality of pre-enumerated interface libraries, wherein each pre-enumerated interface library corresponds to one type of label format;
and determining a target label format used by the target interface library according to the matching result.
3. The method of claim 1, wherein the configuration file comprises at least a tag name, a tag type, and tag attribute description information for each tag.
4. The method of claim 3, wherein the configuration file further contains operation attribute information of each tag, and the operation attribute information comprises: the system comprises a first operation attribute parameter and a second operation attribute parameter, wherein a parameter value of the first operation attribute parameter is used for indicating whether each tag is optional, and a parameter value of the second operation attribute parameter is used for indicating whether each tag is forbidden.
5. The method of claim 1, wherein generating the form in the target tag format based on the data content of each tag comprises:
converting the data content of each label into a character string in the target label format;
and generating a form which accords with the target interface library on the target platform according to the converted character string.
6. The method of generating forms based on a configuration file of claim 1, wherein after generating the form in the target tag format based on the data content of each tag, the method further comprises:
judging whether the size information of the form exceeds the size information of the current display interface or not according to the data content of each label;
and if so, displaying the data content of each label in the form in a column display mode.
7. The method of claim 6, wherein the displaying the data content of each tag in the form by a column-divided display manner comprises:
and displaying the data content of each label in the form in a column display mode according to the label type of each label.
8. An apparatus for generating a form based on a configuration file, comprising:
the file obtaining module is used for obtaining a configuration file of a form to be generated, wherein the form to be generated is the form to be generated in the target platform;
the analysis file module is used for analyzing the configuration file and acquiring the data content of at least one label in the form to be generated;
the tag format obtaining module is used for obtaining a target tag format used by a target interface library on the target platform;
and the form generation module is used for generating a form in the target label format according to the data content of each label.
9. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to execute the method of generating a form based on a configuration file of any of claims 1-7 via execution of the executable instructions.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the method for generating a form based on a configuration file according to any one of claims 1 to 7.
CN202210038232.0A 2022-01-13 2022-01-13 Method, device, equipment and medium for generating form based on configuration file Pending CN114356291A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210038232.0A CN114356291A (en) 2022-01-13 2022-01-13 Method, device, equipment and medium for generating form based on configuration file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210038232.0A CN114356291A (en) 2022-01-13 2022-01-13 Method, device, equipment and medium for generating form based on configuration file

Publications (1)

Publication Number Publication Date
CN114356291A true CN114356291A (en) 2022-04-15

Family

ID=81109931

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210038232.0A Pending CN114356291A (en) 2022-01-13 2022-01-13 Method, device, equipment and medium for generating form based on configuration file

Country Status (1)

Country Link
CN (1) CN114356291A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117875845A (en) * 2024-03-08 2024-04-12 宁德时代新能源科技股份有限公司 Data splitting method and device, electronic equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117875845A (en) * 2024-03-08 2024-04-12 宁德时代新能源科技股份有限公司 Data splitting method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109918607B (en) Page construction method and device, medium and computing equipment
CN100440222C (en) System and method for text legibility enhancement
US20060048107A1 (en) Enhanced compiled representation of transformation formats
CN106293675B (en) System static resource loading method and device
US9817811B2 (en) Web server system, dictionary system, dictionary call method, screen control display method, and demonstration application generation method
JP2006202277A (en) General application sequence diagram generator driven by nonspecific language
CN111656453A (en) Hierarchical entity recognition and semantic modeling framework for information extraction
CN111831384A (en) Language switching method and device, equipment and storage medium
US20090083300A1 (en) Document processing device and document processing method
CN112463152A (en) Webpage adaptation method and device based on AST
CN110308907B (en) Data conversion method and device, storage medium and electronic equipment
EP1768034A1 (en) Document processing device and document processing method
US20080005662A1 (en) Server Device and Name Space Issuing Method
CN113495730A (en) Resource package generation and analysis method and device
KR101552914B1 (en) Web server application framework web application processing method using the framework and computer readable medium processing the method
CN114356291A (en) Method, device, equipment and medium for generating form based on configuration file
CN113641433A (en) Multi-language page conversion method and unit of front-end internationalized multi-language file based on i18n technology
CN108694043B (en) Page decoration method and system
US20080005085A1 (en) Server Device and Search Method
CN111198738A (en) Mobile terminal page display method and device and electronic equipment
CN113127776A (en) Breadcrumb path generation method and device and terminal equipment
CN113687827B (en) Data list generation method, device and equipment based on widget and storage medium
US9141342B2 (en) Programmatic conversion of support documentation into executable programs
CN113703638A (en) Data management page processing method and device, electronic equipment and storage medium
US20090083620A1 (en) Document processing device and document processing method

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