代码生成,支持设置前端的模版

This commit is contained in:
shizhong 2023-06-13 12:34:01 +08:00
parent af546a04e3
commit 76472bcd8e
3 changed files with 38 additions and 23 deletions

View File

@ -21,7 +21,7 @@ export interface DictDataType {
}
export const getDictOptions = (dictType: string) => {
return dictStore.getDictByType(dictType)
return dictStore.getDictByType(dictType) || []
}
export const getIntDictOptions = (dictType: string) => {
@ -118,6 +118,7 @@ export enum DICT_TYPE {
INFRA_API_ERROR_LOG_PROCESS_STATUS = 'infra_api_error_log_process_status',
INFRA_CONFIG_TYPE = 'infra_config_type',
INFRA_CODEGEN_TEMPLATE_TYPE = 'infra_codegen_template_type',
INFRA_CODEGEN_FRONT_TYPE = 'infra_codegen_front_type',
INFRA_CODEGEN_SCENE = 'infra_codegen_scene',
INFRA_FILE_STORAGE = 'infra_file_storage',

View File

@ -15,7 +15,7 @@
v-loading="loading"
element-loading-text="生成文件目录中..."
>
<el-scrollbar height="calc(100vh - 88px - 40px - 50px)">
<el-scrollbar height="calc(100vh - 88px - 40px)">
<el-tree
ref="treeRef"
node-key="id"

View File

@ -13,6 +13,19 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="frontType" label="前端类型">
<el-select v-model="formData.frontType">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_FRONT_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="scene" label="生成场景">
<el-select v-model="formData.scene">
@ -25,6 +38,26 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item>
<template #label>
<span>
上级菜单
<el-tooltip content="分配到指定菜单下,例如 系统管理" placement="top">
<Icon icon="ep:question-filled" />
</el-tooltip>
</span>
</template>
<el-tree-select
v-model="formData.parentMenuId"
placeholder="请选择系统菜单"
node-key="id"
check-strictly
:data="menus"
:props="menuTreeProps"
/>
</el-form-item>
</el-col>
<!-- <el-col :span="12">-->
<!-- <el-form-item prop="packageName">-->
@ -115,27 +148,6 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item>
<template #label>
<span>
上级菜单
<el-tooltip content="分配到指定菜单下,例如 系统管理" placement="top">
<Icon icon="ep:question-filled" />
</el-tooltip>
</span>
</template>
<el-tree-select
v-model="formData.parentMenuId"
placeholder="请选择系统菜单"
node-key="id"
check-strictly
:data="menus"
:props="menuTreeProps"
/>
</el-form-item>
</el-col>
<el-col :span="24" v-if="formData.genType === '1'">
<el-form-item prop="genPath">
<template #label>
@ -297,6 +309,7 @@ const props = defineProps({
const formRef = ref()
const formData = ref({
templateType: null,
frontType: null,
scene: null,
moduleName: '',
businessName: '',
@ -315,6 +328,7 @@ const formData = ref({
const rules = reactive({
templateType: [required],
frontType: [required],
scene: [required],
moduleName: [required],
businessName: [required],