CN114048406A - JavaScript-based data export preprocessing method and system platform - Google Patents

JavaScript-based data export preprocessing method and system platform Download PDF

Info

Publication number
CN114048406A
CN114048406A CN202111252399.9A CN202111252399A CN114048406A CN 114048406 A CN114048406 A CN 114048406A CN 202111252399 A CN202111252399 A CN 202111252399A CN 114048406 A CN114048406 A CN 114048406A
Authority
CN
China
Prior art keywords
javascript
xls
processed
template
script
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111252399.9A
Other languages
Chinese (zh)
Inventor
郑康源
许东武
柯志忠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Infinite Information Technology Co ltd
Original Assignee
Guangdong Infinite Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Infinite Information Technology Co ltd filed Critical Guangdong Infinite Information Technology Co ltd
Priority to CN202111252399.9A priority Critical patent/CN114048406A/en
Publication of CN114048406A publication Critical patent/CN114048406A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9577Optimising the visualization of content, e.g. distillation of HTML documents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a data export preprocessing method and a system platform based on JavaScript, which mainly comprise the following steps: loading a basic XLS template; loading a JavaScript script in a basic XLS template; loading a control function for controlling the JavaScript; calling a control function to control a JavaScript script to process data; outputting the processed XLS template. According to the invention, the preset JavaScript can be freely selected to carry out universal data format processing or the JavaScript can be automatically input to realize the user requirements according to the user requirements, so that an XLS file meeting the user requirements is output, and corresponding prompt can be carried out when the JavaScript runs abnormally. The invention can unify the format of the exported data, improve the reading efficiency and the working efficiency of the user and be widely applied to the data export of the B/S system.

Description

