{ "properties" : { }, "id" : "55ddadf56dfe433baae1b5c26580cf00", "script" : null, "groupId" : "4f0230049d7e4f39b1e0897cc0f46f9a", "name" : "所有机构", "createTime" : null, "updateTime" : 1651892081106, "lock" : "0", "createBy" : null, "updateBy" : null, "path" : "/offices", "method" : "GET", "parameters" : [ ], "options" : [ ], "requestBody" : "", "headers" : [ ], "paths" : [ ], "responseBody" : "{\n \"code\": 402,\n \"message\": \"凭证已过期\",\n \"data\": null,\n \"timestamp\": 1651892073882,\n \"executeTime\": null\n}", "description" : null, "requestBodyDefinition" : null, "responseBodyDefinition" : { "name" : "", "value" : "", "description" : "", "required" : false, "dataType" : "Object", "type" : null, "defaultValue" : null, "validateType" : "", "error" : "", "expression" : "", "children" : [ { "name" : "code", "value" : "402", "description" : "", "required" : false, "dataType" : "Integer", "type" : null, "defaultValue" : null, "validateType" : "", "error" : "", "expression" : "", "children" : [ ] }, { "name" : "message", "value" : "凭证已过期", "description" : "", "required" : false, "dataType" : "String", "type" : null, "defaultValue" : null, "validateType" : "", "error" : "", "expression" : "", "children" : [ ] }, { "name" : "data", "value" : "null", "description" : "", "required" : false, "dataType" : "Object", "type" : null, "defaultValue" : null, "validateType" : "", "error" : "", "expression" : "", "children" : [ ] }, { "name" : "timestamp", "value" : "1651892073882", "description" : "", "required" : false, "dataType" : "Long", "type" : null, "defaultValue" : null, "validateType" : "", "error" : "", "expression" : "", "children" : [ ] }, { "name" : "executeTime", "value" : "null", "description" : "", "required" : false, "dataType" : "Integer", "type" : null, "defaultValue" : null, "validateType" : "", "error" : "", "expression" : "", "children" : [ ] } ] } } ================================ var toTree = (list,pid) => select t.*,toTree(list,t.value) children from list t where t.pid = pid var list = toTree(db.select('select id value,name label,pid from sys_office where is_del = 0 order by sort'),'0') return { list: list, total: list.getLength() }