From 7cb49ae97506d623a1aef36570a4477479832e33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=95=E9=87=91=E6=B3=BD?= <1098696801@qq.com> Date: Sat, 25 Mar 2023 16:44:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=AD=97=E6=AE=B5=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/系统管理/用户管理/所有机构.ms | 18 +- data/magic-api/api/系统管理/组件/选择组件.ms | 158 ++++++++++++++++-- 2 files changed, 154 insertions(+), 22 deletions(-) diff --git a/data/magic-api/api/系统管理/用户管理/所有机构.ms b/data/magic-api/api/系统管理/用户管理/所有机构.ms index d07a237..c427f4d 100644 --- a/data/magic-api/api/系统管理/用户管理/所有机构.ms +++ b/data/magic-api/api/系统管理/用户管理/所有机构.ms @@ -5,7 +5,7 @@ "groupId" : "4f0230049d7e4f39b1e0897cc0f46f9a", "name" : "所有机构", "createTime" : null, - "updateTime" : 1651892081106, + "updateTime" : 1679650617570, "lock" : "0", "createBy" : null, "updateBy" : null, @@ -16,7 +16,7 @@ "requestBody" : "", "headers" : [ ], "paths" : [ ], - "responseBody" : "{\n \"code\": 402,\n \"message\": \"凭证已过期\",\n \"data\": null,\n \"timestamp\": 1651892073882,\n \"executeTime\": null\n}", + "responseBody" : "{\n \"code\": 500,\n \"message\": \"系统内部出现错误\",\n \"data\": null,\n \"timestamp\": 1679650571040,\n \"executeTime\": 14\n}", "description" : null, "requestBodyDefinition" : null, "responseBodyDefinition" : { @@ -32,7 +32,7 @@ "expression" : "", "children" : [ { "name" : "code", - "value" : "402", + "value" : "500", "description" : "", "required" : false, "dataType" : "Integer", @@ -44,7 +44,7 @@ "children" : [ ] }, { "name" : "message", - "value" : "凭证已过期", + "value" : "系统内部出现错误", "description" : "", "required" : false, "dataType" : "String", @@ -68,7 +68,7 @@ "children" : [ ] }, { "name" : "timestamp", - "value" : "1651892073882", + "value" : "1679650571040", "description" : "", "required" : false, "dataType" : "Long", @@ -80,7 +80,7 @@ "children" : [ ] }, { "name" : "executeTime", - "value" : "null", + "value" : "14", "description" : "", "required" : false, "dataType" : "Integer", @@ -94,10 +94,10 @@ } } ================================ -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') +var toTree = (list,pid) => select t.*,toTree(list,t.key) children from list t where t.pid = pid +var list = toTree(db.select("select id 'key',name label,pid from sys_office where is_del = 0 order by sort"),'0') return { list: list, total: list.getLength() -} \ No newline at end of file +} diff --git a/data/magic-api/api/系统管理/组件/选择组件.ms b/data/magic-api/api/系统管理/组件/选择组件.ms index 96b9166..8288fb4 100644 --- a/data/magic-api/api/系统管理/组件/选择组件.ms +++ b/data/magic-api/api/系统管理/组件/选择组件.ms @@ -5,7 +5,7 @@ "groupId" : "6f106ebdee21489db34b956f7770ff03", "name" : "选择组件", "createTime" : null, - "updateTime" : 1655521303906, + "updateTime" : 1679391949508, "lock" : "0", "createBy" : null, "updateBy" : null, @@ -16,7 +16,7 @@ "requestBody" : "", "headers" : [ ], "paths" : [ ], - "responseBody" : "{\n \"code\": 500,\n \"message\": \"系统内部出现错误\",\n \"data\": null,\n \"timestamp\": 1655521300755,\n \"executeTime\": 17\n}", + "responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": [{\n \"key\": \"55ff62aa20144b7bb5c6dfb5d76c8139\",\n \"label\": \"数据管理(/data)\",\n \"children\": [{\n \"key\": \"eb5dbed949de4f50ba4bf59f483252a5\",\n \"label\": \"测试生成(/test)\",\n \"children\": [{\n \"value\": \"data-test-list\",\n \"label\": \"列表(/list)\"\n }]\n }]\n }],\n \"timestamp\": 1679391943330,\n \"executeTime\": 10\n}", "description" : null, "requestBodyDefinition" : null, "responseBodyDefinition" : { @@ -32,7 +32,7 @@ "expression" : "", "children" : [ { "name" : "code", - "value" : "500", + "value" : "200", "description" : "", "required" : false, "dataType" : "Integer", @@ -44,7 +44,7 @@ "children" : [ ] }, { "name" : "message", - "value" : "系统内部出现错误", + "value" : "success", "description" : "", "required" : false, "dataType" : "String", @@ -56,7 +56,7 @@ "children" : [ ] }, { "name" : "data", - "value" : "null", + "value" : "", "description" : "", "required" : false, "dataType" : "Object", @@ -65,10 +65,142 @@ "validateType" : "", "error" : "", "expression" : "", - "children" : [ ] + "children" : [ { + "name" : "", + "value" : "", + "description" : "", + "required" : false, + "dataType" : "Object", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ { + "name" : "key", + "value" : "55ff62aa20144b7bb5c6dfb5d76c8139", + "description" : "", + "required" : false, + "dataType" : "String", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, { + "name" : "label", + "value" : "数据管理(/data)", + "description" : "", + "required" : false, + "dataType" : "String", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, { + "name" : "children", + "value" : "", + "description" : "", + "required" : false, + "dataType" : "Array", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ { + "name" : "", + "value" : "", + "description" : "", + "required" : false, + "dataType" : "Object", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ { + "name" : "key", + "value" : "eb5dbed949de4f50ba4bf59f483252a5", + "description" : "", + "required" : false, + "dataType" : "String", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, { + "name" : "label", + "value" : "测试生成(/test)", + "description" : "", + "required" : false, + "dataType" : "String", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, { + "name" : "children", + "value" : "", + "description" : "", + "required" : false, + "dataType" : "Array", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ { + "name" : "", + "value" : "", + "description" : "", + "required" : false, + "dataType" : "Object", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ { + "name" : "value", + "value" : "data-test-list", + "description" : "", + "required" : false, + "dataType" : "String", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, { + "name" : "label", + "value" : "列表(/list)", + "description" : "", + "required" : false, + "dataType" : "String", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + } ] + } ] + } ] + } ] + } ] + } ] }, { "name" : "timestamp", - "value" : "1655521300755", + "value" : "1679391943330", "description" : "", "required" : false, "dataType" : "Long", @@ -80,7 +212,7 @@ "children" : [ ] }, { "name" : "executeTime", - "value" : "17", + "value" : "10", "description" : "", "required" : false, "dataType" : "Integer", @@ -97,8 +229,8 @@ import org.ssssssss.magicapi.utils.PathUtils import org.ssssssss.magicapi.core.service.MagicResourceService var getFiles = (groupId) => { - return MagicResourceService.listFiles(groupId).map(file => { - value: PathUtils.replaceSlash(String.format("%s/%s", MagicResourceService.getGroupPath(file.groupId), file.path)).replace(/^\//,'').replace(/\/\//, '/').replace('/', '-'), + return MagicResourceService.listFiles(groupId).map(file => { + key: PathUtils.replaceSlash(String.format("%s/%s", MagicResourceService.getGroupPath(file.groupId), file.path)).replace(/^\//,'').replace(/\/\//, '/').replace('/', '-'), label: `${file.name}(${file.path})` }) } @@ -106,7 +238,7 @@ var toTree = (children) => { var treeData = [] children.forEach(it => { var chi = {} - chi.value = it.node.id + chi.key = it.node.id chi.label = `${it.node.name}(${it.node.path})` if(it.children.length > 0){ chi.children = toTree(it.children) @@ -125,7 +257,7 @@ var toTree = (children) => { }else{ treeData.add(chi) } - }) + }) return treeData } -return toTree(MagicResourceService.tree('component').children) \ No newline at end of file +return toTree(MagicResourceService.tree('component').children)