mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2025-04-28 05:50:18 +08:00
代码生成相关代码
This commit is contained in:
parent
9257129ed7
commit
8774b5f826
163
data/magic-api/api/后台/代码生成/列表.ms
Normal file
163
data/magic-api/api/后台/代码生成/列表.ms
Normal file
@ -0,0 +1,163 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "1d0adb4921c2443f83ea84c202d0a9b5",
|
||||
"script" : null,
|
||||
"groupId" : "f2538e0f370a4cabab0ae920f5e77ae7",
|
||||
"name" : "列表",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1647563302987,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/list",
|
||||
"method" : "POST",
|
||||
"parameters" : [ ],
|
||||
"options" : [ ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": {\n \"list\": [{\n \"tableName\": \"sys_user\",\n \"tableComment\": \"用户表\"\n }],\n \"total\": 1\n },\n \"timestamp\": 1647563302700,\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" : "",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Array",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ {
|
||||
"name" : "list",
|
||||
"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" : "tableName",
|
||||
"value" : "sys_user",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
}, {
|
||||
"name" : "tableComment",
|
||||
"value" : "用户表",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
} ]
|
||||
}, {
|
||||
"name" : "total",
|
||||
"value" : "1",
|
||||
"description" : "",
|
||||
"required" : false,
|
||||
"dataType" : "Integer",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : "",
|
||||
"error" : "",
|
||||
"expression" : "",
|
||||
"children" : [ ]
|
||||
} ]
|
||||
}, {
|
||||
"name" : "timestamp",
|
||||
"value" : "1647563302700",
|
||||
"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" : [ ]
|
||||
} ]
|
||||
}
|
||||
}
|
||||
================================
|
||||
return {
|
||||
list: [{
|
||||
tableName: 'sys_user',
|
||||
tableComment: '用户表'
|
||||
}],
|
||||
total: 1
|
||||
}
|
@ -43,12 +43,17 @@ const props = defineProps({
|
||||
operation: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
page: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
const tableOptions = reactive({
|
||||
data: props.modelValue,
|
||||
cols: [],
|
||||
page: props.page,
|
||||
showNo: props.showNo
|
||||
})
|
||||
|
||||
|
@ -5,7 +5,10 @@
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
>
|
||||
<span style="float: left">{{ item.label }}</span>
|
||||
<span v-if="showValue" style="float: right;color: var(--el-text-color-secondary);font-size: 13px;">{{ item.value }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
@ -69,6 +72,10 @@ const props = defineProps({
|
||||
join: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
showValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
|
91
magic-boot-ui/src/scripts/gen/gen-mb-list.js
Normal file
91
magic-boot-ui/src/scripts/gen/gen-mb-list.js
Normal file
@ -0,0 +1,91 @@
|
||||
function gen(groupPath, data){
|
||||
var permissionPrefix = groupPath.replace('/', ':')
|
||||
var html = `
|
||||
<template>
|
||||
<mb-list ref="magicList" v-bind="listOptions" />
|
||||
<mb-dialog ref="formDialog" @confirm-click="magicForm.save($event)" width="50%">
|
||||
<template #content>
|
||||
<mb-form ref="magicForm" @reload="magicList.reload" v-bind="formOptions" />
|
||||
</template>
|
||||
</mb-dialog>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, reactive, getCurrentInstance } from 'vue'
|
||||
const { proxy } = getCurrentInstance()
|
||||
const formDialog = ref()
|
||||
const magicList = ref()
|
||||
const magicForm = ref()
|
||||
const listOptions = reactive({
|
||||
tools: [{
|
||||
type: 'add',
|
||||
permission: '${permissionPrefix}:save',
|
||||
click: () => {
|
||||
formOptions.detail.formData = null
|
||||
formDialog.value.show()
|
||||
}
|
||||
}],
|
||||
table: {
|
||||
url: '${groupPath}/list',
|
||||
where: {
|
||||
`
|
||||
for(var i in data){
|
||||
var d = data[i]
|
||||
if(d.query){
|
||||
html += `
|
||||
${d.columnName}: {
|
||||
label: '${d.columnComment}'
|
||||
},
|
||||
`
|
||||
}
|
||||
}
|
||||
html += `
|
||||
},
|
||||
cols: [
|
||||
`
|
||||
for(var i in data){
|
||||
var d = data[i]
|
||||
if(d.list){
|
||||
html += `
|
||||
{
|
||||
field: '${d.columnName}',
|
||||
label: '${d.columnComment}'
|
||||
},
|
||||
`
|
||||
}
|
||||
}
|
||||
html += `
|
||||
{
|
||||
label: '操作',
|
||||
type: 'btns',
|
||||
width: 140,
|
||||
fixed: 'right',
|
||||
btns: [
|
||||
{
|
||||
permission: '${permissionPrefix}:save',
|
||||
label: '修改',
|
||||
type: 'text',
|
||||
icon: 'ElEdit',
|
||||
click: (row) => {
|
||||
magicForm.value.getDetail(row.id)
|
||||
formDialog.value.show()
|
||||
}
|
||||
}, {
|
||||
permission: '${permissionPrefix}:delete',
|
||||
label: '删除',
|
||||
type: 'text',
|
||||
icon: 'ElDelete',
|
||||
click: (row) => {
|
||||
proxy.$common.handleDelete({
|
||||
url: '${groupPath}/delete',
|
||||
id: row.id,
|
||||
done: () => magicList.value.reload()
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
`
|
||||
console.log(html)
|
||||
}
|
||||
export default gen
|
@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<div style="padding: 50px;">
|
||||
<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="tableDatas" :cols="cols" :show-no="false" :operation="false" />
|
||||
</div>
|
||||
</template>
|
||||
|
Loading…
x
Reference in New Issue
Block a user