Method for generating HTML (Hypertext Markup Language) report template and offline generating HTML report

By building and packaging HTML report templates, the problems of high and low computing power requirements and low efficiency of offline HTML report generation in the existing technology are solved, efficient offline data packet generation and update, and the development process is simplified.

CN118897677APending Publication Date: 2024-11-05JIANGSU BOZHI SOFTWARE TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410967688.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-18
Publication Date
2024-11-05

AI Technical Summary

Technical Problem

The existing offline generation methods of HTML reports have high computing power requirements and low generation efficiency, resulting in performance problems and low development efficiency.

Method used

By obtaining the visual element data structure in the web project file, building HTML report templates based on the front-end framework language, and establishing data binding relationships, using the packaging tool to compile and package to generate offline data packets, upload them to the server for assembly, and providing a download interface for the client to View offline.

Benefits of technology

It improves the efficiency of HTML reports generation, reduces computing power consumption, simplifies the development process, and improves code reuse and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118897677A_ABST
    Figure CN118897677A_ABST
Patent Text Reader

Abstract

The invention discloses an HTML (Hypertext Markup Language) report template generation method and device, an HTML report offline generation method and device, equipment and a medium. The offline generation method of the HTML report comprises the following steps: receiving an offline data packet, a webpage project file and a data binding relationship which are sent by a development client and correspond to a target webpage; according to the data binding relationship, obtaining each target data source used for filling each target data structure of the HTML report template from the webpage project file; adding each obtained target data source into a data source file of the offline data packet to obtain an update data packet of the HTML report for offline display; and generating a downloading interface corresponding to the updating data packet, and providing the downloading interface to at least one browsing client, so that the browsing client can check the HTML report of the target website offline. According to the technical scheme, the generation efficiency of the HTML report can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to generation of HTML report templates, and offline generation methods, devices, equipment and media of HTML reports. Background Art

[0002] As modern web applications become increasingly complex and feature-rich, users have higher and higher requirements for application stability and availability. Especially when the network is unstable or offline access is required, providing users with a stable and reliable access experience has become an important challenge for front-end developers.

[0003] Offline HTML reports are a solution that allows front-end applications to store and access data locally on the user's device without connecting to the server in real time. At present, the traditional way of generating offline HTML reports has the following disadvantages: 1) Performance issues: For large reports, loading all data and HTML content at once may cause browser performance degradation, such as slow page loading and excessive memory usage. If the report contains a large number of interactive elements or complex charts, performance issues may be further exacerbated; 2) Time-consuming development: With the change of technology, most front-end developers use frameworks in daily development, but because the generated offline reports cannot be directly generated using framework languages, and there are no mature tools for generating offline HTML reports that can be used directly, developers often need to redevelop HTML templates using HTML template syntax. For some requirements, such as generating HTML offline templates with similar styles and page contents to the original system, the same page needs to be written twice due to different writing methods, resulting in a waste of human resources and seriously affecting development efficiency; 3) High requirements for developers: The nature of offline HTML reports determines that there will definitely be many tables and charts in the report. However, in the process of developing these charts, the third-party tool libraries used in the framework language are not necessarily the same as the tool libraries used when developing HTML templates, and the tool libraries used by the two are even incompatible, which means that developers need to master how to use third-party tool libraries in the framework ecosystem and non-framework ecosystem.

[0004] In summary, the existing offline generation method of HTML reports requires high computing power and the generation efficiency of HTML reports is low. Summary of the invention

[0005] The present invention provides a method, device, equipment and medium for generating an HTML report template and an offline generation method of an HTML report, which can solve the problem that the existing offline generation method of an HTML report has high requirements on computing power and low generation efficiency of an HTML report.

[0006] In a first aspect, an embodiment of the present invention provides a method for generating an HTML report template, which is executed by a development client, and the method includes:

[0007] Acquire a web page project file corresponding to a target web page, and identify a data structure of each visual element included in the web page project file; wherein the web page project file is constructed by using a target front-end framework language;

[0008] In response to a direct reuse of at least one data structure in a target project file, and / or a reuse operation after editing, constructing an HTML report template corresponding to a target web page based on a target front-end framework language;

[0009] In response to the data binding operation, establishing a data binding relationship between each target data structure in the HTML report template and a target data source in the web page project file;

[0010] Constructing a data source file for filling a data source, and adding the data source file to the HTML report template; the data source file is initialized as a blank file;

[0011] Use a packaging tool that is compatible with the target front-end framework language to compile and package the HTML report template to obtain an offline data package;

[0012] Upload the offline data package, web page project file and data binding relationship corresponding to the target web page to the server;

[0013] The offline data packet is used by the server to assemble and generate an update data packet matching the offline HTML report.

[0014] In a second aspect, an embodiment of the present invention provides an offline generation method of an HTML report, which is executed by a server, and the method includes:

