Commit a39a0e68a042acadeece9b1b847c4c7e7c72f0be
1 parent
98561731
fix: vben codegen
Showing
3 changed files
with
24 additions
and
16 deletions
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 | 2 | #set ($baseURL = "/${table.moduleName}/${simpleClassName_strikeCase}") |
| 3 | 3 | |
| 4 | 4 | // 查询${table.classComment}列表 |
| ... | ... | @@ -28,5 +28,5 @@ export function delete${simpleClassName}(id: number) { |
| 28 | 28 | |
| 29 | 29 | // 导出${table.classComment} Excel |
| 30 | 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 | 5 | export const columns: BasicColumn[] = [ |
| 6 | 6 | #foreach($column in $columns) |
| ... | ... | @@ -50,7 +50,7 @@ export const searchFormSchema: FormSchema[] = [ |
| 50 | 50 | field: '${javaField}', |
| 51 | 51 | #if ($column.htmlType == "input") |
| 52 | 52 | component: 'Input', |
| 53 | - #elseif ($column.htmlType == "select" || $column.htmlType == "radio") | |
| 53 | + #elseif ($column.htmlType == "select") | |
| 54 | 54 | component: 'Select', |
| 55 | 55 | componentProps: { |
| 56 | 56 | #if ("" != $dictType)## 设置了 dictType 数据字典的情况 |
| ... | ... | @@ -59,6 +59,15 @@ export const searchFormSchema: FormSchema[] = [ |
| 59 | 59 | options: [], |
| 60 | 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 | 71 | #elseif($column.htmlType == "datetime") |
| 63 | 72 | component: 'RangePicker', |
| 64 | 73 | #end |
| ... | ... | @@ -181,7 +190,8 @@ export const updateFormSchema: FormSchema[] = [ |
| 181 | 190 | fileType: 'file', |
| 182 | 191 | maxCount: 1, |
| 183 | 192 | }, |
| 184 | - #elseif($column.htmlType == "editor")## 文本编辑器component: 'Editor', | |
| 193 | + #elseif($column.htmlType == "editor")## 文本编辑器 | |
| 194 | + component: 'Editor', | |
| 185 | 195 | #elseif($column.htmlType == "select")## 下拉框 |
| 186 | 196 | component: 'Select', |
| 187 | 197 | componentProps: { | ... | ... |
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben/views/index.vue.vm
| 1 | 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 | 9 | defineOptions({ name: '${table.className}' }) |
| 12 | 10 | |
| ... | ... | @@ -62,7 +60,7 @@ async function handleDelete(record: Recordable) { |
| 62 | 60 | <a-button type="primary" v-auth="['${permissionPrefix}:create']" :preIcon="IconEnum.ADD" @click="handleCreate"> |
| 63 | 61 | {{ t('action.create') }} |
| 64 | 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 | 64 | {{ t('action.export') }} |
| 67 | 65 | </a-button> |
| 68 | 66 | </template> | ... | ... |