系统管理加前缀path “/system”

This commit is contained in:
吕金泽 2022-03-28 21:21:26 +08:00
parent 178e024cf8
commit 25b91353b1
116 changed files with 240 additions and 474 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,10 @@
{ {
"properties" : { }, "properties" : { },
"id" : "acff5ad7aae64de2acb03e1d16a58ce2", "id" : "acff5ad7aae64de2acb03e1d16a58ce2",
"name" : "系统功能", "name" : "系统管理",
"type" : "api", "type" : "api",
"parentId" : "0", "parentId" : "0",
"path" : null, "path" : "/system",
"paths" : [ ], "paths" : [ ],
"options" : [ ] "options" : [ ]
} }

View File

@ -4,12 +4,12 @@
"script" : null, "script" : null,
"groupId" : "f2538e0f370a4cabab0ae920f5e77ae7", "groupId" : "f2538e0f370a4cabab0ae920f5e77ae7",
"name" : "删除", "name" : "删除",
"createTime" : 1648390993959, "createTime" : null,
"updateTime" : null, "updateTime" : 1648424795832,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
"path" : "delete", "path" : "/delete",
"method" : "DELETE", "method" : "DELETE",
"parameters" : [ ], "parameters" : [ ],
"options" : [ ], "options" : [ ],

View File

@ -0,0 +1,100 @@
{
"properties" : { },
"id" : "bb23ca6e863b41b8ad81994b87a4fc0d",
"script" : null,
"groupId" : "f2538e0f370a4cabab0ae920f5e77ae7",
"name" : "执行生成",
"createTime" : null,
"updateTime" : 1648426498457,
"lock" : null,
"createBy" : null,
"updateBy" : null,
"path" : "/execute",
"method" : "GET",
"parameters" : [ ],
"options" : [ ],
"requestBody" : "",
"headers" : [ ],
"paths" : [ ],
"responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": \"02df51e4d7184780a98b632f43dc5848\",\n \"timestamp\": 1648309158679,\n \"executeTime\": 8\n}",
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : {
"name" : "",
"value" : "",
"description" : "",
"required" : false,
"dataType" : "Object",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ {
"name" : "code",
"value" : "200",
"description" : "",
"required" : false,
"dataType" : "Integer",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "message",
"value" : "success",
"description" : "",
"required" : false,
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "data",
"value" : "02df51e4d7184780a98b632f43dc5848",
"description" : "",
"required" : false,
"dataType" : "Object",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "timestamp",
"value" : "1648309158679",
"description" : "",
"required" : false,
"dataType" : "Long",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "executeTime",
"value" : "8",
"description" : "",
"required" : false,
"dataType" : "Integer",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
} ]
}
}
================================
import org.ssssssss.magicapi.core.service.MagicResourceService
return MagicResourceService.tree('api').children.filter(it => it.node.path == '')[0].node.id

View File

@ -4,8 +4,8 @@
"script" : null, "script" : null,
"groupId" : "4f0230049d7e4f39b1e0897cc0f46f9a", "groupId" : "4f0230049d7e4f39b1e0897cc0f46f9a",
"name" : "获取用户信息", "name" : "获取用户信息",
"createTime" : 1646490239479, "createTime" : null,
"updateTime" : 1643710783720, "updateTime" : 1648431786861,
"lock" : "0", "lock" : "0",
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -18,7 +18,19 @@
"paths" : [ ], "paths" : [ ],
"responseBody" : "{\n \"code\": 402,\n \"message\": \"凭证已过期\",\n \"data\": null,\n \"timestamp\": 1643710751531,\n \"executeTime\": null\n}", "responseBody" : "{\n \"code\": 402,\n \"message\": \"凭证已过期\",\n \"data\": null,\n \"timestamp\": 1643710751531,\n \"executeTime\": null\n}",
"description" : null, "description" : null,
"requestBodyDefinition" : null, "requestBodyDefinition" : {
"name" : "",
"value" : "",
"description" : "",
"required" : false,
"dataType" : "Object",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
},
"responseBodyDefinition" : { "responseBodyDefinition" : {
"name" : "", "name" : "",
"value" : "", "value" : "",
@ -95,7 +107,7 @@
} }
================================ ================================
import 'cn.dev33.satoken.stp.StpUtil'; import 'cn.dev33.satoken.stp.StpUtil';
import "@post:/security/permissions" as authoritiesList; import "@post:/system/security/permissions" as authoritiesList;
var user = db.table("sys_user").where().eq("id",StpUtil.getLoginId()).selectOne() var user = db.table("sys_user").where().eq("id",StpUtil.getLoginId()).selectOne()
user.authorities = authoritiesList() user.authorities = authoritiesList()

