This article mainly explains the implementation method of ThinkPHP and EasyUI's ComboTree to generate accounting account tree menu. Share it with everyone for reference. I hope to be helpful.
Assume that the fields of the accounting data table in the database are: id, code, name, islast. They are the auto-increment primary key, account code, account name, and whether it is the last-level account ("1" indicates the last-level account).
Here, recursion is used in the model layer of Thinkphp to build the data required by ComboTree. The code and annotations are as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
Similar to the above Data (such as departments, regions, etc.) that need to build a tree menu can basically achieve similar functions by simply modifying the code.
Related recommendations:
Detailed examples of thinkphp5 URL and routing functions
How to connect to a distributed database in Thinkphp
##Replace the entry file in thinkphp3.2
The above is the detailed content of ThinkPHP uses EasyUI to implement accounting tree menu. For more information, please follow other related articles on the PHP Chinese website!