Skip to content

Commit f3c6249

Browse files
committed
代码生成,支持设置前端的模版
1 parent ebbf47f commit f3c6249

File tree

5 files changed

+41
-25
lines changed

5 files changed

+41
-25
lines changed

src/utils/dict.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export interface DictDataType {
2121
}
2222

2323
export const getDictOptions = (dictType: string) => {
24-
return dictStore.getDictByType(dictType)
24+
return dictStore.getDictByType(dictType) || []
2525
}
2626

2727
export const getIntDictOptions = (dictType: string) => {
@@ -117,6 +117,7 @@ export enum DICT_TYPE {
117117
INFRA_API_ERROR_LOG_PROCESS_STATUS = 'infra_api_error_log_process_status',
118118
INFRA_CONFIG_TYPE = 'infra_config_type',
119119
INFRA_CODEGEN_TEMPLATE_TYPE = 'infra_codegen_template_type',
120+
INFRA_CODEGEN_FRONT_TYPE = 'infra_codegen_front_type',
120121
INFRA_CODEGEN_SCENE = 'infra_codegen_scene',
121122
INFRA_FILE_STORAGE = 'infra_file_storage',
122123

src/views/infra/codegen/PreviewCode.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
v-loading="loading"
1616
element-loading-text="生成文件目录中..."
1717
>
18-
<el-scrollbar height="calc(100vh - 88px - 40px - 50px)">
18+
<el-scrollbar height="calc(100vh - 88px - 40px)">
1919
<el-tree
2020
ref="treeRef"
2121
node-key="id"

src/views/infra/codegen/components/GenerateInfoForm.vue

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@
1313
</el-select>
1414
</el-form-item>
1515
</el-col>
16+
<el-col :span="12">
17+
<el-form-item prop="frontType" label="前端类型">
18+
<el-select v-model="formData.frontType">
19+
<el-option
20+
v-for="dict in getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_FRONT_TYPE)"
21+
:key="dict.value"
22+
:label="dict.label"
23+
:value="dict.value"
24+
/>
25+
</el-select>
26+
</el-form-item>
27+
</el-col>
28+
1629
<el-col :span="12">
1730
<el-form-item prop="scene" label="生成场景">
1831
<el-select v-model="formData.scene">
@@ -25,6 +38,26 @@
2538
</el-select>
2639
</el-form-item>
2740
</el-col>
41+
<el-col :span="12">
42+
<el-form-item>
43+
<template #label>
44+
<span>
45+
上级菜单
46+
<el-tooltip content="分配到指定菜单下,例如 系统管理" placement="top">
47+
<Icon icon="ep:question-filled" />
48+
</el-tooltip>
49+
</span>
50+
</template>
51+
<el-tree-select
52+
v-model="formData.parentMenuId"
53+
placeholder="请选择系统菜单"
54+
node-key="id"
55+
check-strictly
56+
:data="menus"
57+
:props="menuTreeProps"
58+
/>
59+
</el-form-item>
60+
</el-col>
2861

2962
<!-- <el-col :span="12">-->
3063
<!-- <el-form-item prop="packageName">-->
@@ -115,27 +148,6 @@
115148
</el-form-item>
116149
</el-col>
117150

118-
<el-col :span="12">
119-
<el-form-item>
120-
<template #label>
121-
<span>
122-
上级菜单
123-
<el-tooltip content="分配到指定菜单下,例如 系统管理" placement="top">
124-
<Icon icon="ep:question-filled" />
125-
</el-tooltip>
126-
</span>
127-
</template>
128-
<el-tree-select
129-
v-model="formData.parentMenuId"
130-
placeholder="请选择系统菜单"
131-
node-key="id"
132-
check-strictly
133-
:data="menus"
134-
:props="menuTreeProps"
135-
/>
136-
</el-form-item>
137-
</el-col>
138-
139151
<el-col :span="24" v-if="formData.genType === '1'">
140152
<el-form-item prop="genPath">
141153
<template #label>
@@ -297,6 +309,7 @@ const props = defineProps({
297309
const formRef = ref()
298310
const formData = ref({
299311
templateType: null,
312+
frontType: null,
300313
scene: null,
301314
moduleName: '',
302315
businessName: '',
@@ -315,6 +328,7 @@ const formData = ref({
315328
316329
const rules = reactive({
317330
templateType: [required],
331+
frontType: [required],
318332
scene: [required],
319333
moduleName: [required],
320334
businessName: [required],

src/views/system/dict/data/DictDataForm.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,12 @@ const colorTypeOptions = readonly([
115115
])
116116
117117
/** 打开弹窗 */
118-
const open = async (type: string, id?: number) => {
118+
const open = async (type: string, id?: number, dictType?: string) => {
119119
dialogVisible.value = true
120120
dialogTitle.value = t('action.' + type)
121121
formType.value = type
122122
resetForm()
123+
formData.value.dictType = dictType
123124
// 修改时,设置数据
124125
if (id) {
125126
formLoading.value = true

src/views/system/dict/data/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ const resetQuery = () => {
167167
/** 添加/修改操作 */
168168
const formRef = ref()
169169
const openForm = (type: string, id?: number) => {
170-
formRef.value.open(type, id)
170+
formRef.value.open(type, id, queryParams.dictType)
171171
}
172172
173173
/** 删除按钮操作 */

0 commit comments

Comments
 (0)