Commit a39a0e68a042acadeece9b1b847c4c7e7c72f0be

Authored by xingyu
1 parent 98561731

fix: vben codegen

yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben/api/api.ts.vm
1 -import { defHttp } from '@/utils/http/axios' 1 +import {defHttp} from '@/utils/http/axios'
2 #set ($baseURL = "/${table.moduleName}/${simpleClassName_strikeCase}") 2 #set ($baseURL = "/${table.moduleName}/${simpleClassName_strikeCase}")
3 3
4 // 查询${table.classComment}列表 4 // 查询${table.classComment}列表
@@ -28,5 +28,5 @@ export function delete${simpleClassName}(id: number) { @@ -28,5 +28,5 @@ export function delete${simpleClassName}(id: number) {
28 28
29 // 导出${table.classComment} Excel 29 // 导出${table.classComment} Excel
30 export function export${simpleClassName}(params) { 30 export function export${simpleClassName}(params) {
31 - return defHttp.download({ url: '${baseURL}/export-excel', params }, '${table.classComment}.xls') 31 + return defHttp.download({ url: '${baseURL}/export-excel', params }, '${table.classComment}.xls')
32 } 32 }
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben/views/data.ts.vm
1 -import type { BasicColumn, FormSchema } from '@/components/Table'  
2 -import { useRender } from '@/components/Table'  
3 -import { DICT_TYPE, getDictOptions } from '@/utils/dict' 1 +import type {BasicColumn, FormSchema} from '@/components/Table'
  2 +import {useRender} from '@/components/Table'
  3 +import {DICT_TYPE, getDictOptions} from '@/utils/dict'
4 4
5 export const columns: BasicColumn[] = [ 5 export const columns: BasicColumn[] = [
6 #foreach($column in $columns) 6 #foreach($column in $columns)
@@ -50,7 +50,7 @@ export const searchFormSchema: FormSchema[] = [ @@ -50,7 +50,7 @@ export const searchFormSchema: FormSchema[] = [
50 field: '${javaField}', 50 field: '${javaField}',
51 #if ($column.htmlType == "input") 51 #if ($column.htmlType == "input")
52 component: 'Input', 52 component: 'Input',
53 - #elseif ($column.htmlType == "select" || $column.htmlType == "radio") 53 + #elseif ($column.htmlType == "select")
54 component: 'Select', 54 component: 'Select',
55 componentProps: { 55 componentProps: {
56 #if ("" != $dictType)## 设置了 dictType 数据字典的情况 56 #if ("" != $dictType)## 设置了 dictType 数据字典的情况
@@ -59,6 +59,15 @@ export const searchFormSchema: FormSchema[] = [ @@ -59,6 +59,15 @@ export const searchFormSchema: FormSchema[] = [
59 options: [], 59 options: [],
60 #end 60 #end
61 }, 61 },
  62 + #elseif ($column.htmlType == "radio")
  63 + component: 'Radio',
  64 + componentProps: {
  65 + #if ("" != $dictType)## 设置了 dictType 数据字典的情况
  66 + options: getDictOptions(DICT_TYPE.$dictType.toUpperCase()),
  67 + #else## 未设置 dictType 数据字典的情况
  68 + options: [],
  69 + #end
  70 + },
62 #elseif($column.htmlType == "datetime") 71 #elseif($column.htmlType == "datetime")
63 component: 'RangePicker', 72 component: 'RangePicker',
64 #end 73 #end
@@ -181,7 +190,8 @@ export const updateFormSchema: FormSchema[] = [ @@ -181,7 +190,8 @@ export const updateFormSchema: FormSchema[] = [
181 fileType: 'file', 190 fileType: 'file',
182 maxCount: 1, 191 maxCount: 1,
183 }, 192 },
184 - #elseif($column.htmlType == "editor")## 文本编辑器component: 'Editor', 193 + #elseif($column.htmlType == "editor")## 文本编辑器
  194 + component: 'Editor',
185 #elseif($column.htmlType == "select")## 下拉框 195 #elseif($column.htmlType == "select")## 下拉框
186 component: 'Select', 196 component: 'Select',
187 componentProps: { 197 componentProps: {
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben/views/index.vue.vm
1 <script lang="ts" setup> 1 <script lang="ts" setup>
2 -import ${ simpleClassName }Modal from './${simpleClassName}Modal.vue'  
3 -import { columns, searchFormSchema } from './${classNameVar}.data'  
4 -import { useI18n } from '@/hooks/web/useI18n'  
5 -import { useMessage } from '@/hooks/web/useMessage'  
6 -import { useModal } from '@/components/Modal'  
7 -import { IconEnum } from '@/enums/appEnum'  
8 -import { BasicTable, useTable, TableAction } from '@/components/Table'  
9 -import { delete${ simpleClassName }, export${ simpleClassName }, get${ simpleClassName } Page } from '@/api/${table.moduleName}/${classNameVar}' 2 + import {columns, searchFormSchema} from './'
  3 + import {useI18n} from '@/hooks/web/useI18n'
  4 + import {useMessage} from '@/hooks/web/useMessage'
  5 + import {useModal} from '@/components/Modal'
  6 + import {useTable} from '@/components/Table'
  7 + import { delete${ simpleClassName }, export${ simpleClassName }, get${ simpleClassName } Page } from '@/api/${table.moduleName}/${classNameVar}'
10 8
11 defineOptions({ name: '${table.className}' }) 9 defineOptions({ name: '${table.className}' })
12 10
@@ -62,7 +60,7 @@ async function handleDelete(record: Recordable) { @@ -62,7 +60,7 @@ async function handleDelete(record: Recordable) {
62 <a-button type="primary" v-auth="['${permissionPrefix}:create']" :preIcon="IconEnum.ADD" @click="handleCreate"> 60 <a-button type="primary" v-auth="['${permissionPrefix}:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
63 {{ t('action.create') }} 61 {{ t('action.create') }}
64 </a-button> 62 </a-button>
65 - <a-button type="warning" v-auth="['${permissionPrefix}:export']" :preIcon="IconEnum.EXPORT" @click="handleExport"> 63 + <a-button v-auth="['${permissionPrefix}:export']" :preIcon="IconEnum.EXPORT" @click="handleExport">
66 {{ t('action.export') }} 64 {{ t('action.export') }}
67 </a-button> 65 </a-button>
68 </template> 66 </template>