JavaScript-based data export preprocessing method and system platform
Technical Field
The invention relates to the field of XLS data processing, in particular to a data export preprocessing method and a system platform based on JavaScript.
Background
In the existing browser/server system (B/S system) architecture, if a user has a need to export data from a server, the data can only be directly exported according to a matching rule preset by the system. The traditional export method is to display the relevant query conditions on a browser interface and then export data in an XLS format. The exported XLS documents often contain a large amount of redundant data that is difficult for users to read, and the format of the data is also not uniform. Therefore, it is necessary to develop a preprocessing method for server-derived data, so that users can more efficiently acquire data required by themselves.
Javascript (js) is a lightweight, interpreted or just-in-time programming language with function precedence. The method is mainly applied to the browser environment, can be used for adding various dynamic functions to the browser, and has the advantages of cross-platform performance, easiness in use and the like.
Disclosure of Invention
In view of this, the present invention uses JavaScript to write a script for performing secondary processing on server export data, so as to implement preprocessing on data export.
The invention provides a data export preprocessing method based on JavaScript, which comprises the following steps:
loading a basic XLS template, wherein the XLS template comprises data to be processed;
loading a JavaScript script in the basic XLS template;
loading a control function for controlling the JavaScript;
calling the control function to control the JavaScript to process the data to be processed in the basic XLS template to obtain a processed XLS template;
outputting the processed XLS template.
Further, the loading of the JavaScript script in the basic XLS template specifically includes:
calling a preset JavaScript from a preset static file library;
and the user writes the JavaScript script autonomously.
Further, the preset JavaScript script includes a JavaScript script having the following functions:
adjusting the font style and the cell style of the data to be processed;
identifying and adjusting the identity information format in the data to be processed; the identity information comprises a name, a date, a region, an address and a telephone number;
and acquiring an XLS file name, and inputting a user-defined XLS name.
Further, the loading of the control function for controlling the JavaScript script includes the following steps:
calling a control function of a preset JavaScript from the preset static file library;
and compiling a corresponding control function according to the JavaScript script independently compiled by the user.
Further, the presetting of the control function of the JavaScript script includes:
a GetTitles () function used for controlling the preset JavaScript to adjust the font style and the cell style of the data to be processed;
the ConvertValue () function is used for controlling the preset JavaScript script to identify and adjusting the identity information format in the data to be processed;
and the getFileName () function is used for controlling a preset JavaScript to obtain an XLS file name and inputting a user-defined XLS name.
Further, the JavaScript-based data export preprocessing method further includes the following steps:
monitoring the running condition of the JavaScript;
and when the JavaScript script runs abnormally, adding corresponding text prompts in the processed XLS template.
The invention also discloses a data export preprocessing system platform based on JavaScript, which is characterized by comprising the following parts: an application platform, a core processing application and a static file library;
the application platform is used for interacting with a user and can be used for setting a calling interface, managing a static file library and downloading an XLS file; the static file library comprises a preset JavaScript and a control function corresponding to the script;
the core processing application performs the steps of:
data to be processed is transmitted from a calling interface, and a basic XLS template is generated;
reading a JavaScript script and a control function corresponding to the script from a static file library, and writing the JavaScript script and the control function into the basic XLS template;
calling the control function to control the JavaScript to process the data to be processed in the basic XLS template to obtain a processed XLS template;
and outputting the processed XLS template to a user platform for downloading by a user.
Further, the system platform can receive a JavaScript script input by a user and a control function corresponding to the script and store the JavaScript script and the control function into the static file library.
Further, the calling the control function to control the JavaScript script to process the data to be processed includes:
executing a GetTitles () function to adjust the font style and the cell style of the data to be processed;
executing ConvertValue () function to identify and adjust the identity information format in the data to be processed;
and executing a getFileName () function to obtain an XLS file name, and inputting a user-defined XLS name.
Further, the system platform monitors the running condition of the core processing application in real time, and when the core processing application runs abnormally, corresponding text prompts are added to the application platform.
The invention has the following beneficial effects: a JavaScript-based data export preprocessing method and a system platform can realize the function of secondary processing of exported XLS data. And preprocessing the exported data of the server according to the written JavaScript script to enable the output data to meet the requirements of users. Meanwhile, the user can select the preset JavaScript script and write the required JavaScript script by himself for data processing, so that the reading efficiency and the working efficiency are improved, different requirements of the users are considered, and the complexity of a developer in exporting the XLS file format is greatly reduced. In addition, a verification step is additionally added, and if the JavaScript script runs abnormally, a specific error is thrown to prompt a user where the error runs.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flow chart of a data export preprocessing method based on JavaScript according to the present invention.
FIG. 2 is a flow chart of the architecture of a data export preprocessing system platform based on JavaScript in the present invention.
Fig. 3 is a schematic diagram of a processing result of the JavaScript-based data export preprocessing method of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
This embodiment introduces an implementation flow of a JavaScript-based data export preprocessing method, as shown in fig. 1:
A. loading a basic XLS template: and loading a basic XLS template for system call, wherein the basic template is basic file reference data necessary for program processing.
B. Loading a JavaScript processing script on the basic template: and calling a JavaScript execution mode through a program on the basic template, and executing the JavaScript to process the data. The preset JavaScript script comprises common processing scripts of format, such as XLS content replacement of name conversion, date format, area format, address format, title format, telephone number format and the like; style processing for fonts and cells, and XLS filename editing, etc.
C. Controlling data by writing a JavaScript function: the user can independently write a specific JavaScript script, write function control and perform the operations of increasing, deleting, modifying and checking data.
D. The JavaScript script function processes data: and the program executes the JavaScript script to perform data processing, performs data conversion according to the JavaScript function, and performs matching conversion processing on the data according to the input function and parameters.
E. And (3) outputting an XLS template file meeting the requirements: and after the data processing is finished, the XLS template responds and processes according to the JavaScript script, and outputs an XLS template export file meeting the format requirement to provide a user for downloading.
The embodiment of the method can further add the following steps: F. monitoring JavaScript operation: and the system program monitors the running condition of the JavaScript, and if the running condition of the JavaScript program is abnormal, a specific error is thrown to a user, so that the specific abnormality of program execution is prompted.
This embodiment introduces an architecture flow of a JavaScript-based data export preprocessing system platform, as shown in fig. 2:
1. and according to the service use requirement, the system platform calls an interface to start service processing.
2. And entering a core processing application, judging whether a preset JavaScript exists or not by the system platform, and reading if the preset JavaScript exists.
4. And the static file library provides a common JavaScript, and a user can select a format which accords with the requirement of exporting XLS by himself and correspondingly select an existing JavaScript or manually edit and load a new JavaScript.
5. The database queries the database, and transmits the data source to be processed, and the system receives the data response and starts to enter data conversion.
6. And starting a JavaScript function core processing flow.
7. The JavaScript function executes the GetTitles () method, obtains the title, font and style in the XLS file, matches with the corresponding module to be processed, and processes the style such as the color, size and combination of the title by inputting JavaScript parameters.
8. And executing a JavaScript coverValue () function, converting the basic data provided by the database, and filling the content of the XLS file according to the content of which the data format field conversion conforms to the required format.
9. And executing a JavaScript template getFileName () function method, acquiring the xls file name, and outputting the xls name which needs to be customized by a user.
10. And after the JavaScript core flow is processed, all data are converted by a function to fill the corresponding xls template.
11. And outputting an xls format file meeting the service requirement, providing for downloading by a user, and exporting the xls file.
The data export result of the embodiment of the invention is shown in fig. 3. After preprocessing the data by a preset JavaScript script, valuable data such as time, name, mobile phone number, area, address and the like can be screened out; meanwhile, the user can compile corresponding scripts according to own requirements so as to extract required data, such as channel sources, src codes and the like. The exported data format is uniform, the typesetting is neat, and the reading by users is convenient.
In alternative embodiments, the functions/acts noted in the block diagrams may occur out of the order noted in the operational illustrations. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality/acts involved. Furthermore, the embodiments presented and described in the flow charts of the present invention are provided by way of example in order to provide a more thorough understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is changed and in which sub-operations described as part of larger operations are performed independently.
Furthermore, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise stated to the contrary, one or more of the described functions and/or features may be integrated in a single physical device and/or software module, or one or more functions and/or features may be implemented in a separate physical device or software module. It will also be appreciated that a detailed discussion of the actual implementation of each module is not necessary for an understanding of the present invention. Rather, the actual implementation of the various functional modules in the apparatus disclosed herein will be understood within the ordinary skill of an engineer, given the nature, function, and internal relationship of the modules. Accordingly, those skilled in the art can, using ordinary skill, practice the invention as set forth in the claims without undue experimentation. It is also to be understood that the specific concepts disclosed are merely illustrative of and not intended to limit the scope of the invention, which is defined by the appended claims and their full scope of equivalents.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the invention have been shown and described, it will be understood by those of ordinary skill in the art that: various changes, modifications, substitutions and alterations can be made to the embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
While the preferred embodiments of the present invention have been illustrated and described, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A JavaScript-based data export preprocessing method is characterized by comprising the following steps:
loading a basic XLS template, wherein the XLS template comprises data to be processed;
loading a JavaScript script in the basic XLS template;
loading a control function for controlling the JavaScript;
calling the control function to control the JavaScript to process the data to be processed in the basic XLS template to obtain a processed XLS template;
outputting the processed XLS template.
2. The JavaScript-based data export preprocessing method of claim 1, wherein the loading of the JavaScript script in the basic XLS template specifically comprises:
calling a preset JavaScript from a preset static file library;
and the user writes the JavaScript script autonomously.
3. The JavaScript-based data export preprocessing method of claim 2, wherein the preset JavaScript script comprises a JavaScript script having the following functions:
adjusting the font style and the cell style of the data to be processed;
identifying and adjusting the identity information format in the data to be processed; the identity information comprises a name, a date, a region, an address and a telephone number;
and acquiring an XLS file name, and inputting a user-defined XLS name.
4. The JavaScript-based data export preprocessing method according to claim 1, wherein the loading of the control function for controlling the JavaScript script comprises the following steps:
calling a control function of a preset JavaScript from the preset static file library;
and compiling a corresponding control function according to the JavaScript script independently compiled by the user.
5. The JavaScript-based data export preprocessing method of claim 4, wherein presetting the control function of the JavaScript script comprises:
a GetTitles () function used for controlling the preset JavaScript to adjust the font style and the cell style of the data to be processed;
the ConvertValue () function is used for controlling the preset JavaScript script to identify and adjusting the identity information format in the data to be processed;
and the getFileName () function is used for controlling a preset JavaScript to obtain an XLS file name and inputting a user-defined XLS name.
6. The JavaScript-based data export preprocessing method of claim 1, further comprising the following steps:
monitoring the running condition of the JavaScript;
and when the JavaScript script runs abnormally, adding corresponding text prompts in the processed XLS template.
7. A JavaScript-based data export preprocessing system platform is characterized by comprising the following parts: an application platform, a core processing application and a static file library;
the application platform is used for interacting with a user and can be used for setting a calling interface, managing a static file library and downloading an XLS file; the static file library comprises a preset JavaScript and a control function corresponding to the script;
the core processing application performs the steps of:
data to be processed is transmitted from a calling interface, and a basic XLS template is generated;
reading a JavaScript script and a control function corresponding to the script from a static file library, and writing the JavaScript script and the control function into the basic XLS template;
calling the control function to control the JavaScript to process the data to be processed in the basic XLS template to obtain a processed XLS template;
and outputting the processed XLS template to a user platform for downloading by a user.
8. The JavaScript-based data export preprocessing system platform of claim 7, wherein the system platform is capable of receiving a JavaScript script input by a user and a control function corresponding to the script and storing the JavaScript script into the static file library.
9. The JavaScript-based data export preprocessing system platform of claim 7, wherein the invoking the control function controls the JavaScript script to process the data to be processed, comprises:
executing a GetTitles () function to adjust the font style and the cell style of the data to be processed;
executing ConvertValue () function to identify and adjust the identity information format in the data to be processed;
and executing a getFileName () function to obtain an XLS file name, and inputting a user-defined XLS name.
10. The JavaScript-based data export preprocessing system platform of claim 7, wherein the system platform monitors the running condition of the core processing application in real time, and adds a corresponding text prompt to the application platform when the core processing application runs abnormally.
CN202111252399.9A 2021-10-27 2021-10-27 JavaScript-based data export preprocessing method and system platform Pending CN114048406A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111252399.9A CN114048406A (en) 2021-10-27 2021-10-27 JavaScript-based data export preprocessing method and system platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111252399.9A CN114048406A (en) 2021-10-27 2021-10-27 JavaScript-based data export preprocessing method and system platform

