Table data processing method and device, electronic equipment and storage medium
By introducing a draft database into online forms to temporarily store user actions, updating cell display data in real time, and performing unified validation before submission, the problem of low data processing efficiency in online forms is solved, thereby improving user experience and operational efficiency.
Patent Information
- Application Number
- CN202211110747.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-13
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2042-09-13
AI Technical Summary
In online spreadsheet data processing, existing technologies suffer from low data operation efficiency, poor user experience, inability to perform undo and redo operations, and limitations in batch operations.
The concept of draft data is introduced, and user operations are temporarily stored in a draft database. Cell display data is updated in real time, and data is validated and updated uniformly before submission.
It improves the efficiency of online form data processing, reduces user anxiety during operation, and enhances both data processing efficiency and user experience.
Smart Images

Figure CN115510828B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and in particular to a table data processing method and device, electronic equipment and storage medium. BACKGROUND
[0002] At present, one of the core scenarios of low code is table data management, such as online table. Low code emphasizes data integrity and consistency, and one row in a low code table is usually a complete data unit for transaction processing. Unlike the free editing of offline tables, online tables generally take one row as the minimum unit for data processing (addition, deletion, and modification). During data operation, different levels of verification work will be performed on the operation data. For example, verification of mandatory, data format, and duplicate values. In the case of a single row, some verification result prompts will interrupt user operation. In addition, when a single row is submitted, the data in the submission will be locked, preventing the user from continuing to operate, resulting in low data processing efficiency and affecting user experience. Therefore, how to provide a table data processing method to improve the processing efficiency of table data has become a technical problem to be solved. SUMMARY
[0003] The main purpose of the embodiments of the present application is to provide a table data processing method, device, electronic equipment and storage medium, which can improve the processing efficiency of table data.
[0004] To achieve the above purpose, the first aspect of the embodiments of the present application provides a table data processing method, which comprises:
[0005] Receiving a target operation on a cell of an original data table and recording position information of the cell;
[0006] Obtaining an operation type of the target operation, and filtering a preset table operation instruction according to the operation type to obtain a first operation instruction;
[0007] Processing the cell through the first operation instruction to obtain target draft data, and updating a preset draft database according to the target draft data; wherein the draft database comprises original draft data and original effective data;
[0008] If a cancel command is received, filtering a preset table reverse operation instruction according to the operation type to obtain a second operation instruction, and editing the target draft data through the second operation instruction to update the draft database;
[0009] Reading draft data from the draft database to obtain selected draft data; wherein the selected draft data comprises any one of the original effective data, the original draft data, and the target draft data;
[0010] updating display data of the cell based on the selected draft data, and moving an operation window position of the original data table to a table position corresponding to the position information;
[0011] if a submission command is received, rendering the original data table based on the draft database to obtain a target data table.
[0012] In some embodiments, the target operation includes an addition operation, and the operation processing of the cell based on the first operation instruction obtains target draft data, and updating a preset draft database based on the target draft data includes:
[0013] obtaining target addition data of the addition operation;
[0014] obtaining an identification code of the cell to obtain an addition identification code;
[0015] merging the addition identification code and the target addition data according to the operation type to obtain target draft data, and writing the target draft data into the draft database;
[0016] Correspondingly, if a cancel command is received, editing the target draft data based on the second operation instruction includes:
[0017] if a cancel command is received, deleting the target draft data of the draft database based on the addition identification code.
[0018] In some embodiments, the target operation includes a deletion operation, and the operation processing of the cell based on the first operation instruction obtains target draft data, and updating a preset draft database based on the target draft data includes:
[0019] obtaining an identification code of the cell to obtain a deletion identification code;
[0020] reading draft data from the draft database according to the deletion identification code to obtain first candidate draft data;
[0021] if the first candidate draft data is the original effective data, obtaining target deletion data of the deletion operation, merging the deletion identification code and the target deletion data to obtain target draft data, and adding the target draft data to the draft database;
[0022] If the first candidate draft data is the original draft data and the data type of the first candidate draft data is an addition type, first backup draft data is generated according to the first candidate draft data, and the first backup draft data is added to a preset first cache library; based on the deletion identifier, the original draft data of the draft database is deleted;
[0023] Correspondingly, if the undo command is received, the target draft data is edited by the second operation instruction, including:
[0024] If the undo command is received, and if the first backup draft data exists in the first cache library, the first backup draft data is obtained from the first cache library based on the deletion identifier, and the first backup draft data is added to the draft database;
[0025] Alternatively, if the undo command is received, and if the first backup draft data does not exist in the first cache library, the target draft data of the draft database is deleted based on the deletion identifier.
[0026] In some embodiments, the target operation includes a modification operation, the operation of the cell by the first operation instruction obtains target draft data, and the preset draft database is updated according to the target draft data, including:
[0027] An identifier of the cell is obtained, and a modification identifier is obtained;
[0028] Target modification data of the modification operation is obtained;
[0029] Draft data is read from the draft database according to the modification identifier, and second candidate draft data is obtained;
[0030] If the second candidate draft data is the original effective data, the modification identifier and the target modification data are combined based on the operation type to obtain the target draft data, and the target draft data is added to the draft database;
[0031] If the second candidate draft data is the original draft data, the second candidate draft data is backed up to obtain second backup draft data, the second backup draft data is added to a preset second cache library, the modification identifier and the target modification data are combined based on the operation type to obtain target draft data, and the original draft data of the draft database is updated according to the target draft data;
[0032] Correspondingly, if the undo command is received, the target draft data is edited by the second operation instruction, including:
[0033] If the undo command is received, and if the second backup draft data exists in the second cache library, the second backup draft data is obtained from the second cache library based on the modification identification code, and the target draft data of the draft database is updated according to the second backup draft data;
[0034] If the undo command is received, and if the second backup draft data does not exist in the second cache library, the target draft data of the draft database is deleted based on the modification identification code.
[0035] In some embodiments, the target operation includes an undo operation, and the method further includes:
[0036] An identification code of the cell is obtained, and an undo identification code is obtained;
[0037] Draft data is read from the draft database according to the undo identification code, and third candidate draft data is obtained;
[0038] The third candidate draft data is backed up to obtain third backup draft data, and the third backup draft data is added to a preset third cache library;
[0039] The third candidate draft data of the draft database is deleted based on the undo identification code;
[0040] Correspondingly, if the undo command is received, the target draft data is edited by the second operation instruction, including:
[0041] If the undo command is received, the third backup draft data is obtained from the third cache library based on the undo identification code, and the third backup draft data is added to the draft database.
[0042] In some embodiments, if the target operation includes a batch copy operation or a batch paste operation, the operation processing of the cell by the first operation instruction to generate target draft data, and updating a preset draft database according to the target draft data, includes:
[0043] An identification code of the cell is obtained, and a batch identification code is obtained;
[0044] Target batch data of the batch operation is obtained;
[0045] Draft data is read from the draft database according to the batch identification code, and fourth candidate draft data is obtained;
[0046] Backup the fourth candidate draft data to obtain fourth backup draft data, and add the fourth backup draft data to a preset fourth cache library;
[0047] Based on the operation type, the batch identification code and the target batch data are merged to obtain target draft data;
[0048] The target draft data is added to the draft database;
[0049] Correspondingly, if the undo command is received, the target draft data is edited by the second operation instruction, including:
[0050] If the undo command is received, the target draft data of the draft database is deleted based on the batch identification code;
[0051] Based on the batch identification code, the fourth backup draft data is obtained from the fourth cache library, and the fourth backup draft data is added to the draft database.
[0052] In some embodiments, the display data of the cell is updated based on the selected draft data, including:
[0053] If the data type of the selected draft data is an addition type, the selected draft data is parsed to obtain target addition data, and the target addition data is taken as the current display data of the cell;
[0054] Or,
[0055] If the data type of the selected draft data is a deletion type, the current display data of the cell is emptied;
[0056] Or,
[0057] If the data type of the selected draft data is a modification type, the selected draft data is parsed to obtain target modification data, and the target modification data is taken as the current display data of the cell.
[0058] To achieve the above purpose, a second aspect of an embodiment of the present application proposes a table data processing device, the device comprising:
[0059] A target operation receiving module is configured to receive a target operation on a cell of an original data table and record position information of the cell;
[0060] An operation type obtaining module is configured to obtain an operation type of the target operation, and filter a preset table operation instruction according to the operation type to obtain a first operation instruction;
[0061] The draft data generation module is configured to operate the cell according to the first operation instruction to obtain target draft data, and update a preset draft database according to the target draft data; wherein the draft database comprises original draft data and original effective data.
[0062] The undo module is configured to, if an undo command is received, filter a preset inverse operation instruction of the table according to the operation type to obtain a second operation instruction, and edit the target draft data by using the second operation instruction to update the draft database.
[0063] The data reading module is configured to read draft data from the draft database to obtain selected draft data; wherein the selected draft data comprises the original effective data, or the original draft data, or the target draft data.
[0064] The cell updating module is configured to update display data of the cell based on the selected draft data, and move an operation window position of the original data table to a table position corresponding to the position information.
[0065] The target data table generation module is configured to, if a submission command is received, render the original data table based on the draft database to obtain a target data table.
[0066] To achieve the above object, a third aspect of the embodiments of the present application provides an electronic device, which comprises a memory and a processor, the memory stores a computer program, and the processor implements the method of the first aspect when executing the computer program.
[0067] To achieve the above object, a fourth aspect of the embodiments of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the method of the first aspect.
[0068] The table data processing method and device, electronic device and storage medium provided by the present application introduce the concept of draft, and the draft data is temporary data generated by user operation (relative to the data stored in the background database). Before receiving a submission command, various operations of the user are stored in the draft database in the form of draft data. In order to display the operation results of the user in real time, the draft data needs to be read from the draft database, so as to update the current display data of the cell according to the draft data. After receiving the submission command, the original data table is rendered based on all the draft data in the draft database, so as to update the original data table to obtain a target data table. The embodiments of the present application record the operations of the user in the form of draft data, so as to uniformly perform data verification and update after submission, thereby improving the efficiency of online table data processing. BRIEF DESCRIPTION OF DRAWINGS
[0069] Figure 1 is a flowchart of the table data processing method provided by an embodiment of the present application;
[0070] Figure 2 is another flowchart of step S103 in Figure 1
[0071] Figure 3 is another flowchart of step S103 in Figure 1
[0072] Figure 4 is another flowchart of step S103 in Figure 1
[0073] Figure 5 is a flowchart of the table data processing method provided by another embodiment of the present application;
[0074] Figure 6 is another flowchart of step S103 in Figure 1
[0075] Figure 7 is another flowchart of step S106 in Figure 1
[0076] Figure 8 is a module structure block diagram of the table data processing apparatus provided by an embodiment of the present application;
[0077] Figure 9 is a hardware structure schematic diagram of the electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0078] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.
[0079] It should be noted that although the functional modules are divided in the apparatus schematic diagram, and the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a manner different from the module division in the apparatus or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and above-mentioned drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence.
[0080] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in the description herein is for describing particular embodiments only and is not intended to be limiting of the application.
[0081] One of the core scenarios of low code is table data management, which is manifested as an online Excel form. The most significant difference between the traditional low code table data scenario and Excel is transaction. Low code emphasizes data integrity and consistency, and a row in the low code table is often a complete data unit for transaction processing. Therefore, unlike the free editing of Excel, a row is generally used as the smallest unit for data processing (addition, deletion, and modification). This approach is logically complete, but in combination with user feedback, this mode has the following flaws in actual use:
[0082] 1. During data operation, different levels of verification will be performed on the operation data, such as front-end mandatory, data format, and back-end duplicate value, submission rule, and the like. In the case of a single row, some verification result prompts will interrupt the user operation. When submitting, the data in the submission will be locked and cannot be operated continuously. Therefore, the processing efficiency is low and the use experience is affected.
[0083] 2. In the case of single-row submission, the user's batch operations such as copying and pasting are limited, and the user's use scenarios are correspondingly limited.
[0084] 3. Common functions are subject to certain restrictions, such as undo and redo operations that cannot be implemented, affecting operation efficiency.
[0085] Based on this, the main purpose of the embodiments of the present application is to propose a table data processing method, device, electronic equipment and storage medium, which can improve the processing efficiency of table data. The specific embodiments are described as follows. First, the table data processing method in the embodiments of the present application is described.
[0086] Figure 1 is an optional flowchart of the table data processing method provided by the embodiments of the present application, Figure 1 The method in the above embodiment can include, but is not limited to, steps S101 to S107.
[0087] Step S101, receiving a target operation on a cell of an original data table, and recording position information of the cell;
[0088] Step S102, obtaining an operation type of the target operation, and filtering a preset table operation instruction according to the operation type to obtain a first operation instruction;
[0089] In step S103, the cell is processed by the first operation instruction to obtain target draft data, and the preset draft database is updated according to the target draft data; wherein the draft database includes: original draft data and original effective data.
[0090] In step S104, if the undo command is received, the second operation instruction is obtained by screening the preset table inverse operation instruction according to the operation type, and the target draft data is edited by the second operation instruction to update the draft database.
[0091] In step S105, the draft data is read from the draft database to obtain selected draft data; wherein the selected draft data includes any one of the following: original effective data, original draft data and target draft data.
[0092] In step S106, the display data of the cell is updated based on the selected draft data, and the operation window position of the original data table is moved to the table position corresponding to the position information.
[0093] In step S107, if the submit command is received, the original data table is rendered based on the draft database to obtain a target data table.
[0094] The steps S101 to S107 shown in the embodiment of the application introduce the concept of draft, and the draft data is temporary data generated by user operation (relative to the data stored in the background database). The draft data is stored in the draft database, which is a temporary database. According to the actual operation type of the user on the cell, the draft data is divided into three types: addition, modification and deletion. For example, when the user adds a row of data, a draft data of the addition type is generated. When the user modifies a row of original data, a draft data of the modification type is generated. When the user deletes a row of data, a draft data of the deletion type is generated. Before receiving the submit command, the user's multiple operations are stored in the draft database in the form of draft data. In order to display the operation results of the user in real time, the draft data needs to be read from the draft database to update the current display data of the cell according to the draft data. After receiving the submit command, the original data table is rendered based on all the draft data in the draft database to update the original draft data table to obtain a target data table. It can be understood that after obtaining the target data table, the draft data of the draft database can be deleted to receive new draft data next time. The operation of the user is recorded in the form of draft data in the embodiment of the application, so that the data verification and update are performed uniformly after submission, and the efficiency of online table data processing is improved.
[0095] It should be noted that the embodiments of the present application also have the following effects: by transferring the timing of the verification work to batch submission after the user operation is completed, the interruption anxiety during the user operation is reduced; the problems are handled centrally, which is more efficient; the IndexDb method is used to store the draft data, which has good compatibility, strong universality, easy data management, saves the trouble of format conversion, and breaks through the storage size limit; by encapsulating the user operation, different user operations are isolated, and the mutual influence between operations is avoided.
[0096] In step S101 of some embodiments, the original data table can be an online Excel table or other forms of online tables. The target operation includes adding operation, modifying operation, deleting operation, batch copying operation, batch pasting operation, and undo operation. The position information of the cell includes the row number of the cell, the column number of the cell, and the position of the current scroll bar. It can be understood that after recording the position information, when the undo command is executed, the window position of the original data table can be directly positioned to the position when the previous operation is executed. The user can intuitively feel the data change and the surrounding scene when the operation occurs. The scene is restored, which facilitates the user to decide whether to continue to execute the rollback or to start other operations according to the scene information. If not recorded, when the undo command is executed, it is similar to silent execution, and the user cannot feel what the rollback operation has executed, what changes have occurred, and does not know to which step the rollback is. It affects the user's next operation decision.
[0097] In step S102 of some embodiments, the operation types of the target operation are different, and the data processing of the cells is different. The corresponding first operation instruction can be matched according to the operation type, so as to perform corresponding processing on the cell according to the first operation instruction. For example, if the operation type is an adding type, the first operation instruction at least needs to determine the identification code of the cell and the target added data. If the operation type is a deleting type, the first operation instruction at least needs to determine the identification code of the cell, the target deleted data, and the data type of the target deleted data.
[0098] In step S103 of some embodiments, the draft database includes: original draft data and original effective data. The original effective data is generated from the original data table. For example, before the user operates the original data table, the original effective data is read from the original data table and added to the draft database. After the user operates the original data table, if no cell is operated, at least the original effective data is included in the draft database. If it is the first operation on a cell, the corresponding target draft data is generated and added to the draft database. If it is the second operation on the same cell, the target draft data corresponding to the last operation is recorded as the original draft data. Subsequent operations on the cell will generate new target draft data, and the target draft data is added to the draft database.
[0099] It should be noted that the draft database of the present embodiment can be localStorage, sessionStorage, or IndexDB. This is because IndexDb in the browser local storage can avoid the problem of data loss caused by webpage switching, closing, etc., ensuring the security of user data; IndexDb has fast access speed, naturally supports asynchronous callback, and is consistent with the user's operation in the front end; IndexDb has good compatibility and is supported by mainstream browsers; IndexDb theoretically breaks through the size limit of storage, and the storage data structure is more flexible, supporting the storage of relational data, and ensuring consistency with the storage structure of the back end.
[0100] In an example, the original draft data is obtained by operating the cells of the original data table. For example, a target operation on a cell of the original data table is received, and operation data of the target operation is obtained; an identification code of the cell is obtained to obtain a target identification code; the target identification code and the operation data are processed to obtain preliminary draft data; the preliminary draft data is annotated according to the operation type to obtain the original draft data; and the original draft data is written into the draft database according to the operation type.
[0101] It should be noted that there is only one original draft data and target draft data, for example, the first operation on a cell generates target draft data, and the target draft data is added to the draft database. The second operation on the same cell obtains target draft data. The draft data in the draft database is the original draft data, and the original draft data is updated according to the target draft data. Updating the original draft data includes deleting the original draft data, modifying the original draft data, etc.
[0102] In step S104 of some embodiments, if the undo command is received, it indicates that the previous target operation needs to be undone. Therefore, the second operation instruction is obtained from the table of inverse operation instructions according to the operation type. The second operation instruction corresponds to the first operation instruction, and the purpose is to restore the operation result of the first operation instruction parameter. In this embodiment, the draft database is mainly updated by the second operation instruction, so that the cell display data is updated to the latest state according to the draft database update unit in the future.
[0103] In step S105 of some embodiments, the draft database at least includes the original effective data, and can also include the original draft data and the target draft data. Different cells correspond to different draft data in the draft database. It should be noted that the priority of the target draft data is the highest, the priority of the original draft data is between the target draft and the original effective data, and the priority of the original effective data is the lowest. For example, the draft database includes the original effective data, the original draft data, and the target draft data, and the selected draft data is the target draft data. If the draft database includes the original effective data and the original draft data, the selected draft data is the original draft data.
[0104] In step S106 of some embodiments, the display data of the cell is updated based on the selected draft data, and the operation window position of the original data table is moved to the table position corresponding to the position information. It should be noted that in the traditional way, the data is submitted to the background after each operation of the cell, and the data is updated and displayed after the background verification is completed. However, in this embodiment, the data will not be submitted to the background without receiving the submission command, so the cell cannot be updated by the background verification result. Therefore, in this embodiment, draft data is generated for each operation, and the draft data is added to the draft database, so that the draft data is read from the draft database, and the current display data of the cell is updated according to the draft data, so that the user can see the real-time updated data table.
[0105] In step S107 of some embodiments, if the submission command is received, the original data table is rendered based on the draft database to obtain the target data table. Specifically, when the user operation is completed, the draft data generated by the user operation is submitted in batches. During the submission process, the draft data is subjected to unified rule verification (mandatory, field format, etc., no verification during user operation), and if the verification is unsuccessful, the rows and columns with verification errors are prompted for error, and the verification is submitted again after modification.
[0106] Please refer to Figure 2 In some embodiments, the target operation includes an addition operation, and step S103 can include but is not limited to steps S201 to S203.
[0107] Step S201, obtaining target new data of the new operation;
[0108] Step S202, obtaining the identification code of the cell to obtain the new identification code;
[0109] Step S203, merging the new identification code and the target new data according to the operation type to obtain target draft data, and writing the target draft data into the draft database.
[0110] Correspondingly, step S104 can include: if the undo command is received, deleting the target draft data of the draft database based on the new identification code.
[0111] The steps S201 to S203 shown in the embodiments of the present application obtain the target draft data based on the new identification code and the target new data, so as to update the display state of the cell according to the target draft data subsequently, and improve the efficiency of data processing.
[0112] Specifically, the new operation corresponds to the target new data, and after the operation is completed, the target new data should be displayed in the original data table. Therefore, the target new data and the new identification code need to be merged to obtain the target draft data, and the data type of the target draft data is recorded as a new type. It should be noted that when the target draft data is read from the draft database subsequently, the display state of the cell needs to be determined according to the data type (the display state includes displaying data and emptying display data). If the undo command is received, the target draft data is deleted. Subsequently, only the original effective data or the original draft data can be read from the draft database, and the original data table will not be affected by the target draft data, and in the view of the user, the undo command has been executed.
[0113] In an example, if the target operation is to add a row, the position information is recorded. An AddCommand object is instantiated. When the first operation instruction is executed, an original draft data is generated, and the data type is a new type. The original draft data is written into the draft database, and a row is added to the table data. When the second operation instruction is executed, the original draft data generated when the first operation instruction of the same AddCommand object is executed is deleted in the draft database, and a row is deleted from the table data, and the table is returned to the position of the added row based on the position information.
[0114] Please refer to Figure 3 In some embodiments, the target operation includes a delete operation, and step S103 can include but is not limited to steps S301 to S304.
[0115] Step S301, obtaining the identification code of the cell to obtain the deletion identification code;
[0116] Step S302, reading draft data according to the deletion identifier code from the draft database to obtain first candidate draft data;
[0117] Step S303, if the first candidate draft data is original effective data, obtaining target deletion data of the deletion operation, performing merging processing on the deletion identifier code and the target deletion data to obtain target draft data, and adding the target draft data to the draft database;
[0118] Step S304, if the first candidate draft data is original draft data, and the data type of the first candidate draft data is an addition type, generating first backup draft data according to the first candidate draft data, and adding the first backup draft data to a preset first cache library; and deleting the original draft data of the draft database based on the deletion identifier code.
[0119] Correspondingly, step S104 includes: if the undo command is received, and if the first backup draft data exists in the first cache library, obtaining the first backup draft data from the first cache library based on the deletion identifier code, and adding the first backup draft data to the draft database; or if the undo command is received, and if the first backup draft data does not exist in the first cache library, deleting the target draft data of the draft database based on the deletion identifier code.
[0120] The steps S301 to S304 shown in the embodiments of the present application distinguish the data types of the deleted data to perform different processing on the draft data of the draft database, so as to improve the efficiency of data processing under the deletion operation.
[0121] In an example, if the target operation is to delete a row, record position information. Instantiate a DeleteCommand object. When the first operation instruction is executed, different operations are taken according to the data type of the deleted data. If the deleted data is original draft data of an addition type, backup the original draft data to obtain first backup draft data, and add the first backup draft data to the first cache library (a database matched with the DeleteCommand object). At the same time, delete the original draft data from the draft database. If the deleted data is original effective data, generate a new target draft data of a deletion type, and add the target draft data to the draft database. The corresponding result of the deletion operation is to delete a row of table data. When the second operation method is executed, undo the deletion operation, and determine the subsequent operation according to whether the first backup draft data exists. If the first backup draft data exists, add the first backup draft data to the draft database again. If the first backup draft data does not exist, delete the target draft data of the draft database. The corresponding result of the undo operation is to restore the row data, and the table returns to the position when the row is deleted.
[0122] Please refer to Figure 4In some embodiments, the target operation includes a modification operation, and step S103 may include, but is not limited to, steps S401 to S405.
[0123] Step S401: Obtain the cell's identifier code to get the modification identifier code;
[0124] Step S402: Obtain the target modification data for the modification operation;
[0125] Step S403: Read draft data from the draft database according to the modification identifier code to obtain the second candidate draft data;
[0126] Step S404: If the second candidate draft data is the original effective data, then the modification identifier code and the target modification data are merged based on the operation type to obtain the target draft data, and the target draft data is added to the draft database.
[0127] Step S405: If the second candidate draft data is the original draft data, then the second candidate draft data is backed up to obtain the second backup draft data, and the second backup draft data is added to the preset second cache library; the modification identifier code and the target modification data are merged based on the operation type to obtain the target draft data, and the original draft data in the draft database is updated according to the target draft data;
[0128] Correspondingly, step S104 includes: if an undo command is received, and if the second cache contains second backup draft data, then based on the modification identifier, the second backup draft data is obtained from the second cache, and the target draft data in the draft database is updated according to the second backup draft data; if an undo command is received, and if the second cache does not contain second backup draft data, then based on the modification identifier, the target draft data in the draft database is deleted.
[0129] Steps S401 to S405, as shown in the embodiments of this application, distinguish the data type of the modified data and perform different processing on the draft data in the draft database to improve the efficiency of data processing under modification operations.
[0130] In an example, if the target operation is a modification of a row, record the location information. Instantiate an UpdateCommand object. When the first operation instruction is executed, take different operations according to whether the original draft data exists in the draft database. If the original draft data already exists, first backup the original draft data to obtain second backup draft data. Then update the draft database according to the target draft data to update the original draft data to the latest. If the original draft data does not exist, generate a target draft data of a modification type and add it to the draft database. The corresponding result of the modification operation is that the row data is the modified data. When the second operation instruction is executed, undo the modification operation, and judge whether the second backup draft data exists. If the second backup draft data exists in the second cache database (a database matched with the UpdateCommand object), update the target draft data of the same modification identification code in the draft database to the second backup draft data. If not, directly delete the target draft data of the same modification identification code in the draft database. The corresponding result of the undo operation is that the modification is restored, and the table returns to the cell row and column position before the modification.
[0131] Referring to Figure 5 In other embodiments, the target operation includes an undo operation, and the table data processing method further includes, but is not limited to, steps S501 to S505.
[0132] In step S501, the identification code of the cell is obtained to obtain an undo identification code.
[0133] In step S502, the draft data is read from the draft database according to the undo identification code to obtain third candidate draft data.
[0134] In step S503, the third candidate draft data is backed up to obtain third backup draft data, and the third backup draft data is added to a preset third cache database.
[0135] In step S504, the third candidate draft data of the draft database is deleted based on the undo identification code.
[0136] Correspondingly, step S104 includes: if the undo command is received, obtaining the third backup draft data from the third cache database based on the undo identification code, and adding the third backup draft data to the draft database.
[0137] The steps S501 to S505 shown in the embodiments of the present application need to backup the draft data when the undo operation is executed, so as to support the data restoration corresponding to the subsequent undo command and improve the efficiency of data processing under the undo operation.
[0138] In one example, when an undo operation is executed, the position information is recorded, and a CancelCommand object is instantiated. When the first operation instruction is executed, the existing draft data is backed up to obtain a third backup draft data, which is then added to the third cache database (the database matching the CancelCommand object). The current draft data is then deleted from the draft database. The result of the undo operation is that newly added data is deleted, and modified data is restored. When the second operation instruction is executed, the third backup draft data backed up in the first operation instruction is added back to the draft database. The corresponding result is that row data is added or modified, and the table is returned to the row and column position of the cell where the undo operation occurred, based on the position information.
[0139] Please see Figure 6 In some embodiments, the target operation includes a batch copy operation or a batch paste operation, and step S103 may include, but is not limited to, steps S601 to S605.
[0140] Step S601: Obtain the cell identifier code to get the batch identifier code;
[0141] Step S602: Obtain the target batch data for the batch operation;
[0142] Step S603: Read draft data from the draft database according to the batch identification code to obtain the fourth candidate draft data;
[0143] Step S604: Back up the fourth candidate draft data to obtain the fourth backup draft data, and add the fourth backup draft data to the preset fourth cache library;
[0144] Step S605: Based on the operation type, merge the batch identifier code and the target batch data to obtain the target draft data;
[0145] Step S606: Add the target draft data to the draft database.
[0146] Correspondingly, step S104 includes: if an undo command is received, deleting the target draft data in the draft database based on the batch identifier; obtaining the fourth backup draft data from the fourth cache library based on the batch identifier, and adding the fourth backup draft data to the draft database.
[0147] In the embodiments of this application, steps S601 to S606, when performing batch operations, first back up the draft data in the draft database, and then update (delete or modify, etc.) the draft data so as to support the data restoration of the draft database when the undo command is executed later.
[0148] It should be noted that when batch copying and pasting rows, the operation unit is a data list. The operation result is a composite result, including multiple operations such as adding and deleting. The corresponding draft data also includes draft data such as adding and deleting. In order to support the restoration operation of the undo command, the behavior and result of copying and pasting are treated as a whole. In an example, when the first operation instruction is executed, the draft data of the current draft database is backed up first to obtain fourth backup draft data, and the fourth backup draft data is added to the fourth cache library. Then the results of the batch operation are added, updated, and the like, and the operation result is the addition and modification of rows and columns. When the second operation instruction is executed, the draft data generated when the first operation instruction is executed is restored, and the operation result is the undo of the copied and pasted data, and the table returns to the cell row and column position where the copying and pasting occurs.
[0149] In other embodiments, the target operation further includes a pull-down fill operation. The pull-down fill operation is to take the data of a cell in a row of data as a template, and change the values of the cell in all rows after the pull-down to the template value. In an example, an AutoFillCommand object can be defined, and when the first operation instruction is executed, the current draft database is backed up first to obtain fifth draft data, and the fifth draft data is added to the fifth cache library (a database matched with the AutoFillCommand object). Then the values of the target cells in all rows of data after the pull-down are changed in turn, and the draft data of the draft database is changed, and the operation result is that the values of the cells in the rows after the pull-down on the rendered table are changed to the template value. When the second operation instruction is executed, the draft database is directly restored according to the fifth draft data, and the operation result is that the values of the cells in the rows after the pull-down fill on the rendered table are restored to the values before the fill.
[0150] Please refer to Figure 7 In some embodiments, step S106 can include but is not limited to steps S701-S703.
[0151] In step S701, if the data type of the selected draft data is an addition type, the selected draft data is parsed to obtain target addition data, and the target addition data is taken as the current display data of the cell;
[0152] In step S702, if the data type of the selected draft data is a deletion type, the current display data of the cell is emptied;
[0153] In step S703, if the data type of the selected draft data is a modification type, the selected draft data is parsed to obtain target modification data, and the target modification data is taken as the current display data of the cell.
[0154] The steps S701 to S703 shown in the embodiments of the present application distinguish selected draft data of different data types, update the display data of the cells, so that the user can know the operation result in real time.
[0155] Please refer to Figure 8 The embodiments of the present application also provide a table data processing device, which can implement the table data processing method described above. Figure 8 The module structure block diagram of the table data processing device provided by the embodiments of the present application is shown in the figure. The device comprises a target operation receiving module 801, an operation type obtaining module 802, a draft data generating module 803, a cancel module 804, a data reading module 805, a cell updating module 806 and a target data table generating module 807. The target operation receiving module 801 is configured to receive a target operation on a cell of an original data table and record position information of the cell. The operation type obtaining module 802 is configured to obtain an operation type of the target operation, and filter a preset table operation instruction according to the operation type to obtain a first operation instruction. The draft data generating module 803 is configured to perform operation processing on the cell through the first operation instruction, obtain target draft data, and update a preset draft database according to the target draft data. The draft database comprises original draft data and original effective data. The cancel module 804 is configured to, if a cancel command is received, filter a preset table reverse operation instruction according to the operation type to obtain a second operation instruction, and perform editing processing on the target draft data through the second operation instruction to update the draft database. The data reading module 805 is configured to read draft data from the draft database to obtain selected draft data. The selected draft data comprises the original effective data, or the original draft data, or the target draft data. The cell updating module 806 is configured to update display data of the cell based on the selected draft data, and move an operation window position of the original data table to a table position corresponding to the position information. The target data table generating module 807 is configured to, if a submit command is received, render the original data table based on the draft database to obtain a target data table.
[0156] It should be noted that the specific implementation of the table data processing device is basically the same as the specific embodiments of the table data processing method described above, and will not be repeated here.
[0157] The embodiments of the present application also provide an electronic device, which comprises a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory. The program is executed by the processor to implement the table data processing method described above. The electronic device can be any smart terminal, such as a tablet computer or a vehicle-mounted computer.
[0158] Please refer to Figure 9 ,Figure 9 The hardware structure of an electronic device is illustrated, and the electronic device includes:
[0159] The processor 901 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits, and is configured to execute related programs to implement the technical solutions provided by the embodiments of the present application.
[0160] The memory 902 can be implemented by a ROM (Read Only Memory), a static storage device, a dynamic storage device, or a RAM (Random Access Memory), and the like. The memory 902 can store an operating system and other application programs, and when the technical solutions provided by the embodiments of the present application are implemented by software or firmware, the related program codes are stored in the memory 902 and called and executed by the processor 901 to implement the data import method of the embodiments of the present application.
[0161] The input / output interface 903 is configured to implement information input and output.
[0162] The communication interface 904 is configured to implement the communication interaction between the device and other devices, and can realize the communication through a wired manner (for example, a USB, a network cable, and the like) or a wireless manner (for example, a mobile network, WIFI, Bluetooth, and the like).
[0163] The bus 905 is configured to transmit information between various components (for example, the processor 901, the memory 902, the input / output interface 903, and the communication interface 904) of the device.
[0164] The processor 901, the memory 902, the input / output interface 903, and the communication interface 904 are connected to each other through the bus 905 to realize the communication connection between the device.
[0165] The embodiments of the present application further provide a storage medium, which is a computer readable storage medium, and is configured to store computer readable information. The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the above-mentioned data import method.
[0166] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. In addition, the memory can include a high-speed random access memory and can also include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state memory device. In some embodiments, the memory can optionally include a memory disposed remotely with respect to the processor, which can be connected to the processor through a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0167] The table data processing method, the table data processing apparatus, the electronic device and the storage medium provided by the embodiments of the present application introduce the concept of a draft, and the draft data is temporary data generated by user operation (relative to the data stored in the background database). The draft data is stored in a draft database, and the draft database is a temporary database. According to the actual operation type of the user on the cell, the draft data is divided into three types: addition, modification and deletion. When the user adds a row of data, a draft data of the addition type is generated. When the user modifies a row of original data, a draft data of the modification type is generated. When the user deletes a row of data, a draft data of the deletion type is generated. Before receiving a submission command, the user's multiple operations are stored in the draft database in the form of draft data. In order to display the operation results of the user in real time, the draft data needs to be read from the draft database, so as to update the current display data of the cell according to the draft data. After receiving the submission command, the original data table is rendered based on all the draft data in the draft database, so as to update the original draft data table to obtain a target data table. It can be understood that after obtaining the target data table, the draft data of the draft database can be deleted, so as to receive new draft data next time. The embodiments of the present application record the user's operation in the form of draft data, so as to uniformly perform data checking and updating after submission, thereby improving the efficiency of online table data processing.
[0168] The embodiments described in the embodiments of the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that, with the evolution of technology and the appearance of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0169] Those skilled in the art can understand that, Figures 1-7 The technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and can include more or fewer steps than shown in the figures, or combine certain steps, or different steps.
[0170] The apparatus embodiments described above are merely exemplary, and the units described as separate units can or can not be physically separate, i.e., can be located in one place, or can be distributed over multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purposes of the embodiments.
[0171] Those skilled in the art can understand that all or some of the steps in the method disclosed above, the functional modules / units in the system and the device can be implemented as software, firmware, hardware and appropriate combinations thereof.
[0172] The terms "first", "second", "third", "fourth" and the like in the description of the application and in the claims of the foregoing drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the use of the terms so construed can be interchanged, such that the embodiments of the application described herein can be carried out in other than the order discussed herein without departing from the scope of the application. Further, the terms "comprise" and "comprising" and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, product or apparatus that comprises a list of steps or units does not necessarily comprise only those steps or units but can include other not expressly listed steps or units.
[0173] It should be understood that in the present application, "at least one" means one or more, and "multiple" means two or more. "And / or" is used to describe the relationship between associated objects, which means that there can be three relationships, for example, "A and / or B" can mean that there are three cases: only A, only B, and A and B at the same time, where A and B can be singular or plural. The character " / " generally represents that the associated objects before and after are in an "or" relationship. "At least one of the following" or the like means any combination of these items, including any combination of single or multiple items. For example, at least one of a, b or c can mean a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0174] In several embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented by other manners. For example, the apparatus embodiments described above are merely illustrative, for example, the division of the units is merely a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, apparatuses or units, and can be electrical, mechanical or other forms.
[0175] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place or distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
[0176] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0177] When the integrated unit is realized in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part of the prior art that contributes to the technical solutions or all or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a plurality of instructions for causing an electronic device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program storage media.
[0178] The preferred embodiments of the embodiments of the present application are described above with reference to the accompanying drawings, but this does not limit the scope of the embodiments of the present application. Any modifications, equivalent replacements and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of the present application shall be within the scope of the embodiments of the present application.
Claims
1. A tabular data processing method, characterized by, The method comprises: receiving a target operation on a cell of an original data table and recording position information of the cell; obtaining an operation type of the target operation, and screening a preset table operation instruction according to the operation type to obtain a first operation instruction; the target operation comprises a batch copy operation, a batch paste operation and a drop-down filling operation; processing the cell through the first operation instruction to obtain target draft data, and updating a preset draft database according to the target draft data; wherein the draft database comprises original draft data and original effective data; if a cancel command is received, screening a preset table reverse operation instruction according to the operation type to obtain a second operation instruction, and editing the target draft data through the second operation instruction to update the draft database; reading draft data from the draft database to obtain selected draft data; wherein the selected draft data comprises any one of the original effective data, the original draft data and the target draft data; updating display data of the cell based on the selected draft data, and moving an operation window position of the original data table to a table position corresponding to the position information; if a submit command is received, rendering the original data table based on the draft database to obtain a target data table; if the target operation comprises the batch copy operation or the batch paste operation, the processing the cell through the first operation instruction to obtain the target draft data and updating the preset draft database according to the target draft data comprises: obtaining an identification code of the cell to obtain a batch identification code; obtaining target batch data of a batch operation; reading draft data from the draft database according to the batch identification code to obtain fourth candidate draft data; backing up the fourth candidate draft data to obtain fourth backup draft data, and adding the fourth backup draft data to a preset fourth cache; based on the operation type, merging the batch identification code and the target batch data to obtain the target draft data; adding the target draft data to the draft database; correspondingly, if the cancel command is received, the editing the target draft data through the second operation instruction comprises: if the cancel command is received, deleting the target draft data of the draft database based on the batch identification code; based on the batch identification code, obtaining the fourth backup draft data from the fourth cache and adding the fourth backup draft data to the draft database.
2. The method of claim 1, wherein, the target operation comprises an addition operation, and the processing the cell through the first operation instruction to obtain the target draft data and updating the preset draft database according to the target draft data comprises: obtaining target addition data of the addition operation; obtaining an identification code of the cell to obtain an addition identification code; According to the operation type, the new identification code and the target new data are merged to obtain target draft data, and the target draft data is written into the draft database; Correspondingly, if the undo command is received, the target draft data is edited by using the second operation instruction, including: If the undo command is received, the target draft data of the draft database is deleted based on the new identification code.
3. The method of claim 1, wherein, The target operation includes a deletion operation, the operation of the cell is processed by using the first operation instruction to obtain target draft data, and a preset draft database is updated according to the target draft data, including: An identification code of the cell is obtained to obtain a deletion identification code; Draft data is read from the draft database according to the deletion identification code to obtain first candidate draft data; If the first candidate draft data is the original effective data, target deletion data of the deletion operation is obtained, the deletion identification code and the target deletion data are merged to obtain target draft data, and the target draft data is added to the draft database; If the first candidate draft data is the original draft data, and the data type of the first candidate draft data is a new type, first backup draft data is generated according to the first candidate draft data, and the first backup draft data is added to a preset first cache library; the original draft data of the draft database is deleted based on the deletion identification code; Correspondingly, if the undo command is received, the target draft data is edited by using the second operation instruction, including: If the undo command is received, and if the first backup draft data exists in the first cache library, the first backup draft data is obtained from the first cache library based on the deletion identification code, and the first backup draft data is added to the draft database; Or, if the undo command is received, and if the first backup draft data does not exist in the first cache library, the target draft data of the draft database is deleted based on the deletion identification code.
4. The method of claim 1, wherein, The target operation includes a modification operation, the operation of the cell is processed by using the first operation instruction to obtain target draft data, and a preset draft database is updated according to the target draft data, including: An identification code of the cell is obtained to obtain a modification identification code; Target modification data of the modification operation is obtained; Draft data is read from the draft database according to the modification identification code to obtain second candidate draft data; If the second candidate draft data is the original effective data, the modification identification code and the target modification data are merged based on the operation type to obtain the target draft data, and the target draft data is added to the draft database; If the second candidate draft data is the original draft data, the second candidate draft data is backed up to obtain second backup draft data, and the second backup draft data is added to a preset second cache library; the modification identifier code and the target modification data are processed based on the operation type to obtain target draft data, and the original draft data of the draft database is updated according to the target draft data; Correspondingly, the editing processing of the target draft data by the second operation instruction when the undo command is received comprises: If the undo command is received, and if the second backup draft data exists in the second cache library, the second backup draft data is obtained from the second cache library based on the modification identifier code, and the target draft data of the draft database is updated according to the second backup draft data; If the undo command is received, and if the second backup draft data does not exist in the second cache library, the target draft data of the draft database is deleted based on the modification identifier code.
5. The method of claim 1, wherein, The target operation comprises an undo operation, and the method further comprises: An identifier code of the cell is obtained to obtain an undo identifier code; Draft data is read from the draft database according to the undo identifier code to obtain third candidate draft data; The third candidate draft data is backed up to obtain third backup draft data, and the third backup draft data is added to a preset third cache library; The third candidate draft data of the draft database is deleted based on the undo identifier code; Correspondingly, the editing processing of the target draft data by the second operation instruction when the undo command is received comprises: If the undo command is received, the third backup draft data is obtained from the third cache library based on the undo identifier code, and the third backup draft data is added to the draft database.
6. The method according to any one of claims 1 to 5, characterized in that, The updating of the display data of the cell based on the selected draft data comprises: If the data type of the selected draft data is an addition type, the selected draft data is parsed to obtain target addition data, and the target addition data is taken as current display data of the cell; Or, If the data type of the selected draft data is a deletion type, current display data of the cell is emptied; Or, If the data type of the selected draft data is a modification type, the selected draft data is parsed to obtain target modification data, and the target modification data is taken as current display data of the cell.
7. The method of claim 1, wherein, After the fourth backup draft data is obtained from the fourth cache library based on the batch identifier code and the fourth backup draft data is added to the draft database, the method further comprises: If the target operation comprises the pull-down filling operation, the draft database is backed up to obtain fifth draft data when a first operation instruction is executed, and the fifth draft data is added to a fifth cache library; All row data passed through the pull-down are sequentially changed in value of a target cell, and draft data of the draft database is changed. In a second operation instruction execution, the draft database is restored according to the fifth draft data.
8. A tabular data processing apparatus, characterized by comprising: The device comprises: a target operation receiving module configured to receive a target operation on a cell of an original data table and record position information of the cell; an operation type obtaining module configured to obtain an operation type of the target operation, and filter a preset table operation instruction according to the operation type to obtain a first operation instruction; the target operation comprises a batch copy operation, a batch paste operation, and a drop-down filling operation; a draft data generating module configured to perform operation processing on the cell through the first operation instruction to obtain target draft data, and update a preset draft database according to the target draft data; wherein the draft database comprises original draft data and original effective data; if the target operation comprises the batch copy operation or the batch paste operation, the operation processing on the cell through the first operation instruction to obtain the target draft data, and the updating of the preset draft database according to the target draft data, comprises: obtaining an identification code of the cell to obtain a batch identification code; obtaining target batch data of a batch operation; reading draft data from the draft database according to the batch identification code to obtain fourth candidate draft data; backing up the fourth candidate draft data to obtain fourth backup draft data, and adding the fourth backup draft data to a preset fourth cache library; based on the operation type, performing merging processing on the batch identification code and the target batch data to obtain the target draft data; and adding the target draft data to the draft database; a cancel module configured to, if a cancel command is received, filter a preset table reverse operation instruction according to the operation type to obtain a second operation instruction, and perform editing processing on the target draft data through the second operation instruction to update the draft database; correspondingly, if the cancel command is received, the editing processing on the target draft data through the second operation instruction comprises: if the cancel command is received, deleting the target draft data of the draft database based on the batch identification code; obtaining the fourth backup draft data from the fourth cache library based on the batch identification code, and adding the fourth backup draft data to the draft database; a data reading module configured to read draft data from the draft database to obtain selected draft data; wherein the selected draft data comprises the original effective data, or the original draft data, or the target draft data; a cell updating module configured to update display data of the cell based on the selected draft data, and move an operation window position of the original data table to a table position corresponding to the position information; a target data table generating module configured to, if a submission command is received, render the original data table based on the draft database to obtain a target data table.
9. An electronic device, comprising: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the table data processing method in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program is executed by the processor to implement the table data processing method in any one of claims 1 to 7.
Citation Information
Patent Citations
Online spreadsheet editing method and device, storage medium and electronic equipment
CN109597978A
Data processing method and device, storage medium and electronic equipment
CN113343655A