Form rendering method and device, storage medium and computer device

CN115576557BActive Publication Date: 2026-10-09GUANGZHOU WERIDE TECH LTD CO
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211405257.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-10
Publication Date
2026-10-09
Estimated Expiration
2042-11-10

AI Technical Summary

Technical Problem

[0003]本申请的目的旨在至少能解决上述的技术缺陷之一,特别是现有技术中表单渲染时作效率低,且容易出错的问题的技术缺陷

Benefits of technology

[0015] Based on any of the above embodiments, the front-end obtains a first definition file and preprocesses it to obtain a second definition file. Finally, the form is rendered based on the second definition file. Since the first definition file is converted from the back-end definition file, this method reuses the proto file that defines the data structure from the back-end to generate the json file used for front-end rendering. This reduces the time the front-end spends independently writing form rendering files, improves work efficiency, and ensures that the generated form is consistent with the back-end's definition of the same data, thus guaranteeing the accuracy of form generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115576557B_ABST
    Figure CN115576557B_ABST
Patent Text Reader

Abstract

The application provides a form rendering method and device, a storage medium and a computer device. The method comprises the following steps: obtaining a first definition file from a backend; the first definition file is obtained by converting a backend definition file format, the first definition file is a definition file in a json format, and the backend definition file is a definition file in a proto format; preprocessing the first definition file to obtain a second definition file; the preprocessing comprises simplifying a nested object in the first definition file; the type definition of the nested object before simplification is located in other data objects of the first definition file; the nested object after simplification comprises a type definition composed of a simple object; the data type of the simple object is a preset data type; there is a corresponding relationship between the preset data type and a rendering style; and rendering is performed based on the second definition file to generate a form. The method can reduce the time for independently writing a form rendering file by the front end, improve work efficiency, and also ensure the accuracy of form generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet technology, and in particular to a form rendering method, apparatus, storage medium, and computer device. Background Technology

[0002] In front-end projects, forms are a primary means of information entry. Especially in visualization and simulation tools, the front-end page often displays a very complex form for algorithm engineers to edit, and this data is then sent to the back-end program for processing. However, in traditional technologies, the back-end frequently needs to modify the data structure, requiring front-end developers to constantly modify the front-end form rendering code according to the latest structure, leading to low work efficiency and a high risk of errors. Summary of the Invention

[0003] The purpose of this application is to at least solve one of the aforementioned technical defects, particularly the technical defect of low efficiency and error-proneness in form rendering in the prior art.

[0004] In a first aspect, embodiments of this application provide a form rendering method, comprising: obtaining a first definition file from a backend; the first definition file is obtained by converting the format of a backend definition file, wherein the first definition file is a JSON format definition file and the backend definition file is a proto format definition file; preprocessing the first definition file to obtain a second definition file; the preprocessing includes simplifying nested objects in the first definition file, wherein the type definition of the nested objects before simplification is located in other data objects in the first definition file, and the simplified nested objects include type definitions composed of simple objects, wherein the data type of the simple objects is a preset data type, and there is a correspondence between the preset data type and the rendering style; and rendering based on the second definition file to generate a form.

[0005] In one embodiment, the nested objects in the first definition file are simplified by: determining a first target object from the first positioning file according to the data type of the nested object; the first target object has the same data type name as the nested object; and adding the type definition of the nested object to the nested object according to the first target object.

[0006] In one embodiment, for any nested object, rendering is performed based on a second definition file, including: reading a type definition from the nested object; rendering the form element corresponding to the nested object according to the rendering style corresponding to each simple object in the type definition; the form element corresponding to the nested object includes the form sub-elements corresponding to each simple object in the type definition.

[0007] In one embodiment, the preset data type includes an enumeration type, and the preprocessing further includes: adding a corresponding auxiliary object to the selected object in the first definition file; the definition of the selected object includes two or more candidate objects, the candidate objects are simple objects, the selected object can only be set to one of the corresponding candidate objects, the data type of the auxiliary object is an enumeration type, and the enumeration content of the auxiliary object includes the name of the candidate object corresponding to the selected object.

[0008] In one embodiment, the rendering style corresponding to the enumeration type is a selection control. For any selection object, rendering is performed based on the second definition file, including: using the selection control generated by rendering the auxiliary object corresponding to the selection object as an associated control; selecting a candidate object that matches the selection content from the definition of the selection object according to the selection content of the associated control; and rendering the form element corresponding to the selection object according to the rendering style corresponding to the data type of the selected candidate object.

