CN115221852A - Vxe-table based dynamic calculation table implementation method, device and computer equipment - Google Patents

Vxe-table based dynamic calculation table implementation method, device and computer equipment Download PDF

Info

Publication number
CN115221852A
CN115221852A CN202210717955.3A CN202210717955A CN115221852A CN 115221852 A CN115221852 A CN 115221852A CN 202210717955 A CN202210717955 A CN 202210717955A CN 115221852 A CN115221852 A CN 115221852A
Authority
CN
China
Prior art keywords
data
calculation
calculation formula
corresponding relation
value
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
CN202210717955.3A
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.)
DBAPPSecurity Co Ltd
Original Assignee
DBAPPSecurity 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 DBAPPSecurity Co Ltd filed Critical DBAPPSecurity Co Ltd
Priority to CN202210717955.3A priority Critical patent/CN115221852A/en
Publication of CN115221852A publication Critical patent/CN115221852A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/177Editing, e.g. inserting or deleting of tables; using ruled lines
    • G06F40/18Editing, e.g. inserting or deleting of tables; using ruled lines of spreadsheets
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a vxe-table-based dynamic calculation table implementation method, a vxe-table-based dynamic calculation table implementation device and computer equipment. The method comprises the following steps: acquiring data to be rendered, wherein the data to be rendered comprises a data name and a data value, and a first corresponding relation is formed between the data name and the data value; generating a data table based on the data name and the data value according to a preset table generation rule; acquiring a preset data calculation formula, wherein a second corresponding relation exists between an independent variable in the data calculation formula and the data name; and calculating the data values in the data table through the data calculation formula according to the first corresponding relation and the second corresponding relation, and rendering the data calculation result values in the data table. Compared with the prior art, the table calculation function is simple to realize, a large number of codes are not required to be written for realizing the linkage calculation of the data, and a user can directly input a data calculation formula with a corresponding format.

Description

