JSON (JavaScript Object Notation) form generation method and device

Through JSON form generation method, the high cost and maintenance difficulties of customer-based development in enterprise report display and filling are solved, and flexible form management and the ability to quickly respond to business needs is realized.

CN119025112AInactive Publication Date: 2024-11-26北京融和友信科技股份有限公司
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411506173.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2024-11-26
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the presentation of existing technologies, in the report presentation and report filling within the enterprise, the customer development workload is large and the cost is high, the system maintenance is difficult, and the form changes and development cycle is long, which cannot meet business needs.

Method used

Using JSON form generation method, by defining div block elements in HTML pages, calling the image conversion function of the form constructor, passing in JSON strings and Boolean objects, parsing and rendering the basic information of the form, capturing form changes in real time, and converting the content into JSON strings are stored in the backend, supporting asynchronous rendering and configuration management.

Benefits of technology

It reduces the workload and implementation costs of custom development, simplifies form change management, can respond to business needs in a timely manner, and improves the flexibility and maintenance convenience of forms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025112A_ABST
    Figure CN119025112A_ABST
Patent Text Reader

Abstract

The invention discloses a JSON (JavaScript Object Notation) form generation method and device. The method for generating the form through the JSON comprises the steps that a div block element is defined in an HTML page, the ID value of the div block element is defined as ExcelId, an image conversion function of a form constructor is called, the image conversion function is transmitted into two parameters, the first parameter is transmitted into a JSON character string, and the second parameter is transmitted into a Boolean object; judging whether the input first parameter is empty or not, if yes, initializing the form, and enabling the content of the form to be empty. According to the method for generating the form through the JSON, various form attributes such as the style, the font style, the font color and the form formula of the form can be converted into the JSON form, and meanwhile conversion of the JSON mode into the visual form is supported.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a JSON form generation method and a JSON form generation device. Background Art

[0002] Currently, the report display and report filling in the enterprise are fixed forms developed by VUE. However, during the implementation process, due to the differences in the needs of each customer, the following problems occurred: 1. The workload of customized development is huge and the implementation cost is high; 2. Due to the characteristics of the product, the table changes frequently after the system goes online, making operation and maintenance extremely difficult; 3. The form change development cycle is very long and cannot meet business needs. Summary of the invention

[0003] The purpose of the present invention is to provide a JSON form generation method to solve at least one of the above technical problems.

[0004] One aspect of the present invention provides a JSON form generation method, the JSON form generation method comprising: Define a div block element in the HTML page, define the ID value of the div block element as ExcelId, call the image conversion function of the form constructor, and pass in two parameters. The first parameter passes in a JSON string, and the second parameter passes in a Boolean object. Determine whether the first parameter passed in is empty. If so, Initialize the form, the form content is empty.

[0005] Optionally, the JSON form generation method further includes: Checks whether the second parameter is empty. By default, it is FALSE. In this case, the form is in read-only mode and editing is not allowed.

[0006] Optionally, the JSON form generation method further includes: Determine whether the first parameter passed in is empty. If not, According to the first parameter passed in by the image conversion function, parse the JSON string to obtain the basic information of the form; The parsed basic form information is rendered and processed into form mode for display.

[0007] Optionally, the JSON form generation method further includes: Capture form changes in real time, parse the changed content into a JSON string through function 2 and pass it to the backend for storage in the persistence layer.

[0008] Optionally, parsing the JSON string according to the first parameter passed into the image conversion function to obtain basic form information includes: Receive the backend JSON string; Verify the integrity of the JSON. If complete, The execution function parses the JSON string and asynchronously parses the basic information of the form to convert it into a graphical form.

[0009] Optionally, the execution function parses the JSON string and asynchronously parses the basic information of the form, thereby converting it into a graphical form including: Graphical asynchronous rendering, asynchronously loading and rendering the JSON string according to regions; wherein the regions include title region, condition region, table header region, data region, and paging region; Load the preset JS function and automatically execute the preset pre-function and post-function; Obtain user operation information, and calculate the final form style and data information based on the user operation and preset functions and formulas.

[0010] Optionally, the basic information of the form includes: Operation button information, query condition information, table formula information, form style information, and form data information.

[0011] Optionally, the real-time capture of form changes and parsing the changed content into a JSON string through function 2 and transmitting it to the backend for storage in the persistence layer include: Get form change information; Convert form change information into a JSON string; Compress the JSON string to obtain a compressed JSON string; Transmit the compressed JSON string to the backend persistence layer.

