mirror of
				https://github.com/YunaiV/ruoyi-vue-pro.git
				synced 2025-10-31 10:37:41 +08:00 
			
		
		
		
	feat: vben codegen
This commit is contained in:
		| @ -1,15 +1,19 @@ | |||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? t('action.edit') : t('action.create')" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm" /> |     <BasicForm @register="registerForm" /> | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="${table.className}Modal"> | <script lang="ts" setup name="${table.className}Modal"> | ||||||
| import { ref, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
|   import { BasicModal, useModalInner } from '@/components/Modal' | import { useI18n } from '@/hooks/web/useI18n' | ||||||
|  | import { useMessage } from '@/hooks/web/useMessage' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
|  | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
| import { formSchema } from './${classNameVar}.data' | import { formSchema } from './${classNameVar}.data' | ||||||
| import { create${simpleClassName}, get${simpleClassName}, update${simpleClassName} } from '@/api/${table.moduleName}/${classNameVar}' | import { create${simpleClassName}, get${simpleClassName}, update${simpleClassName} } from '@/api/${table.moduleName}/${classNameVar}' | ||||||
|  |  | ||||||
|  | const { t } = useI18n() | ||||||
|  | const { createMessage } = useMessage() | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
|  |  | ||||||
| @ -43,6 +47,7 @@ | |||||||
|     closeModal() |     closeModal() | ||||||
|     emit('success') |     emit('success') | ||||||
|   } finally { |   } finally { | ||||||
|  |     createMessage.success(t('common.saveSuccessText')) | ||||||
|     setModalProps({ confirmLoading: false }) |     setModalProps({ confirmLoading: false }) | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 xingyu
					xingyu