View File

@ -182,7 +182,7 @@ function reloadTable() {
} }
function getSort() { function getSort() {
proxy.$get('dict/sort').then(res => { proxy.$get('/system/dict/sort').then(res => {
temp.value.sort = res.data temp.value.sort = res.data
}) })
} }
@ -201,7 +201,7 @@ function save(d) {
dataForm.value.validate((valid) => { dataForm.value.validate((valid) => {
if (valid) { if (valid) {
d.loading() d.loading()
proxy.$post('dict/save', temp.value).then((response) => { proxy.$post('/system/dict/save', temp.value).then((response) => {
d.hideLoading() d.hideLoading()
temp.value.id = response.data temp.value.id = response.data
dictDialog.value.hide() dictDialog.value.hide()

View File

@ -86,7 +86,7 @@ export default {
}, },
created() { created() {
if (this.externalId) { if (this.externalId) {
this.$get('file/files', { externalId: this.externalId, externalType: this.externalType }).then(res => { this.$get('/system/file/files', { externalId: this.externalId, externalType: this.externalType }).then(res => {
const { data } = res const { data } = res
this.fileList = data this.fileList = data
}) })

View File

@ -156,7 +156,7 @@ export default {
this.cropperOption = this.cropperConfig || {} this.cropperOption = this.cropperConfig || {}
this.cropperOption.img = '' this.cropperOption.img = ''
if (this.externalId) { if (this.externalId) {
this.$get('file/files', { externalId: this.externalId, externalType: this.externalType }).then(res => { this.$get('/system/file/files', { externalId: this.externalId, externalType: this.externalType }).then(res => {
this.urls = res.data this.urls = res.data
}) })
this.action = this.action + `?externalId=${this.externalId}&externalType=${this.externalType}` this.action = this.action + `?externalId=${this.externalId}&externalType=${this.externalType}`
@ -218,7 +218,7 @@ export default {
this.urls.forEach(url => { this.urls.forEach(url => {
newUrls.push(encodeURI(url)) newUrls.push(encodeURI(url))
}) })
this.$get('file/resort', { urls: newUrls.join(',') }) this.$get('/system/file/resort', { urls: newUrls.join(',') })
}, },
onExceed() { onExceed() {
this.$message({ this.$message({
@ -238,7 +238,7 @@ export default {
formData.append('file', dataFile) formData.append('file', dataFile)
formData.append('url', encodeURI(this.cropperOption.relativeImg)) formData.append('url', encodeURI(this.cropperOption.relativeImg))
this.$request({ this.$request({
url: 'file/cropper', url: '/system/file/cropper',
method: 'post', method: 'post',
data: formData data: formData
}).then(res => { }).then(res => {

View File

@ -22,7 +22,7 @@ export function removeToken() {
export async function getUserInfo() { export async function getUserInfo() {
await request({ await request({
url: 'user/info', url: '/system/user/info',
method: 'get' method: 'get'
}).then(response => { }).then(response => {
const { data } = response const { data } = response
@ -40,7 +40,7 @@ export async function getUserInfo() {
export function login(data){ export function login(data){
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
request({ request({
url: 'security/login', url: '/system/security/login',
method: 'post', method: 'post',
data data
}).then(res => { }).then(res => {
@ -55,7 +55,7 @@ export function login(data){
export function logout(){ export function logout(){
request({ request({
url: 'security/logout', url: '/system/security/logout',
method: 'get' method: 'get'
}).then(() => { }).then(() => {
removeToken() removeToken()

View File

@ -7,7 +7,7 @@ const common = {}
let dictData = [] let dictData = []
common.getDictData = async function() { common.getDictData = async function() {
await request({ await request({
url: 'dict/items/all', url: '/system/dict/items/all',
method: 'get' method: 'get'
}).then((response) => { }).then((response) => {
const { data } = response const { data } = response
@ -160,7 +160,7 @@ common.getUrl = (url, data) => {
// common.loadConfig = async() => { // common.loadConfig = async() => {
// await request({ // await request({
// url: 'config/list' // url: '/system/config/list'
// }).then(res => { // }).then(res => {
// const { data } = res // const { data } = res
// global.filePrefix = data.filePrefix // global.filePrefix = data.filePrefix

View File

@ -32,7 +32,7 @@ const install = (app) => {
lock: true, lock: true,
background: 'rgba(255, 255, 255, 0)', background: 'rgba(255, 255, 255, 0)',
}) })
app.config.globalProperties.$post('/component/list').then((res) => { app.config.globalProperties.$post('/system/component/list').then((res) => {
res.data.forEach(it => { res.data.forEach(it => {
appComponent(app, it) appComponent(app, it)
}) })

View File

@ -43,7 +43,7 @@ export const loadView = (view) => {
export function generateRoutes(){ export function generateRoutes(){
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
request({ request({
url: 'menu/current/menus', url: '/system/menu/current/menus',
method: 'post' method: 'post'
}).then(response => { }).then(response => {
const { data } = response const { data } = response

View File

@ -12,7 +12,7 @@ import genCode from '@/scripts/gen/gen-mb-list.js'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const tableDatas = reactive([]) const tableDatas = reactive([])
proxy.$get('/code/gen/columns', { tableName: 'sys_test' }).then(res => { proxy.$get('/system/code/gen/columns', { tableName: 'sys_test' }).then(res => {
var columns = res.data.columns var columns = res.data.columns
var primary = res.data.primary var primary = res.data.primary
columns.forEach(it => { columns.forEach(it => {
@ -161,7 +161,7 @@ const cols = reactive([{
field: 'dictType', field: 'dictType',
label: '字典类型', label: '字典类型',
props: { props: {
url: 'dict/all', url: '/system/dict/all',
showValue: true showValue: true
} }
}]) }])

View File

@ -104,7 +104,7 @@ const formOptions = reactive({
label: 'treeselect', label: 'treeselect',
rules: [{ required: true, message: '请选择组织机构', trigger: 'change' }], rules: [{ required: true, message: '请选择组织机构', trigger: 'change' }],
props: { props: {
url: 'user/offices' url: '/system/user/offices'
} }
}, { }, {
component: 'select', component: 'select',
@ -113,7 +113,7 @@ const formOptions = reactive({
label: 'select', label: 'select',
rules: [{ required: true, message: '请选择角色', trigger: 'change' }], rules: [{ required: true, message: '请选择角色', trigger: 'change' }],
props: { props: {
url: 'role/all', url: '/system/role/all',
placeholder: '请选择角色', placeholder: '请选择角色',
multiple: true multiple: true
} }

View File

@ -28,10 +28,10 @@ const listOptions = reactive({
},{ },{
type: 'delete', type: 'delete',
permission: 'user:delete', permission: 'user:delete',
url: 'user/delete' url: '/system/user/delete'
}], }],
table: { table: {
url: 'user/list', url: '/system/user/list',
where: { where: {
username: { username: {
label: '登录名称', label: '登录名称',
@ -43,7 +43,7 @@ const listOptions = reactive({
type: 'select', type: 'select',
label: '角色', label: '角色',
props: { props: {
url: 'role/all', url: '/system/role/all',
el: { multiple: true } el: { multiple: true }
} }
} }
@ -73,7 +73,7 @@ const listOptions = reactive({
type: 'switch', type: 'switch',
width: 100, width: 100,
change: (row) => { change: (row) => {
proxy.$get('/user/change/login/status', { proxy.$get('/system/user/change/login/status', {
id: row.id, id: row.id,
isLogin: row.isLogin isLogin: row.isLogin
}) })
@ -106,7 +106,7 @@ const listOptions = reactive({
icon: 'ElDelete', icon: 'ElDelete',
click: (row) => { click: (row) => {
proxy.$common.handleDelete({ proxy.$common.handleDelete({
url: 'user/delete', url: '/system/user/delete',
id: row.id, id: row.id,
done: () => magicList.value.reload() done: () => magicList.value.reload()
}) })
@ -120,7 +120,7 @@ const listOptions = reactive({
const formOptions = reactive({ const formOptions = reactive({
detail: { detail: {
request: { request: {
url: 'user/get' url: '/system/user/get'
} }
}, },
form: { form: {
@ -166,7 +166,7 @@ const formOptions = reactive({
label: '组织机构', label: '组织机构',
rules: [{ required: true, message: '请选择组织机构', trigger: 'change' }], rules: [{ required: true, message: '请选择组织机构', trigger: 'change' }],
props: { props: {
url: 'user/offices' url: '/system/user/offices'
} }
}, { }, {
component: 'select', component: 'select',
@ -175,7 +175,7 @@ const formOptions = reactive({
label: '选择角色', label: '选择角色',
rules: [{ required: true, message: '请选择角色', trigger: 'change' }], rules: [{ required: true, message: '请选择角色', trigger: 'change' }],
props: { props: {
url: 'role/all', url: '/system/role/all',
placeholder: '请选择角色', placeholder: '请选择角色',
el: { multiple: true } el: { multiple: true }
} }

View File

@ -37,7 +37,7 @@
}) })
const loading = ref(false) const loading = ref(false)
function refreshCode(){ function refreshCode(){
proxy.$get('/security/verification/code').then(res => { proxy.$get('/system/security/verification/code').then(res => {
codeImg.value = 'data:image/png;base64,' + res.data.img codeImg.value = 'data:image/png;base64,' + res.data.img
loginForm.uuid = res.data.uuid loginForm.uuid = res.data.uuid
}) })

View File

@ -16,8 +16,6 @@
</el-row> </el-row>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="字段信息" name="field"> <el-tab-pane label="字段信息" name="field">
<el-button type="primary" @click="getData" style="margin-bottom: 10px">获取数据</el-button>
<el-button type="primary" @click="gen" style="margin-bottom: 10px">代码生成</el-button>
<mb-editor-table v-model="genInfo.columns" :cols="cols" :show-no="false" :operation="false" :toolbar="false" /> <mb-editor-table v-model="genInfo.columns" :cols="cols" :show-no="false" :operation="false" :toolbar="false" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="生成信息" name="gen"> <el-tab-pane label="生成信息" name="gen">
@ -71,6 +69,17 @@
<el-input v-model="genInfo.info.businessPath"></el-input> <el-input v-model="genInfo.info.businessPath"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24">
<el-form-item>
<template #label>
代码生成
<el-tooltip content="接口和页面直接生成到magic-api的api,component" placement="top">
<el-icon><ElQuestionFilled /></el-icon>
</el-tooltip>
</template>
<el-button type="primary" @click="gen" style="margin-bottom: 10px">代码生成</el-button>
</el-form-item>
</el-col>
</el-row> </el-row>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
@ -84,14 +93,23 @@
const dataForm = ref() const dataForm = ref()
const tables = ref([]) const tables = ref([])
const emit = defineEmits(['reload']) const emit = defineEmits(['reload'])
var validatePath = (rule, value, callback) => {
if(!value.startsWith('/')){
callback(new Error('请以“/”开头'));
}else if(value.endsWith('/')){
callback(new Error('不能以“/”结尾'));
}else{
callback();
}
}
const genInfoRules = reactive({ const genInfoRules = reactive({
tableName: [{ required: true, message: '请选择表', trigger: 'change' }], tableName: [{ required: true, message: '请选择表', trigger: 'change' }],
tableComment: [{ required: true, message: '请输入描述', trigger: 'change' }], tableComment: [{ required: true, message: '请输入描述', trigger: 'change' }],
'info.template': [{ required: true, message: '请选择模板', trigger: 'change' }], 'info.template': [{ required: true, message: '请选择模板', trigger: 'change' }],
'info.moduleName': [{ required: true, message: '请输入模块名称', trigger: 'change' }], 'info.moduleName': [{ required: true, message: '请输入模块名称', trigger: 'change' }],
'info.modulePath': [{ required: true, message: '请输入模块路径', trigger: 'change' }], 'info.modulePath': [{ required: true, message: '请输入模块路径', trigger: 'change' }, { validator: validatePath }],
'info.businessName': [{ required: true, message: '请输入功能名称', trigger: 'change' }], 'info.businessName': [{ required: true, message: '请输入功能名称', trigger: 'change' }],
'info.businessPath': [{ required: true, message: '请输入功能路径', trigger: 'change' }] 'info.businessPath': [{ required: true, message: '请输入功能路径', trigger: 'change' }, { validator: validatePath }]
}) })
const genInfo = ref({ const genInfo = ref({
tableName: '', tableName: '',
@ -107,13 +125,13 @@
}) })
async function watchTableName(){ async function watchTableName(){
await proxy.$get('/code/gen/tables').then(res => { await proxy.$get('/system/code/gen/tables').then(res => {
tables.value = res.data tables.value = res.data
}) })
watch(() => genInfo.value.tableName, (value) => { watch(() => genInfo.value.tableName, (value) => {
genInfo.value.tableComment = tables.value.filter(it => it.value == value)[0].label.replace(value, '').replace('(','').replace(')','') genInfo.value.tableComment = tables.value.filter(it => it.value == value)[0].label.replace(value, '').replace('(','').replace(')','')
genInfo.value.columns = [] genInfo.value.columns = []
proxy.$get('/code/gen/columns', { tableName: value }).then(res => { proxy.$get('/system/code/gen/columns', { tableName: value }).then(res => {
var columns = res.data.columns var columns = res.data.columns
var primary = res.data.primary var primary = res.data.primary
columns.forEach(it => { columns.forEach(it => {
@ -274,7 +292,7 @@
field: 'dictType', field: 'dictType',
label: '字典类型', label: '字典类型',
props: { props: {
url: 'dict/all', url: '/system/dict/all',
showValue: true showValue: true
} }
}]) }])
@ -283,10 +301,6 @@
genCode('test', genInfo.value.columns) genCode('test', genInfo.value.columns)
} }
function getData(){
console.log(genInfo.value.columns)
}
function save(d){ function save(d){
dataForm.value.validate((valid) => { dataForm.value.validate((valid) => {
if (valid) { if (valid) {
@ -294,7 +308,7 @@
formData.info = JSON.stringify(genInfo.value.info) formData.info = JSON.stringify(genInfo.value.info)
formData.columns = JSON.stringify(genInfo.value.columns) formData.columns = JSON.stringify(genInfo.value.columns)
d.loading() d.loading()
proxy.$post('/code/gen/save', formData).then(() => { proxy.$post('/system/code/gen/save', formData).then(() => {
d.hideLoading() d.hideLoading()
proxy.$notify({ proxy.$notify({
title: '成功', title: '成功',
@ -312,7 +326,7 @@
} }
function getDetail(id){ function getDetail(id){
proxy.$get('/code/gen/get', { id: id }).then(res => { proxy.$get('/system/code/gen/get', { id: id }).then(res => {
var formData = {...res.data} var formData = {...res.data}
formData.info = JSON.parse(formData.info) formData.info = JSON.parse(formData.info)
formData.columns = JSON.parse(formData.columns) formData.columns = JSON.parse(formData.columns)

Some files were not shown because too many files have changed in this diff Show More