[0015] Receive offline data packets, web page project files and data binding relationships corresponding to the target web page sent by the development client;

[0016] According to the data binding relationship, obtaining from the webpage project file each target data source for filling into each target data structure of the HTML report template;

[0017] Adding each acquired target data source to the data source file of the offline data package to obtain an updated data package of the HTML report for offline display;

[0018] A download interface corresponding to the update data packet is generated, and the download interface is provided to at least one browsing client so that the browsing client can view the HTML report of the target website offline.

[0019] In a third aspect, an embodiment of the present invention provides an offline generation method of an HTML report, which is executed by a browsing client, and the method includes:

[0020] Sending an HTML report viewing request corresponding to a target web page to a server, wherein the viewing request includes a web page identifier of the target web page;

[0021] The server pre-stores an HTML report template constructed by the method according to claim 1 or 2; and the server is used to obtain the offline data package, web page project file and data binding relationship of the target web page according to the web page identifier, and extract the matching data source from the web page project file and add it to the data source file of the offline data package to obtain the updated data package;

[0022] After receiving the update data packet fed back by the server, decompressing the update data packet;

[0023] Based on the decompression processing results, the HTML report of the target web page can be viewed offline in the browser.

[0024] In a fourth aspect, an embodiment of the present invention provides a device for generating an HTML report template, the device comprising:

[0025] A data structure identification module is used to obtain a web page project file corresponding to a target web page and identify the data structure of each visual element included in the web page project file; wherein the web page project file is constructed by using a target front-end framework language;

[0026] A template construction module, configured to construct an HTML report template corresponding to a target web page based on a target front-end framework language in response to a direct reuse of at least one data structure in a target project file and / or a reuse operation after editing;

[0027] A data binding module, for establishing a data binding relationship between each target data structure in the HTML report template and a target data source in the web page project file in response to a data binding operation;

[0028] A data source file construction module, used to construct a data source file for filling a data source, and add the data source file to the HTML report template; the data source file is initialized as a blank file;

[0029] The template packaging module is used to compile and package the HTML report template using a packaging tool adapted to the target front-end framework language to obtain an offline data package;

[0030] The data upload module is used to upload the offline data package, web page project file and data binding relationship corresponding to the target web page to the server; wherein, the offline data package is used for the server to assemble and generate an update data package matching the offline HTML report.

[0031] In a fifth aspect, an embodiment of the present invention provides an offline generation device for an HTML report, the device comprising:

[0032] The data receiving module is used to receive the offline data packet, web page project file and data binding relationship corresponding to the target web page sent by the development client;

[0033] A data acquisition module, used for acquiring, according to the data binding relationship, from the webpage project file each target data source for filling into each target data structure of the HTML report template;

[0034] An update data packet acquisition module, used to add each acquired target data source to the data source file of the offline data packet to obtain an update data packet of an HTML report for offline display;

[0035] The report download module is used to generate a download interface corresponding to the update data package, and provide the download interface to at least one browsing client so that the browsing client can view the HTML report of the target website offline.

[0036] In a sixth aspect, an embodiment of the present invention provides an offline generation device for an HTML report, the device comprising:

[0037] A request sending module, used for sending an HTML report viewing request corresponding to a target web page to a server, wherein the viewing request includes a web page identifier of the target web page;

[0038] The server pre-stores an HTML report template constructed by the method according to claim 1 or 2; and the server is used to obtain the offline data package, web page project file and data binding relationship of the target web page according to the web page identifier, and extract the matching data source from the web page project file and add it to the data source file of the offline data package to obtain the updated data package;

[0039] A decompression module, configured to decompress the update data packet after receiving the update data packet fed back by the server;

[0040] The report viewing module is used to view the HTML report of the target web page offline in the browser according to the decompression processing result.

[0041] In a seventh aspect, an embodiment of the present invention provides an electronic device, the electronic device comprising:

[0042] at least one processor; and

[0043] a memory communicatively connected to the at least one processor; wherein,

[0044] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute a method for generating an HTML report template and generating an HTML report offline as described in any embodiment of the present invention.

[0045] In an eighth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement a method for generating an HTML report template and an offline generation method of an HTML report as described in any embodiment of the present invention when executed.