[0009] In one embodiment, the preset data types include basic data types and custom data types.

[0010] In one embodiment, rendering based on a second definition file to generate a form includes: obtaining a setting file corresponding to a first definition file from a backend; the setting file includes exclusion statements, hiding statements, and / or modification statements, wherein data objects declared in the exclusion statements do not need to be rendered, data objects other than those declared in the hiding statements will be hidden, and modification statements are used to modify the definitions of data objects in the second definition file; and rendering based on the second definition file and the setting file to generate a form.

[0011] Secondly, embodiments of this application also provide a form rendering apparatus, including: a data acquisition module, used to acquire a first definition file from a backend; the first definition file is obtained by converting the format of a backend definition file, wherein the first definition file is a JSON format definition file and the backend definition file is a proto format definition file; a preprocessing module, used to preprocess the first definition file to obtain a second definition file; the preprocessing includes simplifying nested objects in the first definition file, wherein the type definition of the nested objects before simplification is located in other data objects of the first definition file, and the simplified nested objects include type definitions composed of simple objects, wherein the data type of the simple objects is a preset data type, and there is a correspondence between the preset data type and the rendering style; and a rendering module, used to render based on the second definition file to generate a form.

[0012] Thirdly, embodiments of this application also provide a computer device, including one or more processors and a memory, the memory storing computer-readable instructions, which, when executed by one or more processors, perform the steps of the form rendering method in any of the above embodiments.

[0013] Fourthly, embodiments of this application also provide a storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the form rendering method in any of the above embodiments.

[0014] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:

[0015] Based on any of the above embodiments, the front-end obtains a first definition file and preprocesses it to obtain a second definition file. Finally, the form is rendered based on the second definition file. Since the first definition file is converted from the back-end definition file, this method reuses the proto file that defines the data structure from the back-end to generate the json file used for front-end rendering. This reduces the time the front-end spends independently writing form rendering files, improves work efficiency, and ensures that the generated form is consistent with the back-end's definition of the same data, thus guaranteeing the accuracy of form generation. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 A flowchart illustrating the form rendering method provided in this application embodiment;

[0018] Figure 2 This is a schematic diagram of a backend definition file containing nested objects in one embodiment of this application;

[0019] Figure 3 for Figure 2 A diagram showing the backend definition file containing the type definitions of nested object data types;

[0020] Figure 4 For based on Figure 2 and Figure 3 A diagram illustrating the first definition file obtained from the backend definition file;

[0021] Figure 5 for Figure 4 A simplified diagram of nested objects in the first definition file;

[0022] Figure 6 This is a schematic diagram of the form rendering result in one embodiment;

[0023] Figure 7 This is a schematic diagram of a backend definition file containing an alternative object in one embodiment of this application;

[0024] Figure 8 This is a schematic diagram of the form rendering result in another embodiment;

[0025] Figure 9 To exclude via the configuration file Figure 6 This is an illustration of how to set the display effect of a form.

[0026] Figure 10 To use hidden statements in the configuration file Figure 6 This is an illustration of how to set the display effect of a form.

[0027] Figure 11 An internal structural diagram of the computer device provided in this application. Detailed Implementation

[0028] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0029] This application provides a form rendering method. Please refer to [link / reference]. Figure 1 This includes steps S102 to S106.

[0030] S102, retrieve the first definition file from the backend.