[0012] The present application also provides a JSON form generation device, the JSON form generation device comprising: A calling module is used to define a div block element in an HTML page, wherein the ID value of the div block element is defined as ExcelId, and to call an image conversion function of a form constructor, wherein the image conversion function passes in two parameters, wherein the first parameter passes in a JSON string, and the second parameter passes in a Boolean object; A judgment module, the judgment module is used to judge whether the first parameter passed in is empty; The form initialization module is used to initialize the form, and the form content is empty.

[0013] Beneficial Effects

[0014] The JSON form generation method of this application can convert various form attributes such as form style, font style, font color, form formula, etc. into JSON format, and also supports converting JSON mode into a visual form. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 It is a flowchart of a JSON form generation method according to an embodiment of the present application.

[0016] Figure 2 It is a schematic diagram of an electronic device for implementing the JSON form generation method of an embodiment of the present application.

[0017] Figure 3 This is a schematic diagram of a specific processing flow of function 1 of this application.

[0018] Figure 4 This is a schematic diagram of the specific processing flow of Function 2 of this application. DETAILED DESCRIPTION

[0019] In order to make the purpose, technical scheme and advantages of the implementation of this application clearer, the technical scheme in the embodiment of this application will be described in more detail below in conjunction with the drawings in the embodiment of this application. In the drawings, the same or similar reference numerals throughout represent the same or similar elements or elements with the same or similar functions. The described embodiments are part of the embodiments of this application, not all of them. The embodiments described below with reference to the drawings are exemplary and are intended to be used to explain this application, and should not be construed as limitations on this application. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application. The embodiments of this application are described in detail below in conjunction with the drawings.

[0020] Figure 1 It is a flowchart of a JSON form generation method according to an embodiment of the present application.

[0021] like Figure 1 The JSON generation form methods shown include: Define a div block element in the HTML page, define the ID value of the div block element as ExcelId, call the image conversion function of the form constructor, and pass in two parameters. The first parameter passes in a JSON string, and the second parameter passes in a Boolean object. Determine whether the first parameter passed in is empty. If so, Initialize the form, the form content is empty.

[0022] The JSON form generation method of this application can convert various form attributes such as form style, font style, font color, form formula, etc. into JSON format, and also supports converting JSON mode into a visual form.

[0023] In this embodiment, the JSON form generation method further includes: Checks whether the second parameter is empty. By default, it is FALSE. In this case, the form is in read-only mode and editing is not allowed.

[0024] In this embodiment, the JSON form generation method further includes: Determine whether the first parameter passed in is empty. If not, According to the first parameter passed in by the image conversion function, parse the JSON string to obtain the basic information of the form; The parsed basic form information is rendered and processed into form mode for display.

[0025] In this embodiment, the JSON form generation method further includes: Capture form changes in real time, parse the changed content into a JSON string through function 2 and pass it to the backend for storage in the persistence layer.

[0026] See also Figure 3 In this embodiment, the first parameter passed in by the image conversion function is used to parse the JSON string and obtain the basic information of the form, including: Receive the backend JSON string; Verify the integrity of the JSON. If complete, The execution function parses the JSON string and asynchronously parses the basic information of the form to convert it into a graphical form.

[0027] In this embodiment, the process of executing function one is as follows: Graphical asynchronous rendering, asynchronously loading and rendering the JSON string according to regions; wherein the regions include title region, condition region, table header region, data region, and paging region; Load the preset JS function and automatically execute the preset pre-function and post-function; Obtain user operation information, and calculate the final form style and data information based on the user operation and preset functions and formulas.

[0028] In this embodiment, the basic information of the form includes: Operation button information, query condition information, table formula information, form style information, and form data information.

[0029] See also Figure 4In this embodiment, the real-time capture of form changes and parsing of the changed content into a JSON string through function 2 and transmitting it to the backend for storage in the persistence layer include: Get form change information; Convert form change information into a JSON string; Compress the JSON string to obtain a compressed JSON string; Transmit the compressed JSON string to the backend persistence layer.

[0030] In this embodiment, the process of executing function 2 is as follows: [Function 1]: This function provides a drag-and-drop page layout design, and converts the graphical form into a JSON string and finally stores it in the database for subsequent use.

[0031] Verify that the incoming JSON is complete and legal The function verifies whether the incoming JSON is complete. It mainly relies on the length of the length field in the JSON content and the received length. If they are inconsistent, the JSON is incomplete and will be rejected.