[0046] The technical solution of the embodiment of the present invention first obtains a web page project file corresponding to a target web page through a development client, identifies the data structure of each visual element included in the web page project file, and in response to direct reuse of at least one data structure in the target project file, and / or post-edit reuse operations, obtains an HTML report template corresponding to the target web page based on a target front-end framework language, establishes a data binding relationship between each target data structure in the HTML report template and a target data source in the web page project file in response to a data binding operation, constructs a data source file for filling the data source, and adds the data source file to the HTML report template, compiles and packages the HTML report template using a packaging tool adapted to the target front-end framework language to obtain an offline data package, and uploads the offline data package, web page project file and data binding relationship corresponding to the target web page to a server, then receives the offline data package, web page project file and data binding relationship corresponding to the target web page sent by the development client through the server, and generates a report based on the generated report. The invention discloses a method for obtaining a target data source in each target data structure used to fill in an HTML report template from a web page project file, and adding each target data source obtained to a data source file of an offline data package, so as to obtain an update data package of an HTML report for offline display, and generate a download interface corresponding to the update data package, and provide the download interface to at least one browsing client, so that the browsing client can view the HTML report of the target website offline, and finally send an HTML report viewing request corresponding to the target web page to a server through the browsing client, wherein the viewing request includes a web page identifier of the target web page, and after receiving the update data package fed back by the server, decompress the update data package, and view the HTML report of the target web page offline in the browser according to the decompression result, so as to solve the problem that the existing offline generation method of HTML report has large computing power requirements and low generation efficiency of HTML report, and can improve the generation efficiency of HTML report and reduce the computing power consumption of generating offline HTML report.

[0047] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0049] Figure 1is a flow chart of a method for generating an HTML report template provided according to the first embodiment of the present invention;

[0050] Figure 2 is a flow chart of an offline generation method of an HTML report provided according to Embodiment 2 of the present invention;

[0051] Figure 3 is a flow chart of an offline generation method of an HTML report provided according to Embodiment 3 of the present invention;

[0052] Figure 4 It is a structural schematic diagram of a device for generating an HTML report template according to a fourth embodiment of the present invention;

[0053] Figure 5 is a schematic diagram of the structure of an offline generation device for HTML reports provided according to Embodiment 5 of the present invention;

[0054] Figure 6 is a schematic diagram of the structure of an offline generation device for HTML reports provided according to Embodiment 6 of the present invention;

[0055] Figure 7 It is a structural schematic diagram of an electronic device for realizing the generation of an HTML report template and offline generation of an HTML report according to an embodiment of the present invention. DETAILED DESCRIPTION

[0056] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0057] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, any variation of the terms "including" and "having" is intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0058] Embodiment 1

[0059] Figure 1 A flowchart of a method for generating an HTML report template is provided in the first embodiment of the present invention. This embodiment is applicable to the situation where an HTML report template is generated. The method can be executed by a device for generating an HTML report template. The device for generating an HTML report template can be implemented in the form of hardware and / or software. The device for generating an HTML report template can be configured in a development client with a function of generating an HTML report template.

[0060] like Figure 1 As shown, the method includes:

[0061] S110: Acquire a web page project file corresponding to the target web page, and identify the data structure of each visual element included in the web page project file.

[0062] Among them, the web page project file is constructed through the target front-end framework language.

[0063] Specifically, the visual elements include but are not limited to interactive elements, charts or pictures and other types of data that need to be displayed on the target web page; further, the data structure includes other data contained in each visual element except the specific real-time data and the corresponding position information of the visual element in the target web page.

[0064] S120: In response to direct reuse of at least one data structure in the target project file, and / or a reuse operation after editing, an HTML report template corresponding to the target web page is constructed based on the target front-end framework language.

[0065] In this embodiment, since the HTML report template is constructed based on the target front-end framework language, that is, the HTML report template and the target web page have the same framework language, in the process of developing the HTML report template, the same visual elements such as charts and tables can directly reuse the code data in the target web page, and there is no problem of incompatibility between template data and web page data; exemplarily, if the data structure of the identified visual element A is to display A completely at B of the HTML report template, since the same visual elements such as charts and tables can directly reuse the code data in the target web page, when constructing the HTML report template, the data structure of A, that is, the other data of the visual elements such as icons and tables except the specific data, can be directly reused at B of the HTML report template for display; further, if the data structure of the identified visual element A is to display some marked elements in A at B of the HTML report template, A is edited in response to the data marked by the user and then reused.

[0066] The traditional HTML report template construction method uses Javascript to create and operate DOM. The method used in this embodiment is to construct an HTML report template corresponding to the target web page based on the target front-end framework language. There is no need to use another development method. It is consistent with the development language of the original target web page. Even for content, charts, etc. that are similar or consistent with the target web page, the relevant code can be directly copied without the need for secondary development, which greatly reduces the development time and improves the development efficiency. The code is more secure and has a higher code reuse rate. Furthermore, the HTML report template created by the traditional method is created using Javascript. When the content of the target web page is changed, the HTML report template also needs to make a large number of code changes to synchronize the changes, which makes the maintenance of the HTML report template more troublesome. The HTML report template generation method used in this embodiment is the same as the development language and method of the target web page. If the content of the target web page is changed, it can be directly reused in the HTML report template for modification, and the maintenance cost of the HTML report template is lower.

[0067] S130 . In response to the data binding operation, a data binding relationship is established between each target data structure in the HTML report template and a target data source in the web page project file.

