Explorar el Código

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

YunaiV hace 2 años
padre
commit
f3c6249600

+ 2 - 1
src/utils/dict.ts

@@ -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) => {
@@ -117,6 +117,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',
 

+ 1 - 1
src/views/infra/codegen/PreviewCode.vue

@@ -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"

+ 35 - 21
src/views/infra/codegen/components/GenerateInfoForm.vue

@@ -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],

+ 2 - 1
src/views/system/dict/data/DictDataForm.vue

@@ -115,11 +115,12 @@ const colorTypeOptions = readonly([
 ])
 
 /** 打开弹窗 */
-const open = async (type: string, id?: number) => {
+const open = async (type: string, id?: number, dictType?: string) => {
   dialogVisible.value = true
   dialogTitle.value = t('action.' + type)
   formType.value = type
   resetForm()
+  formData.value.dictType = dictType
   // 修改时,设置数据
   if (id) {
     formLoading.value = true

+ 1 - 1
src/views/system/dict/data/index.vue

@@ -167,7 +167,7 @@ const resetQuery = () => {
 /** 添加/修改操作 */
 const formRef = ref()
 const openForm = (type: string, id?: number) => {
-  formRef.value.open(type, id)
+  formRef.value.open(type, id, queryParams.dictType)
 }
 
 /** 删除按钮操作 */