[0031] The first definition file is obtained by converting the backend definition file format. The first definition file is in JSON format, while the backend definition file is in proto format. This is understandable, as many backend services currently use the protobuf language to define data structures, and proto format definition files are defined files written in protobuf. However, backend definition files are generally stored in the backend's file system, and there may be dependencies between them, making it difficult for the frontend to easily obtain all the backend definition files needed to render the form. Figure 2As shown, 210 declares the language used by the backend definition file, 220 declares the backend definition file named ". / custom_message.proto" that is imported by this backend definition file, and 230 declares a message body named "TestConfig" in this backend definition file. Within this message body, the object named "customField" declared in 240 has a data type of "CustomMessage," the definition of which is not clear in the backend definition file. The backend definition file ". / custom_message.proto" is... Figure 3 As shown, 310 declares the language used by the backend definition file, and 320 declares a message body named "CustomMessage". This message body defines the data type definitions of the objects declared in 240, specifically including a simple object with data type "double" and name "doubleField", and a simple object with data type "bool", data property "repeated", and name "repeatedField". Therefore, if it is necessary to render the "customField" object in 240, it is difficult to rely solely on... Figure 2 In this single backend definition file implementation, data objects like "customField" and data objects whose type definitions reside in different message bodies within the backend definition file can be considered nested objects. Therefore, the backend merges and abstracts backend definition files with dependencies, transforming them into a JSON format definition file commonly used in frontend projects. This format conversion of the backend definition files yields the first definition file. The first definition file has better readability, and relevant information for each object is summarized together. Figure 2 and Figure 3 The backend definition file in the middle is obtained after format conversion. Figure 4 The first definition file in the renderable object (simple objects are not in) Figure 4 As shown in the image, only the part related to the nested object "customField" is retained. 410 declares in "fields" that... Figure 2 The corresponding renderable object in the message body of the backend definition file named "TestConfig" is 420, which is the nested object "customField" with data type "CustomMessage". 430 declares... Figure 3The corresponding renderable object in the message body named "CustomMessage" in the backend definition file. The definition of the "CustomMessage" data type is located in the part declared in "fields" in 430, which is the content in 440. This format conversion process can be achieved using the pbjs tool provided by the protobuf official documentation.

[0032] In addition, after the first definition file is generated, it is stored in a location on the backend that can be accessed by the frontend. For example, it can be placed in a static directory on the server. The frontend can retrieve the first definition file by sending an AJAX request to the backend or by having it returned to the frontend via an API. To enable dynamic updates of the form by backend personnel, after modifying the backend definition file, the backend personnel can repeat step S102 once, and the frontend can update the form based on the updated first definition file.

[0033] S104, preprocess the first definition file to obtain the second definition file.

[0034] Preprocessing includes simplifying nested objects in the first definition file.

[0035] While the first definition file is more suitable for rendering forms than the backend definition file, the definition of a nested object alone remains unclear. Generally, data objects with a preset data type have clear definitions and can be directly rendered; that is, there is a correspondence between the preset data type and the rendering style. Therefore, data objects with a preset data type are called simple objects. Preset data types include basic data types and / or custom data types. In computer languages, the most important characteristic of basic data types is that their values ​​cannot be further decomposed into other types. In other words, basic data types are self-explanatory. Basic data types include string, short, int, long, float, double, bool, etc. In some implementations, to increase flexibility, corresponding rendering styles can be set for custom data types. For example, to input three-dimensional coordinates, three float type input boxes can be used. However, to increase flexibility, a data type named "common.geometry.Point3D" can be defined. During rendering, if the custom data type "common.geometry.Point3D" is read, a coordinate point selection control will be rendered. Users can directly input the three-dimensional coordinates of the selected point by clicking on it on the map.

[0036] The data types of nested objects can only be understood by relying on their corresponding type definitions. Although both the nested object and its type definition reside in the first definition file, they belong to different data objects. That is, before simplification, the type definitions of nested objects were located within other data objects in the first definition file. For example... Figure 4 As shown, the nested object "customField" has a data type of "CustomMessage". "CustomMessage" is not a default data type, and its definition exists in another data object named "CustomMessage" within the first definition file. This structure in the first definition file is detrimental to rendering; ideally, each data object to be rendered should have a default data type. Therefore, the nested objects in the first definition file need to be simplified so that the simplified nested objects include type definitions composed of simple objects. For example... Figure 5 As shown, 510 declares the name of the object to be rendered as "customField", and 520 declares the data type of this object. Although the data type is still "CustomMessage", 540 declares the definition of the "CustomMessage" data type in "fields". That is, "customField" is composed of a simple object of type double (doubleField) declared in 550 and a simple object of type bool that can be repeatedly added (repeatedField) declared in 560. 530 defines the nesting relationship of the corresponding data objects' type definitions, which can more clearly show the relationship between data objects. However, in some embodiments, this part can be removed to ensure simplicity. For example, the data type of the "customField" object declared in 530 can only be read from the message bodies "TestConfig" and "CustomMessage" in sequence. When rendering according to the data type of the object to be rendered, if the nested object is traversed in the second definition file, although the data type of the nested object is not the preset data type, the type definition of the data type of the nested object can be found within the nested object. The type definition is composed of simple objects and is clearly defined and renderable. Therefore, the second definition file obtained after preprocessing is more convenient for form rendering.