Publications (1)

Publication Number Publication Date
CN114048406A true CN114048406A (en) 2022-02-15

Family

ID=80206087

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111252399.9A Pending CN114048406A (en) 2021-10-27 2021-10-27 JavaScript-based data export preprocessing method and system platform

Country Status (1)

Country Link
CN (1) CN114048406A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105404613A (en) * 2015-09-24 2016-03-16 鲁能集团有限公司 XLS (Microsoft Excel) data export method and system based on SAP (System Applications and Products in Data Processing) platform
CN105446944A (en) * 2015-11-12 2016-03-30 国云科技股份有限公司 JavaScript-based method for exporting EXCEL by using HTML table
KR20170111119A (en) * 2016-03-25 2017-10-12 (주)아라커뮤니케이션즈 System and method of authoring contents based on template

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105404613A (en) * 2015-09-24 2016-03-16 鲁能集团有限公司 XLS (Microsoft Excel) data export method and system based on SAP (System Applications and Products in Data Processing) platform
CN105446944A (en) * 2015-11-12 2016-03-30 国云科技股份有限公司 JavaScript-based method for exporting EXCEL by using HTML table
KR20170111119A (en) * 2016-03-25 2017-10-12 (주)아라커뮤니케이션즈 System and method of authoring contents based on template

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
@SOKACHWANG: "js-xls.rar", pages 1, Retrieved from the Internet <URL:https://download.csdn.net/download/qq_34707744/10105073> *
生生不息的希望: "JavaScript 导出 xls", pages 1 - 6, Retrieved from the Internet <URL:https://blog.csdn.net/weixin_39589065/article/details/89253287> *

