From df0bb5c38f522eeeefe56331c6a5c0d4295c7ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=95=E9=87=91=E6=B3=BD?= <1098696801@qq.com> Date: Fri, 1 Apr 2022 20:35:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20=E5=85=B6=E4=BB=96=E4=B8=80=E4=BA=9B=E5=B0=8F?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/magic-api/api/数据管理/测试生成/保存.ms | 16 +++++++-- data/magic-api/api/数据管理/测试生成/列表.ms | 18 ++++++++-- data/magic-api/api/数据管理/测试生成/删除.ms | 18 ++++++++-- data/magic-api/api/数据管理/测试生成/详情.ms | 18 ++++++++-- .../api/系统管理/代码生成/执行生成.ms | 9 +++-- .../component/数据管理/测试生成/列表.ms | 21 +++++------ .../src/components/magic/basic/mb-dialog.vue | 6 +++- .../magic/basic/mb-table-column.vue | 6 +++- magic-boot-ui/src/layout/layout.vue | 18 ++++++---- magic-boot-ui/src/scripts/gen/gen-mb-list.js | 35 +++++++++++++------ .../src/views/system/dict/dict-list.vue | 2 +- .../src/views/system/user/user-form.vue | 2 +- 12 files changed, 121 insertions(+), 48 deletions(-) diff --git a/data/magic-api/api/数据管理/测试生成/保存.ms b/data/magic-api/api/数据管理/测试生成/保存.ms index 16558dc..3e3d2d9 100644 --- a/data/magic-api/api/数据管理/测试生成/保存.ms +++ b/data/magic-api/api/数据管理/测试生成/保存.ms @@ -1,10 +1,10 @@ { "properties" : { }, - "id" : "46a5f8f41666462987ae042469b99ff4", + "id" : "ae425d18ae6f44c9adc25028eb891d15", "script" : null, "groupId" : "7bdcc43555b9419caba2ee722e1aa2d3", "name" : "保存", - "createTime" : 1648655132918, + "createTime" : 1648780777664, "updateTime" : null, "lock" : null, "createBy" : null, @@ -24,6 +24,18 @@ "error" : null, "expression" : null, "children" : null + }, { + "name" : "permission", + "value" : "data:test:save", + "description" : "允许拥有该权限的访问", + "required" : false, + "dataType" : "String", + "type" : null, + "defaultValue" : null, + "validateType" : null, + "error" : null, + "expression" : null, + "children" : null } ], "requestBody" : null, "headers" : [ ], diff --git a/data/magic-api/api/数据管理/测试生成/列表.ms b/data/magic-api/api/数据管理/测试生成/列表.ms index c6a0f4f..3137975 100644 --- a/data/magic-api/api/数据管理/测试生成/列表.ms +++ b/data/magic-api/api/数据管理/测试生成/列表.ms @@ -1,10 +1,10 @@ { "properties" : { }, - "id" : "d94a4788e17a4e0f9b67ca86b171e231", + "id" : "33639781fde24f32902b486bd0edd6ca", "script" : null, "groupId" : "7bdcc43555b9419caba2ee722e1aa2d3", "name" : "列表", - "createTime" : 1648655132912, + "createTime" : 1648780777658, "updateTime" : null, "lock" : null, "createBy" : null, @@ -12,7 +12,19 @@ "path" : "/list", "method" : "POST", "parameters" : [ ], - "options" : [ ], + "options" : [ { + "name" : "permission", + "value" : "data:test:view", + "description" : "允许拥有该权限的访问", + "required" : false, + "dataType" : "String", + "type" : null, + "defaultValue" : null, + "validateType" : null, + "error" : null, + "expression" : null, + "children" : null + } ], "requestBody" : null, "headers" : [ ], "paths" : [ ], diff --git a/data/magic-api/api/数据管理/测试生成/删除.ms b/data/magic-api/api/数据管理/测试生成/删除.ms index 08fd9f1..21c6027 100644 --- a/data/magic-api/api/数据管理/测试生成/删除.ms +++ b/data/magic-api/api/数据管理/测试生成/删除.ms @@ -1,10 +1,10 @@ { "properties" : { }, - "id" : "e1df886fe7604810b495d555abaa6200", + "id" : "5019707e422245b89e0b2bf00f9a2ec8", "script" : null, "groupId" : "7bdcc43555b9419caba2ee722e1aa2d3", "name" : "删除", - "createTime" : 1648655132924, + "createTime" : 1648780777671, "updateTime" : null, "lock" : null, "createBy" : null, @@ -12,7 +12,19 @@ "path" : "/delete", "method" : "DELETE", "parameters" : [ ], - "options" : [ ], + "options" : [ { + "name" : "permission", + "value" : "data:test:delete", + "description" : "允许拥有该权限的访问", + "required" : false, + "dataType" : "String", + "type" : null, + "defaultValue" : null, + "validateType" : null, + "error" : null, + "expression" : null, + "children" : null + } ], "requestBody" : null, "headers" : [ ], "paths" : [ ], diff --git a/data/magic-api/api/数据管理/测试生成/详情.ms b/data/magic-api/api/数据管理/测试生成/详情.ms index f5baff7..e246f30 100644 --- a/data/magic-api/api/数据管理/测试生成/详情.ms +++ b/data/magic-api/api/数据管理/测试生成/详情.ms @@ -1,10 +1,10 @@ { "properties" : { }, - "id" : "c999de118aa04594bc14c0e3f5ade568", + "id" : "ad14a4bc8cf54fc792125a59bc2d34ad", "script" : null, "groupId" : "7bdcc43555b9419caba2ee722e1aa2d3", "name" : "详情", - "createTime" : 1648655132931, + "createTime" : 1648780777677, "updateTime" : null, "lock" : null, "createBy" : null, @@ -12,7 +12,19 @@ "path" : "/get", "method" : "GET", "parameters" : [ ], - "options" : [ ], + "options" : [ { + "name" : "permission", + "value" : "data:test:view", + "description" : "允许拥有该权限的访问", + "required" : false, + "dataType" : "String", + "type" : null, + "defaultValue" : null, + "validateType" : null, + "error" : null, + "expression" : null, + "children" : null + } ], "requestBody" : null, "headers" : [ ], "paths" : [ ], diff --git a/data/magic-api/api/系统管理/代码生成/执行生成.ms b/data/magic-api/api/系统管理/代码生成/执行生成.ms index 93b0d12..3619651 100644 --- a/data/magic-api/api/系统管理/代码生成/执行生成.ms +++ b/data/magic-api/api/系统管理/代码生成/执行生成.ms @@ -5,7 +5,7 @@ "groupId" : "f2538e0f370a4cabab0ae920f5e77ae7", "name" : "执行生成", "createTime" : null, - "updateTime" : 1648651494341, + "updateTime" : 1648780783577, "lock" : null, "createBy" : null, "updateBy" : null, @@ -308,7 +308,7 @@ if(commonField.contains('is_del')){ wheres += ` and is_del = 0\n` } wheres = wheres.substring(0,wheres.length() - 1) - +var permissionPrefix = (info.modulePath + info.businessPath).replace(/^\//,'').replace(/\/\//, '/').replace('/', ':') ApiInfo listApi = new ApiInfo() listApi.setName("列表") listApi.setPath("/list") @@ -318,6 +318,7 @@ listApi.setScript(`return db.page(""" select ${primary},${listFields} from ${tableName} where 1=1 ${wheres} """)`) +listApi.setOption([new Option('permission', `${permissionPrefix}:view`, '允许拥有该权限的访问')]) MagicResourceService.saveFile(listApi) var saveMethod = 'save(data)' @@ -331,7 +332,7 @@ saveApi.setPath("/save") saveApi.setMethod("POST") saveApi.setGroupId(businessGroup.getId()) saveApi.setScript(`return db.table('${tableName}').primary('${primary}').${saveMethod}`) -saveApi.setOption([new Option('wrap_request_parameter', 'data')]) +saveApi.setOption([new Option('wrap_request_parameter', 'data'), new Option('permission', `${permissionPrefix}:save`, '允许拥有该权限的访问')]) MagicResourceService.saveFile(saveApi) ApiInfo deleteApi = new ApiInfo() @@ -340,6 +341,7 @@ deleteApi.setPath("/delete") deleteApi.setMethod("DELETE") deleteApi.setGroupId(businessGroup.getId()) deleteApi.setScript(`return db.table('${tableName}')${logic}.where().eq('${primary}', ${primaryLowerCamelCase}).delete()`) +deleteApi.setOption([new Option('permission', `${permissionPrefix}:delete`, '允许拥有该权限的访问')]) MagicResourceService.saveFile(deleteApi) var saveFields = columns.filter(it => it.save).map(it => it.columnName.replace(/([A-Z])/g,"_$1").toLowerCase()).join(',') @@ -352,6 +354,7 @@ getApi.setGroupId(businessGroup.getId()) getApi.setScript(`return db.selectOne(""" select ${primary},${saveFields} from ${tableName} where ${primary} = #{${primaryLowerCamelCase}} """)`) +getApi.setOption([new Option('permission', `${permissionPrefix}:view`, '允许拥有该权限的访问')]) MagicResourceService.saveFile(getApi) diff --git a/data/magic-api/component/数据管理/测试生成/列表.ms b/data/magic-api/component/数据管理/测试生成/列表.ms index c0c7895..18ed9bf 100644 --- a/data/magic-api/component/数据管理/测试生成/列表.ms +++ b/data/magic-api/component/数据管理/测试生成/列表.ms @@ -1,10 +1,10 @@ { "properties" : { }, - "id" : "f4ebe91beaef452498879a98556481eb", + "id" : "64c78249fafd4ddcbcac12d734645b67", "script" : null, "groupId" : "eb5dbed949de4f50ba4bf59f483252a5", "name" : "列表", - "createTime" : 1648655132940, + "createTime" : 1648780777685, "updateTime" : null, "lock" : null, "createBy" : null, @@ -55,22 +55,20 @@ }, cols: [ { - field: 'name', label: '名字' }, { - dictType: 'sex', field: 'sex', - label: '性别' + label: '性别', + dictType: 'sex' }, { - field: 'headPortrait', - label: '头像' + label: '头像', + type: 'image' }, { - field: 'remarks', label: '备注' },{ @@ -124,7 +122,7 @@ name: 'name', label: '名字', component: 'input', - + rules: [{ required: true, message: '请输入名字', trigger: 'change' }] },{ span: 12, name: 'sex', @@ -138,7 +136,7 @@ name: 'headPortrait', label: '头像', component: 'upload-image', - + rules: [{ required: true, message: '请选择头像', trigger: 'change' }] },{ span: 12, name: 'remarks', @@ -147,8 +145,7 @@ props: { type: 'textarea' } - , - + }] }] } diff --git a/magic-boot-ui/src/components/magic/basic/mb-dialog.vue b/magic-boot-ui/src/components/magic/basic/mb-dialog.vue index 6ae70bd..3f0fb39 100644 --- a/magic-boot-ui/src/components/magic/basic/mb-dialog.vue +++ b/magic-boot-ui/src/components/magic/basic/mb-dialog.vue @@ -14,7 +14,7 @@ @close="$emit('close')" > -