[0037] S106, Render based on the second definition file to generate a form.

[0038] After obtaining the second definition file, the objects to be rendered can be rendered. By reading the data type (type) of each object to be rendered, the corresponding rendering style is selected to generate the form elements corresponding to each object, and finally the form is obtained. In some embodiments, such as Figure 6 As shown, the correspondence between basic data types and rendering styles can be as follows: string type is rendered as a character input control by default, number type is rendered as a numeric input control by default, boolean type is rendered as a checkbox control by default, and enum type is rendered as a selection control by default. Additionally, in some embodiments, if the object to be rendered has a rule attribute, and the rule attribute reflects that the rendering rule for the object is repeatable, then when the object to be rendered is rendered as the corresponding form element according to its data type, a new control is set for that form element. The new control is used to add an identical form element.

[0039] Based on the form rendering method in this embodiment, the front-end obtains a first definition file and preprocesses it to obtain a second definition file. Finally, the form is rendered based on the second definition file. Since the first definition file is converted from the back-end definition file, this method reuses the proto file that defines the data structure from the back-end to generate the json file used for front-end rendering. This reduces the time the front-end spends independently writing form rendering files, improves work efficiency, and ensures that the generated form is consistent with the back-end's definition of the same data, thus guaranteeing the accuracy of form generation.

[0040] In one embodiment, the nested objects in the first definition file are simplified, including:

[0041] (1) Determine the first target object from the first location file based on the data type of the nested object. The first target object has the same data type name as the nested object.

[0042] It's understandable that the first definition file contains the type definitions of nested objects; however, in different data objects, the type definitions need to be added to the definitions of the nested objects. The type definition of the nested object has the same name as the data type of the nested object, such as... Figure 4 In definition file 420, the nested object "customField" is declared to have a data type of "CustomMessage". In definition file 440, there is a data object named "CustomMessage", which is the type definition for the "CustomMessage" data type. The first target object is the data object in the first definition file that contains the type definition of the nested object's data type. Therefore, based on the data type of the nested object, a first target object matching that data type can be found in the first definition file.

[0043] (2) Based on the first target object, add the type definition of the data type of the nested object to the nested object.

[0044] It is understandable that if the data type of the nested object is single-level nested, that is, the first target object is composed of simple objects, then the first target object is directly merged into the nested object. If the data type of the nested object is multi-level nested, that is, the first target object still contains nested objects, then step (1) can be referred to to determine the first target object corresponding to the nesting level, and merge them layer by layer until a type definition composed entirely of simple objects is obtained.

[0045] In one embodiment, it can be determined whether each object to be rendered is a nested object by obtaining the data type of the object to be rendered and determining whether there is a data object with the same name in the first definition file. If there is, the object to be rendered is determined to be a nested object.

[0046] In one embodiment, for any nested object, rendering is performed based on a second definition file, including:

[0047] (1) Read the type definition from the nested object.

[0048] It is understandable that rendering is based on the data type of each object to be rendered. However, the data type definition of nested objects is not clear, and there is no directly corresponding rendering style. Rendering can only be performed based on the simple objects in the type definition.

[0049] (2) Render the form elements corresponding to the nested objects according to the rendering styles of the simple objects in the type definition. The form elements corresponding to the nested objects include the form sub-elements corresponding to the simple objects in the type definition.

[0050] Specifically, the form elements corresponding to nested objects are composed of the form sub-elements corresponding to the simple objects defined in the type definition. For example... Figure 5 As shown, the type definition of the nested object "customField" declared in 540 includes two simple objects: "doubleField" and "repeatedField". The form element corresponding to "customField" is as follows: Figure 6 As shown in 610, it includes form sub-elements corresponding to the two simple objects "doubleField" and "repeatedField".

[0051] In one embodiment, the preset data type includes an enumeration type, which is a type of basic data type. In the protobuf language, some data object definitions include two or more candidate objects. The candidate objects are simple objects, and the data object can only be set as one of the corresponding candidate objects. This kind of data object selection is called a selector object. Figure 7 In the backend definition file shown, section 710 declares the language used by the backend definition file, section 720 declares a message body named "OneOfConfig," and section 730 declares a data object named "result," which is the alternative object. In protobuf, an object is declared as an alternative object by adding "oneof" before it. Section 740 declares that the alternative object "result" includes two candidate objects: "bool_Result" and "double_Result." If the second definition file, which includes the alternative object, is not processed, the form elements corresponding to the two alternative objects "bool_Result" and "double_Result" will be directly generated, failing to reflect the alternative setting characteristic of "result." Therefore, to facilitate the setting of the alternative object, the preprocessing also includes adding a corresponding auxiliary object to the alternative object in the first definition file. The data type of the auxiliary object is an enumeration type, and the enumeration content of the auxiliary object includes the name of the candidate object corresponding to the alternative object.