[0032] JSON type checking Parse the complete JSON data. To solve the transmission efficiency and timeliness issues, this function provides two ways to parse through jsonType in JSON: ① Full: When jsonType=1, it is identified as full synchronization. The current usage scenario is to submit all form designs or modify content at one time ② Incremental: When jsonType=2, it is identified as incremental synchronization. In the current usage scenario, the front-end and back-end need to use ws for front-end and back-end interaction. In the current mode, collaborative editing is also supported, and real-time submission and display are possible. JSON instantiation The parsed JSON is stored in the database according to the rules, supporting ORACLE, Mysql and common domestic databases.

[0033] Form Sharing The prepared forms can be shared with other users or other departments.

[0034] The present application is further described in detail below by way of examples. It should be understood that the examples do not constitute any limitation to the present application.

[0035] This application provides javascript SDK package and js file for table template parsing.

[0036] The javascript SDK package encapsulates WEBSERVER and compression tools. Data is compressed before transmission and transmitted to the backend in real time through WEBSERVER. The backend supports traditional databases and REDIS cache databases.

[0037] The method of the present application is stored in the form of a JSON string, which includes: query condition JSON, form style JSON, form formula JSON, form data JSON and other types of data, and the table builder includes the function of converting between JSON and the table; Function 1 is a JSON to form function. The first parameter is the mode of the JSON string. The JSON string includes various data such as toolbar content, table style, font style, display data, etc.

[0038] The method of this application has the following advantages: 1. All kinds of forms support configuration, which reduces the workload of customized development and reduces the implementation cost; 2. The form supports configuration. After going online, form changes only require modifying the configuration, which reduces workload, shortens the time to go online, and can respond to business needs in a timely manner. 3. Each form can be developed and configured independently, which not only eliminates the impact between forms, but also provides convenience for later maintenance and upgrades.

[0039] JSON is a lightweight data exchange format that uses a text format that is completely independent of programming languages ​​to store and represent data. The simplicity and clear hierarchical structure make JSON an ideal data exchange language. It is easy for humans to read and write, and easy for machines to parse and generate, and effectively improves network transmission efficiency.

[0040] The WEB side outputs a table model that supports various table styles, font styles, table formulas, and also supports function formulas, etc. Changes on the WEB side can be synchronized to the backend persistence layer in real time.

[0041] After using the method of this application, during the implementation process, all budget reporting functions can be developed based on this method and configured on this method to reduce the implementation workload; During use, it can support more complex report models, with more flexible and convenient configuration, able to meet the requirements for adjusting budget reports caused by changes in demand, closely follow business needs, reduce the workload of secondary development, and complete budget reporting work faster.

[0042] The present application also provides a JSON form generation device, the JSON form generation device comprising: A calling module is used to define a div block element in an HTML page, wherein the ID value of the div block element is defined as ExcelId, and to call an image conversion function of a form constructor, wherein the image conversion function passes in two parameters, wherein the first parameter passes in a JSON string, and the second parameter passes in a Boolean object; A judgment module, the judgment module is used to judge whether the first parameter passed in is empty; The form initialization module is used to initialize the form, and the form content is empty.

[0043] It should be noted that the above explanations of the method embodiment are also applicable to the device of this embodiment and will not be repeated here.

[0044] The present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the processor implements the above-mentioned JSON form generation method when executing the computer program.

[0045] The present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it can implement the above JSON form generation method.

[0046] Figure 2 It is an exemplary structural diagram of an electronic device that can implement the JSON form generation method provided according to an embodiment of the present application.

[0047] like Figure 2 As shown, the electronic device includes an input device 501, an input interface 502, a central processor 503, a memory 504, an output interface 505, and an output device 506. The input interface 502, the central processor 503, the memory 504, and the output interface 505 are interconnected through a bus 507, and the input device 501 and the output device 506 are connected to the bus 507 through the input interface 502 and the output interface 505, respectively, and then connected to other components of the electronic device. Specifically, the input device 501 receives input information from the outside, and transmits the input information to the central processor 503 through the input interface 502; the central processor 503 processes the input information based on the computer executable instructions stored in the memory 504 to generate output information, temporarily or permanently stores the output information in the memory 504, and then transmits the output information to the output device 506 through the output interface 505; the output device 506 outputs the output information to the outside of the electronic device for use by the user.

[0048] That is to say, Figure 2The electronic device shown can also be implemented as comprising: a memory storing computer executable instructions; and one or more processors, which can implement the combination when executing the computer executable instructions. Figure 1 Describes the JSON generation form method.

[0049] In one embodiment, Figure 2 The electronic device shown can be implemented to include: a memory 504 configured to store executable program code; and one or more processors configured to run the executable program code stored in the memory 504 to execute the JSON form generation method in the above embodiment.

