Commit df8a0768ea0a734d0ee84e18e4e2badea90e94fe
1 parent
f352c4d9
feat: vue3 代码生成
Showing
1 changed file
with
7 additions
and
9 deletions
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/index.vue.vm
| 1 | <template> | 1 | <template> |
| 2 | <ContentWrap> | 2 | <ContentWrap> |
| 3 | <!-- 列表 --> | 3 | <!-- 列表 --> |
| 4 | - <vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> | 4 | + <XTable @register="registerTable"> |
| 5 | <template #toolbar_buttons> | 5 | <template #toolbar_buttons> |
| 6 | <!-- 操作:新增 --> | 6 | <!-- 操作:新增 --> |
| 7 | <XButton | 7 | <XButton |
| @@ -43,7 +43,7 @@ | @@ -43,7 +43,7 @@ | ||
| 43 | @click="handleDelete(row.id)" | 43 | @click="handleDelete(row.id)" |
| 44 | /> | 44 | /> |
| 45 | </template> | 45 | </template> |
| 46 | - </vxe-grid> | 46 | + </XTable> |
| 47 | </ContentWrap> | 47 | </ContentWrap> |
| 48 | <!-- 弹窗 --> | 48 | <!-- 弹窗 --> |
| 49 | <XModal id="${classNameVar}Model" :loading="modelLoading" v-model="modelVisible" :title="modelTitle"> | 49 | <XModal id="${classNameVar}Model" :loading="modelLoading" v-model="modelVisible" :title="modelTitle"> |
| @@ -79,8 +79,7 @@ | @@ -79,8 +79,7 @@ | ||
| 79 | import { ref, unref } from 'vue' | 79 | import { ref, unref } from 'vue' |
| 80 | import { useI18n } from '@/hooks/web/useI18n' | 80 | import { useI18n } from '@/hooks/web/useI18n' |
| 81 | import { useMessage } from '@/hooks/web/useMessage' | 81 | import { useMessage } from '@/hooks/web/useMessage' |
| 82 | -import { useVxeGrid } from '@/hooks/web/useVxeGrid' | ||
| 83 | -import { VxeGridInstance } from 'vxe-table' | 82 | +import { useXTable } from '@/hooks/web/useXTable' |
| 84 | import { FormExpose } from '@/components/Form' | 83 | import { FormExpose } from '@/components/Form' |
| 85 | // 业务相关的 import | 84 | // 业务相关的 import |
| 86 | import { rules, allSchemas } from './${classNameVar}.data' | 85 | import { rules, allSchemas } from './${classNameVar}.data' |
| @@ -90,8 +89,7 @@ const { t } = useI18n() // 国际化 | @@ -90,8 +89,7 @@ const { t } = useI18n() // 国际化 | ||
| 90 | const message = useMessage() // 消息弹窗 | 89 | const message = useMessage() // 消息弹窗 |
| 91 | 90 | ||
| 92 | // 列表相关的变量 | 91 | // 列表相关的变量 |
| 93 | -const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref | ||
| 94 | -const { gridOptions, getList, deleteData, exportList } = useVxeGrid<${simpleClassName}Api.${simpleClassName}VO>({ | 92 | +const [registerTable, { reload, deleteData, exportList }] = useXTable({ |
| 95 | allSchemas: allSchemas, | 93 | allSchemas: allSchemas, |
| 96 | getListApi: ${simpleClassName}Api.get${simpleClassName}PageApi, | 94 | getListApi: ${simpleClassName}Api.get${simpleClassName}PageApi, |
| 97 | deleteApi: ${simpleClassName}Api.delete${simpleClassName}Api, | 95 | deleteApi: ${simpleClassName}Api.delete${simpleClassName}Api, |
| @@ -123,7 +121,7 @@ const handleCreate = () => { | @@ -123,7 +121,7 @@ const handleCreate = () => { | ||
| 123 | 121 | ||
| 124 | // 导出操作 | 122 | // 导出操作 |
| 125 | const handleExport = async () => { | 123 | const handleExport = async () => { |
| 126 | - await exportList(xGrid, '${table.classComment}.xls') | 124 | + await exportList('${table.classComment}.xls') |
| 127 | } | 125 | } |
| 128 | 126 | ||
| 129 | // 修改操作 | 127 | // 修改操作 |
| @@ -145,7 +143,7 @@ const handleDetail = async (rowId: number) => { | @@ -145,7 +143,7 @@ const handleDetail = async (rowId: number) => { | ||
| 145 | 143 | ||
| 146 | // 删除操作 | 144 | // 删除操作 |
| 147 | const handleDelete = async (rowId: number) => { | 145 | const handleDelete = async (rowId: number) => { |
| 148 | - await deleteData(xGrid, rowId) | 146 | + await deleteData(rowId) |
| 149 | } | 147 | } |
| 150 | 148 | ||
| 151 | // 提交按钮 | 149 | // 提交按钮 |
| @@ -169,7 +167,7 @@ const submitForm = async () => { | @@ -169,7 +167,7 @@ const submitForm = async () => { | ||
| 169 | } finally { | 167 | } finally { |
| 170 | actionLoading.value = false | 168 | actionLoading.value = false |
| 171 | // 刷新列表 | 169 | // 刷新列表 |
| 172 | - await getList(xGrid) | 170 | + await reload() |
| 173 | } | 171 | } |
| 174 | } | 172 | } |
| 175 | }) | 173 | }) |