[0068] Exemplarily, in a specific implementation of this embodiment, when the data binding operation is triggered, a data binding relationship is established between each target data structure in the HTML report template and the target data source in the web project file. Specifically, through a preset data binding method, the part of the HTML report template that needs to display data is associated with the place where the data is actually stored in the web project file, so that when the data in the data source changes, the corresponding part in the HTML report template will also be automatically updated to reflect the latest data status; further, the data binding method may include but is not limited to: using a data binding function provided by a specific programming language or framework, or through a custom script or code. When establishing a data binding relationship. By establishing a data binding relationship, automatic synchronization and updating of data can be achieved, improving development efficiency and user experience. At the same time, it can also reduce the risk of manual operation and data inconsistency, ensuring the accuracy and reliability of HTML reports.

[0069] S140, constructing a data source file for filling a data source, and adding the data source file to the HTML report template; the data source file is initialized as a blank file.

[0070] In a specific implementation of this embodiment, first, a data source file is constructed specifically for filling the data source. The data source file can be in various formats, such as CSV, JSON or XML, depending on the type and requirements of the data. When constructing the data source file, it is necessary to ensure that the fields and values ​​corresponding to the data required in the HTML report template are included. Next, the constructed data source file is added to the HTML report template. This can be achieved by using specific tags or attributes in the HTML template to reference the data source file.

[0071] Adding the data source file to the HTML report template includes: adding the data source file to a public folder in the HTML report template that cannot be compiled.

[0072] S150: Use a packaging tool that is compatible with the target front-end framework language to compile and package the HTML report template to obtain an offline data package.

[0073] The packaging tool adapted to the target front-end framework language may specifically be a Webpack packaging tool; further, the Webpack packaging tool is a widely used front-end building tool, which can package and optimize various resource files (such as HTML, CSS, JavaScript, pictures, etc.) in a project and generate one or more output files for deployment and use in a production environment; specifically, the process of packaging an HTML report template using the Webpack packaging tool generally includes the following steps:

[0074] 1) Install and configure the Webpack packaging tool: First, you need to install Webpack in the project and configure it accordingly, including but not limited to creating a configuration file (such as webpack.config.js) and specifying the project's entry file, output path, module loader, plug-in, etc. 2) Define the entry file: In the Webpack configuration, you need to specify the project's entry file, that is, the path of the HTML report template. Webpack will start from this entry file and recursively process other resource files in the project. 3) Configure module loaders: Webpack supports various module loaders for processing different types of resource files. For example, you can use HTML loaders to process HTML files, CSS loaders to process CSS files, and JavaScript loaders to process JavaScript files. 4) Configure plug-ins: Webpack also supports various plug-ins to enhance the functionality of the packaging process. For example, you can use compression plug-ins to compress output files, use HTML template plug-ins to generate HTML files, and use image compression plug-ins to compress images. 5) Run the packaging command: After completing the Webpack configuration, you can use the corresponding command to run the packaging process. Webpack will package and optimize the resource files in the project according to the settings in the configuration file and generate one or more output files. 6) Deploy offline data package: Finally, deploy the generated offline data package to the production environment so that users can access and use the HTML report in an offline state.

[0075] By using the Webpack packaging tool to compile and package the HTML report template, the packaged code will be converted into Html+Javascript to make the packaged code compatible, and can quickly complete the data requirements of some offline Html reports with high compatibility and adaptability requirements, further improving the development efficiency and deployment efficiency of offline Html reports. At the same time, after the HTML report template is packaged by the packaging tool, the relevant code and static resources will be compressed, making the code unreadable, avoiding the leakage of relevant code, and improving the security of the code. At the same time, it also reduces the size of the offline data package and increases the speed of generating offline data packages.

[0076] S160: Upload the offline data package, web page project file and data binding relationship corresponding to the target web page to the server.

[0077] The offline data packet is used by the server to assemble and generate an update data packet matching the offline HTML report.

[0078] In a specific implementation scenario of the present embodiment, illustratively, based on step S150, an upload method such as FTP, SFTP or HTTP is selected to upload the prepared offline data packet, web page project file and data binding relationship to a server end that has been configured with a corresponding receiving program, and then the selected upload method is used to upload the offline data packet, web page project file and data binding relationship to a directory specified by the server. After receiving the uploaded file, the server will perform corresponding processing, for example, it will read the offline data packet, and assemble and generate an update data packet matching the offline HTML report according to the information therein, and then the server will bind the data in the update data packet to the corresponding part in the web page project file according to the uploaded data binding relationship. In this way, when the user accesses the offline report, he can see the latest data and content. By uploading the offline data packet, web page project file and data binding relationship to the server, the dynamic update and real-time display of the offline HTML report can be realized, thereby improving the user experience and work efficiency.

