magic-boot/data/magic-api/api/系统管理/组件/获取组件tree.ms
2024-03-10 23:22:31 +08:00

43 lines
1.1 KiB
Plaintext

{
"properties" : { },
"id" : "8ba14d61082e4ba69324fdc9de080f38",
"script" : null,
"groupId" : "6f106ebdee21489db34b956f7770ff03",
"name" : "获取组件tree",
"createTime" : null,
"updateTime" : 1710083862734,
"lock" : null,
"createBy" : null,
"updateBy" : null,
"path" : "/tree",
"method" : "GET",
"parameters" : [ ],
"options" : [ {
"name" : "permission",
"value" : "component:tree",
"description" : "允许拥有该权限的访问",
"required" : false,
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : null,
"error" : null,
"expression" : null,
"children" : null
} ],
"requestBody" : "",
"headers" : [ ],
"paths" : [ ],
"responseBody" : null,
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null
}
================================
var toTree = (list,pid) => select t.*,toTree(list,t.id) children from list t where t.pid = pid
var list = toTree(db.select('select id,name,pid from sys_dynamic_component where is_del = 0 order by name'),'0')
return {
list: list,
total: list.getLength()
}