refactor:修复 antd typecheck 提供的报错
							parent
							
								
									a6f25d477b
								
							
						
					
					
						commit
						b4efb7c468
					
				|  | @ -27,7 +27,7 @@ export namespace InfraFileApi { | |||
| 
 | ||||
|   /** 上传文件 */ | ||||
|   export interface FileUploadReqVO { | ||||
|     file: File; | ||||
|     file: globalThis.File; | ||||
|     path?: string; | ||||
|   } | ||||
| } | ||||
|  | @ -60,7 +60,6 @@ export function createFile(data: InfraFileApi.File) { | |||
| } | ||||
| 
 | ||||
| /** 上传文件 */ | ||||
| // TODO @芋艿:这里有爆红
 | ||||
| export function uploadFile( | ||||
|   data: InfraFileApi.FileUploadReqVO, | ||||
|   onUploadProgress?: AxiosProgressEvent, | ||||
|  |  | |||
|  | @ -1,3 +1,5 @@ | |||
| import type { PageParam } from '@vben/request'; | ||||
| 
 | ||||
| import { requestClient } from '#/api/request'; | ||||
| 
 | ||||
| export namespace SystemDictDataApi { | ||||
|  | @ -22,7 +24,7 @@ export function getSimpleDictDataList() { | |||
| } | ||||
| 
 | ||||
| // 查询字典数据列表
 | ||||
| export function getDictDataPage(params: any) { | ||||
| export function getDictDataPage(params: PageParam) { | ||||
|   return requestClient.get('/system/dict-data/page', { params }); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| <script lang="ts" setup> | ||||
| import type { IPropTypes } from '@tinymce/tinymce-vue/lib/cjs/main/ts/components/EditorPropTypes'; | ||||
| import type { Editor as EditorType } from 'tinymce/tinymce'; | ||||
| import type { Editor as EditorType } from '@tinymce/tinymce-vue'; | ||||
| 
 | ||||
| import type { PropType } from 'vue'; | ||||
| 
 | ||||
|  |  | |||
|  | @ -113,7 +113,6 @@ export const useUpload = () => { | |||
|         }); | ||||
|     } else { | ||||
|       // 模式二:后端上传
 | ||||
|       // TODO @芋艿:这里有爆红
 | ||||
|       return uploadFile({ file }, onUploadProgress); | ||||
|     } | ||||
|   }; | ||||
|  |  | |||
|  | @ -1,4 +1,5 @@ | |||
| import type { | ||||
|   AppRouteRecordRaw, | ||||
|   ComponentRecordType, | ||||
|   GenerateMenuAndRoutesOptions, | ||||
| } from '@vben/types'; | ||||
|  | @ -25,8 +26,8 @@ async function generateAccess(options: GenerateMenuAndRoutesOptions) { | |||
|     ...options, | ||||
|     fetchMenuListAsync: async () => { | ||||
|       // 由于 yudao 通过 accessStore 读取,所以不在进行 message.loading 提示
 | ||||
|       const accessMenus = accessStore.accessMenus; | ||||
|       // TODO @芋艿:爆红!!!
 | ||||
|       // 补充说明:accessStore.accessMenus 一开始是 AppRouteRecordRaw 类型(后端加载),后面被赋值成 MenuRecordRaw 类型(前端转换)
 | ||||
|       const accessMenus = accessStore.accessMenus as AppRouteRecordRaw[]; | ||||
|       return convertServerMenuToRouteRecordStringComponent(accessMenus); | ||||
|     }, | ||||
|     // 可以指定没有权限跳转403页面
 | ||||
|  |  | |||
|  | @ -1,28 +1,28 @@ | |||
| import type { RouteRecordRaw } from 'vue-router'; | ||||
| 
 | ||||
| import { $t } from '#/locales'; | ||||
| // import { $t } from '#/locales';
 | ||||
| 
 | ||||
| const routes: RouteRecordRaw[] = [ | ||||
|   { | ||||
|     meta: { | ||||
|       icon: 'ic:baseline-view-in-ar', | ||||
|       keepAlive: true, | ||||
|       order: 1000, | ||||
|       title: $t('demos.title'), | ||||
|     }, | ||||
|     name: 'Demos', | ||||
|     path: '/demos', | ||||
|     children: [ | ||||
|       { | ||||
|         meta: { | ||||
|           title: $t('demos.antd'), | ||||
|         }, | ||||
|         name: 'AntDesignDemos', | ||||
|         path: '/demos/ant-design', | ||||
|         component: () => import('#/views/demos/antd/index.vue'), | ||||
|       }, | ||||
|     ], | ||||
|   }, | ||||
|   // {
 | ||||
|   //   meta: {
 | ||||
|   //     icon: 'ic:baseline-view-in-ar',
 | ||||
|   //     keepAlive: true,
 | ||||
|   //     order: 1000,
 | ||||
|   //     title: $t('demos.title'),
 | ||||
|   //   },
 | ||||
|   //   name: 'Demos',
 | ||||
|   //   path: '/demos',
 | ||||
|   //   children: [
 | ||||
|   //     {
 | ||||
|   //       meta: {
 | ||||
|   //         title: $t('demos.antd'),
 | ||||
|   //       },
 | ||||
|   //       name: 'AntDesignDemos',
 | ||||
|   //       path: '/demos/ant-design',
 | ||||
|   //       component: () => import('#/views/demos/antd/index.vue'),
 | ||||
|   //     },
 | ||||
|   //   ],
 | ||||
|   // },
 | ||||
| ]; | ||||
| 
 | ||||
| // export default routes; // update by 芋艿:不展示
 | ||||
| export default routes; // update by 芋艿:不展示
 | ||||
|  |  | |||
|  | @ -1,81 +1,81 @@ | |||
| import type { RouteRecordRaw } from 'vue-router'; | ||||
| 
 | ||||
| import { | ||||
|   VBEN_DOC_URL, | ||||
|   VBEN_ELE_PREVIEW_URL, | ||||
|   VBEN_GITHUB_URL, | ||||
|   VBEN_LOGO_URL, | ||||
|   VBEN_NAIVE_PREVIEW_URL, | ||||
| } from '@vben/constants'; | ||||
| 
 | ||||
| import { IFrameView } from '#/layouts'; | ||||
| import { $t } from '#/locales'; | ||||
| // import {
 | ||||
| //   VBEN_DOC_URL,
 | ||||
| //   VBEN_ELE_PREVIEW_URL,
 | ||||
| //   VBEN_GITHUB_URL,
 | ||||
| //   VBEN_LOGO_URL,
 | ||||
| //   VBEN_NAIVE_PREVIEW_URL,
 | ||||
| // } from '@vben/constants';
 | ||||
| //
 | ||||
| // import { IFrameView } from '#/layouts';
 | ||||
| // import { $t } from '#/locales';
 | ||||
| 
 | ||||
| const routes: RouteRecordRaw[] = [ | ||||
|   { | ||||
|     meta: { | ||||
|       badgeType: 'dot', | ||||
|       icon: VBEN_LOGO_URL, | ||||
|       order: 9998, | ||||
|       title: $t('demos.vben.title'), | ||||
|     }, | ||||
|     name: 'VbenProject', | ||||
|     path: '/vben-admin', | ||||
|     children: [ | ||||
|       { | ||||
|         name: 'VbenDocument', | ||||
|         path: '/vben-admin/document', | ||||
|         component: IFrameView, | ||||
|         meta: { | ||||
|           icon: 'lucide:book-open-text', | ||||
|           link: VBEN_DOC_URL, | ||||
|           title: $t('demos.vben.document'), | ||||
|         }, | ||||
|       }, | ||||
|       { | ||||
|         name: 'VbenGithub', | ||||
|         path: '/vben-admin/github', | ||||
|         component: IFrameView, | ||||
|         meta: { | ||||
|           icon: 'mdi:github', | ||||
|           link: VBEN_GITHUB_URL, | ||||
|           title: 'Github', | ||||
|         }, | ||||
|       }, | ||||
|       { | ||||
|         name: 'VbenNaive', | ||||
|         path: '/vben-admin/naive', | ||||
|         component: IFrameView, | ||||
|         meta: { | ||||
|           badgeType: 'dot', | ||||
|           icon: 'logos:naiveui', | ||||
|           link: VBEN_NAIVE_PREVIEW_URL, | ||||
|           title: $t('demos.vben.naive-ui'), | ||||
|         }, | ||||
|       }, | ||||
|       { | ||||
|         name: 'VbenElementPlus', | ||||
|         path: '/vben-admin/ele', | ||||
|         component: IFrameView, | ||||
|         meta: { | ||||
|           badgeType: 'dot', | ||||
|           icon: 'logos:element', | ||||
|           link: VBEN_ELE_PREVIEW_URL, | ||||
|           title: $t('demos.vben.element-plus'), | ||||
|         }, | ||||
|       }, | ||||
|     ], | ||||
|   }, | ||||
|   { | ||||
|     name: 'VbenAbout', | ||||
|     path: '/vben-admin/about', | ||||
|     component: () => import('#/views/_core/about/index.vue'), | ||||
|     meta: { | ||||
|       icon: 'lucide:copyright', | ||||
|       title: $t('demos.vben.about'), | ||||
|       order: 9999, | ||||
|     }, | ||||
|   }, | ||||
|   // {
 | ||||
|   //   meta: {
 | ||||
|   //     badgeType: 'dot',
 | ||||
|   //     icon: VBEN_LOGO_URL,
 | ||||
|   //     order: 9998,
 | ||||
|   //     title: $t('demos.vben.title'),
 | ||||
|   //   },
 | ||||
|   //   name: 'VbenProject',
 | ||||
|   //   path: '/vben-admin',
 | ||||
|   //   children: [
 | ||||
|   //     {
 | ||||
|   //       name: 'VbenDocument',
 | ||||
|   //       path: '/vben-admin/document',
 | ||||
|   //       component: IFrameView,
 | ||||
|   //       meta: {
 | ||||
|   //         icon: 'lucide:book-open-text',
 | ||||
|   //         link: VBEN_DOC_URL,
 | ||||
|   //         title: $t('demos.vben.document'),
 | ||||
|   //       },
 | ||||
|   //     },
 | ||||
|   //     {
 | ||||
|   //       name: 'VbenGithub',
 | ||||
|   //       path: '/vben-admin/github',
 | ||||
|   //       component: IFrameView,
 | ||||
|   //       meta: {
 | ||||
|   //         icon: 'mdi:github',
 | ||||
|   //         link: VBEN_GITHUB_URL,
 | ||||
|   //         title: 'Github',
 | ||||
|   //       },
 | ||||
|   //     },
 | ||||
|   //     {
 | ||||
|   //       name: 'VbenNaive',
 | ||||
|   //       path: '/vben-admin/naive',
 | ||||
|   //       component: IFrameView,
 | ||||
|   //       meta: {
 | ||||
|   //         badgeType: 'dot',
 | ||||
|   //         icon: 'logos:naiveui',
 | ||||
|   //         link: VBEN_NAIVE_PREVIEW_URL,
 | ||||
|   //         title: $t('demos.vben.naive-ui'),
 | ||||
|   //       },
 | ||||
|   //     },
 | ||||
|   //     {
 | ||||
|   //       name: 'VbenElementPlus',
 | ||||
|   //       path: '/vben-admin/ele',
 | ||||
|   //       component: IFrameView,
 | ||||
|   //       meta: {
 | ||||
|   //         badgeType: 'dot',
 | ||||
|   //         icon: 'logos:element',
 | ||||
|   //         link: VBEN_ELE_PREVIEW_URL,
 | ||||
|   //         title: $t('demos.vben.element-plus'),
 | ||||
|   //       },
 | ||||
|   //     },
 | ||||
|   //   ],
 | ||||
|   // },
 | ||||
|   // {
 | ||||
|   //   name: 'VbenAbout',
 | ||||
|   //   path: '/vben-admin/about',
 | ||||
|   //   component: () => import('#/views/_core/about/index.vue'),
 | ||||
|   //   meta: {
 | ||||
|   //     icon: 'lucide:copyright',
 | ||||
|   //     title: $t('demos.vben.about'),
 | ||||
|   //     order: 9999,
 | ||||
|   //   },
 | ||||
|   // },
 | ||||
| ]; | ||||
| 
 | ||||
| // export default routes; // update by 芋艿:不展示
 | ||||
| export default routes; // update by 芋艿:不展示
 | ||||
|  |  | |||
|  | @ -1,17 +1,21 @@ | |||
| <script setup lang="ts"> | ||||
| import {type SystemUserProfileApi, updateUserPassword} from '#/api/system/user/profile'; | ||||
| 
 | ||||
| import {Descriptions, DescriptionsItem, message, Tooltip} from 'ant-design-vue'; | ||||
| import { IconifyIcon } from '@vben/icons'; | ||||
| import type { SystemUserProfileApi } from '#/api/system/user/profile'; | ||||
| 
 | ||||
| import { computed } from 'vue'; | ||||
| 
 | ||||
| import { IconifyIcon } from '@vben/icons'; | ||||
| import { preferences } from '@vben/preferences'; | ||||
| import { updateUserProfile } from '#/api/system/user/profile'; | ||||
| import { formatDateTime } from '@vben/utils'; | ||||
| 
 | ||||
| import { Descriptions, DescriptionsItem, Tooltip } from 'ant-design-vue'; | ||||
| 
 | ||||
| import { updateUserProfile } from '#/api/system/user/profile'; | ||||
| import { CropperAvatar } from '#/components/cropper'; | ||||
| import { useUpload } from '#/components/upload/use-upload'; | ||||
| 
 | ||||
| const props = defineProps<{ profile?: SystemUserProfileApi.UserProfileRespVO }>(); | ||||
| const props = defineProps<{ | ||||
|   profile?: SystemUserProfileApi.UserProfileRespVO; | ||||
| }>(); | ||||
| 
 | ||||
| const emit = defineEmits<{ | ||||
|   (e: 'success'): void; | ||||
|  | @ -21,7 +25,13 @@ const avatar = computed( | |||
|   () => props.profile?.avatar || preferences.app.defaultAvatar, | ||||
| ); | ||||
| 
 | ||||
| async function handelUpload({ file, filename }: { file: Blob; filename: string; }) { | ||||
| async function handelUpload({ | ||||
|   file, | ||||
|   filename, | ||||
| }: { | ||||
|   file: Blob; | ||||
|   filename: string; | ||||
| }) { | ||||
|   // 1. 上传头像,获取 URL | ||||
|   const { httpRequest } = useUpload(); | ||||
|   // 将 Blob 转换为 File | ||||
|  | @ -59,11 +69,14 @@ async function handelUpload({ file, filename }: { file: Blob; filename: string; | |||
|         <DescriptionsItem> | ||||
|           <template #label> | ||||
|             <div class="flex items-center"> | ||||
|               <IconifyIcon icon="ant-design:user-switch-outlined" class="mr-1" /> | ||||
|               <IconifyIcon | ||||
|                 icon="ant-design:user-switch-outlined" | ||||
|                 class="mr-1" | ||||
|               /> | ||||
|               所属角色 | ||||
|             </div> | ||||
|           </template> | ||||
|           {{ profile.roles.map(role => role.name).join(',') }} | ||||
|           {{ profile.roles.map((role) => role.name).join(',') }} | ||||
|         </DescriptionsItem> | ||||
|         <DescriptionsItem> | ||||
|           <template #label> | ||||
|  | @ -95,16 +108,22 @@ async function handelUpload({ file, filename }: { file: Blob; filename: string; | |||
|         <DescriptionsItem> | ||||
|           <template #label> | ||||
|             <div class="flex items-center"> | ||||
|               <IconifyIcon icon="ant-design:usergroup-add-outlined" class="mr-1" /> | ||||
|               <IconifyIcon | ||||
|                 icon="ant-design:usergroup-add-outlined" | ||||
|                 class="mr-1" | ||||
|               /> | ||||
|               所属岗位 | ||||
|             </div> | ||||
|           </template> | ||||
|           {{ profile.posts.map(post => post.name).join(',') }} | ||||
|           {{ profile.posts.map((post) => post.name).join(',') }} | ||||
|         </DescriptionsItem> | ||||
|         <DescriptionsItem> | ||||
|           <template #label> | ||||
|             <div class="flex items-center"> | ||||
|               <IconifyIcon icon="ant-design:clock-circle-outlined" class="mr-1" /> | ||||
|               <IconifyIcon | ||||
|                 icon="ant-design:clock-circle-outlined" | ||||
|                 class="mr-1" | ||||
|               /> | ||||
|               创建时间 | ||||
|             </div> | ||||
|           </template> | ||||
|  |  | |||
|  | @ -1,17 +1,28 @@ | |||
| <script lang="ts" setup> | ||||
| import { DocAlert } from '#/components/doc-alert'; | ||||
| import { Button } from 'ant-design-vue'; | ||||
| import { Page } from '@vben/common-ui'; | ||||
| 
 | ||||
| import { Button } from 'ant-design-vue'; | ||||
| </script> | ||||
| 
 | ||||
| <template> | ||||
|   <Page> | ||||
|     <Button danger type="link" target="_blank" href="https://github.com/yudaocode/yudao-ui-admin-vue3"> | ||||
|     <Button | ||||
|       danger | ||||
|       type="link" | ||||
|       target="_blank" | ||||
|       href="https://github.com/yudaocode/yudao-ui-admin-vue3" | ||||
|     > | ||||
|       该功能支持 Vue3 + element-plus 版本! | ||||
|     </Button> | ||||
|     <br /> | ||||
|     <Button type="link" target="_blank" href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/model/index"> | ||||
|       可参考 https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/model/index 代码,pull request 贡献给我们! | ||||
|     <Button | ||||
|       type="link" | ||||
|       target="_blank" | ||||
|       href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/model/index" | ||||
|     > | ||||
|       可参考 | ||||
|       https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/model/index | ||||
|       代码,pull request 贡献给我们! | ||||
|     </Button> | ||||
|   </Page> | ||||
| </template> | ||||
|  | @ -1,17 +1,28 @@ | |||
| <script lang="ts" setup> | ||||
| import { DocAlert } from '#/components/doc-alert'; | ||||
| import { Button } from 'ant-design-vue'; | ||||
| import { Page } from '@vben/common-ui'; | ||||
| 
 | ||||
| import { Button } from 'ant-design-vue'; | ||||
| </script> | ||||
| 
 | ||||
| <template> | ||||
|   <Page> | ||||
|     <Button danger type="link" target="_blank" href="https://github.com/yudaocode/yudao-ui-admin-vue3"> | ||||
|     <Button | ||||
|       danger | ||||
|       type="link" | ||||
|       target="_blank" | ||||
|       href="https://github.com/yudaocode/yudao-ui-admin-vue3" | ||||
|     > | ||||
|       该功能支持 Vue3 + element-plus 版本! | ||||
|     </Button> | ||||
|     <br /> | ||||
|     <Button type="link" target="_blank" href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/processInstance/create/index"> | ||||
|       可参考 https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/processInstance/create/index 代码,pull request 贡献给我们! | ||||
|     <Button | ||||
|       type="link" | ||||
|       target="_blank" | ||||
|       href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/processInstance/create/index" | ||||
|     > | ||||
|       可参考 | ||||
|       https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/processInstance/create/index | ||||
|       代码,pull request 贡献给我们! | ||||
|     </Button> | ||||
|   </Page> | ||||
| </template> | ||||
|  | @ -84,8 +84,7 @@ const [Modal, modalApi] = useVbenModal({ | |||
|       </Descriptions.Item> | ||||
|       <Descriptions.Item label="操作结果"> | ||||
|         <div v-if="formData?.resultCode === 0">正常</div> | ||||
|         <!-- TODO @芋艿:处理爆红 --> | ||||
|         <div v-else-if="formData?.resultCode > 0"> | ||||
|         <div v-else-if="formData && formData?.resultCode > 0"> | ||||
|           失败 | {{ formData?.resultCode }} | {{ formData?.resultMsg }} | ||||
|         </div> | ||||
|       </Descriptions.Item> | ||||
|  |  | |||
|  | @ -54,6 +54,7 @@ const [Modal, modalApi] = useVbenModal({ | |||
|     // 提交表单 | ||||
|     const data = (await formApi.getValues()) as Demo03StudentApi.Demo03Student; | ||||
|     // 拼接子表的数据 | ||||
|     // TODO @puhui999:字段对不上 | ||||
|     data.demo03Courses = demo03CourseFormRef.value?.getData(); | ||||
|     data.demo03Grade = await demo03GradeFormRef.value?.getValues(); | ||||
|     try { | ||||
|  |  | |||
|  | @ -1,5 +1,7 @@ | |||
| import type { VbenFormSchema } from '#/adapter/form'; | ||||
| import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; | ||||
| import type { SystemDictDataApi } from '#/api/system/dict/data'; | ||||
| import type { SystemDictTypeApi } from '#/api/system/dict/type'; | ||||
| 
 | ||||
| import { useAccess } from '@vben/access'; | ||||
| 
 | ||||
|  | @ -94,7 +96,7 @@ export function useTypeGridFormSchema(): VbenFormSchema[] { | |||
| } | ||||
| 
 | ||||
| /** 类型列表的字段 */ | ||||
| export function useTypeGridColumns<T = any>( | ||||
| export function useTypeGridColumns<T = SystemDictTypeApi.DictType>( | ||||
|   onActionClick: OnActionClickFn<T>, | ||||
| ): VxeTableGridOptions['columns'] { | ||||
|   return [ | ||||
|  | @ -312,7 +314,7 @@ export function useDataGridFormSchema(): VbenFormSchema[] { | |||
| /** | ||||
|  * 字典数据表格列 | ||||
|  */ | ||||
| export function useDataGridColumns<T = any>( | ||||
| export function useDataGridColumns<T = SystemDictDataApi.DictData>( | ||||
|   onActionClick: OnActionClickFn<T>, | ||||
| ): VxeTableGridOptions['columns'] { | ||||
|   return [ | ||||
|  |  | |||
|  | @ -1,5 +1,9 @@ | |||
| <script lang="ts" setup> | ||||
| import type { OnActionClickParams } from '#/adapter/vxe-table'; | ||||
| import type { | ||||
|   OnActionClickParams, | ||||
|   VxeTableGridOptions, | ||||
| } from '#/adapter/vxe-table'; | ||||
| import type { SystemDictDataApi } from '#/api/system/dict/data'; | ||||
| 
 | ||||
| import { watch } from 'vue'; | ||||
| 
 | ||||
|  | @ -100,8 +104,8 @@ const [Grid, gridApi] = useVbenVxeGrid({ | |||
|           return await getDictDataPage({ | ||||
|             pageNo: page.currentPage, | ||||
|             pageSize: page.pageSize, | ||||
|             ...formValues, | ||||
|             dictType: props.dictType, | ||||
|             ...formValues, | ||||
|           }); | ||||
|         }, | ||||
|       }, | ||||
|  | @ -113,7 +117,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ | |||
|       refresh: { code: 'query' }, | ||||
|       search: true, | ||||
|     }, | ||||
|   }, | ||||
|   } as VxeTableGridOptions<SystemDictDataApi.DictData>, | ||||
| }); | ||||
| 
 | ||||
| /** 监听 dictType 变化,重新查询 */ | ||||
|  |  | |||
|  | @ -1,5 +1,9 @@ | |||
| <script lang="ts" setup> | ||||
| import type { OnActionClickParams } from '#/adapter/vxe-table'; | ||||
| import type { | ||||
|   OnActionClickParams, | ||||
|   VxeGridListeners, | ||||
|   VxeTableGridOptions, | ||||
| } from '#/adapter/vxe-table'; | ||||
| import type { SystemDictTypeApi } from '#/api/system/dict/type'; | ||||
| 
 | ||||
| import { useVbenModal } from '@vben/common-ui'; | ||||
|  | @ -67,7 +71,10 @@ async function onDelete(row: SystemDictTypeApi.DictType) { | |||
| } | ||||
| 
 | ||||
| /** 表格操作按钮回调 */ | ||||
| function onActionClick({ code, row }: OnActionClickParams) { | ||||
| function onActionClick({ | ||||
|   code, | ||||
|   row, | ||||
| }: OnActionClickParams<SystemDictTypeApi.DictType>) { | ||||
|   switch (code) { | ||||
|     case 'delete': { | ||||
|       onDelete(row); | ||||
|  | @ -81,8 +88,7 @@ function onActionClick({ code, row }: OnActionClickParams) { | |||
| } | ||||
| 
 | ||||
| /** 表格事件 */ | ||||
| // TODO @芋艿:这里有爆红 | ||||
| const gridEvents: VxeGridListeners<RowType> = { | ||||
| const gridEvents: VxeGridListeners<SystemDictTypeApi.DictType> = { | ||||
|   cellClick: ({ row }) => { | ||||
|     emit('select', row.type); | ||||
|   }, | ||||
|  | @ -115,7 +121,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ | |||
|       refresh: { code: 'query' }, | ||||
|       search: true, | ||||
|     }, | ||||
|   }, | ||||
|   } as VxeTableGridOptions<SystemDictTypeApi.DictType>, | ||||
|   gridEvents, | ||||
| }); | ||||
| </script> | ||||
|  |  | |||
|  | @ -43,7 +43,6 @@ const [Modal, modalApi] = useVbenModal({ | |||
|       <Descriptions.Item label="发送人"> | ||||
|         {{ formData?.templateNickname }} | ||||
|       </Descriptions.Item> | ||||
|       <!-- TODO @芋艿:报错 --> | ||||
|       <Descriptions.Item label="发送时间"> | ||||
|         {{ formatDateTime(formData?.createTime) }} | ||||
|       </Descriptions.Item> | ||||
|  |  | |||
|  | @ -1,6 +1,12 @@ | |||
| import dayjs from 'dayjs'; | ||||
| 
 | ||||
| export function formatDate(time: number | string | Date, format = 'YYYY-MM-DD') { | ||||
| export function formatDate( | ||||
|   time: Date | number | string | undefined, | ||||
|   format = 'YYYY-MM-DD', | ||||
| ) { | ||||
|   if (!time) { | ||||
|     return time; | ||||
|   } | ||||
|   try { | ||||
|     const date = dayjs(time); | ||||
|     if (!date.isValid()) { | ||||
|  | @ -13,7 +19,10 @@ export function formatDate(time: number | string | Date, format = 'YYYY-MM-DD') | |||
|   } | ||||
| } | ||||
| 
 | ||||
| export function formatDateTime(time: number | string | Date) { | ||||
| export function formatDateTime(time: Date | number | string | undefined) { | ||||
|   if (!time) { | ||||
|     return time; | ||||
|   } | ||||
|   return formatDate(time, 'YYYY-MM-DD HH:mm:ss'); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| <script lang="ts" setup> | ||||
| import type { ComponentInternalInstance } from 'vue'; | ||||
| 
 | ||||
| import type { VerificationProps } from '../types'; | ||||
| 
 | ||||
| import { | ||||
|   type ComponentInternalInstance, | ||||
|   getCurrentInstance, | ||||
|   nextTick, | ||||
|   onMounted, | ||||
|  | @ -127,7 +128,7 @@ onMounted(() => { | |||
| const canvas = ref(null); | ||||
| 
 | ||||
| // 获取坐标 | ||||
| const getMousePos = function (obj: any, e: any) { | ||||
| const getMousePos = function (_obj: any, e: any) { | ||||
|   const x = e.offsetX; | ||||
|   const y = e.offsetY; | ||||
|   return { x, y }; | ||||
|  |  | |||
|  | @ -69,13 +69,13 @@ function extendProxyOption( | |||
| export function extendsDefaultFormatter(vxeUI: VxeUIExport) { | ||||
|   vxeUI.formats.add('formatDate', { | ||||
|     tableCellFormatMethod({ cellValue }) { | ||||
|       return formatDate(cellValue); | ||||
|       return formatDate(cellValue) as string; | ||||
|     }, | ||||
|   }); | ||||
| 
 | ||||
|   vxeUI.formats.add('formatDateTime', { | ||||
|     tableCellFormatMethod({ cellValue }) { | ||||
|       return formatDateTime(cellValue); | ||||
|       return formatDateTime(cellValue) as string; | ||||
|     }, | ||||
|   }); | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 YunaiV
						YunaiV