[0079] The technical solution of the embodiment of the present invention first obtains the web page project file corresponding to the target web page through the development client, and identifies the data structure of each visual element included in the web page project file, then responds to the direct reuse of at least one data structure in the target project file, and / or the reuse operation after editing, and obtains the HTML report template corresponding to the target web page based on the target front-end framework language, then responds to the data binding operation, establishes the data binding relationship between each target data structure in the HTML report template and the target data source in the web page project file, and constructs a data source file for filling the data source, and adds the data source file to the HTML report template, then uses a packaging tool adapted to the target front-end framework language to compile and package the HTML report template to obtain an offline data package, and finally uploads the offline data package corresponding to the target web page, the web page project file and the data binding relationship to the server, thereby improving the generation efficiency of the HTML report and reducing the computing power consumption of generating the offline HTML report.

[0080] Embodiment 2

[0081] Figure 2 A flowchart of an offline generation method of an HTML report provided in the second embodiment of the present invention. This embodiment is applicable to the situation where an HTML report is generated offline. The method can be executed by an offline generation device for an HTML report. The offline generation device for an HTML report can be implemented in the form of hardware and / or software. The offline generation device for an HTML report can be configured in a server with an offline generation function of an HTML report.

[0082] like Figure 2 As shown, the method includes:

[0083] S210: Receive an offline data packet, a web page project file and a data binding relationship corresponding to a target web page sent by a development client.

[0084] S220 . According to the data binding relationship, obtain from the webpage project file each target data source for filling into each target data structure of the HTML report template.

[0085] S230: Add each acquired target data source to the data source file of the offline data package to obtain an updated data package of an HTML report for offline display.

[0086] S240: Generate a download interface corresponding to the update data packet, and provide the download interface to at least one browsing client so that the browsing client can view the HTML report of the target website offline.

[0087] When generating an update data packet of an HTML report for offline display, the traditional method generally operates the DOM on the front end to create Html content, and then fills in elements and loads static files related to the report on the front end, etc. The operations of filling in the data required to generate the offline HTML report are all placed on the front end, resulting in a large amount of computing power and memory usage on the terminal. If the report is large and contains a lot of content, it may even cause the browser terminal to freeze. The method used in this embodiment is to generate an Html report template by developing a client, and then send the Html report template to the server. When generating an update data packet, the back end obtains each target data source in each target data structure used to fill in the HTML report template from the web page project file and adds the obtained target data sources to the data source file of the offline data packet, thereby obtaining an update data packet of the HTML report for offline display. Then, the server transmits the data source file filled with the update data packet to the front end for downloading through a download interface in a streaming manner, thereby reducing the computing power and memory usage of the server.

[0088] The technical solution of the embodiment of the present invention first receives an offline data packet, a web page project file and a data binding relationship corresponding to a target web page sent by a development client, and obtains each target data source in each target data structure used to fill in an HTML report template from the web page project file according to the data binding relationship, then adds each obtained target data source to the data source file of the offline data packet to obtain an update data packet of an HTML report for offline display, and finally generates a download interface corresponding to the update data packet, and provides the download interface to at least one browsing client for the browsing client to view the HTML report of the target website offline, thereby improving the generation efficiency of the HTML report and reducing the computing power consumption of generating the offline HTML report.

[0089] Specific implementation scenarios

[0090] In order to more clearly describe the technical solution provided by the embodiment of the present invention, this embodiment briefly introduces a specific implementation scenario obtained according to this embodiment.

[0091] 1) Set the target web page to a project with the target front-end framework language as Vue2.0, then use the relevant instructions of vue-cli to quickly create an empty Vue project and install related dependencies;

[0092] 2) a data structure identifying each visual element included in the target web page;

[0093] 3) Use Vue to develop HTML report template. In this step, since the framework language used to generate the HTML report template is Vue, which is exactly the same as the target web page, the development of each visual element can be reused or refer to the original target web page to improve development efficiency.

[0094] 4) After the HTML report template is developed, set the Webpack configuration. In this implementation, since only the HTML template needs to be generated and no other special operations are required, many configurations such as entry and exit do not need to be configured. Therefore, the most basic configuration of the package file directory and the name of the offline package are directly configured in the vue.config.js file of the Vue project;

[0095] 5) Using the npm run build command in Webpack to package the HTML report template, since the offline data packet generated by the Webpack packaging tool is a data packet containing an HTML file as an entry and compressed Javascript code, it complies with the rules of the HTML report template in the prior art;

[0096] 6) After generating the offline data package, the offline data package, the web page project file and the data binding relationship are placed in the server, and according to the data binding relationship, each target data source in each target data structure for filling in the HTML report template is obtained from the web page project file.

[0097] 7) Add the acquired target data sources to the data source file of the offline data package to obtain an updated data package of the HTML report for offline display. The server puts the updated data package into the data.js file of the packaged Vue project, and then generates a download interface corresponding to the updated data package.

[0098] Embodiment 3

[0099] Figure 3A flowchart of an offline generation method of an HTML report provided in Example 3 of the present invention. This embodiment is applicable to the situation where an HTML report is generated offline. The method can be executed by an offline generation device for an HTML report. The offline generation device for an HTML report can be implemented in the form of hardware and / or software. The offline generation device for an HTML report can be configured in a browsing client with an offline generation function of an HTML report.

[0100] like Figure 3 As shown, the method includes:

[0101] S310: Send an HTML report viewing request corresponding to a target webpage to a server, wherein the viewing request includes a webpage identifier of the target webpage.

[0102] Among them, the server pre-stores an HTML report template constructed by the method described in Example 1; and the server is used to obtain the offline data package, web page project file and data binding relationship of the target web page according to the web page identifier, and extract the matching data source from the web page project file and add it to the data source file of the offline data package to obtain an updated data package.

[0103] S320: After receiving the update data packet fed back by the server, decompress the update data packet.

[0104] S330: View the HTML report of the target web page offline in a browser according to the decompression processing result.

[0105] Specifically, according to the decompression processing result, the HTML report of the target web page is viewed offline in the browser, including: obtaining the main directory file of the target web page in the decompression processing result, and displaying the HTML report of the target web page offline by opening the main directory file in the browser.

[0106] Specifically, the user sends an HTML report viewing request corresponding to the target web page to the server, and the request includes the web page identifier of the target web page. After receiving the request, the server will feedback the corresponding update data packet. After receiving the update data packet fed back by the server, the user will decompress it. This process will restore the compressed data packet to the original file and data. According to the result of the decompression process, the user can view the HTML report of the target web page offline in the browser. Specifically, the user will obtain the main directory file of the target web page in the decompression process result. The main directory file usually contains the main structure and content of the HTML report. By opening the main directory file in the browser, the user can display the HTML report of the target web page offline. The browser will parse the main directory file and present the HTML, CSS, JavaScript and other contents therein to the user, so that the user can view and interact with the HTML report of the target web page without a network connection.

[0107] The technical solution of the embodiment of the present invention first sends an HTML report viewing request corresponding to the target web page to the server, wherein the viewing request includes the web page identifier of the target web page, and then after receiving the update data packet fed back by the server, the update data packet is decompressed, and finally, based on the decompression result, the HTML report of the target web page is viewed offline in the browser, thereby improving the generation efficiency of the HTML report and reducing the computing power consumption of generating offline HTML reports.

[0108] Embodiment 4

[0109] Figure 4 This is a schematic diagram of the structure of a device for generating an HTML report template provided by Embodiment 4 of the present invention. Figure 4 As shown, the device comprises:

[0110] The data structure identification module 410 is used to obtain a web page project file corresponding to the target web page and identify the data structure of each visual element included in the web page project file; wherein the web page project file is constructed by using the target front-end framework language;

[0111] A template construction module 420 is used to construct an HTML report template corresponding to a target web page based on a target front-end framework language in response to a direct reuse of at least one data structure in a target project file and / or a reuse operation after editing;

[0112] A data binding module 430 is used to establish a data binding relationship between each target data structure in the HTML report template and a target data source in the web page project file in response to the data binding operation;

[0113] A data source file construction module 440 is used to construct a data source file for filling a data source, and add the data source file to the HTML report template; the data source file is initialized as a blank file;

[0114] The template packaging module 450 is used to compile and package the HTML report template using a packaging tool adapted to the target front-end framework language to obtain an offline data package;

[0115] The data upload module 460 is used to upload the offline data package, web page project file and data binding relationship corresponding to the target web page to the server; wherein the offline data package is used by the server to assemble and generate an update data package matching the offline HTML report.

[0116] The technical solution of the embodiment of the present invention first obtains the web page project file corresponding to the target web page through the development client, and identifies the data structure of each visual element included in the web page project file, then responds to the direct reuse of at least one data structure in the target project file, and / or the reuse operation after editing, and obtains the HTML report template corresponding to the target web page based on the target front-end framework language, then responds to the data binding operation, establishes the data binding relationship between each target data structure in the HTML report template and the target data source in the web page project file, and constructs a data source file for filling the data source, and adds the data source file to the HTML report template, then uses a packaging tool adapted to the target front-end framework language to compile and package the HTML report template to obtain an offline data package, and finally uploads the offline data package corresponding to the target web page, the web page project file and the data binding relationship to the server, thereby improving the generation efficiency of the HTML report and reducing the computing power consumption of generating the offline HTML report.

[0117] On the basis of the above embodiment, the data source file construction module 340 is specifically used to: add the data source file to the public folder that cannot be compiled in the HTML report template.

[0118] The device for generating an HTML report template provided in the embodiment of the present invention can execute the method for generating an HTML report template provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0119] Embodiment 5