Vxe-table based dynamic calculation table implementation method, apparatus and computer device
Technical Field
The application relates to the technical field of computer application, in particular to a vxe-table-based dynamic calculation table implementation method, a vxe-table-based dynamic calculation table implementation device and computer equipment.
Background
As computer application technology has developed, data is typically presented in tabular form. The Vxe-table is a Vue-based PC end table component and supports functions of adding, deleting, modifying, checking, virtual lists, virtual trees, lazy loading, shortcut menus, data checking, printing and exporting, form rendering, data paging, popup, self-defining templates and the like.
However, the main function of the Vxe-table is data display, and the following defects still exist at present:
1. the function of data calculation used when the box is opened is not available, and the linkage calculation of the data needs developers to write a large amount of codes to realize the linkage calculation.
2. The written table can not be used repeatedly, and the calculation method is required to be rewritten when a use scene is changed.
3. The data calculation capability faces developers, the definition of the form calculation formula can be completed only by a little programming basis, and users cannot define the calculation capability of the form by self.
Therefore, in the prior art, in order to realize the data calculation capability of the PC-side table based on the vxe-table, developers need to write a large amount of codes; and in the face of different use scenarios, a large number of different codes need to be written to realize different computing capabilities. Therefore, the existing PC side table with data calculation capability based on the vxe-table has the problem of great development difficulty.
Aiming at the problem that a PC end table with data computing capability based on a vxe-table in the related technology has great development difficulty, no effective solution is provided at present.
Disclosure of Invention
In view of the foregoing, there is a need to provide a method, an apparatus, a computer device, a computer-readable storage medium, and a computer program product for implementing a vxe-table based dynamic calculation table, which can reduce the development difficulty.
In a first aspect, the application provides a vxe-table-based dynamic calculation table implementation method. The method comprises the following steps:
acquiring data to be rendered, wherein the data to be rendered comprises a data name and a data value, and a first corresponding relation is formed between the data name and the data value;
generating a data table based on the data name and the data value according to a preset table generation rule;
acquiring a preset data calculation formula, wherein a second corresponding relation exists between independent variables in the data calculation formula and the data names;
and calculating the data values in the data table through the data calculation formula according to the first corresponding relation and the second corresponding relation, and rendering the data calculation result values in the data table.
In one embodiment, the method further comprises:
when the data value in the data table is detected to be changed, calculating the changed data value in the data table through the data calculation formula according to the first corresponding relation and the second corresponding relation, and updating the data calculation result in the data table.
In one embodiment, when it is detected that the data value in the data table changes, calculating the changed data value in the data table according to the first corresponding relationship and the second corresponding relationship by using the data calculation formula includes:
determining a data value to be modified in the data table according to a modification instruction input by a user based on a vxe-table component, and converting a cell where the data value to be modified is located into a data input frame;
receiving a new data value in the data input box, and replacing the data value to be modified by the new data value;
and calculating the data values in the data table through the data calculation formula according to the first corresponding relation and the second corresponding relation.
In one embodiment, the method further comprises:
when the data calculation formula is detected to be changed, calculating the data value in the data table through the changed data calculation formula according to the first corresponding relation and the second corresponding relation, and updating the data calculation result in the data table.
In one embodiment, the generating a data table based on the data name and the data value according to a preset table generation rule includes:
and rendering and generating a header of the data table according to the data name, and rendering and generating a body of the data table according to the data value.
In one embodiment, the calculating the data value in the data table according to the first corresponding relationship and the second corresponding relationship by the data calculation formula, and rendering the data calculation result value in the data table includes:
determining a mapping relation between the data value and an independent variable in the data calculation formula according to the first corresponding relation and the second corresponding relation;
inputting the data calculation formula and the corresponding data value in the table into a preset calculation library according to the mapping relation; the calculation library is used for substituting the data value into the data calculation formula according to the mapping relation to carry out calculation and generating a data calculation result;
and acquiring the data calculation result from the calculation library, and rendering the data calculation result in the data table.
In one embodiment, the method further comprises:
judging whether the data calculation formula is abnormal or not according to the operation result of the data calculation formula;
if so, prompting that the data calculation formula is wrong;
and if not, storing the data calculation formula.
In a second aspect, the application further provides a dynamic calculation table implementation device based on the vxe-table.
The device comprises:
the data rendering method comprises the steps that a data obtaining module is used for obtaining data to be rendered, wherein the data to be rendered comprises a data name and a data value, and a first corresponding relation is formed between the data name and the data value;
the table generation module is used for generating a data table based on the data name and the data value according to a preset table generation rule;
the formula acquisition module is used for acquiring a preset data calculation formula, wherein a second corresponding relation exists between an independent variable in the data calculation formula and the data name;
and the data calculation module is used for calculating the data values in the data table through the data calculation formula according to the first corresponding relation and the second corresponding relation and rendering the data calculation result values in the data table.
In a third aspect, the application also provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the following steps when executing the computer program:
acquiring data to be rendered, wherein the data to be rendered comprises a data name and a data value, and a first corresponding relation is formed between the data name and the data value;
generating a data table based on the data name and the data value according to a preset table generation rule;
acquiring a preset data calculation formula, wherein a second corresponding relation exists between an independent variable in the data calculation formula and the data name;
and calculating the data values in the data table through the data calculation formula according to the first corresponding relation and the second corresponding relation, and rendering the data calculation result values in the data table.
In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
acquiring data to be rendered, wherein the data to be rendered comprises a data name and a data value, and a first corresponding relation is formed between the data name and the data value;
generating a data table based on the data name and the data value according to a preset table generation rule;
acquiring a preset data calculation formula, wherein a second corresponding relation exists between independent variables in the data calculation formula and the data names;
and calculating the data values in the data table through the data calculation formula according to the first corresponding relation and the second corresponding relation, and rendering the data calculation result values in the data table.
In a fifth aspect, the present application further provides a computer program product. The computer program product comprising a computer program which when executed by a processor performs the steps of:
acquiring data to be rendered, wherein the data to be rendered comprises a data name and a data value, and a first corresponding relation is formed between the data name and the data value;
generating a data table based on the data name and the data value according to a preset table generation rule;
acquiring a preset data calculation formula, wherein a second corresponding relation exists between an independent variable in the data calculation formula and the data name;
and calculating the data values in the data table through the data calculation formula according to the first corresponding relation and the second corresponding relation, and rendering the data calculation result values in the data table.
According to the vxe-table-based dynamic calculation table implementation method, the vxe-table-based dynamic calculation table implementation device, the computer device and the computer readable storage medium, the terminal device firstly acquires data to be rendered, and automatically generates a corresponding table according to data values and data values in the data; and then receiving a data calculation formula input by a user, wherein the independent variable in the data calculation formula corresponds to the data name and the data value, so that the data value is directly brought into the data calculation formula for calculation according to the corresponding relation during calculation. Compared with the prior art, the realization of the table calculation function is simpler, the linkage calculation of the data is realized without compiling a large number of codes, and a user can directly input a data calculation formula with a corresponding format; under different application scenes, a user only needs to design different data calculation formulas according to actual conditions, so that the form realized by the method has the advantage of low development difficulty.
Drawings
FIG. 1 is a flowchart of a vxe-table based dynamic calculation table implementation method in this embodiment;
FIG. 2 is a flow chart of a vxe-table based dynamic calculation table implementation method in the preferred embodiment;
FIG. 3 is a preferred flow chart of a vxe-table based dynamic calculation table implementation method in the preferred embodiment;
fig. 4 is a block diagram of a vxe-table based dynamic calculation table implementation apparatus in this embodiment;
FIG. 5 is a diagram illustrating an internal structure of a computer device according to an embodiment.
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.
Fig. 1 is a flowchart of a vxe-table based dynamic calculation table implementation method in this embodiment. The embodiment is exemplified by applying the method to a terminal with a display device, and it can be understood that the method can also be applied to a system comprising the terminal and a server, and is realized through the interaction of the terminal and the server. As shown in fig. 1, the above process includes the following steps:
step S110, acquiring data to be rendered, wherein the data to be rendered comprises a data name and a data value, and the data name and the data value have a first corresponding relation;
specifically, the terminal device acquires data to be rendered, wherein the data is composed of a data name and a data value which have a first corresponding relationship, the data name is a field name in a data structure, and the data name is identification information of the data value; for example, data name a has a first correspondence with data value 6, then data name a is an identification of data value 6 in the data structure. Further, one data name may correspond to a plurality of data values.
And step S120, generating a data table based on the data name and the data value according to a preset table generation rule.
Specifically, after the terminal device acquires the data, a table is automatically generated according to a data name and a data value in the data. Specifically, the preset table generating rule is that the terminal equipment generates a header of a data table according to data name rendering, and generates a body of the data table according to data value rendering; illustratively, when 5 data names are included in the data, at least 5 tables are generated according to the data names, a column of cells is corresponding to the lower part of each table, and data values corresponding to the data names in the tables are rendered in sequence in each column of cells, so that the terminal equipment automatically generates the table according to the data names and the data values. Compared with the table construction mode in the prior art, the table construction method has the advantages that the user firstly makes the table or firstly determines the table template and then fills data into the table; in this embodiment, the device terminal generates the corresponding table by rendering according to the corresponding data structure directly based on the acquired data, thereby greatly improving the table generation efficiency and finally displaying the corresponding data on the display device.
Step S130, a preset data calculation formula is obtained, where the independent variable and the data name in the data calculation formula have a second corresponding relationship.
Specifically, the terminal device obtains a data calculation formula input by a user, wherein each independent variable in the data calculation formula corresponds to a plurality of data names respectively. For example, when the plurality of data names are A, B, C, respectively, the data calculation formula may be X =3A +2B + A + a, where X is the result term and a is the constant term. It should be noted that, a plurality of data calculation formulas may be input to the terminal device in advance by the user for saving, and the corresponding data calculation formula is selected in the table during use. Preferably, an input control of the data calculation formula and an effective formula display area are provided on a configuration interface of the table; after the user inputs the data calculation formula in the input control, the data calculation formula is displayed in the display area, the display area can delete the validated formula, and then the terminal device can receive the data calculation formula input by the user in real time.
Step S140, calculating the data value in the data table according to the first corresponding relationship and the second corresponding relationship by using the data calculation formula, and rendering the data calculation result value in the data table.
Specifically, the terminal device performs association mapping on the data value and the independent variable in the data calculation formula according to the first corresponding relationship and the second corresponding relationship. In the process of data calculation, the data values are directly brought into the data calculation formula for calculation according to the mapping relation, so that data calculation results are obtained, and finally, corresponding data calculation results are rendered in the data table. More specifically, each row of data values in the data table is a group, a plurality of data values in the group of data values respectively correspond to a plurality of independent variables of the data calculation formula, and the data values are brought into the corresponding independent variables to realize calculation during calculation.
In the vxe-table-based dynamic calculation table implementation method, the terminal device first acquires data to be rendered, and automatically generates a corresponding table according to data values and data values in the data; and then receiving a data calculation formula input by a user, wherein the independent variable in the data calculation formula corresponds to the data name and the data value, so that the data value is directly brought into the data calculation formula for calculation according to the corresponding relation during calculation. Compared with the prior art, the realization of the table calculation function is simpler, the linkage calculation of the data is realized without compiling a large number of codes, and a user can directly input a data calculation formula with a corresponding format; under different application scenes, a user only needs to design different data calculation formulas according to actual conditions, so that the form realized by the method has the advantage of low development difficulty. It should be noted that the data calculation formula used in this embodiment needs to satisfy a specific format condition, that is, the independent variable in the data calculation formula needs to correspond to the data name, so that a user can directly design a corresponding data calculation formula using the data name as the independent variable.
It should be further noted that the method in this embodiment generates the table only according to the field names and field values that are the most basic of the data, and does not limit the field types. The table can be generated by using the general key value pair data without adopting a special professional data format. And the data calculation formula is input by a separate input module and is separated from the data, and the table can be freely modified before and after being generated.
In one embodiment, the method for implementing the vxe-table-based dynamic calculation table further comprises the following steps:
and when the data value in the data table is detected to be changed, calculating the changed data value in the data table through a data calculation formula according to the first corresponding relation and the second corresponding relation, and updating a data calculation result in the data table.
Specifically, the table generated by the method in this embodiment also has a dynamic calculation function, that is, after the table is generated and the result rendering is completed according to the data calculation formula, the result may be recalculated in real time according to the data change in the table. More specifically, after detecting a data value in the table changes, the corresponding data value group is substituted into the data calculation formula for recalculation, for example, after detecting a data value in the third row changes, the data value in the third row is substituted into the formula for recalculation, and the data calculation result is updated in the table.
Further, in a specific embodiment, the method for implementing a vxe-table based dynamic calculation table further includes the following steps:
determining a data value to be modified in a data table according to a modification instruction input by a user based on a vxe-table component, and converting a cell where the data value to be modified is located into a data input frame;
receiving a new data value in the data input box, and replacing the data value to be modified by the new data value;
and calculating the data values in the data table through a data calculation formula according to the first corresponding relation and the second corresponding relation.
Specifically, the table modification function in the present embodiment is provided by a vxe-table component. Illustratively, when a user needs to modify a certain data value in the table, a corresponding data value is clicked through a mouse, then the cell where the data value is located is converted into a data input box, at this time, the user can input a new data value in the data input box, and the terminal device replaces the original data value after receiving the new data value, so that the original first corresponding relationship between the new data value and the data name is maintained. And after the data value replacement is finished, the equipment terminal detects that one data value change is finished, and then all data values of a row where a new data value is located are brought into the data calculation formula for calculation again. Therefore, in this embodiment, according to the modification function provided by the vxe-table component, the user can modify the data values in the table in real time, and the device terminal recalculates and updates the data calculation result in the table in real time according to the data value change, so that the table realizes the dynamic calculation function.
In another embodiment, the vxe-table based dynamic calculation table implementation method further comprises the following steps:
and when the data calculation formula is detected to be changed, calculating the data value in the data table through the changed data calculation formula according to the first corresponding relation and the second corresponding relation, and updating the data calculation result in the data table.
In particular, the table realized by the method also has the function of modifying the data calculation formula. After receiving the new data calculation formula, the equipment terminal equipment replaces the data values in the table into the new data calculation formula again according to the corresponding relationship for calculation, and updates all data calculation results. Therefore, a user can design a new data calculation formula according to the actual use condition. Exemplarily, an input control of a data calculation formula and an effective formula showing area are provided on a configuration interface of the table; after the user inputs the data calculation formula in the input control, the data calculation formula is displayed in the display area, the display area can delete the effective formula, and meanwhile, the user can directly modify the data calculation formula on the input control or input a new data calculation formula.
In one embodiment, the step of calculating the data value in the data table according to the first corresponding relationship and the second corresponding relationship by using a data calculation formula, and rendering the data calculation result value in the data table includes:
determining the mapping relation between the data value and the independent variable in the data calculation formula according to the first corresponding relation and the second corresponding relation;
inputting corresponding data values in the data calculation formula and the table into a preset calculation library according to the mapping relation; the calculation library is used for substituting the data values into a data calculation formula according to the mapping relation for calculation and generating a data calculation result;
and acquiring a data calculation result from the calculation library, and rendering the data calculation result in the data table.
Specifically, the terminal device determines a mapping relationship between the data value and the independent variable according to a first corresponding relationship between the data name and the data value and a second corresponding relationship between the data name and the independent variable, then inputs a data calculation formula and a corresponding data value into a calculation base according to the mapping relationship, then realizes calculation of the data value through the database, and finally obtains a data calculation result from the database. Specifically, the database carries each data value into the independent variable of the data calculation formula to realize calculation according to the mapping relation during calculation. Js, a professional computation library is adopted by the computation library, and data computation is realized through an evaluate method in the computation library.
In one optional embodiment, the method for implementing a vxe-table based dynamic calculation table further includes the following steps:
judging whether the data calculation formula is abnormal or not according to the operation result of the data calculation formula;
if yes, prompting that the data calculation formula is wrong; if not, storing the data calculation formula.
Specifically, the method for implementing the dynamic calculation table in the embodiment further includes an error capturing function, which performs a judgment according to an operation result of the data calculation formula, captures an error if the operation is performed in error, and prompts the error in a form of a bullet frame; if the operation is correct, the data calculation formula is saved, and data calculation is realized through the data calculation formula.
The technical solution in the present application is further described below by specific preferred embodiments.
FIG. 2 is a flow chart of a vxe-table based dynamic calculation table implementation method in the preferred embodiment. As shown in fig. 2, the above process includes the following steps:
in step S210, a calculation formula is received in the configuration area.
Specifically, the configuration area is composed of two parts, one is an input box used for inputting a calculation formula; the other is a formula display area which displays the existing formula and can also select the formula for deleting operation, wherein the input box is provided by the formula input control, so that the user can input the calculation formula in the input box of the configuration area.
Step S220, storing the calculation formula into a calculation queue and displaying the calculation formula in a formula display area.
Specifically, the equipment terminal stores the calculation formula into the calculation queue and displays the calculation formula in the formula display area.
Step S230, judging whether the calculation formula is abnormal; if yes, step S210 is executed, otherwise, step S240 is executed.
Specifically, when the calculation formula is abnormal, an error is prompted, and a new calculation formula is received again; step S240 is performed when the calculation formula is not abnormal.
In step S240, the table data is traversed, each row of data is filled into the calculation formula for calculation, and the result is stored in the table data.
And step S250, rendering the calculated table data into a table.
Fig. 3 is a preferred flowchart of a vxe-table based dynamic calculation table implementation method in the preferred embodiment. As shown in fig. 3, the preferred process includes the following steps:
in step S310, a calculation formula input by a user is received.
Specifically, a calculation formula input by a user is assigned to the transition variable by utilizing the bidirectional binding function of vue.
Step S320, storing a calculation formula: and storing the value of the transition variable into the calculation formula array, and emptying the transition variable.
Step S330, the data in the table is calculated according to the calculation formula.
Specifically, after a user inputs a new calculation formula, a calculation button above the table is clicked to call a calculation function, the function executes operation to pass through the table data, and each row of table data and the input of the calculation formula are input into the evaluate method of mathJS together to obtain a calculation result.
Step S340, recalculating the data in the table according to the data variation in the table.
Specifically, by using a table editing function of the vxe-table, a cell is changed into an input box after a user clicks a table data item, the corresponding table data is dynamically bound by the input box, and a calculation function is triggered by returning or clicking a place outside the cell after the user inputs the data to recalculate the table data.
According to the preferable process, the dynamic calculation table implementation method based on the vue + vxe-table customizable calculation formula is provided. The method comprises the following steps: providing a calculation formula input control and an effective formula display area on a configuration interface; after a calculation formula is input in the input control, the formula is displayed in a display area, and the display area can delete the validated formula; and providing an input control in the form control, displaying the input control after clicking the data in the form by the user, and dynamically rendering the calculation result into the form according to the calculation formula after inputting new data by the user. By the method, reusability of the form is improved, development efficiency of research and development personnel is improved, and data entry work is simpler and more efficient.
Through the description of the above preferred embodiment, the method for implementing a vxe-table based dynamic calculation table in the present application has at least the following advantages:
1. developers do not need to write a large number of codes to realize the linkage calculation function of the form, and the development efficiency is improved
2. The form definition can be repeatedly used, only the calculation formula needs to be changed in the face of different calculation scenes, and the repeated labor is reduced
3. Not only facing developers, but also defining a calculation formula by users, and having more flexible operation.
It should be understood that, although the steps in the flowcharts related to the embodiments are shown in sequence as indicated by the arrows, the steps are not necessarily executed in sequence as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts related to the above embodiments may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least a part of the steps or stages in other steps.
Based on the same inventive concept, the embodiment of the present application further provides a dynamic calculation table implementation apparatus based on a vxe-table, for implementing the above related dynamic calculation table implementation method based on a vxe-table. The implementation scheme for solving the problem provided by the apparatus is similar to the implementation scheme described in the above method, so that specific limitations in one or more embodiments of the apparatus for implementing a dynamic calculation table based on a vxe-table provided below may refer to limitations in the above method for implementing a dynamic calculation table based on a vxe-table, and are not described herein again.
Fig. 4 is a block diagram of a vxe-table based dynamic calculation table implementation apparatus in this embodiment. In one embodiment, as shown in fig. 4, there is provided a vxe-table based dynamic calculation table implementation apparatus, including: a data acquisition module 410, a table generation module 420, a formula acquisition module 430, and a data calculation module 440, wherein:
a data obtaining module 410, configured to obtain data to be rendered, where the data to be rendered includes a data name and a data value, and the data name and the data value have a first corresponding relationship;
a table generating module 420, configured to generate a data table based on the data name and the data value according to a preset table generating rule;
the formula obtaining module 430 is configured to obtain a preset data calculation formula, where an argument and a data name in the data calculation formula have a second correspondence;
and the data calculation module 440 is configured to calculate data values in the data table according to the first corresponding relationship and the second corresponding relationship by using a data calculation formula, and render data calculation result values in the data table.
The dynamic calculation table based on the vxe-table is realized through the modules, the realization of the table calculation function is simpler than that of the prior art, a large number of codes are not required to be written for realizing the linkage calculation of data, and a user can directly input a data calculation formula in a corresponding format; under different application scenes, a user only needs to design different data calculation formulas according to actual conditions, so that the form realized by the method has the advantage of low development difficulty.
In other embodiments, the vxe-table based dynamic calculation table implementation apparatus further includes: the system comprises a first updating module, a second updating module and a formula judging module; wherein:
the first updating module is used for calculating the changed data value in the data table through a data calculation formula according to the first corresponding relation and the second corresponding relation when detecting that the data value in the data table changes, and updating a data calculation result in the data table;
the second updating module is used for calculating the data values in the data table through the changed data calculation formula according to the first corresponding relation and the second corresponding relation when detecting that the data calculation formula is changed, and updating the data calculation result in the data table;
the formula judgment module is used for judging whether the data calculation formula is abnormal or not according to the operation result of the data calculation formula; if yes, prompting that the data calculation formula is wrong; if not, storing the data calculation formula.
The various modules in the vxe-table based dynamic calculation table implementation apparatus may be implemented wholly or partially by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 5. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to realize a vxe-table-based dynamic calculation table implementation method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the configuration shown in fig. 5 is a block diagram of only a portion of the configuration associated with the present application, and is not intended to limit the computing device to which the present application may be applied, and that a particular computing device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
the method comprises the steps that A1, data to be rendered are obtained, wherein the data to be rendered comprise data names and data values, and a first corresponding relation exists between the data names and the data values;
step A2, generating a data table based on a data name and a data value according to a preset table generation rule;
a3, acquiring a preset data calculation formula, wherein a second corresponding relation exists between independent variables and data names in the data calculation formula;
and A4, calculating the data values in the data table through a data calculation formula according to the first corresponding relation and the second corresponding relation, and rendering the data calculation result values in the data table.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
step B1, data to be rendered are obtained, wherein the data to be rendered comprise data names and data values, and a first corresponding relation exists between the data names and the data values;
b2, generating a data table based on the data name and the data value according to a preset table generation rule;
step B3, acquiring a preset data calculation formula, wherein a second corresponding relation exists between independent variables and data names in the data calculation formula;
and B4, calculating the data values in the data table through a data calculation formula according to the first corresponding relation and the second corresponding relation, and rendering the data calculation result values in the data table.
In one embodiment, a computer program product is provided, comprising a computer program which when executed by a processor performs the steps of:
step C1, data to be rendered are obtained, wherein the data to be rendered comprise data names and data values, and a first corresponding relation exists between the data names and the data values;
step C2, generating a data table based on the data name and the data value according to a preset table generation rule;
step C3, acquiring a preset data calculation formula, wherein a second corresponding relation exists between independent variables and data names in the data calculation formula;
and C4, calculating the data values in the data table through a data calculation formula according to the first corresponding relation and the second corresponding relation, and rendering the data calculation result values in the data table.
It should be noted that, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware related to instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include a Read-Only Memory (ROM), a magnetic tape, a floppy disk, a flash Memory, an optical Memory, a high-density embedded nonvolatile Memory, a resistive Random Access Memory (ReRAM), a Magnetic Random Access Memory (MRAM), a Ferroelectric Random Access Memory (FRAM), a Phase Change Memory (PCM), a graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others. The databases referred to in various embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above examples only express several embodiments of the present application, and the description thereof is more specific and detailed, but not to be construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims (10)