[0052] This involves adding an auxiliary selection object to the first definition file to select from the candidate objects. An association is established between the auxiliary object and the candidate objects, declaring which auxiliary object a candidate object is associated with. This association can be established by adding an association attribute to the definitions of the two candidate objects, "bool_Result" and "double_Result," declaring the name of the auxiliary object within the association attribute. When a candidate object is parsed, the association attribute can be used to determine the relationship between the objects.

[0053] In one embodiment, the rendering style corresponding to the enumeration type is a selection control. For any selectable object, rendering is performed based on the second definition file, including:

[0054] (1) The selection control generated by rendering the auxiliary object corresponding to the selected object is the associated control.

[0055] Based on the relationship between the auxiliary object and the candidate objects within the chosen object, the auxiliary object corresponding to the chosen object can be determined.

[0056] (2) Based on the selection content of the associated control, select a candidate object that matches the selection content from the definition of the candidate object, and render the form element corresponding to the candidate object according to the rendering style corresponding to the data type of the selected candidate object.

[0057] The associated control displays the name of the candidate object to the user, who can then set the selected object by manipulating the associated control. Once a candidate object displayed by the associated control is selected, it's equivalent to the user setting the selected object as the chosen candidate object. Therefore, the candidate object is a simple object with its own rendering style, which is determined based on the data type of the selected candidate object to obtain the corresponding form element. For example... Figure 8 As shown, the "result" selection control can display the names of two candidate objects, "boolResult" and "doubleResult". When the selection content of the selection control changes, one of the selected objects will be rendered as a candidate object that matches the selection content.

[0058] In one embodiment, in most application scenarios, each data object in the backend definition file will have a corresponding form element in the form. However, in a few application scenarios, it is desirable to have more flexible control over the content displayed in the form. For example, a certain data object in proto may be optional and does not need to be displayed on the front end. To meet the flexibility requirements, the form is generated based on the second definition file, including:

[0059] (1) Obtain the configuration file corresponding to the first definition file from the backend.

[0060] The configuration file includes exclusion statements, hide statements, and / or modify statements. Data objects declared in exclusion statements do not need to be rendered, data objects other than those declared in hide statements will be hidden, and modify statements are used to modify the definitions of data objects. In short, the configuration file can configure the display of form files. Specifically, exclusion statements can be used to declare data objects that do not need to be displayed, such as... Figure 6 For forms, declaring the "boolField" object in the exclusion statement will result in... Figure 9 In a form, the form element corresponding to "boolField" will not appear in the form. You can also hide all data objects except the declared data object using a hide statement, such as for... Figure 6 For forms, declaring the "boolField" object in the exclusion statement will result in... Figure 10 The form contains only the form element corresponding to "boolField". The definition of the data object in the second definition file can also be modified by declaring the name of the data object and the content to be modified in the modification statement.

[0061] (2) Render the form based on the second definition file and the setting file.

[0062] Before rendering using the second definition file, the configuration file is parsed. Based on exclusion statements, hiding statements, and / or modification statements, it is determined whether the object to be rendered needs to be filtered or whether the second definition file needs to be modified. The configuration file is stored in the backend in the same location as the first definition file, allowing backend personnel to modify it at any time. This satisfies the need for customized form display while also enabling dynamic updates to the form's display effect.

[0063] This application also provides a form rendering apparatus, including a data acquisition module, a preprocessing module, and a rendering module.

[0064] The data acquisition module is used to obtain the first definition file from the backend; the first definition file is obtained by converting the backend definition file format. The first definition file is a definition file in JSON format, while the backend definition file is a definition file in proto format.

[0065] The preprocessing module is used to preprocess the first definition file to obtain the second definition file. The preprocessing includes simplifying the nested objects in the first definition file. The type definition of the nested objects before simplification is located in other data objects in the first definition file. The simplified nested objects include the type definition composed of simple objects. The data type of the simple objects is a preset data type. There is a correspondence between the preset data type and the rendering style.

