Operation button generation method and device, storage medium and electronic equipment
By providing an operation button generation method of configuration mode, slot mode and mixed mode, the problem of low maintainability of operation button generation code in the prior art is solved, and the flexibility and maintainability of the generation process are improved.
Patent Information
- Application Number
- CN202411466772.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2025-02-28
AI Technical Summary
In the prior art, when generating operation buttons in tables, users need to provide complete code, resulting in low code maintenance, and there are many identical code segments in operation button codes of different functions, and synchronous modifications are required when errors are made.
There are three operation button generation modes: configuration mode, slot mode and mix mode. The generation mode is determined based on the configuration parameters in the operation button generation instruction. The generation mode includes: generating operation buttons based on the generation template and parameter values in the configuration mode; generating operation buttons based on the slot label in the slot mode; and generating operation buttons based on the generation template, parameter values and slot labels in the mixed mode.
Improves the flexibility and maintainability of the operation button generation process, reduces the complexity of users when generating operation buttons, and avoids synchronous modification problems caused by the same code segment error.
Smart Images

Figure CN119536705A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an operation button generation method, device, storage medium and electronic device. Background Art
[0002] Tables are one of the most commonly used data processing methods. They are mainly used to input, output, display, process and print data. They can be used to create various complex table documents and even help users perform complex statistical calculations and graphical displays. Tables are also commonly used for presenting and editing data in databases, designing data entry interfaces, data exchange, data reporting and distribution, etc.
[0003] In order to realize different functions of tables in different scenarios, such as editing and exporting data, operation buttons are added to the table to perform specific operations in the table. However, when generating operation buttons in the table, users are required to provide complete code for generating operation buttons each time. In some cases, there are many identical code segments in the codes of operation buttons with different functions, and as long as there is an error in these identical code segments, all the codes in the complete code that are identical to the code segment need to be modified synchronously. Therefore, the current method of generating operation buttons will cause the problem of low maintainability of the code. Summary of the invention
[0004] In view of the above problems, the present application provides an operation button generating method, device, storage medium and electronic device.
[0005] In order to solve the above technical problems, this application proposes the following solutions:
[0006] In a first aspect, the present application provides an operation button generation method, the method comprising: receiving an operation button generation instruction; determining a generation mode of the operation button according to the operation button generation instruction, the generation mode comprising a configuration mode and a slot mode; and generating the operation button according to the generation mode.
[0007] In combination with the first aspect, in a possible implementation method, determining the generation mode of an operation button according to an operation button generation instruction includes: determining the generation mode of the operation button according to the configuration status of configuration parameters in the operation button generation instruction, the configuration status of the configuration parameters including the configuration status of the parameter value and / or the slot flag in the parameter value.
[0008] In combination with the first aspect, in another possible implementation method, the generation mode of the operation button is determined according to the configuration status of the configuration parameters in the operation button generation instruction, including: when the operation button generation instruction includes the parameter value of the configuration parameter of the operation button, and the parameter value does not include the slot flag, indicating that the generation mode of the operation button is the configuration mode; when the operation button generation instruction includes the parameter value of the configuration parameter of the operation button, and the parameter value includes the slot flag, indicating that the generation mode of the operation button is the mixed mode; when the operation button generation instruction does not include the parameter value of the configuration parameter of the operation button, indicating that the generation mode of the operation button is the slot mode.
[0009] In combination with the first aspect, in another possible implementation, an operation button is generated according to a generation mode, including: when the generation mode of the operation button is a configuration mode, the operation button is generated according to a generation template and a parameter value of the operation button, and the parameter value is bound to the operation button.
[0010] In combination with the first aspect, in another possible implementation, generating an operation button according to a generation mode also includes: when the generation mode of the operation button is a slot mode, obtaining a slot tag, wherein the slot tag is used to indicate a code for generating the operation button; and generating the operation button according to the slot tag.
[0011] In combination with the first aspect, in another possible implementation, when the generation mode of the operation button is the mixed mode, the operation button is generated according to the generation template of the operation button, the parameter value, and the slot tag included in the operation button generation instruction.
[0012] In combination with the first aspect, in another possible implementation, the method also includes: determining the width value of each row of the operation button group in the table where the operation buttons are located, wherein the operation button group consists of operation buttons displayed in each row; determining the maximum width value of each row of the operation button group in the table where the operation buttons are located and setting it as the width value of each row of the operation button group in the table; storing the table in the form of a key-value pair, wherein all the data in the table are keys and the maximum width value of the operation button group in the table is a value.
[0013] In a second aspect, the present application provides an operation button generation device, the operation button generation device comprising: a receiving module, configured to receive an operation button generation instruction;
[0014] A determination module, used to determine a generation mode of the operation button according to the operation button generation instruction, the generation mode including a configuration mode and a slot mode;
[0015] The generation module is used to generate operation buttons according to the generation mode.
[0016] In combination with the second aspect, in a possible implementation, the determination module is specifically used to determine the generation mode of the operation button according to the configuration of the configuration parameters in the operation button generation instruction, and the configuration of the configuration parameters includes the configuration of the parameter value and / or the slot flag in the parameter value.
[0017] In combination with the second aspect, in another possible implementation method, the determination module is specifically used to, when the operation button generation instruction includes the parameter value of the configuration parameter of the operation button, and the parameter value does not include the slot flag, indicate that the generation mode of the operation button is the configuration mode; when the operation button generation instruction includes the parameter value of the configuration parameter of the operation button, and the parameter value includes the slot flag, indicate that the generation mode of the operation button is the mixed mode; when the operation button generation instruction does not include the parameter value of the configuration parameter of the operation button, indicate that the generation mode of the operation button is the slot mode.
[0018] In combination with the second aspect, in another possible implementation, the generation module is specifically used to generate the operation button according to the generation template and parameter value of the operation button when the generation mode of the operation button is the configuration mode, and bind the parameter value to the operation button.
[0019] In combination with the second aspect, in another possible implementation, the generation module is specifically used to, when the generation mode of the operation button is the slot mode, obtain a slot tag, where the slot tag is used to indicate a code for generating the operation button; and generate the operation button according to the slot tag.
[0020] In combination with the second aspect, in another possible implementation method, the generation module is specifically used to generate an operation button according to the generation template, parameter value, the slot flag and the slot label included in the operation button generation instruction when the generation mode of the operation button is a mixed mode.
[0021] In combination with the second aspect, in another possible implementation, the generation module is also used to determine the width value of each row of the operation button group in the table where the operation buttons are located, wherein the operation button group consists of operation buttons displayed in each row; determine the maximum width value of each row of the operation button group in the table where the operation buttons are located and set it as the width value of each row of the operation button group in the table; store the table in the form of a key-value pair, wherein all the data in the table are keys and the maximum width value of the operation button group in the table is a value.
[0022] In order to achieve the above-mentioned purpose, according to the third aspect of the present application, a storage medium is provided, which includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the operation button generation method of the above-mentioned first aspect.
[0023] In order to achieve the above-mentioned purpose, according to the fourth aspect of the present application, an electronic device is provided, which includes at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; the processor is used to call the program instructions in the memory to execute the operation button generation method of the above-mentioned first aspect.
[0024] By means of the above technical solution, the technical solution provided by this application has at least the following advantages:
[0025] The present application provides an operation button generation method, device, storage medium and electronic device. When generating the operation buttons of a table, the present application provides three generation modes, namely, configuration mode, slot mode and mixed mode, which solves the problem in the prior art that when generating the operation buttons of a table, the user can only generate the operation buttons by providing complete and all codes for generating the operation buttons, resulting in low maintainability of the codes for generating the operation buttons. At the same time, the present application provides three operation button generation modes at the same time, which can be freely selected by the user, thereby improving the flexibility of the operation button generation process.
[0026] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0028] Figure 1 A schematic diagram of the structure of an electronic device of a system architecture provided by an embodiment of the present application is shown;
[0029] Figure 2 A schematic diagram of a flow chart of a method for generating an operation button provided in an embodiment of the present application is shown;
[0030] Figure 3 A schematic diagram showing a flow chart of another method for generating an operation button provided in an embodiment of the present application;
[0031] Figure 4 A schematic structural diagram of an operation button generating device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0032] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.
[0033] In the embodiments of the present application, the terms "first" and "second" do not have a logical or temporal dependency, nor do they limit the quantity and execution order. It should also be understood that although the following description uses the terms first, second, etc. to describe various elements, these elements should not be limited by the terms. These terms are only used to distinguish one element from another element.
[0034] In the embodiments of the present application, the term "at least one" means one or more, and the term "plurality" means two or more.
[0035] It should also be understood that the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting." Similarly, the phrase "if it is determined that ..." or "if [a stated condition or event] is detected" may be interpreted as "upon determining that ..." or "in response to determining that ..." or "upon detecting [a stated condition or event]" or "in response to detecting [a stated condition or event]," depending on the context.
[0036] The embodiment of the present application also provides an operation button generation device, which can be used to execute the above operation button generation method. Optionally, the operation button generation device can be an electronic device with data processing capability, or a functional module in the electronic device, which is not limited.
[0037] For example, the electronic device may be a server, which may be a single server, or a server cluster consisting of multiple servers. For another example, the electronic device may be a mobile phone, a tablet computer, a desktop, a laptop, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, and a cellular phone, a personal digital assistant (PDA), an augmented reality (AR), a virtual reality (VR) device and other terminal devices. For another example, the electronic device may also be a recording device, a video surveillance device and other devices. The present application does not impose any special restrictions on the specific form of the electronic device.
[0038] The following takes the operation button generating device as an electronic device as an example. Figure 1 As shown, Figure 1 The present application provides a hardware structure of an electronic device 100.
[0039] like Figure 1 As shown, the electronic device 100 includes a processor 110 , a communication circuit 120 and a communication interface 130 .
[0040] Optionally, the electronic device 100 may further include a memory 140 . The processor 110 , the memory 140 and the communication interface 130 may be connected via a communication line 120 .
[0041] The processor 110 may be a central processing unit (CPU), a general-purpose processor, a network processor (NP), a digital signal processor (DSP), a microprocessor, a microcontroller, a programmable logic device (PLD), or any combination thereof. The processor 110 may also be any other device having a processing function, such as a circuit, a device, or a software module, without limitation.
[0042] In one example, the processor 110 may include one or more CPUs, such as Figure 1 CPU0 and CPU1 in.
[0043] As an optional implementation, the electronic device 100 includes multiple processors, for example, in addition to the processor 110, it may also include a processor 170. The communication line 120 is used to transmit information between the components included in the electronic device 100.
[0044] The communication interface 130 is used to communicate with other devices or other communication networks. The other communication networks may be Ethernet, Radio Access Network (RAN), Wireless Local Area Networks (WLAN), etc. The communication interface 130 may be a module, a circuit, a transceiver or any device capable of achieving communication.
[0045] The memory 140 is used to store instructions, where the instructions may be computer programs.
[0046] Among them, the memory 140 can be a read-only memory (ROM) or other types of static storage devices that can store static information and / or instructions, or a random access memory (RAM) or other types of dynamic storage devices that can store information and / or instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), magnetic disk storage medium or other magnetic storage devices, etc., without limitation.
[0047] It should be noted that the memory 140 may exist independently of the processor 110 or may be integrated with the processor 110. The memory 140 may be used to store instructions or program codes or some data, etc. The memory 140 may be located inside the electronic device 100 or outside the electronic device 100, without limitation.
[0048] The processor 110 is used to execute the instructions stored in the memory 140 to implement the communication method provided in the following embodiments of the present application. For example, when the electronic device 100 is a terminal or a chip in a terminal, the processor 110 can execute the instructions stored in the memory 140 to implement the steps performed by the transmitting end in the following embodiments of the present application.
[0049] As an optional implementation, the electronic device 100 further includes an output device 150 and an input device 160. The output device 150 may be a device such as a display screen, a speaker, etc. that can output data of the electronic device 100 to a user. The input device 160 may be a device such as a keyboard, a mouse, a microphone, or a joystick that can input data to the electronic device 100.
[0050] It should be pointed out that Figure 1 The structure shown in the figure does not constitute a limitation on the computing device, except Figure 1 In addition to the components shown, the computing device may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0051] The operation button generating device and application scenario described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided in the embodiment of the present application. Ordinary technicians in this field can know that with the evolution of the operation button generating device and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.
[0052] Next, the operation button generating method is described in detail with reference to the accompanying drawings. Figure 2 A flowchart of a method for generating an operation button provided in this application. The method is applied to a Figure 1 The operation button generating device of the hardware structure shown in the figure specifically comprises the following steps:
[0053] Step 210: Receive an operation button generation instruction.
[0054] In the Internet age, the web pages we browse daily usually involve various forms. Tables are both a visual communication mode and a tool for data organization and management. Their basic function is to list data and organize it into a form that is easy to understand and use. Tables can help us quickly find specific data and sort, screen and filter data to make better decisions. Tables are used in all walks of life and have become an indispensable tool in our lives.
[0055] Operation buttons are buttons commonly used in tables to perform specific operations. They usually appear at the end of each row or at the end of the table header. These operation buttons can be used to perform various operations, such as editing, deleting, exporting, and viewing details of data in the table, so that users can easily operate and manage the data in the table.
[0056] When a user wants to generate a table that can perform some operations, the user needs to issue an operation button generation instruction so that the computing device can generate corresponding buttons according to the operation button generation instruction issued by the user, so that the finally generated table not only displays data, but also has functions such as editing and deleting.
[0057] Step 220: Determine a generation mode of the operation button according to the operation button generation instruction.
[0058] In an implementation manner of the present application, a user may configure configuration parameters for generating an operation button in an operation button generation instruction, so that after receiving the operation button generation instruction, the computing device determines the generation mode of the operation button according to the configuration of the configuration parameters in the operation button generation instruction, wherein the configuration of the configuration parameters includes the configuration of the parameter value and / or the slot flag in the parameter value, and the generation mode of the operation button includes the configuration mode, the slot mode, and the mixed mode. In one embodiment, by considering the configuration of the configuration parameters, such as the parameter value and / or the slot flag in the parameter value, the corresponding generation mode is selected according to different configuration parameter conditions, so as to ensure that different configuration parameters generate operation buttons according to specific generation modes.
[0059] The present application proposes a detailed logic for determining a generation mode based on the configuration of configuration parameters in an operation button generation instruction. Specifically, when the operation button generation instruction includes the parameter value of the configuration parameter of the operation button, and the parameter value does not include a slot flag, the generation mode of the operation button is indicated to be a configuration mode. In this mode, the operation button can be generated according to the parameter value in the preset operation button generation template and the configuration parameter, and the parameter value is bound to the operation button. When the operation button generation instruction includes the parameter value of the configuration parameter of the operation button, and the parameter value includes a slot flag, the generation mode of the operation button is indicated to be a mixed mode. In this mode, not only the generation template of the operation button and the parameter value in the configuration parameter need to be considered, but also the slot flag and the slot label need to be considered to determine the generation logic of the operation button. When the operation button generation instruction does not include the parameter value of the configuration parameter of the operation button, the generation mode of the operation button is indicated to be a slot mode. In this mode, the operation button is mainly generated according to the slot label, without considering the parameter value in the configuration parameter. It can be seen that three different generation modes are determined by carefully dividing the different situations of configuration parameters. Since the logic of the generation operation buttons corresponding to different generation modes is different, when the configuration parameters change, the code under different logics can be modified independently, thereby improving the maintainability and flexibility of the code.
[0060] In one embodiment, the operation button instruction sent by the user includes configuration parameters including parameter values and / or the configuration of slot flags in the parameter values, and the generation mode of the operation button can be determined according to the configuration state of the configuration parameters in the operation button generation instruction. For example, after the system receives the operation button generation instruction sent by the user, it determines whether the operation button generation instruction includes the parameter value of the configuration parameter of the operation button. The purpose of the determination is to determine whether the operation button needs to be generated according to the generation template in the system. The specific situation is as follows:
[0061] Scenario 1: When the operation button generation instruction includes the parameter value of the configuration parameter of the operation button, the generation template needs to be applied. When the operation button generation instruction does not include the parameter value of the configuration parameter of the operation button, the generation template does not need to be applied. After the system determines that the operation button generation instruction includes the parameter value of the configuration parameter of the operation button, it is necessary to further determine whether the parameter value of the configuration parameter includes a slot flag. The purpose of determining the slot flag is to determine whether the generation of the operation button needs to be combined with the slot mode. When the system determines that the slot flag exists in the parameter value of the configuration parameter, it means that the configuration parameter is not completely included in the generation template pre-set in the system, and the generation template cannot be directly applied. It is necessary to determine the configuration parameters not included in the generation template and generate the operation button according to the configuration parameters combined with the slot mode, that is, when it is determined that there is a slot flag, the slot tag is obtained. The slot tag is used to indicate the code for generating the operation button for the configuration parameter without parameter value in the generation template, and the relevant code of the configuration parameter not included in the generation template is inserted at the slot flag to generate the operation button. At this time, the generation mode of the operation button is a combination of the configuration mode and the slot mode, that is, the mixed mode. In some embodiments, obtaining a slot tag may be generating a slot tag or calling a preset slot tag.
[0062] Scenario 2: When the system determines that the parameter value of the configuration parameter does not include the slot flag, it means that the generation template pre-set in the system contains all the configuration parameters of the operation button generation instructions. You only need to directly add the parameter value of the configuration parameter in the generation template to obtain the operation button. That is, the generation mode of the operation button is the configuration mode at this time.
[0063] Scenario 3: When the system determines that the operation button generation instruction does not include the parameter value of the configuration parameter of the operation button, it means that the pre-set generation template in the system does not include the configuration parameters containing the parameter value at all, and needs to be configured according to the slot mode. Among them, the slot mode specifically uses slots to hold placeholders at the positions of the operation buttons of the table. Users can fill in any code in this placeholder (slot label), for example, code that can implement the table editing function, etc. The content (code) filled in the slot label will replace the slot label at the position of the operation button in the table, thereby enabling the computing device to generate an operation button according to the content (code) filled in the slot label. It is worth noting that the configuration parameters can be the name of the operation button, the width of the operation button, the display function of the operation button, the disable function of the operation button, the permission of the operation button, and the maximum number of buttons to be displayed. The specific content items of the configuration parameters are not limited here.
[0064] For most systems, the operations to be performed on each row in the table are basically similar, such as editing, deleting, exporting, viewing details, sorting, screening, filtering, etc. However, the essence is to generate action buttons, but the specific business logic of each action button is different. Therefore, in some cases, there will be many identical code segments in the complete code of action buttons with different functions. As long as there is an error in these identical code segments, all the codes in the complete code that are identical to the code segment need to be modified synchronously. Therefore, generating action buttons by having users write complete codes to generate action buttons will cause the problem of low maintainability of the code, and there are also certain requirements on the user's coding ability when generating action buttons.
[0065] However, since the computing device in the present application stores a generation template for generating operation buttons, when generating an operation button, the user only needs to search for the configuration parameters in the generation template for the operation button stored in the computing device according to the parameter values in the configuration parameters for generating the operation button, and enter the corresponding parameter values. The user does not need to write the complete code for generating the operation button each time an operation button is generated. The user only needs to determine the generation template containing the configuration parameters and enter the corresponding parameter values, thereby avoiding writing the completed code for generating the operation button each time an operation button is generated, reducing the complexity for the user in generating the operation button, and solving the problem of low code maintainability in the prior art. When an error occurs in the operation button code, the present application only needs to modify the generation template for the operation button, without repeatedly modifying the code for the same operation buttons in different rows in the table.
[0066] In another embodiment, when the operation button generation instruction issued by the user does not include the parameter value of the configuration parameter of the operation button, the present application provides another generation mode of the operation button, namely the slot mode. Specifically, when the system receives the operation button generation instruction issued by the user, the primary task is to determine whether the operation button generation instruction includes the parameter value of the configuration parameter of the operation button. The purpose of this judgment is to determine whether it is necessary to generate the operation button according to the generation template in the system. The specific situation is described as follows: If the operation button generation instruction clearly includes the configuration parameter value of the operation button, the system will apply the preset generation template and combine these parameter values to generate the operation button. On the contrary, if the instruction does not include any configuration parameter value, the system does not need to rely on the generation template. When the system determines that the operation button generation instruction does not include the parameter value of the configuration parameter of the operation button, the slot label is obtained. The slot label is used to indicate the code for generating the operation button. At this time, it means that the generation template pre-set in the system does not include the configuration parameter at all, that is, when the parameter value of the configuration parameter does not exist in the system, it is necessary to configure it according to other configuration data in the operation button generation instruction combined with the slot mode. It is worth noting that when the generation mode of the operation button is the slot mode, the system will no longer need to call the preset generation template in the system. In this case, the code logic corresponding to the operation button generated according to the slot mode can be regarded as a new generation template. The system will save this code information in the generation template storage area for subsequent use. The above-mentioned slot mode specifically uses slots to hold placeholders at the positions of the operation buttons of the table, specifically, represented by slot labels. The user can fill in any code in this placeholder (slot label), for example, code that can implement the table editing function, etc. The content (code) filled in the slot label will replace the slot label at the position of the operation button in the table, thereby enabling the computing device to generate an operation button according to the content (code) filled in the slot label. The code of the required function is inserted through the slot mode, which provides scalability for the operation button generation process.
[0067] In another embodiment, after the system receives the operation button generation instruction issued by the user, it is determined that the operation button generation instruction includes the parameter value of the configuration parameter of the operation button, and the parameter value includes the slot flag. At this time, the configuration parameter in the operation button instruction issued by the user includes two parts, the first part is the parameter value of the configuration part operation button, that is, the parameter value of the generated template can be directly applied, and the second part is the operation button for which the user does not provide the parameter value, that is, the parameter value of the generated template cannot be directly applied, wherein the configuration parameter of the first part can be directly filled in the corresponding position in the generated template according to the parameter value provided by the user to generate the operation button, and the configuration parameter of the second part can generate the operation button by means of a slot. The generation method of the first part and the second part is combined to generate the corresponding operation button, that is, the corresponding operation button is generated by inserting the slot tag (the code of the second part configuration parameter) into the slot flag in the parameter value of the configuration parameter in the first part, wherein the content (code) filled in the slot tag will replace the slot tag at the position of the operation button in the table, thereby enabling the computing device to generate the operation button according to the content (code) filled in the slot tag. The above method can realize the mixed use of the configuration mode and the slot mode, thereby meeting various configuration requirements of the user.
[0068] For the above configuration mode, slot mode and mixed mode, examples are given as follows, where the configuration parameters include the operation button name, operation button width, maximum number of display buttons, and operation button permissions.
[0069] Scenario 1: It is known that the operation button generation instruction includes: the parameter value of the operation button name is A, the parameter value of the operation button width is B, the parameter value of the maximum number of display buttons is C, the parameter value of the operation button authority is D, and the parameter value of each configuration parameter does not contain a slot flag.
[0070] When the system receives the operation button generation instruction, it is determined that the operation button generation instruction contains parameter values A, B, C, and D, and each parameter value does not contain a slot flag, that is, the operation button generation instruction contains the parameter values of all configuration parameters. At this time, it is explained that the generation template in the system can be directly applied to generate the operation button, that is, the parameter values A, B, C, and D are directly input into the generation template, and the operation button can be obtained and the parameter value is bound to the operation button. It should be noted that if there are only parameter values A, B, and C in the operation button generation instruction, and each parameter value does not contain a slot flag, the generation template in the system is also directly applied to generate the operation button, that is, the parameter values A, B, and C are directly input into the generation template, and the operation button can be obtained and the parameter value is bound to the operation button. It can be seen that the parameter values in the configuration parameters are clear. When the style or function of the operation button needs to be modified or updated, it is only necessary to modify the parameter values in the generation template, without the need to modify the core logic of the system multiple times and repeatedly, thereby improving maintenance efficiency.
[0071] Scenario 2: It is known that the operation button generation instruction includes: the parameter value of the operation button name is E, and the parameter value of the operation button name contains a slot flag.
[0072] When the system receives the operation button generation instruction, the system will first identify the parameter value E of the operation button name and the slot flag in the instruction. The system determines that there is a configuration parameter without a parameter value. At this time, there are two parts of the configuration parameters in the operation button generation instruction. One part of the configuration parameters has a parameter value, that is, the parameter value of the operation button name is E. The generation template in the system can be used to directly input the parameter value E to generate the operation button. There are also other configuration parameters that have no parameter values, such as the width of the operation button, the maximum number of display buttons, and the permission of the operation button. Since the parameter value of the configuration parameter and the parameter value include the slot flag, the system understands that the slot mode needs to be used to generate the operation button. At this time, the system will do the following processing: For the operation button name that has provided the parameter value E, it is directly applied to the corresponding position in the generation template. For other configuration parameters (operation button width, maximum number of display buttons, operation button permission) that do not provide parameter values, the system will not directly apply any default values or preset values. On the contrary, when the system determines that there is a configuration parameter without a parameter value, it will generate corresponding slot tags. These tags will be used as placeholders to store the codes of other configuration parameters that do not provide parameter values. Finally, the generated code is inserted into the parameter value of the operation button name, and the slot flag is used to generate the operation button. In addition, the generation and use of slot labels are to indicate which configuration parameters do not provide parameter values in the current generation instructions, and these labels will be inserted into the slot flag positions. The introduction of slot labels in this embodiment not only enables the system to clearly identify which configuration parameters do not provide parameter values in the current generation instructions, thereby facilitating the subsequent dynamic addition or modification of these configuration items, but also enables the system to respond more flexibly to different changes in requirements. The customized requirements of the operation buttons can be realized by simply modifying the code or configuration in the slot without the need to reconstruct or modify the entire system in large quantities, thereby reducing the difficulty of maintenance and improving the scalability and maintainability of the system.
[0073] Case 3: The operation button generation instruction does not include the parameter value of the configuration parameter.
[0074] When the system receives an instruction to generate an operation button, the system will first check whether the instruction contains parameter values of configuration parameters. If the system recognizes that the instruction does not contain any parameter values of configuration parameters, such as the name of the operation button, the width of the operation button, the maximum number of display buttons, the authority of the operation button, etc., it is determined that since there are no parameter values in the configuration parameters, the system cannot directly apply the generation template in the system to generate the operation button. However, in order to meet the needs of generating operation buttons, the system chooses to obtain the slot label and generate the operation button according to the slot label, that is, the slot label is used as a placeholder. The user can fill in any code in this placeholder (slot label), for example, the code that can implement the table editing function, etc. The content (code) filled in the slot label will replace the slot label at the position of the operation button in the table, thereby enabling the computing device to generate the operation button according to the content (code) filled in the slot label. It is worth noting that the system can encapsulate the logic of generating operation buttons based on slot labels into a new generation template, store it in a file folder on a disk or save it in memory. It can be seen that in this generation mode, since this new template contains the generation logic of the slot label, when a similar operation button needs to be generated, the user can directly use this new template without rewriting the code or configuration. This not only improves the user's maintenance efficiency of the operation button, but also improves the scalability and maintainability of the system, allowing the system to better adapt to changing needs.
[0075] It can be seen from this that when generating an operation button, the present application provides three generation modes, namely, configuration mode, slot mode and mixed mode, so that users can choose the corresponding operation button generation mode according to their own needs. That is, if the operation button generation instruction contains the parameter value of the configuration parameter and the parameter value does not contain the slot flag, the configuration mode is used; if the operation button generation instruction contains the parameter value of the configuration parameter and the parameter value contains the slot flag, the mixed mode is used; if the operation button generation instruction does not contain the parameter value of the configuration parameter, the slot mode is used. It can be seen that different generation modes can be selected under different configuration parameter conditions, which further improves the flexibility and extensibility of generating operation buttons.
[0076] Step 230: Generate an operation button according to the generation mode.
[0077] When the generation mode of the operation button is the configuration mode, the parameter value of the configuration parameter in the operation button generation instruction is substituted into the generation template of the operation button, and the computing device executes the generation template of the operation button after the parameter value is substituted to generate the corresponding operation button.
[0078] In addition, after the operation button is generated according to the generation template and parameter value of the operation button, the parameter value is bound to the operation button so that the user can intuitively see the configuration parameter information of the operation button through the display interface.
[0079] When the generation mode of the operation button is the slot mode, the computing device generates the operation button in the slot mode. Since the computing device determines that the operation button generation instruction does not contain the parameter value of the configuration parameter, the slot tag is obtained. The slot tag is used to indicate the code for generating the operation button. This code is written according to other data in the operation button generation instruction except the configuration parameters of the operation button containing the parameter value. Therefore, the computing device can generate the operation button according to the slot tag. Among them, the slot tag is not limited to the code for generating the operation button of the present application, and can also be other user-defined codes, such as the code for generating a table. In order to ensure that the operation button generated by the operation button generation instruction is consistent with the target operation button set in the instruction, the computing device of the present application, after receiving the operation button generation instruction, filters the slot tags included in the operation button generation instruction to filter out the slot tags that are not named according to the preset format and do not belong to the generated operation button. For example, the format of the slot tag used to generate the operation button is AAA, then after receiving the operation button generation instruction, the computing device deletes the slot tags in the operation button generation instruction that are not in the format of AAA.
[0080] When the generation mode of the operation button is the mixed mode, the parameter value of the configuration parameter in the operation button generation instruction is substituted into the generation template of the operation button, and the computing device executes the generation template of the operation button after the parameter value is substituted to generate the corresponding operation button. For configuration parameters not included in the operation button generation instruction, the computing device uses the slot mode to generate this part of the operation button. The following takes the configuration parameters including: operation button name, operation button width, operation button display function, operation button disable function, operation button authority, and maximum number of display buttons as an example to explain the specific meaning of the configuration parameters of this application.
[0081] The computing device determines whether the user has the authority to generate the operation button based on the operation button authority. If the operation button authority is no, the generation of the operation button is stopped; if the operation button authority is yes, the operation button is further judged whether the operation button is the operation button displayed in the table based on the operation button display function. Specifically, the operation button display function is executed, and it is determined whether the operation button is displayed based on the result value output by the operation button display function. The operation button authority and the operation button display function can filter out the operation buttons that are unauthorized or not displayed. On this basis, it is determined whether the operation button is disabled based on the operation button disable function. Similar to the operation button display function, the operation button disable function is executed, and it is determined whether the operation button is disabled based on the result value output by the operation button disable function.
[0082] Furthermore, the operation buttons that are finally displayed in the table are selected according to the maximum number of display buttons. For example, after the above configuration parameters are selected, there are finally 5 operation buttons that need to be displayed, but the maximum number of display buttons is 3. Then at this time, two operation buttons are randomly or sequentially selected from the 5 operation buttons that need to be displayed for display, and the remaining 3 operation buttons are placed in a drop-down list, and the drop-down list is displayed through an operation button with an operation button name of "More". Finally, the operation buttons are displayed according to the width and name of the displayed operation buttons. The present application uses a drop-down list to display the operation buttons, which can solve the problem of too many operation buttons being displayed in the current table, which is not aesthetically pleasing.
[0083] It should be noted that the configuration parameters of the present application include but are not limited to the operation button name, operation button width, operation button display function, operation button disable function, operation button permission, and maximum number of displayed buttons in the above example. The above is only used as an example to explain the present application.
[0084] In summary, compared with the prior art, when generating the operation buttons in the table, the user is required to provide the complete code for generating the operation buttons each time. When there are many identical code segments in the code of the operation buttons with different functions, if there is an error in these identical code segments, all the codes identical to the code segment in the complete code need to be modified synchronously. When generating the operation buttons of the table, the present application determines three generation modes according to the operation button generation instructions, namely, the configuration mode, the slot mode and the mixed mode, wherein the configuration mode only requires the user to enter the parameter value in the generation template, which reduces the complexity of generating the operation button, and only needs to modify the template once when an error occurs; the slot mode allows the user to fill in the code in the slot tag to generate the operation button, while the mixed mode allows the user to fill in the code in the slot tag to generate the operation button by entering the parameter value in the generation template, which can meet the needs of complex scenarios. It can be seen that the present application can be modified in a targeted manner according to different generation modes, which can improve the maintainability of the code logic of different generation modes, reduce the complexity of the user generating the operation button, and avoid the occurrence of multiple modifications caused by the same code segment code error in the prior art, providing users with a more flexible and efficient operation button generation solution.
[0085] Figure 3 A flowchart of another method for generating an operation button provided in this application. Figure 2 The method shown differs in that, according to Figure 2 After the operation button is generated, the method shown adaptively adjusts the width of each row of the operation button group in the table where the operation button is located according to the width of the operation button.
[0086] Step 310: Determine the width value of each row of the operation button group in the table where the operation buttons are located.
[0087] At present, when generating operation buttons in a table, the table column width cannot be adaptively adjusted according to the content of the operation column (the column where the operation button is located), especially when the operation button has user permissions or has visibility rules, the table column width cannot be adaptively adjusted according to the operation column content. In order to solve the problem that the table operation column cannot adapt to the width of the operation button when the operation button is displayed with permission control or logic control. Figure 2 After the method shown generates the operation button, the width of the operation column in the table is adaptively adjusted according to the width of the operation button.
[0088] Specifically, based on the above example, the maximum number of buttons displayed is 3, so the width of the 3 operation buttons displayed in each row of the table is determined. The 3 operation buttons displayed in each row form an operation button group. Then the width value of each row of the operation button group is the sum of the widths of the 3 operation buttons included in each row of the operation button group.
[0089] Step 320: Set the maximum width value of each row of the operation button group in the table to the width value of the operation button group in the table.
[0090] Since the width of each row of operation button groups in the table is the width of the operation column, in order to ensure that the operation buttons in each row of the table can be fully displayed. After determining the width value of each row of operation button groups, the application screens out the operation button group with the maximum width value, and sets the width of the table operation column (i.e., the width of each row of operation button groups in the table) to the maximum width value. In this way, the width of the table operation column can be adaptively adjusted according to the size of the operation button, solving the problem of incomplete display of the operation button.
[0091] In order to improve the maintainability of table data, the present application adopts the form of key-value pairs to store dynamically updated table data. That is, all the data in the table are keys, and the maximum width value of the operation button group in the table where these data are located is stored as the corresponding value. Specifically, the present application can adopt a two-key storage architecture, such as {all data in the table; maximum width value of the operation button group}, where all the data in the table can be an ordered data set. It can be seen that this key-value pair storage architecture can directly locate the corresponding value (i.e., the maximum width value of the operation button group) through the key (i.e., the table data) compared to the traditional configuration parameter one by one screening and comparison search method, avoiding one by one screening and comparison search operations, greatly simplifying the data retrieval process, and improving the speed of data retrieval. In addition, since the table is updated regularly, the table data is stored in the form of key-value pairs. When the data is updated, it only needs to simply modify or add the corresponding key-value pair to complete the data update, without the need to frequently modify and update the configuration file or database like the traditional storage method, which not only reduces the complexity of data maintenance, but also improves the maintainability of the table data.
[0092] It is understandable that in order to implement the functions in the above embodiments, the computer device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and method steps of each example described in the embodiments disclosed in this application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application scenario and design constraints of the technical solution.
[0093] Furthermore, as a response to the above Figure 2 The embodiment of the method shown in the figure is implemented. The embodiment of the present application provides an operation button generation device. The embodiment of the device corresponds to the aforementioned method embodiment. For ease of reading, the present embodiment will not repeat the details of the aforementioned method embodiment one by one, but it should be clear that the device in this embodiment can correspond to all the contents of the aforementioned method embodiment. Figure 4 As shown, the operation button generating device 400 includes:
[0094] A receiving module 410 is used to receive an operation button generation instruction;
[0095] A determination module 420, configured to determine a generation mode of the operation button according to the operation button generation instruction, wherein the generation mode includes a configuration mode and a slot mode;
[0096] The generating module 430 is used to generate an operation button according to a generating mode.
[0097] Further, such as Figure 4 As shown, the determination module 420 is specifically used to determine the generation mode of the operation button according to the configuration of the configuration parameters in the operation button generation instruction, and the configuration of the configuration parameters includes the configuration of the parameter value and / or the slot flag in the parameter value.
[0098] Further, such as Figure 4 As shown, the determination module 420 is specifically used to, when the operation button generation instruction includes the parameter value of the configuration parameter of the operation button, and the parameter value does not include the slot flag, indicate that the generation mode of the operation button is the configuration mode; when the operation button generation instruction includes the parameter value of the configuration parameter of the operation button, and the parameter value includes the slot flag, indicate that the generation mode of the operation button is the mixed mode; when the operation button generation instruction does not include the parameter value of the configuration parameter of the operation button, indicate that the generation mode of the operation button is the slot mode.
[0099] Further, such as Figure 4As shown, the generating module 430 is specifically used to generate the operating button according to the generating template and parameter value of the operating button when the generating mode of the operating button is the configuration mode, and bind the parameter value to the operating button.
[0100] Further, such as Figure 4 As shown, the generating module 430 is specifically used to, when the generating mode of the operation button is the slot mode, obtain a slot tag, where the slot tag is used to indicate the code for generating the operation button; and generate the operation button according to the slot tag.
[0101] Further, such as Figure 4 As shown, the generation module 430 is specifically used to generate the operation button according to the generation template of the operation button, the parameter value, the slot flag bit and the slot label included in the operation button generation instruction when the generation mode of the operation button is the mixed mode.
[0102] Further, such as Figure 4 As shown, the configuration parameters include: operation button name, operation button width, operation button display function, operation button disable function, operation button permission, and maximum number of display buttons.
[0103] Further, such as Figure 4 As shown, the generation module 430 is also used to determine the width value of each row of the operation button group in the table where the operation buttons are located, wherein the operation button group consists of the operation buttons displayed in each row; and set the width of each row of the operation button group in the table to the maximum width value of the operation button group in the table.
[0104] Further, such as Figure 4 As shown, the generating module 430 is further used to store the table in the form of key-value pairs, wherein all the data in the table are keys, and the maximum width value of the operation button group in the table is a value.
[0105] An embodiment of the present application provides a storage medium on which a program is stored. When the program is executed by a processor, the operation button generating method is implemented.
[0106] An embodiment of the present application provides a processor, which is used to run a program, wherein the operation button generating method is executed when the program is running.
[0107] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having the following method steps: receiving an operation button generation instruction; determining a generation mode of the operation button according to the operation button generation instruction, the generation mode including a configuration mode and a slot mode; and generating the operation button according to the generation mode.
[0108] Furthermore, the generation mode of the operation button is determined according to the configuration of the configuration parameters in the operation button generation instruction, and the configuration of the configuration parameters includes the configuration of the parameter value and / or the configuration of the slot flag in the parameter value.
[0109] Furthermore, the generation mode of the operation button is determined according to the operation button generation instruction, including: when the operation button generation instruction includes the parameter value of the configuration parameter of the operation button, and the parameter value does not include the slot flag, indicating that the generation mode of the operation button is the configuration mode; when the operation button generation instruction includes the parameter value of the configuration parameter of the operation button, and the parameter value includes the slot flag, indicating that the generation mode of the operation button is the mixed mode; when the operation button generation instruction does not include the parameter value of the configuration parameter of the operation button, indicating that the generation mode of the operation button is the slot mode.
[0110] Further, generating an operation button according to a generation mode includes: when the generation mode of the operation button is a configuration mode, generating the operation button according to a generation template and a parameter value of the operation button, and binding the parameter value to the operation button.
[0111] Furthermore, generating an operation button according to a generation mode also includes: when the generation mode of the operation button is a slot mode, the operation button generation instruction includes a slot tag, and the slot tag is used to indicate a code for generating the operation button; and generating the operation button according to the slot tag.
[0112] Furthermore, generating the operation button according to the generation mode also includes: when the generation mode of the operation button is a mixed mode, generating the operation button according to the generation template of the operation button, the parameter value and the slot tag included in the operation button generation instruction.
[0113] Furthermore, the configuration parameters include: operation button name, operation button width, operation button display function, operation button disable function, operation button permission, and maximum number of display buttons.
[0114] Furthermore, the method also includes: determining the width value of each row of the operation button group in the table where the operation buttons are located, wherein the operation button group consists of the operation buttons displayed in each row; and setting the width of each row of the operation button group in the table to the maximum width value of the operation button group in the table.
[0115] Furthermore, the method also includes: storing the table in the form of key-value pairs, wherein all the data in the table are keys, and the maximum width value of the operation button group in the table is a value.
[0116] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0117] In a typical configuration, the device includes one or more processors (CPU), memory and bus. The device may also include input / output interface, network interface and the like.
[0118] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
[0119] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0120] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0121] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0122] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for generating an operation button, characterized in that: The method comprises: Receive operation button generation instructions; Determining a generation mode of the operation button according to the operation button generation instruction, wherein the generation mode includes a configuration mode, a slot mode and a mixed mode; The operation button is generated according to the generation mode.
2. The method according to claim 1, characterized in that Determining a generation mode of the operation button according to the operation button generation instruction includes: The generation mode of the operation button is determined according to the configuration of the configuration parameters in the operation button generation instruction, and the configuration of the configuration parameters includes the configuration of the parameter value and / or the slot flag in the parameter value.
3. The method according to claim 2, characterized in that The step of determining the generation mode of the operation button according to the configuration of the configuration parameters in the operation button generation instruction includes: When the operation button generation instruction includes a parameter value of a configuration parameter of the operation button, and the parameter value does not include a slot flag, indicating that the generation mode of the operation button is a configuration mode; When the operation button generation instruction includes the parameter value of the configuration parameter of the operation button, and the parameter value includes a slot flag, it indicates that the generation mode of the operation button is a mixed mode; When the operation button generation instruction does not include the parameter value of the configuration parameter of the operation button, it indicates that the generation mode of the operation button is the slot mode.
4. The method according to claim 3, characterized in that: The step of generating the operation button according to the generation mode comprises: When the generation mode of the operation button is the configuration mode, the operation button is generated according to the generation template of the operation button and the parameter value, and the parameter value is bound to the operation button.
5. The method according to claim 3, characterized in that: Generating the operation button according to the generation mode also includes: When the generation mode of the operation button is the slot mode, obtaining a slot tag, where the slot tag is used to indicate a code for generating the operation button; The operation button is generated according to the slot tag.
6. The method according to claim 3, characterized in that Generating the operation button according to the generation mode also includes: When the generation mode of the operation button is the mixed mode, the operation button is generated according to the generation template of the operation button, the parameter value, the slot flag bit and the slot tag included in the operation button generation instruction.
7. The method according to claim 1, characterized in that The method further comprises: Determine the width value of each row of the operation button group in the table where the operation button is located, wherein the operation button group is composed of the operation buttons displayed in each row; Determine the maximum width value of each row of the operation button group in the table where the operation button is located and set it as the width value of each row of the operation button group in the table; The table is stored in the form of key-value pairs, wherein all data in the table are keys, and the maximum width value of the operation button group in the table is a value.
8. An operation button generating device, characterized in that: The device comprises: A receiving module, used for receiving an operation button generation instruction; A determination module, used to determine a generation mode of the operation button according to the operation button generation instruction, wherein the generation mode includes a configuration mode and a slot mode; A generating module is used to generate the operation button according to the generating mode.
9. A storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the operation button generation method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: The device includes at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the operation button generation method as described in any one of claims 1-7.