1. A vxe-table based dynamic calculation table implementation method is characterized by comprising the following steps:
acquiring data to be rendered, wherein the data to be rendered comprises a data name and a data value, and a first corresponding relation is formed between the data name and the data value;
generating a data table based on the data name and the data value according to a preset table generation rule;
acquiring a preset data calculation formula, wherein a second corresponding relation exists between an independent variable in the data calculation formula and the data name;
and calculating the data values in the data table through the data calculation formula according to the first corresponding relation and the second corresponding relation, and rendering the data calculation result values in the data table.
2. The vxe-table based dynamic calculation table implementation method of claim 1, further comprising:
when the data value in the data table is detected to be changed, the changed data value in the data table is calculated through the data calculation formula according to the first corresponding relation and the second corresponding relation, and the data calculation result is updated in the data table.
3. The vxe-table based dynamic calculation table implementation method of claim 2, wherein the calculating, according to the first correspondence and the second correspondence, the changed data value in the data table by the data calculation formula when it is detected that the data value in the data table changes comprises:
determining a data value to be modified in the data table according to a modification instruction input by a user based on a vxe-table component, and converting a cell where the data value to be modified is located into a data input frame;
receiving a new data value in the data input box, and replacing the data value to be modified by the new data value;
and calculating the data values in the data table through the data calculation formula according to the first corresponding relation and the second corresponding relation.
4. The vxe-table based dynamic calculation table implementation method of claim 1, further comprising:
when the data calculation formula is detected to be changed, calculating the data value in the data table through the changed data calculation formula according to the first corresponding relation and the second corresponding relation, and updating the data calculation result in the data table.
5. The vxe-table based dynamic calculation table implementation method of any one of claims 1 to 4, wherein the generating a data table based on the data name and data value according to a preset table generation rule comprises:
and rendering and generating a header of the data table according to the data name, and rendering and generating a body of the data table according to the data value.
6. The vxe-table based dynamic calculation table implementation method according to any one of claims 1 to 4, wherein the calculating data values in the data table by the data calculation formula according to the first correspondence and the second correspondence, and rendering data calculation result values in the data table comprises:
determining a mapping relation between the data value and an independent variable in the data calculation formula according to the first corresponding relation and the second corresponding relation;
inputting the data calculation formula and the corresponding data value in the table into a preset calculation library according to the mapping relation; the calculation library is used for substituting the data value into the data calculation formula according to the mapping relation to carry out calculation and generating a data calculation result;
and acquiring the data calculation result from the calculation library, and rendering the data calculation result in the data table.
7. The vxe-table based dynamic calculation table implementation method according to any one of claims 1 to 4, further comprising:
judging whether the data calculation formula is abnormal or not according to the operation result of the data calculation formula;
if so, prompting that the data calculation formula is wrong;
and if not, storing the data calculation formula.
8. A vxe-table based dynamic calculation table implementation apparatus, the apparatus comprising:
the data rendering method comprises the steps of obtaining data to be rendered, wherein the data to be rendered comprises a data name and a data value, and a first corresponding relation is formed between the data name and the data value;
the table generating module is used for generating a data table based on the data name and the data value according to a preset table generating rule;
the formula acquisition module is used for acquiring a preset data calculation formula, wherein a second corresponding relation exists between an independent variable in the data calculation formula and the data name;
and the data calculation module is used for calculating the data values in the data table through the data calculation formula according to the first corresponding relation and the second corresponding relation and rendering the data calculation result values in the data table.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any one of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202210717955.3A 2022-06-21 2022-06-21 Vxe-table based dynamic calculation table implementation method, device and computer equipment Pending CN115221852A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210717955.3A CN115221852A (en) 2022-06-21 2022-06-21 Vxe-table based dynamic calculation table implementation method, device and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210717955.3A CN115221852A (en) 2022-06-21 2022-06-21 Vxe-table based dynamic calculation table implementation method, device and computer equipment

Publications (1)

Publication Number Publication Date
CN115221852A true CN115221852A (en) 2022-10-21

Family

ID=83609056

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210717955.3A Pending CN115221852A (en) 2022-06-21 2022-06-21 Vxe-table based dynamic calculation table implementation method, device and computer equipment

Country Status (1)

Country Link
CN (1) CN115221852A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116628067A (en) * 2023-07-25 2023-08-22 苏州万店掌网络科技有限公司 Form data processing method, device, equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116628067A (en) * 2023-07-25 2023-08-22 苏州万店掌网络科技有限公司 Form data processing method, device, equipment and storage medium
CN116628067B (en) * 2023-07-25 2023-10-31 苏州万店掌网络科技有限公司 Form data processing method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
WO2020253059A1 (en) Method and apparatus for implementing multi-stage linkage drop-down box, and computer device
CN111061475B (en) Software code generating method, device, computer equipment and storage medium
CN111596911B (en) Method, device, computer equipment and storage medium for generating control
CN112433712A (en) Report display method and device, computer equipment and storage medium
CN113535135A (en) Software development method and device, computer equipment and storage medium
CN110597552B (en) Configuration method, device, equipment and storage medium of project continuous integrated pipeline
CN115221852A (en) Vxe-table based dynamic calculation table implementation method, device and computer equipment
CN115145545A (en) Method and device for generating small program code, computer equipment and storage medium
CN112001615A (en) Process creation method, system, computer device, and storage medium
CN112764763A (en) Code conversion method, system, equipment and computer readable storage medium
CN115686706B (en) Terminal view configuration method, device, computer equipment and storage medium
CN115840861A (en) Method and device for updating style layout information, computer equipment and storage medium
WO2024152742A1 (en) Rich text editing method and apparatus, storage medium and computer device
CN117612192A (en) Electronic drawing information identification method, system, electronic equipment and storage medium
CN115878929A (en) Webpage rendering method and device
CN116881594A (en) View updating method, device, computer equipment and storage medium
CN117632951A (en) Algorithm flow arranging method, device, computer equipment and storage medium
CN117196924A (en) Watermark adding method, watermark adding device, computer equipment and storage medium
CN118092888A (en) Code aided programming method, apparatus, computer device and storage medium
CN117522296A (en) Auditing flow generation method, auditing flow generation device, computer equipment and storage medium
CN117648484A (en) Content recommendation method, device, computer equipment and storage medium
CN117453211A (en) Page generation method, page generation device, computer device, storage medium and program product
CN115269065A (en) Call modification method and device, computer equipment and storage medium thereof
CN117311686A (en) Application generation method, device, apparatus, medium and program product
CN115718701A (en) Program testing method, program testing device, computer equipment and storage medium

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