[0120] Figure 5 This is a schematic diagram of the structure of an offline HTML report generation device provided by Embodiment 5 of the present invention. Figure 5 As shown, the device comprises:

[0121] The data receiving module 510 is used to receive the offline data packet, web page project file and data binding relationship corresponding to the target web page sent by the development client;

[0122] A data acquisition module 520 is used to acquire, according to the data binding relationship, from the webpage project file each target data source for filling into each target data structure of the HTML report template;

[0123] An update data packet acquisition module 530 is used to add each acquired target data source to the data source file of the offline data packet to obtain an update data packet of an HTML report for offline display;

[0124] The report download module 540 is used to generate a download interface corresponding to the update data package, and provide the download interface to at least one browsing client so that the browsing client can view the HTML report of the target website offline.

[0125] The technical solution of the embodiment of the present invention first receives an offline data packet, a web page project file and a data binding relationship corresponding to a target web page sent by a development client, and obtains each target data source in each target data structure used to fill in an HTML report template from the web page project file according to the data binding relationship, then adds each obtained target data source to the data source file of the offline data packet to obtain an update data packet of an HTML report for offline display, and finally generates a download interface corresponding to the update data packet, and provides the download interface to at least one browsing client for the browsing client to view the HTML report of the target website offline, thereby improving the generation efficiency of the HTML report and reducing the computing power consumption of generating the offline HTML report.

[0126] The offline generation device of HTML report provided by the embodiment of the present invention can execute the offline generation method of HTML report provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0127] Embodiment 6

[0128] Figure 6 This is a schematic diagram of the structure of an offline HTML report generation device provided by Embodiment 6 of the present invention. Figure 6 As shown, the device comprises:

[0129] A request sending module 610 is used to send an HTML report viewing request corresponding to a target web page to a server, wherein the viewing request includes a web page identifier of the target web page;

[0130] The server pre-stores an HTML report template constructed by the method according to claim 1 or 2; and the server is used to obtain the offline data package, web page project file and data binding relationship of the target web page according to the web page identifier, and extract the matching data source from the web page project file and add it to the data source file of the offline data package to obtain the updated data package;

[0131] A decompression module 620, configured to decompress the update data packet after receiving the update data packet fed back by the server;

[0132] The report viewing module 630 is used to view the HTML report of the target web page offline in the browser according to the decompression processing result.

[0133] The technical solution of the embodiment of the present invention first sends an HTML report viewing request corresponding to the target web page to the server, wherein the viewing request includes the web page identifier of the target web page, and then after receiving the update data packet fed back by the server, the update data packet is decompressed, and finally, based on the decompression result, the HTML report of the target web page is viewed offline in the browser, thereby improving the generation efficiency of the HTML report and reducing the computing power consumption of generating offline HTML reports.

[0134] Based on the above embodiment, the report viewing module 630 is specifically used to obtain the main directory file of the target web page in the decompression processing result, and display the HTML report of the target web page offline by opening the main directory file in the browser.

[0135] The offline generation device of HTML report provided by the embodiment of the present invention can execute the offline generation method of HTML report provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0136] Embodiment 4

[0137] Figure 7 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0138] like Figure 7As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0139] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0140] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the generation of an HTML report template and an offline generation method of an HTML report.

[0141] Accordingly, the method for generating the HTML report template includes:

[0142] Acquire a web page project file corresponding to a target web page, and identify a data structure of each visual element included in the web page project file; wherein the web page project file is constructed by using a target front-end framework language;

[0143] In response to a direct reuse of at least one data structure in a target project file, and / or a reuse operation after editing, constructing an HTML report template corresponding to a target web page based on a target front-end framework language;

[0144] In response to the data binding operation, establishing a data binding relationship between each target data structure in the HTML report template and a target data source in the web page project file;

[0145] Constructing a data source file for filling a data source, and adding the data source file to the HTML report template; the data source file is initialized as a blank file;

[0146] Use a packaging tool that is compatible with the target front-end framework language to compile and package the HTML report template to obtain an offline data package;

[0147] Upload the offline data package, web page project file and data binding relationship corresponding to the target web page to the server;

[0148] The offline data packet is used by the server to assemble and generate an update data packet matching the offline HTML report.

[0149] In some embodiments, the generation of HTML report templates and the offline generation method of HTML reports can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the generation of HTML report templates and the offline generation method of HTML reports described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the generation of HTML report templates and the offline generation method of HTML reports by any other appropriate means (for example, by means of firmware).

[0150] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0151] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0152] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0153] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0154] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0155] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0156] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

Claims

