mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 02:08:43 +08:00 
			
		
		
		
	feat: vue3 代码生成
This commit is contained in:
		| @@ -1,7 +1,7 @@ | |||||||
| <template> | <template> | ||||||
|   <ContentWrap> |   <ContentWrap> | ||||||
|     <!-- 列表 --> |     <!-- 列表 --> | ||||||
|     <vxe-grid ref="xGrid" v-bind="gridOptions" class="xtable-scrollbar"> |     <XTable @register="registerTable"> | ||||||
|       <template #toolbar_buttons> |       <template #toolbar_buttons> | ||||||
|         <!-- 操作:新增 --> |         <!-- 操作:新增 --> | ||||||
|         <XButton |         <XButton | ||||||
| @@ -43,7 +43,7 @@ | |||||||
|           @click="handleDelete(row.id)" |           @click="handleDelete(row.id)" | ||||||
|         /> |         /> | ||||||
|       </template> |       </template> | ||||||
|     </vxe-grid> |     </XTable> | ||||||
|   </ContentWrap> |   </ContentWrap> | ||||||
|   <!-- 弹窗 --> |   <!-- 弹窗 --> | ||||||
|   <XModal id="${classNameVar}Model" :loading="modelLoading" v-model="modelVisible" :title="modelTitle"> |   <XModal id="${classNameVar}Model" :loading="modelLoading" v-model="modelVisible" :title="modelTitle"> | ||||||
| @@ -79,8 +79,7 @@ | |||||||
| import { ref, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { useI18n } from '@/hooks/web/useI18n' | import { useI18n } from '@/hooks/web/useI18n' | ||||||
| import { useMessage } from '@/hooks/web/useMessage' | import { useMessage } from '@/hooks/web/useMessage' | ||||||
| import { useVxeGrid } from '@/hooks/web/useVxeGrid' | import { useXTable } from '@/hooks/web/useXTable' | ||||||
| import { VxeGridInstance } from 'vxe-table' |  | ||||||
| import { FormExpose } from '@/components/Form' | import { FormExpose } from '@/components/Form' | ||||||
| // 业务相关的 import | // 业务相关的 import | ||||||
| import { rules, allSchemas } from './${classNameVar}.data' | import { rules, allSchemas } from './${classNameVar}.data' | ||||||
| @@ -90,8 +89,7 @@ const { t } = useI18n() // 国际化 | |||||||
| const message = useMessage() // 消息弹窗 | const message = useMessage() // 消息弹窗 | ||||||
|  |  | ||||||
| // 列表相关的变量 | // 列表相关的变量 | ||||||
| const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref | const [registerTable, { reload, deleteData, exportList }] = useXTable({ | ||||||
| const { gridOptions, getList, deleteData, exportList } = useVxeGrid<${simpleClassName}Api.${simpleClassName}VO>({ |  | ||||||
|   allSchemas: allSchemas, |   allSchemas: allSchemas, | ||||||
|   getListApi: ${simpleClassName}Api.get${simpleClassName}PageApi, |   getListApi: ${simpleClassName}Api.get${simpleClassName}PageApi, | ||||||
|   deleteApi: ${simpleClassName}Api.delete${simpleClassName}Api, |   deleteApi: ${simpleClassName}Api.delete${simpleClassName}Api, | ||||||
| @@ -123,7 +121,7 @@ const handleCreate = () => { | |||||||
|  |  | ||||||
| // 导出操作 | // 导出操作 | ||||||
| const handleExport = async () => { | const handleExport = async () => { | ||||||
|   await exportList(xGrid, '${table.classComment}.xls') |   await exportList('${table.classComment}.xls') | ||||||
| } | } | ||||||
|  |  | ||||||
| // 修改操作 | // 修改操作 | ||||||
| @@ -145,7 +143,7 @@ const handleDetail = async (rowId: number) => { | |||||||
|  |  | ||||||
| // 删除操作 | // 删除操作 | ||||||
| const handleDelete = async (rowId: number) => { | const handleDelete = async (rowId: number) => { | ||||||
|   await deleteData(xGrid, rowId) |   await deleteData(rowId) | ||||||
| } | } | ||||||
|  |  | ||||||
| // 提交按钮 | // 提交按钮 | ||||||
| @@ -169,7 +167,7 @@ const submitForm = async () => { | |||||||
|       } finally { |       } finally { | ||||||
|         actionLoading.value = false |         actionLoading.value = false | ||||||
|         // 刷新列表 |         // 刷新列表 | ||||||
|         await getList(xGrid) |         await reload() | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   }) |   }) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 xingyu
					xingyu