[0066] The rendering module is used to render forms based on a second definition file.

[0067] In one embodiment, the preprocessing module is used to determine a first target object from a first location file based on the data type of the nested object. The first target object has the same name as the data type of the nested object. And based on the first target object, the type definition of the data type of the nested object is added to the nested object.

[0068] In one embodiment, for nested objects, the rendering module reads the type definition from the nested object. Based on the rendering style corresponding to each simple object in the type definition, it renders the form elements corresponding to the nested object. The form elements corresponding to the nested object include the form sub-elements corresponding to each simple object in the type definition.

[0069] In one embodiment, the preprocessing module is used to add a corresponding auxiliary object to the selected object in the first definition file. The data type of the auxiliary object is an enumeration type, and the enumeration content of the auxiliary object includes the name of the candidate object corresponding to the selected object.

[0070] In one embodiment, the rendering module is used to generate a selection control based on the auxiliary object corresponding to the selection object, which is then used as an associated control. Based on the selection content of the associated control, a candidate object matching the selection content is selected from the definition of the selection object, and the form element corresponding to the selection object is rendered according to the rendering style corresponding to the data type of the selected candidate object.

[0071] In one embodiment, the data acquisition module is further configured to obtain a setting file corresponding to the first definition file from the backend. The rendering module is further configured to perform rendering based on the second definition file and the setting file to generate a form.

[0072] Specific limitations regarding the form rendering device can be found in the limitations of the form rendering method above, and will not be repeated here. Each module in the aforementioned form rendering device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module. It should be noted that the module division in this embodiment is illustrative and only represents a logical functional division; other division methods may be used in actual implementation.

[0073] This application embodiment also provides a computer device, including one or more processors and a memory. The memory stores computer-readable instructions. When the computer-readable instructions are executed by one or more processors, they perform the following: obtaining a first definition file from a backend; the first definition file is obtained by converting the format of the backend definition file, wherein the first definition file is a JSON format definition file and the backend definition file is a proto format definition file; preprocessing the first definition file to obtain a second definition file; the preprocessing includes simplifying nested objects in the first definition file, wherein the type definition of the nested objects before simplification is located in other data objects in the first definition file, and the simplified nested objects include type definitions composed of simple objects, wherein the data type of the simple objects is a preset data type, and there is a correspondence between the preset data type and the rendering style; and rendering based on the second definition file to generate a form.

[0074] In one embodiment, when computer-readable instructions are executed by one or more processors, the steps of the form rendering method in any of the above embodiments are performed.

[0075] Indicatively, such as Figure 11 As shown, Figure 11 This is a schematic diagram of the internal structure of a computer device 1100 provided in an embodiment of this application. The computer device 1100 can be provided as a server. (Refer to...) Figure 11The computer device 1100 includes a processing component 1102, which further includes one or more processors, and memory resources represented by memory 1101 for storing instructions, such as application programs, that can be executed by the processing component 1102. The application programs stored in memory 1101 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 1102 is configured to execute instructions to perform the form rendering method of any of the above embodiments.

[0076] Computer device 1100 may also include a power supply component 1103 configured to perform power management of computer device 1100, a wired or wireless network interface 1104 configured to connect computer device 1100 to a network, and an input / output (I / O) interface 1105. Computer device 1100 may operate on an operating system stored in memory 1101, such as Windows Server™, Mac OS X™, Unix™, Linux™, Free BSD™, or similar.

[0077] Those skilled in the art will understand that Figure 11 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0078] This application embodiment also provides a storage medium storing computer-readable instructions. When executed by one or more processors, the computer-readable instructions cause the one or more processors to perform the following: obtaining a first definition file from a backend; the first definition file is obtained by converting the format of the backend definition file, wherein the first definition file is a JSON format definition file and the backend definition file is a proto format definition file; preprocessing the first definition file to obtain a second definition file; the preprocessing includes simplifying nested objects in the first definition file, wherein the type definition of the nested objects before simplification is located in other data objects in the first definition file, and the simplified nested objects include type definitions composed of simple objects, wherein the data type of the simple objects is a preset data type, and there is a correspondence between the preset data type and the rendering style; and rendering based on the second definition file to generate a form.