[0050] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0051] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0052] Computer readable media include permanent and non-permanent, removable and non-removable, and the media can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), data versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0053] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and a module, a program segment or a part of a code includes one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes identified in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or the total flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0054] The processor referred to in this embodiment may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0055] The memory can be used to store computer programs and / or modules. The processor realizes various functions of the device / terminal equipment by running or executing the computer programs and / or modules stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, phone book, etc.), etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0056] In this embodiment, if the module / unit integrated in the device / terminal equipment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device that can carry computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. Although the present application is disclosed as above in terms of a preferred embodiment, it is not intended to limit the present application. Any technical personnel in this field may make possible changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined by the claims of the present application.

[0057] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0058] In addition, it is obvious that the word "comprising" does not exclude other units or steps. Multiple units, modules or devices stated in the device claim can also be implemented by one unit or the overall device through software or hardware.

[0059] Although the present invention has been described in detail above with general descriptions and specific embodiments, it is obvious to those skilled in the art that some modifications or improvements may be made thereto based on the present invention. Therefore, these modifications or improvements made without departing from the spirit of the present invention all fall within the scope of protection claimed by the present invention.

Claims

1. A JSON form generation method, characterized in that: The JSON form generation method includes: Define a div block element in the HTML page, define the ID value of the div block element as ExcelId, call the image conversion function of the form constructor, and pass in two parameters. The first parameter passes in a JSON string, and the second parameter passes in a Boolean object. Determine whether the first parameter passed in is empty. If so, Initialize the form, the form content is empty.

2. The JSON form generation method according to claim 1, characterized in that: The JSON form generation method further includes: Checks whether the second parameter is empty. By default, it is FALSE. In this case, the form is in read-only mode and editing is not allowed.

3. The JSON form generation method according to claim 2, characterized in that: The JSON form generation method further includes: Determine whether the first parameter passed in is empty. If not, According to the first parameter passed in by the image conversion function, parse the JSON string to obtain the basic information of the form; The parsed basic form information is rendered and processed into form mode for display.

4. The JSON form generation method according to claim 3, characterized in that: The JSON form generation method further includes: Capture form changes in real time, parse the changed content into a JSON string through function 2 and pass it to the backend for storage in the persistence layer.

5. The JSON form generation method according to claim 4, characterized in that: According to the first parameter passed in by the image conversion function, the JSON string is parsed to obtain the basic information of the form including: Receive the backend JSON string; Verify the integrity of the JSON. If complete, The execution function parses the JSON string and asynchronously parses the basic information of the form to convert it into a graphical form.

6. The JSON form generation method according to claim 5, characterized in that: The execution function parses the JSON string and asynchronously parses the basic information of the form, thereby converting it into a graphical form including: Graphical asynchronous rendering, asynchronously loading and rendering the JSON string according to regions; wherein the regions include title region, condition region, table header region, data region, and paging region; Load the preset JS function and automatically execute the preset pre-function and post-function; Obtain user operation information, and calculate the final form style and data information based on the user operation and preset functions and formulas.

7. The JSON form generation method according to claim 6, characterized in that: The basic information of the form includes: Operation button information, query condition information, table formula information, form style information, and form data information.

8. The JSON form generation method according to claim 7, characterized in that: The real-time capture of form changes and parsing of the changed content into a JSON string through function 2 and transmitting it to the backend for storage in the persistence layer include: Get form change information; Convert form change information into a JSON string; Compress the JSON string to obtain a compressed JSON string; Transmit the compressed JSON string to the backend persistence layer.

9. A JSON form generation device, characterized in that: The JSON form generation device comprises: A calling module is used to define a div block element in an HTML page, wherein the ID value of the div block element is defined as ExcelId, and to call an image conversion function of a form constructor, wherein the image conversion function passes in two parameters, wherein the first parameter passes in a JSON string, and the second parameter passes in a Boolean object; A judgment module, the judgment module is used to judge whether the first parameter passed in is empty; The form initialization module is used to initialize the form, and the form content is empty.

Citation Information

Patent Citations

  • Method and system for dynamically increasing and decreasing form items, electronic equipment and readable storage medium

    CN115455923A

  • Method for generating WEB front-end image through XML and method for generating WEB front-end image through XML

    CN115640095A

  • Form designer, form generation method and form analysis method

    CN116502619A

  • Method, system and equipment for creating page canvas and storage medium

    CN117270851A

  • Form generation method and system for APP development, electronic equipment and product

    CN118733148A