1. A method for generating an HTML report template, characterized in that: Executed by a development client, the method includes: Acquire a web page project file corresponding to a target web page, and identify a data structure of each visual element included in the web page project file; wherein the web page project file is constructed by using a target front-end framework language; In response to a direct reuse of at least one data structure in a target project file, and / or a reuse operation after editing, constructing an HTML report template corresponding to a target web page based on a target front-end framework language; In response to the data binding operation, establishing a data binding relationship between each target data structure in the HTML report template and a target data source in the web page project file; Constructing a data source file for filling a data source, and adding the data source file to the HTML report template; the data source file is initialized as a blank file; Use a packaging tool that is compatible with the target front-end framework language to compile and package the HTML report template to obtain an offline data package; Upload the offline data package, web page project file and data binding relationship corresponding to the target web page to the server; The offline data packet is used by the server to assemble and generate an update data packet matching the offline HTML report.

2. The method according to claim 1, characterized in that Add the data source file to the HTML report template, including: Add the data source file to a public folder in the HTML report template that cannot be compiled.

3. A method for generating an HTML report offline, characterized in that: Executed by a server, the method includes: Receive offline data packets, web page project files and data binding relationships corresponding to the target web page sent by the development client; According to the data binding relationship, obtaining from the webpage project file each target data source for filling into each target data structure of the HTML report template; Adding each acquired target data source to the data source file of the offline data package to obtain an updated data package of the HTML report for offline display; A download interface corresponding to the update data packet is generated, and the download interface is provided to at least one browsing client so that the browsing client can view the HTML report of the target website offline.

4. A method for generating an HTML report offline, characterized in that: Executed by a browsing client, the method includes: Sending an HTML report viewing request corresponding to a target web page to a server, wherein the viewing request includes a web page identifier of the target web page; The server pre-stores an HTML report template constructed by the method according to claim 1 or 2; and the server is used to obtain the offline data package, web page project file and data binding relationship of the target web page according to the web page identifier, and extract the matching data source from the web page project file and add it to the data source file of the offline data package to obtain the updated data package; After receiving the update data packet fed back by the server, decompressing the update data packet; Based on the decompression processing results, the HTML report of the target web page can be viewed offline in the browser.

5. The method according to claim 4, characterized in that Based on the decompression results, the HTML report of the target web page can be viewed offline in the browser, including: In the decompression processing result, the main directory file of the target webpage is obtained, and the HTML report of the target webpage is displayed offline by opening the main directory file in a browser.

6. A device for generating an HTML report template, characterized in that: Executed by a development client, the method includes: A data structure identification module is used to obtain a web page project file corresponding to a target web page and identify the data structure of each visual element included in the web page project file; wherein the web page project file is constructed by using a target front-end framework language; A template construction module, configured to construct an HTML report template corresponding to a target web page based on a target front-end framework language in response to a direct reuse of at least one data structure in a target project file and / or a reuse operation after editing; A data binding module, for establishing a data binding relationship between each target data structure in the HTML report template and a target data source in the web page project file in response to a data binding operation; A data source file construction module, used to construct a data source file for filling a data source, and add the data source file to the HTML report template; the data source file is initialized as a blank file; The template packaging module is used to compile and package the HTML report template using a packaging tool adapted to the target front-end framework language to obtain an offline data package; The data upload module is used to upload the offline data package, web page project file and data binding relationship corresponding to the target web page to the server; wherein, the offline data package is used for the server to assemble and generate an update data package matching the offline HTML report.

7. An off-line HTML report generation device, characterized in that: Executed by a server, the method includes: The data receiving module is used to receive the offline data packet, web page project file and data binding relationship corresponding to the target web page sent by the development client; A data acquisition module, used for acquiring, according to the data binding relationship, from the webpage project file each target data source for filling into each target data structure of the HTML report template; An update data packet acquisition module is used to add each acquired target data source to the data source file of the offline data packet to obtain an update data packet of an HTML report for offline display; The report download module is used to generate a download interface corresponding to the update data package, and provide the download interface to at least one browsing client so that the browsing client can view the HTML report of the target website offline.

8. A method for generating an HTML report offline, characterized in that: Executed by a browsing client, the method includes: A request sending module, used for sending an HTML report viewing request corresponding to a target web page to a server, wherein the viewing request includes a web page identifier of the target web page; The server pre-stores an HTML report template constructed by the method according to claim 1 or 2; and the server is used to obtain the offline data package, web page project file and data binding relationship of the target web page according to the web page identifier, and extract the matching data source from the web page project file and add it to the data source file of the offline data package to obtain the updated data package; A decompression module, configured to decompress the update data packet after receiving the update data packet fed back by the server; The report viewing module is used to view the HTML report of the target web page offline in the browser according to the decompression processing result.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute a method for generating an HTML report template and generating an HTML report offline according to any one of claims 1 to 5.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement a method for generating an HTML report template and an offline generation method of an HTML report according to any one of claims 1 to 5 when executed.

Citation Information

Cited By

  • Time sequence safety report generation method and device, equipment and storage medium

    CN122528859A

  • Timing security report generation method and apparatus, device, and storage medium

    CN122528859B