[0079] In one embodiment, when computer-readable instructions are executed by one or more processors, the one or more processors cause the one or more processors to perform the steps of the form rendering method in any of the above embodiments.

[0080] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0081] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.

[0082] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A form rendering method, characterized in that, include: Retrieve the first definition file from the backend; The first definition file is obtained by converting the backend definition file format. The first definition file is a JSON format definition file, and the backend definition file is a proto format definition file. The first definition file is preprocessed to obtain a second definition file. The preprocessing includes simplifying the nested objects in the first definition file. The type definition of the nested objects before simplification is located in other data objects in the first definition file. The simplified nested objects include the type definition composed of simple objects. The data type of the simple objects is a preset data type. The preset data type has a corresponding relationship with the rendering style. Render the form based on the second definition file; The preset data type includes an enumeration type, and the preprocessing further includes: Add a corresponding auxiliary object to the selected object in the first definition file; the definition of the selected object includes two or more candidate objects, the candidate objects are the simple objects, the selected object can only be set to one of the corresponding candidate objects, the data type of the auxiliary object is the enumeration type, and the enumeration content of the auxiliary object includes the name of the candidate object corresponding to the selected object; The rendering style corresponding to the enumeration type is a selection control. For any one of the selection objects, the rendering based on the second definition file includes: The selection control generated by rendering the auxiliary object corresponding to the selected object is the associated control; Based on the selection content of the associated control, select a candidate object that matches the selection content from the definition of the candidate object, and render the form element corresponding to the candidate object according to the rendering style corresponding to the data type of the selected candidate object.

2. The method according to claim 1, characterized in that, The simplification of nested objects in the first definition file includes: Based on the data type of the nested object, a first target object is determined from the first definition file; the first target object has the same data type name as the nested object. Based on the first target object, the type definition of the nested object is added to the nested object.

3. The method according to claim 2, characterized in that, For any of the nested objects, the rendering based on the second definition file includes: The type definition is read from the nested object; The form elements corresponding to the nested objects are rendered according to the rendering styles corresponding to the simple objects in the type definition; the form elements corresponding to the nested objects include the form sub-elements corresponding to the simple objects in the type definition.

4. The method according to claim 1, characterized in that, The preset data types include basic data types and custom data types.

5. The method according to claim 1, characterized in that, The step of rendering and generating a form based on the second definition file includes: The configuration file corresponding to the first definition file is obtained from the backend; the configuration file includes exclusion statements, hiding statements and / or modification statements. The data objects declared in the exclusion statements do not need to be rendered, the data objects other than the data objects declared in the hiding statements will be hidden, and the modification statements are used to modify the definitions of the data objects in the second definition file. The form is generated by rendering based on the second definition file and the setting file.

6. A form rendering device, characterized in that, include: The data acquisition module is used to retrieve the first definition file from the backend; The first definition file is obtained by converting the backend definition file format. The first definition file is a JSON format definition file, and the backend definition file is a proto format definition file. A preprocessing module is used to preprocess the first definition file to obtain a second definition file. The preprocessing includes simplifying the nested objects in the first definition file. The type definition of the nested objects before simplification is located in other data objects in the first definition file. The simplified nested objects include the type definition composed of simple objects. The data type of the simple objects is a preset data type. The preset data type has a corresponding relationship with the rendering style. The rendering module is used to render and generate forms based on the second definition file; The preprocessing module is used to add a corresponding auxiliary object to the selected object in the first definition file; the definition of the selected object includes two or more candidate objects, the candidate objects are the simple objects, the selected object can only be set to one of the corresponding candidate objects, the data type of the auxiliary object is an enumeration type, and the enumeration content of the auxiliary object includes the name of the candidate object corresponding to the selected object; The rendering style corresponding to the enumeration type is a selection control; the rendering module is used to render the selection control generated by the auxiliary object corresponding to the selection object as an associated control; according to the selection content of the associated control, select a candidate object that matches the selection content from the definition of the selection object, and render the form element corresponding to the selection object according to the rendering style corresponding to the data type of the selected candidate object.

7. A computer device, characterized in that, It includes one or more processors and a memory storing computer-readable instructions that, when executed by the one or more processors, perform the steps of the form rendering method as described in any one of claims 1 to 5.

8. A storage medium, characterized in that, The storage medium stores computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the form rendering method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Form generation method and device, electronic equipment and medium

    CN110321540A

  • Method and system for converting deep learning training process data into visual data

    CN113419727A