Similar Documents

Publication Publication Date Title
CN110825369A (en) Method for automatically generating codes based on java language
CN111488145B (en) Micro-service code generation system and method based on service domain data model library
CN106293664A (en) Code generating method and device
CN112650487B (en) Hybrid application development method, system, computer device and storage medium
CN113886362A (en) Data storage system and storage method based on workflow engine and low-code platform
CN109255107A (en) Configuration software processing method and device, computer equipment and storage medium
CN112328229A (en) Method for quickly creating Jenkins assembly line
Freeman Essential TypeScript 5
CN116820811B (en) RPA component variable rapid deriving and assigning method and system based on shear plate
CN109597618A (en) Program developing method, device, computer equipment and storage medium
CN110543299A (en) Cloud computing management platform code generation method and device
CN112988298A (en) Visual interface configuration method and device, computer equipment and storage medium
CN111667231B (en) Automatic tax return method, device, system, computer equipment and storage medium
CN112527286A (en) Service code generation method and device, computer equipment and storage medium
CN117311683B (en) Code auxiliary system, code auxiliary processing method and device and electronic equipment
CN118113271A (en) Code generation method, system, terminal and medium based on large model
CN108874395B (en) Hard compiling method and device in modular stream processing process
CN113655996A (en) Enterprise-level system generation method based on demand model
CN114048406A (en) JavaScript-based data export preprocessing method and system platform
CN109299005B (en) Test script generation method and device
CN115344248A (en) RPA development field editing diversification method
CN114510497A (en) Variable processing method, device and equipment and readable storage medium
JP2000132425A (en) Software testing method
CN117234512B (en) Method, system, electronic equipment and storage medium for rapidly developing business
CN111857698B (en) Macro program configuration method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination