Merge remote-tracking branch 'origin/dev' into dev-bpm
						commit
						c0a82df7f4
					
				|  | @ -47,7 +47,8 @@ export function deleteDemo01Contact(id: number) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** 批量删除示例联系人 */ | /** 批量删除示例联系人 */ | ||||||
| export function deleteDemo01ContactByIds(ids: number[]) { | // TODO @puhui999:ByIds,这种按照约定,是不带的,针对 Id 的情况哈。
 | ||||||
|  | export function deleteDemo01ContactListByIds(ids: number[]) { | ||||||
|   return requestClient.delete( |   return requestClient.delete( | ||||||
|     `/infra/demo01-contact/delete-list?ids=${ids.join(',')}`, |     `/infra/demo01-contact/delete-list?ids=${ids.join(',')}`, | ||||||
|   ); |   ); | ||||||
|  |  | ||||||
|  | @ -62,7 +62,7 @@ export function deleteDemo03Student(id: number) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** 批量删除学生 */ | /** 批量删除学生 */ | ||||||
| export function deleteDemo03StudentByIds(ids: number[]) { | export function deleteDemo03StudentListByIds(ids: number[]) { | ||||||
|   return requestClient.delete( |   return requestClient.delete( | ||||||
|     `/infra/demo03-student-erp/delete-list?ids=${ids.join(',')}`, |     `/infra/demo03-student-erp/delete-list?ids=${ids.join(',')}`, | ||||||
|   ); |   ); | ||||||
|  | @ -109,7 +109,7 @@ export function deleteDemo03Course(id: number) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** 批量删除学生课程 */ | /** 批量删除学生课程 */ | ||||||
| export function deleteDemo03CourseByIds(ids: number[]) { | export function deleteDemo03CourseListByIds(ids: number[]) { | ||||||
|   return requestClient.delete( |   return requestClient.delete( | ||||||
|     `/infra/demo03-student-erp/demo03-course/delete-list?ids=${ids.join(',')}`, |     `/infra/demo03-student-erp/demo03-course/delete-list?ids=${ids.join(',')}`, | ||||||
|   ); |   ); | ||||||
|  | @ -155,7 +155,7 @@ export function deleteDemo03Grade(id: number) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** 批量删除学生班级 */ | /** 批量删除学生班级 */ | ||||||
| export function deleteDemo03GradeByIds(ids: number[]) { | export function deleteDemo03GradeListByIds(ids: number[]) { | ||||||
|   return requestClient.delete( |   return requestClient.delete( | ||||||
|     `/infra/demo03-student-erp/demo03-grade/delete-list?ids=${ids.join(',')}`, |     `/infra/demo03-student-erp/demo03-grade/delete-list?ids=${ids.join(',')}`, | ||||||
|   ); |   ); | ||||||
|  |  | ||||||
|  | @ -64,7 +64,7 @@ export function deleteDemo03Student(id: number) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** 批量删除学生 */ | /** 批量删除学生 */ | ||||||
| export function deleteDemo03StudentByIds(ids: number[]) { | export function deleteDemo03StudentListByIds(ids: number[]) { | ||||||
|   return requestClient.delete( |   return requestClient.delete( | ||||||
|     `/infra/demo03-student-inner/delete-list?ids=${ids.join(',')}`, |     `/infra/demo03-student-inner/delete-list?ids=${ids.join(',')}`, | ||||||
|   ); |   ); | ||||||
|  |  | ||||||
|  | @ -64,7 +64,7 @@ export function deleteDemo03Student(id: number) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** 批量删除学生 */ | /** 批量删除学生 */ | ||||||
| export function deleteDemo03StudentByIds(ids: number[]) { | export function deleteDemo03StudentListByIds(ids: number[]) { | ||||||
|   return requestClient.delete( |   return requestClient.delete( | ||||||
|     `/infra/demo03-student-normal/delete-list?ids=${ids.join(',')}`, |     `/infra/demo03-student-normal/delete-list?ids=${ids.join(',')}`, | ||||||
|   ); |   ); | ||||||
|  |  | ||||||
|  | @ -18,7 +18,7 @@ export function useTableToolbar() { | ||||||
|     const table = tableRef.value; |     const table = tableRef.value; | ||||||
|     const tableToolbar = tableToolbarRef.value; |     const tableToolbar = tableToolbarRef.value; | ||||||
|     if (table && tableToolbar) { |     if (table && tableToolbar) { | ||||||
|       // TODO @puhui999:通过 nexttick 可以解决么?试过不得行🤣刚好列表组件出现后延迟一秒挂载很稳
 |       // 延迟 1 秒,确保 toolbar 组件已经挂载
 | ||||||
|       setTimeout(async () => { |       setTimeout(async () => { | ||||||
|         const toolbar = tableToolbar.getToolbarRef(); |         const toolbar = tableToolbar.getToolbarRef(); | ||||||
|         if (!toolbar) { |         if (!toolbar) { | ||||||
|  |  | ||||||
|  | @ -1,18 +1,22 @@ | ||||||
| <script lang="ts" setup> | <script lang="ts" setup> | ||||||
| import type { VxeTableGridOptions } from '#/adapter/vxe-table'; | import type { | ||||||
|  |   OnActionClickParams, | ||||||
|  |   VxeTableGridOptions, | ||||||
|  | } from '#/adapter/vxe-table'; | ||||||
| import type { Demo01ContactApi } from '#/api/infra/demo/demo01'; | import type { Demo01ContactApi } from '#/api/infra/demo/demo01'; | ||||||
| 
 | 
 | ||||||
| import { ref } from 'vue'; | import { h, ref } from 'vue'; | ||||||
| 
 | 
 | ||||||
| import { Page, useVbenModal } from '@vben/common-ui'; | import { Page, useVbenModal } from '@vben/common-ui'; | ||||||
|  | import { Download, Plus, Trash2 } from '@vben/icons'; | ||||||
| import { downloadFileFromBlobPart, isEmpty } from '@vben/utils'; | import { downloadFileFromBlobPart, isEmpty } from '@vben/utils'; | ||||||
| 
 | 
 | ||||||
| import { message } from 'ant-design-vue'; | import { Button, message } from 'ant-design-vue'; | ||||||
| 
 | 
 | ||||||
| import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; | import { useVbenVxeGrid } from '#/adapter/vxe-table'; | ||||||
| import { | import { | ||||||
|   deleteDemo01Contact, |   deleteDemo01Contact, | ||||||
|   deleteDemo01ContactByIds, |   deleteDemo01ContactListByIds, | ||||||
|   exportDemo01Contact, |   exportDemo01Contact, | ||||||
|   getDemo01ContactPage, |   getDemo01ContactPage, | ||||||
| } from '#/api/infra/demo/demo01'; | } from '#/api/infra/demo/demo01'; | ||||||
|  | @ -31,35 +35,26 @@ function onRefresh() { | ||||||
|   gridApi.query(); |   gridApi.query(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** 导出表格 */ |  | ||||||
| async function handleExport() { |  | ||||||
|   const data = await exportDemo01Contact(await gridApi.formApi.getValues()); |  | ||||||
|   downloadFileFromBlobPart({ fileName: '示例联系人.xls', source: data }); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /** 创建示例联系人 */ | /** 创建示例联系人 */ | ||||||
| function handleCreate() { | function onCreate() { | ||||||
|   formModalApi.setData({}).open(); |   formModalApi.setData({}).open(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** 编辑示例联系人 */ | /** 编辑示例联系人 */ | ||||||
| function handleEdit(row: Demo01ContactApi.Demo01Contact) { | function onEdit(row: Demo01ContactApi.Demo01Contact) { | ||||||
|   formModalApi.setData(row).open(); |   formModalApi.setData(row).open(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** 删除示例联系人 */ | /** 删除示例联系人 */ | ||||||
| async function handleDelete(row: Demo01ContactApi.Demo01Contact) { | async function onDelete(row: Demo01ContactApi.Demo01Contact) { | ||||||
|   const hideLoading = message.loading({ |   const hideLoading = message.loading({ | ||||||
|     content: $t('ui.actionMessage.deleting', [row.id]), |     content: $t('ui.actionMessage.deleting', [row.id]), | ||||||
|     duration: 0, |     duration: 0, | ||||||
|     key: 'action_key_msg', |     key: 'action_process_msg', | ||||||
|   }); |   }); | ||||||
|   try { |   try { | ||||||
|     await deleteDemo01Contact(row.id as number); |     await deleteDemo01Contact(row.id as number); | ||||||
|     message.success({ |     message.success($t('ui.actionMessage.deleteSuccess', [row.id])); | ||||||
|       content: $t('ui.actionMessage.deleteSuccess', [row.name]), |  | ||||||
|       key: 'action_key_msg', |  | ||||||
|     }); |  | ||||||
|     onRefresh(); |     onRefresh(); | ||||||
|   } finally { |   } finally { | ||||||
|     hideLoading(); |     hideLoading(); | ||||||
|  | @ -67,23 +62,23 @@ async function handleDelete(row: Demo01ContactApi.Demo01Contact) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** 批量删除示例联系人 */ | /** 批量删除示例联系人 */ | ||||||
| async function handleDeleteBatch() { | async function onDeleteBatch() { | ||||||
|   const hideLoading = message.loading({ |   const hideLoading = message.loading({ | ||||||
|     content: $t('ui.actionMessage.deleting'), |     content: $t('ui.actionMessage.deleting'), | ||||||
|     key: 'action_key_msg', |     duration: 0, | ||||||
|  |     key: 'action_process_msg', | ||||||
|   }); |   }); | ||||||
|   try { |   try { | ||||||
|     await deleteDemo01ContactByIds(deleteIds.value); |     await deleteDemo01ContactListByIds(deleteIds.value); | ||||||
|     message.success({ |     message.success($t('ui.actionMessage.deleteSuccess')); | ||||||
|       content: $t('ui.actionMessage.deleteSuccess'), |  | ||||||
|       key: 'action_key_msg', |  | ||||||
|     }); |  | ||||||
|     onRefresh(); |     onRefresh(); | ||||||
|   } finally { |   } finally { | ||||||
|     hideLoading(); |     hideLoading(); | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // TODO @puhui999:方法名,改成 handleRowCheckboxChange;注释:处理选中表格行 | ||||||
|  | // TODO @puhui999:deleteIds => checkedIds;然后注释去掉? | ||||||
| const deleteIds = ref<number[]>([]); // 待删除示例联系人 ID | const deleteIds = ref<number[]>([]); // 待删除示例联系人 ID | ||||||
| function setDeleteIds({ | function setDeleteIds({ | ||||||
|   records, |   records, | ||||||
|  | @ -93,12 +88,35 @@ function setDeleteIds({ | ||||||
|   deleteIds.value = records.map((item) => item.id); |   deleteIds.value = records.map((item) => item.id); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /** 导出表格 */ | ||||||
|  | async function onExport() { | ||||||
|  |   const data = await exportDemo01Contact(await gridApi.formApi.getValues()); | ||||||
|  |   downloadFileFromBlobPart({ fileName: '示例联系人.xls', source: data }); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /** 表格操作按钮的回调函数 */ | ||||||
|  | function onActionClick({ | ||||||
|  |   code, | ||||||
|  |   row, | ||||||
|  | }: OnActionClickParams<Demo01ContactApi.Demo01Contact>) { | ||||||
|  |   switch (code) { | ||||||
|  |     case 'delete': { | ||||||
|  |       onDelete(row); | ||||||
|  |       break; | ||||||
|  |     } | ||||||
|  |     case 'edit': { | ||||||
|  |       onEdit(row); | ||||||
|  |       break; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
| const [Grid, gridApi] = useVbenVxeGrid({ | const [Grid, gridApi] = useVbenVxeGrid({ | ||||||
|   formOptions: { |   formOptions: { | ||||||
|     schema: useGridFormSchema(), |     schema: useGridFormSchema(), | ||||||
|   }, |   }, | ||||||
|   gridOptions: { |   gridOptions: { | ||||||
|     columns: useGridColumns(), |     columns: useGridColumns(onActionClick), | ||||||
|     height: 'auto', |     height: 'auto', | ||||||
|     pagerConfig: { |     pagerConfig: { | ||||||
|       enabled: true, |       enabled: true, | ||||||
|  | @ -136,56 +154,34 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||||||
| 
 | 
 | ||||||
|     <Grid table-title="示例联系人列表"> |     <Grid table-title="示例联系人列表"> | ||||||
|       <template #toolbar-tools> |       <template #toolbar-tools> | ||||||
|         <TableAction |         <Button | ||||||
|           :actions="[ |           :icon="h(Plus)" | ||||||
|             { |           type="primary" | ||||||
|               label: $t('ui.actionTitle.create', ['示例联系人']), |           @click="onCreate" | ||||||
|               type: 'primary', |           v-access:code="['infra:demo01-contact:create']" | ||||||
|               icon: ACTION_ICON.ADD, |         > | ||||||
|               auth: ['infra:demo01-contact:create'], |           {{ $t('ui.actionTitle.create', ['示例联系人']) }} | ||||||
|               onClick: handleCreate, |         </Button> | ||||||
|             }, |         <Button | ||||||
|             { |           :icon="h(Download)" | ||||||
|               label: $t('ui.actionTitle.export'), |           type="primary" | ||||||
|               type: 'primary', |           class="ml-2" | ||||||
|               icon: ACTION_ICON.DOWNLOAD, |           @click="onExport" | ||||||
|               auth: ['infra:demo01-contact:export'], |           v-access:code="['infra:demo01-contact:export']" | ||||||
|               onClick: handleExport, |         > | ||||||
|             }, |           {{ $t('ui.actionTitle.export') }} | ||||||
|             { |         </Button> | ||||||
|               label: $t('common.deleteBatch'), |         <Button | ||||||
|               type: 'primary', |           :icon="h(Trash2)" | ||||||
|               icon: ACTION_ICON.DELETE, |           type="primary" | ||||||
|               auth: ['infra:demo01-contact:delete'], |           danger | ||||||
|               disabled: isEmpty(deleteIds), |           class="ml-2" | ||||||
|               onClick: handleDeleteBatch, |           :disabled="isEmpty(deleteIds)" | ||||||
|             }, |           @click="onDeleteBatch" | ||||||
|           ]" |           v-access:code="['infra:demo01-contact:delete']" | ||||||
|         /> |         > | ||||||
|       </template> |           批量删除 | ||||||
|       <template #actions="{ row }"> |         </Button> | ||||||
|         <TableAction |  | ||||||
|           :actions="[ |  | ||||||
|             { |  | ||||||
|               label: $t('common.edit'), |  | ||||||
|               type: 'link', |  | ||||||
|               icon: ACTION_ICON.EDIT, |  | ||||||
|               auth: ['system:post:update'], |  | ||||||
|               onClick: handleEdit.bind(null, row), |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|               label: $t('common.delete'), |  | ||||||
|               type: 'link', |  | ||||||
|               danger: true, |  | ||||||
|               icon: ACTION_ICON.DELETE, |  | ||||||
|               auth: ['system:post:delete'], |  | ||||||
|               popConfirm: { |  | ||||||
|                 title: $t('ui.actionMessage.deleteConfirm', [row.name]), |  | ||||||
|                 confirm: handleDelete.bind(null, row), |  | ||||||
|               }, |  | ||||||
|             }, |  | ||||||
|           ]" |  | ||||||
|         /> |  | ||||||
|       </template> |       </template> | ||||||
|     </Grid> |     </Grid> | ||||||
|   </Page> |   </Page> | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ import { Button, message, Tabs } from 'ant-design-vue'; | ||||||
| import { useVbenVxeGrid } from '#/adapter/vxe-table'; | import { useVbenVxeGrid } from '#/adapter/vxe-table'; | ||||||
| import { | import { | ||||||
|   deleteDemo03Student, |   deleteDemo03Student, | ||||||
|   deleteDemo03StudentByIds, |   deleteDemo03StudentListByIds, | ||||||
|   exportDemo03Student, |   exportDemo03Student, | ||||||
|   getDemo03StudentPage, |   getDemo03StudentPage, | ||||||
| } from '#/api/infra/demo/demo03/erp'; | } from '#/api/infra/demo/demo03/erp'; | ||||||
|  | @ -75,7 +75,7 @@ async function onDeleteBatch() { | ||||||
|     key: 'action_process_msg', |     key: 'action_process_msg', | ||||||
|   }); |   }); | ||||||
|   try { |   try { | ||||||
|     await deleteDemo03StudentByIds(deleteIds.value); |     await deleteDemo03StudentListByIds(deleteIds.value); | ||||||
|     message.success($t('ui.actionMessage.deleteSuccess')); |     message.success($t('ui.actionMessage.deleteSuccess')); | ||||||
|     onRefresh(); |     onRefresh(); | ||||||
|   } finally { |   } finally { | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ import { Button, message } from 'ant-design-vue'; | ||||||
| import { useVbenVxeGrid } from '#/adapter/vxe-table'; | import { useVbenVxeGrid } from '#/adapter/vxe-table'; | ||||||
| import { | import { | ||||||
|   deleteDemo03Course, |   deleteDemo03Course, | ||||||
|   deleteDemo03CourseByIds, |   deleteDemo03CourseListByIds, | ||||||
|   getDemo03CoursePage, |   getDemo03CoursePage, | ||||||
| } from '#/api/infra/demo/demo03/erp'; | } from '#/api/infra/demo/demo03/erp'; | ||||||
| import { $t } from '#/locales'; | import { $t } from '#/locales'; | ||||||
|  | @ -74,7 +74,7 @@ async function onDeleteBatch() { | ||||||
|     key: 'action_process_msg', |     key: 'action_process_msg', | ||||||
|   }); |   }); | ||||||
|   try { |   try { | ||||||
|     await deleteDemo03CourseByIds(deleteIds.value); |     await deleteDemo03CourseListByIds(deleteIds.value); | ||||||
|     message.success($t('ui.actionMessage.deleteSuccess')); |     message.success($t('ui.actionMessage.deleteSuccess')); | ||||||
|     onRefresh(); |     onRefresh(); | ||||||
|   } finally { |   } finally { | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ import { Button, message } from 'ant-design-vue'; | ||||||
| import { useVbenVxeGrid } from '#/adapter/vxe-table'; | import { useVbenVxeGrid } from '#/adapter/vxe-table'; | ||||||
| import { | import { | ||||||
|   deleteDemo03Grade, |   deleteDemo03Grade, | ||||||
|   deleteDemo03GradeByIds, |   deleteDemo03GradeListByIds, | ||||||
|   getDemo03GradePage, |   getDemo03GradePage, | ||||||
| } from '#/api/infra/demo/demo03/erp'; | } from '#/api/infra/demo/demo03/erp'; | ||||||
| import { $t } from '#/locales'; | import { $t } from '#/locales'; | ||||||
|  | @ -74,7 +74,7 @@ async function onDeleteBatch() { | ||||||
|     key: 'action_process_msg', |     key: 'action_process_msg', | ||||||
|   }); |   }); | ||||||
|   try { |   try { | ||||||
|     await deleteDemo03GradeByIds(deleteIds.value); |     await deleteDemo03GradeListByIds(deleteIds.value); | ||||||
|     message.success($t('ui.actionMessage.deleteSuccess')); |     message.success($t('ui.actionMessage.deleteSuccess')); | ||||||
|     onRefresh(); |     onRefresh(); | ||||||
|   } finally { |   } finally { | ||||||
|  |  | ||||||
|  | @ -199,7 +199,6 @@ export function useDemo03CourseGridEditColumns( | ||||||
|       minWidth: 60, |       minWidth: 60, | ||||||
|       align: 'center', |       align: 'center', | ||||||
|       fixed: 'right', |       fixed: 'right', | ||||||
| 
 |  | ||||||
|       showOverflow: false, |       showOverflow: false, | ||||||
|       cellRender: { |       cellRender: { | ||||||
|         attrs: { |         attrs: { | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ import { Button, message, Tabs } from 'ant-design-vue'; | ||||||
| import { useVbenVxeGrid } from '#/adapter/vxe-table'; | import { useVbenVxeGrid } from '#/adapter/vxe-table'; | ||||||
| import { | import { | ||||||
|   deleteDemo03Student, |   deleteDemo03Student, | ||||||
|   deleteDemo03StudentByIds, |   deleteDemo03StudentListByIds, | ||||||
|   exportDemo03Student, |   exportDemo03Student, | ||||||
|   getDemo03StudentPage, |   getDemo03StudentPage, | ||||||
| } from '#/api/infra/demo/demo03/inner'; | } from '#/api/infra/demo/demo03/inner'; | ||||||
|  | @ -74,7 +74,7 @@ async function onDeleteBatch() { | ||||||
|     key: 'action_process_msg', |     key: 'action_process_msg', | ||||||
|   }); |   }); | ||||||
|   try { |   try { | ||||||
|     await deleteDemo03StudentByIds(deleteIds.value); |     await deleteDemo03StudentListByIds(deleteIds.value); | ||||||
|     message.success($t('ui.actionMessage.deleteSuccess')); |     message.success($t('ui.actionMessage.deleteSuccess')); | ||||||
|     onRefresh(); |     onRefresh(); | ||||||
|   } finally { |   } finally { | ||||||
|  |  | ||||||
|  | @ -198,7 +198,6 @@ export function useDemo03CourseGridEditColumns( | ||||||
|       minWidth: 60, |       minWidth: 60, | ||||||
|       align: 'center', |       align: 'center', | ||||||
|       fixed: 'right', |       fixed: 'right', | ||||||
| 
 |  | ||||||
|       showOverflow: false, |       showOverflow: false, | ||||||
|       cellRender: { |       cellRender: { | ||||||
|         attrs: { |         attrs: { | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ import { Button, message } from 'ant-design-vue'; | ||||||
| import { useVbenVxeGrid } from '#/adapter/vxe-table'; | import { useVbenVxeGrid } from '#/adapter/vxe-table'; | ||||||
| import { | import { | ||||||
|   deleteDemo03Student, |   deleteDemo03Student, | ||||||
|   deleteDemo03StudentByIds, |   deleteDemo03StudentListByIds, | ||||||
|   exportDemo03Student, |   exportDemo03Student, | ||||||
|   getDemo03StudentPage, |   getDemo03StudentPage, | ||||||
| } from '#/api/infra/demo/demo03/normal'; | } from '#/api/infra/demo/demo03/normal'; | ||||||
|  | @ -77,7 +77,7 @@ async function onDeleteBatch() { | ||||||
|     key: 'action_process_msg', |     key: 'action_process_msg', | ||||||
|   }); |   }); | ||||||
|   try { |   try { | ||||||
|     await deleteDemo03StudentByIds(deleteIds.value); |     await deleteDemo03StudentListByIds(deleteIds.value); | ||||||
|     message.success($t('ui.actionMessage.deleteSuccess')); |     message.success($t('ui.actionMessage.deleteSuccess')); | ||||||
|     onRefresh(); |     onRefresh(); | ||||||
|   } finally { |   } finally { | ||||||
|  |  | ||||||
|  | @ -4,11 +4,12 @@ import type { Demo01ContactApi } from '#/api/infra/demo/demo01'; | ||||||
| import { h, onMounted, reactive, ref } from 'vue'; | import { h, onMounted, reactive, ref } from 'vue'; | ||||||
| 
 | 
 | ||||||
| import { Page, useVbenModal } from '@vben/common-ui'; | import { Page, useVbenModal } from '@vben/common-ui'; | ||||||
| import { Download, Plus } from '@vben/icons'; | import { Download, Plus, Trash2 } from '@vben/icons'; | ||||||
| import { | import { | ||||||
|   cloneDeep, |   cloneDeep, | ||||||
|   downloadFileFromBlobPart, |   downloadFileFromBlobPart, | ||||||
|   formatDateTime, |   formatDateTime, | ||||||
|  |   isEmpty, | ||||||
| } from '@vben/utils'; | } from '@vben/utils'; | ||||||
| 
 | 
 | ||||||
| import { | import { | ||||||
|  | @ -24,6 +25,7 @@ import { | ||||||
| import { VxeColumn, VxeTable } from '#/adapter/vxe-table'; | import { VxeColumn, VxeTable } from '#/adapter/vxe-table'; | ||||||
| import { | import { | ||||||
|   deleteDemo01Contact, |   deleteDemo01Contact, | ||||||
|  |   deleteDemo01ContactListByIds, | ||||||
|   exportDemo01Contact, |   exportDemo01Contact, | ||||||
|   getDemo01ContactPage, |   getDemo01ContactPage, | ||||||
| } from '#/api/infra/demo/demo01'; | } from '#/api/infra/demo/demo01'; | ||||||
|  | @ -38,6 +40,7 @@ import Demo01ContactForm from './modules/form.vue'; | ||||||
| 
 | 
 | ||||||
| const loading = ref(true); // 列表的加载中 | const loading = ref(true); // 列表的加载中 | ||||||
| const list = ref<Demo01ContactApi.Demo01Contact[]>([]); // 列表的数据 | const list = ref<Demo01ContactApi.Demo01Contact[]>([]); // 列表的数据 | ||||||
|  | 
 | ||||||
| const total = ref(0); // 列表的总页数 | const total = ref(0); // 列表的总页数 | ||||||
| const queryParams = reactive({ | const queryParams = reactive({ | ||||||
|   pageNo: 1, |   pageNo: 1, | ||||||
|  | @ -96,13 +99,14 @@ function onEdit(row: Demo01ContactApi.Demo01Contact) { | ||||||
| async function onDelete(row: Demo01ContactApi.Demo01Contact) { | async function onDelete(row: Demo01ContactApi.Demo01Contact) { | ||||||
|   const hideLoading = message.loading({ |   const hideLoading = message.loading({ | ||||||
|     content: $t('ui.actionMessage.deleting', [row.id]), |     content: $t('ui.actionMessage.deleting', [row.id]), | ||||||
|     key: 'action_key_msg', |     duration: 0, | ||||||
|  |     key: 'action_process_msg', | ||||||
|   }); |   }); | ||||||
|   try { |   try { | ||||||
|     await deleteDemo01Contact(row.id as number); |     await deleteDemo01Contact(row.id as number); | ||||||
|     message.success({ |     message.success({ | ||||||
|       content: $t('ui.actionMessage.deleteSuccess', [row.id]), |       content: $t('ui.actionMessage.deleteSuccess', [row.id]), | ||||||
|       key: 'action_key_msg', |       key: 'action_process_msg', | ||||||
|     }); |     }); | ||||||
|     await getList(); |     await getList(); | ||||||
|   } finally { |   } finally { | ||||||
|  | @ -110,6 +114,31 @@ async function onDelete(row: Demo01ContactApi.Demo01Contact) { | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /** 批量删除示例联系人 */ | ||||||
|  | async function onDeleteBatch() { | ||||||
|  |   const hideLoading = message.loading({ | ||||||
|  |     content: $t('ui.actionMessage.deleting'), | ||||||
|  |     duration: 0, | ||||||
|  |     key: 'action_process_msg', | ||||||
|  |   }); | ||||||
|  |   try { | ||||||
|  |     await deleteDemo01ContactListByIds(deleteIds.value); | ||||||
|  |     message.success($t('ui.actionMessage.deleteSuccess')); | ||||||
|  |     await getList(); | ||||||
|  |   } finally { | ||||||
|  |     hideLoading(); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const deleteIds = ref<number[]>([]); // 待删除示例联系人 ID | ||||||
|  | function setDeleteIds({ | ||||||
|  |   records, | ||||||
|  | }: { | ||||||
|  |   records: Demo01ContactApi.Demo01Contact[]; | ||||||
|  | }) { | ||||||
|  |   deleteIds.value = records.map((item) => item.id); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /** 导出表格 */ | /** 导出表格 */ | ||||||
| async function onExport() { | async function onExport() { | ||||||
|   try { |   try { | ||||||
|  | @ -207,9 +236,28 @@ onMounted(() => { | ||||||
|           > |           > | ||||||
|             {{ $t('ui.actionTitle.export') }} |             {{ $t('ui.actionTitle.export') }} | ||||||
|           </Button> |           </Button> | ||||||
|  |           <Button | ||||||
|  |             :icon="h(Trash2)" | ||||||
|  |             type="primary" | ||||||
|  |             danger | ||||||
|  |             class="ml-2" | ||||||
|  |             :disabled="isEmpty(deleteIds)" | ||||||
|  |             @click="onDeleteBatch" | ||||||
|  |             v-access:code="['infra:demo01-contact:delete']" | ||||||
|  |           > | ||||||
|  |             批量删除 | ||||||
|  |           </Button> | ||||||
|         </TableToolbar> |         </TableToolbar> | ||||||
|       </template> |       </template> | ||||||
|       <VxeTable ref="tableRef" :data="list" show-overflow :loading="loading"> |       <VxeTable | ||||||
|  |         ref="tableRef" | ||||||
|  |         :data="list" | ||||||
|  |         show-overflow | ||||||
|  |         :loading="loading" | ||||||
|  |         @checkbox-all="setDeleteIds" | ||||||
|  |         @checkbox-change="setDeleteIds" | ||||||
|  |       > | ||||||
|  |         <VxeColumn type="checkbox" width="40" /> | ||||||
|         <VxeColumn field="id" title="编号" align="center" /> |         <VxeColumn field="id" title="编号" align="center" /> | ||||||
|         <VxeColumn field="name" title="名字" align="center" /> |         <VxeColumn field="name" title="名字" align="center" /> | ||||||
|         <VxeColumn field="sex" title="性别" align="center"> |         <VxeColumn field="sex" title="性别" align="center"> | ||||||
|  | @ -242,6 +290,7 @@ onMounted(() => { | ||||||
|             <Button |             <Button | ||||||
|               size="small" |               size="small" | ||||||
|               type="link" |               type="link" | ||||||
|  |               danger | ||||||
|               class="ml-2" |               class="ml-2" | ||||||
|               @click="onDelete(row as any)" |               @click="onDelete(row as any)" | ||||||
|               v-access:code="['infra:demo01-contact:delete']" |               v-access:code="['infra:demo01-contact:delete']" | ||||||
|  |  | ||||||
|  | @ -4,16 +4,16 @@ import type { Demo03StudentApi } from '#/api/infra/demo/demo03/erp'; | ||||||
| import { h, onMounted, reactive, ref } from 'vue'; | import { h, onMounted, reactive, ref } from 'vue'; | ||||||
| 
 | 
 | ||||||
| import { Page, useVbenModal } from '@vben/common-ui'; | import { Page, useVbenModal } from '@vben/common-ui'; | ||||||
| import { Download, Plus } from '@vben/icons'; | import { Download, Plus, Trash2 } from '@vben/icons'; | ||||||
| import { | import { | ||||||
|   cloneDeep, |   cloneDeep, | ||||||
|   downloadFileFromBlobPart, |   downloadFileFromBlobPart, | ||||||
|   formatDateTime, |   formatDateTime, | ||||||
|  |   isEmpty, | ||||||
| } from '@vben/utils'; | } from '@vben/utils'; | ||||||
| 
 | 
 | ||||||
| import { | import { | ||||||
|   Button, |   Button, | ||||||
|   DatePicker, |  | ||||||
|   Form, |   Form, | ||||||
|   Input, |   Input, | ||||||
|   message, |   message, | ||||||
|  | @ -26,6 +26,7 @@ import { | ||||||
| import { VxeColumn, VxeTable } from '#/adapter/vxe-table'; | import { VxeColumn, VxeTable } from '#/adapter/vxe-table'; | ||||||
| import { | import { | ||||||
|   deleteDemo03Student, |   deleteDemo03Student, | ||||||
|  |   deleteDemo03StudentListByIds, | ||||||
|   exportDemo03Student, |   exportDemo03Student, | ||||||
|   getDemo03StudentPage, |   getDemo03StudentPage, | ||||||
| } from '#/api/infra/demo/demo03/erp'; | } from '#/api/infra/demo/demo03/erp'; | ||||||
|  | @ -56,7 +57,6 @@ const queryParams = reactive({ | ||||||
|   pageSize: 10, |   pageSize: 10, | ||||||
|   name: undefined, |   name: undefined, | ||||||
|   sex: undefined, |   sex: undefined, | ||||||
|   birthday: undefined, |  | ||||||
|   description: undefined, |   description: undefined, | ||||||
|   createTime: undefined, |   createTime: undefined, | ||||||
| }); | }); | ||||||
|  | @ -68,9 +68,6 @@ const getList = async () => { | ||||||
|   loading.value = true; |   loading.value = true; | ||||||
|   try { |   try { | ||||||
|     const params = cloneDeep(queryParams) as any; |     const params = cloneDeep(queryParams) as any; | ||||||
|     if (params.birthday && Array.isArray(params.birthday)) { |  | ||||||
|       params.birthday = (params.birthday as string[]).join(','); |  | ||||||
|     } |  | ||||||
|     if (params.createTime && Array.isArray(params.createTime)) { |     if (params.createTime && Array.isArray(params.createTime)) { | ||||||
|       params.createTime = (params.createTime as string[]).join(','); |       params.createTime = (params.createTime as string[]).join(','); | ||||||
|     } |     } | ||||||
|  | @ -113,13 +110,14 @@ function onEdit(row: Demo03StudentApi.Demo03Student) { | ||||||
| async function onDelete(row: Demo03StudentApi.Demo03Student) { | async function onDelete(row: Demo03StudentApi.Demo03Student) { | ||||||
|   const hideLoading = message.loading({ |   const hideLoading = message.loading({ | ||||||
|     content: $t('ui.actionMessage.deleting', [row.id]), |     content: $t('ui.actionMessage.deleting', [row.id]), | ||||||
|     key: 'action_key_msg', |     duration: 0, | ||||||
|  |     key: 'action_process_msg', | ||||||
|   }); |   }); | ||||||
|   try { |   try { | ||||||
|     await deleteDemo03Student(row.id as number); |     await deleteDemo03Student(row.id as number); | ||||||
|     message.success({ |     message.success({ | ||||||
|       content: $t('ui.actionMessage.deleteSuccess', [row.id]), |       content: $t('ui.actionMessage.deleteSuccess', [row.id]), | ||||||
|       key: 'action_key_msg', |       key: 'action_process_msg', | ||||||
|     }); |     }); | ||||||
|     await getList(); |     await getList(); | ||||||
|   } finally { |   } finally { | ||||||
|  | @ -127,6 +125,31 @@ async function onDelete(row: Demo03StudentApi.Demo03Student) { | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /** 批量删除学生 */ | ||||||
|  | async function onDeleteBatch() { | ||||||
|  |   const hideLoading = message.loading({ | ||||||
|  |     content: $t('ui.actionMessage.deleting'), | ||||||
|  |     duration: 0, | ||||||
|  |     key: 'action_process_msg', | ||||||
|  |   }); | ||||||
|  |   try { | ||||||
|  |     await deleteDemo03StudentListByIds(deleteIds.value); | ||||||
|  |     message.success($t('ui.actionMessage.deleteSuccess')); | ||||||
|  |     await getList(); | ||||||
|  |   } finally { | ||||||
|  |     hideLoading(); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const deleteIds = ref<number[]>([]); // 待删除学生 ID | ||||||
|  | function setDeleteIds({ | ||||||
|  |   records, | ||||||
|  | }: { | ||||||
|  |   records: Demo03StudentApi.Demo03Student[]; | ||||||
|  | }) { | ||||||
|  |   deleteIds.value = records.map((item) => item.id); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /** 导出表格 */ | /** 导出表格 */ | ||||||
| async function onExport() { | async function onExport() { | ||||||
|   try { |   try { | ||||||
|  | @ -180,15 +203,6 @@ onMounted(() => { | ||||||
|             </Select.Option> |             </Select.Option> | ||||||
|           </Select> |           </Select> | ||||||
|         </Form.Item> |         </Form.Item> | ||||||
|         <Form.Item label="出生日期" name="birthday"> |  | ||||||
|           <DatePicker |  | ||||||
|             v-model:value="queryParams.birthday" |  | ||||||
|             value-format="YYYY-MM-DD" |  | ||||||
|             placeholder="选择出生日期" |  | ||||||
|             allow-clear |  | ||||||
|             class="w-full" |  | ||||||
|           /> |  | ||||||
|         </Form.Item> |  | ||||||
|         <Form.Item label="创建时间" name="createTime"> |         <Form.Item label="创建时间" name="createTime"> | ||||||
|           <RangePicker |           <RangePicker | ||||||
|             v-model:value="queryParams.createTime" |             v-model:value="queryParams.createTime" | ||||||
|  | @ -231,6 +245,17 @@ onMounted(() => { | ||||||
|           > |           > | ||||||
|             {{ $t('ui.actionTitle.export') }} |             {{ $t('ui.actionTitle.export') }} | ||||||
|           </Button> |           </Button> | ||||||
|  |           <Button | ||||||
|  |             :icon="h(Trash2)" | ||||||
|  |             type="primary" | ||||||
|  |             danger | ||||||
|  |             class="ml-2" | ||||||
|  |             :disabled="isEmpty(deleteIds)" | ||||||
|  |             @click="onDeleteBatch" | ||||||
|  |             v-access:code="['infra:demo03-student:delete']" | ||||||
|  |           > | ||||||
|  |             批量删除 | ||||||
|  |           </Button> | ||||||
|         </TableToolbar> |         </TableToolbar> | ||||||
|       </template> |       </template> | ||||||
|       <VxeTable |       <VxeTable | ||||||
|  | @ -244,7 +269,10 @@ onMounted(() => { | ||||||
|         }" |         }" | ||||||
|         show-overflow |         show-overflow | ||||||
|         :loading="loading" |         :loading="loading" | ||||||
|  |         @checkbox-all="setDeleteIds" | ||||||
|  |         @checkbox-change="setDeleteIds" | ||||||
|       > |       > | ||||||
|  |         <VxeColumn type="checkbox" width="40" /> | ||||||
|         <VxeColumn field="id" title="编号" align="center" /> |         <VxeColumn field="id" title="编号" align="center" /> | ||||||
|         <VxeColumn field="name" title="名字" align="center" /> |         <VxeColumn field="name" title="名字" align="center" /> | ||||||
|         <VxeColumn field="sex" title="性别" align="center"> |         <VxeColumn field="sex" title="性别" align="center"> | ||||||
|  |  | ||||||
|  | @ -4,8 +4,8 @@ import type { Demo03StudentApi } from '#/api/infra/demo/demo03/erp'; | ||||||
| import { h, nextTick, onMounted, reactive, ref, watch } from 'vue'; | import { h, nextTick, onMounted, reactive, ref, watch } from 'vue'; | ||||||
| 
 | 
 | ||||||
| import { useVbenModal } from '@vben/common-ui'; | import { useVbenModal } from '@vben/common-ui'; | ||||||
| import { Plus } from '@vben/icons'; | import { Plus, Trash2 } from '@vben/icons'; | ||||||
| import { cloneDeep, formatDateTime } from '@vben/utils'; | import { cloneDeep, formatDateTime, isEmpty } from '@vben/utils'; | ||||||
| 
 | 
 | ||||||
| import { | import { | ||||||
|   Button, |   Button, | ||||||
|  | @ -19,6 +19,7 @@ import { | ||||||
| import { VxeColumn, VxeTable } from '#/adapter/vxe-table'; | import { VxeColumn, VxeTable } from '#/adapter/vxe-table'; | ||||||
| import { | import { | ||||||
|   deleteDemo03Course, |   deleteDemo03Course, | ||||||
|  |   deleteDemo03CourseListByIds, | ||||||
|   getDemo03CoursePage, |   getDemo03CoursePage, | ||||||
| } from '#/api/infra/demo/demo03/erp'; | } from '#/api/infra/demo/demo03/erp'; | ||||||
| import { ContentWrap } from '#/components/content-wrap'; | import { ContentWrap } from '#/components/content-wrap'; | ||||||
|  | @ -56,20 +57,46 @@ function onEdit(row: Demo03StudentApi.Demo03Course) { | ||||||
| async function onDelete(row: Demo03StudentApi.Demo03Course) { | async function onDelete(row: Demo03StudentApi.Demo03Course) { | ||||||
|   const hideLoading = message.loading({ |   const hideLoading = message.loading({ | ||||||
|     content: $t('ui.actionMessage.deleting', [row.id]), |     content: $t('ui.actionMessage.deleting', [row.id]), | ||||||
|     key: 'action_key_msg', |     duration: 0, | ||||||
|  |     key: 'action_process_msg', | ||||||
|   }); |   }); | ||||||
|   try { |   try { | ||||||
|     await deleteDemo03Course(row.id as number); |     await deleteDemo03Course(row.id as number); | ||||||
|     message.success({ |     message.success({ | ||||||
|       content: $t('ui.actionMessage.deleteSuccess', [row.id]), |       content: $t('ui.actionMessage.deleteSuccess', [row.id]), | ||||||
|       key: 'action_key_msg', |       key: 'action_process_msg', | ||||||
|     }); |     }); | ||||||
|     getList(); |     await getList(); | ||||||
|   } finally { |   } finally { | ||||||
|     hideLoading(); |     hideLoading(); | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /** 批量删除学生课程 */ | ||||||
|  | async function onDeleteBatch() { | ||||||
|  |   const hideLoading = message.loading({ | ||||||
|  |     content: $t('ui.actionMessage.deleting'), | ||||||
|  |     duration: 0, | ||||||
|  |     key: 'action_process_msg', | ||||||
|  |   }); | ||||||
|  |   try { | ||||||
|  |     await deleteDemo03CourseListByIds(deleteIds.value); | ||||||
|  |     message.success($t('ui.actionMessage.deleteSuccess')); | ||||||
|  |     await getList(); | ||||||
|  |   } finally { | ||||||
|  |     hideLoading(); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const deleteIds = ref<number[]>([]); // 待删除学生课程 ID | ||||||
|  | function setDeleteIds({ | ||||||
|  |   records, | ||||||
|  | }: { | ||||||
|  |   records: Demo03StudentApi.Demo03Course[]; | ||||||
|  | }) { | ||||||
|  |   deleteIds.value = records.map((item) => item.id); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| const loading = ref(true); // 列表的加载中 | const loading = ref(true); // 列表的加载中 | ||||||
| const list = ref<Demo03StudentApi.Demo03Course[]>([]); // 列表的数据 | const list = ref<Demo03StudentApi.Demo03Course[]>([]); // 列表的数据 | ||||||
| const total = ref(0); // 列表的总页数 | const total = ref(0); // 列表的总页数 | ||||||
|  | @ -102,9 +129,6 @@ const getList = async () => { | ||||||
|       return []; |       return []; | ||||||
|     } |     } | ||||||
|     const params = cloneDeep(queryParams) as any; |     const params = cloneDeep(queryParams) as any; | ||||||
|     if (params.birthday && Array.isArray(params.birthday)) { |  | ||||||
|       params.birthday = (params.birthday as string[]).join(','); |  | ||||||
|     } |  | ||||||
|     if (params.createTime && Array.isArray(params.createTime)) { |     if (params.createTime && Array.isArray(params.createTime)) { | ||||||
|       params.createTime = (params.createTime as string[]).join(','); |       params.createTime = (params.createTime as string[]).join(','); | ||||||
|     } |     } | ||||||
|  | @ -202,9 +226,28 @@ onMounted(() => { | ||||||
|           > |           > | ||||||
|             {{ $t('ui.actionTitle.create', ['学生']) }} |             {{ $t('ui.actionTitle.create', ['学生']) }} | ||||||
|           </Button> |           </Button> | ||||||
|  |           <Button | ||||||
|  |             :icon="h(Trash2)" | ||||||
|  |             type="primary" | ||||||
|  |             danger | ||||||
|  |             class="ml-2" | ||||||
|  |             :disabled="isEmpty(deleteIds)" | ||||||
|  |             @click="onDeleteBatch" | ||||||
|  |             v-access:code="['infra:demo03-student:delete']" | ||||||
|  |           > | ||||||
|  |             批量删除 | ||||||
|  |           </Button> | ||||||
|         </TableToolbar> |         </TableToolbar> | ||||||
|       </template> |       </template> | ||||||
|       <VxeTable ref="tableRef" :data="list" show-overflow :loading="loading"> |       <VxeTable | ||||||
|  |         ref="tableRef" | ||||||
|  |         :data="list" | ||||||
|  |         show-overflow | ||||||
|  |         :loading="loading" | ||||||
|  |         @checkbox-all="setDeleteIds" | ||||||
|  |         @checkbox-change="setDeleteIds" | ||||||
|  |       > | ||||||
|  |         <VxeColumn type="checkbox" width="40" /> | ||||||
|         <VxeColumn field="id" title="编号" align="center" /> |         <VxeColumn field="id" title="编号" align="center" /> | ||||||
|         <VxeColumn field="studentId" title="学生编号" align="center" /> |         <VxeColumn field="studentId" title="学生编号" align="center" /> | ||||||
|         <VxeColumn field="name" title="名字" align="center" /> |         <VxeColumn field="name" title="名字" align="center" /> | ||||||
|  |  | ||||||
|  | @ -4,8 +4,8 @@ import type { Demo03StudentApi } from '#/api/infra/demo/demo03/erp'; | ||||||
| import { h, nextTick, onMounted, reactive, ref, watch } from 'vue'; | import { h, nextTick, onMounted, reactive, ref, watch } from 'vue'; | ||||||
| 
 | 
 | ||||||
| import { useVbenModal } from '@vben/common-ui'; | import { useVbenModal } from '@vben/common-ui'; | ||||||
| import { Plus } from '@vben/icons'; | import { Plus, Trash2 } from '@vben/icons'; | ||||||
| import { cloneDeep, formatDateTime } from '@vben/utils'; | import { cloneDeep, formatDateTime, isEmpty } from '@vben/utils'; | ||||||
| 
 | 
 | ||||||
| import { | import { | ||||||
|   Button, |   Button, | ||||||
|  | @ -19,6 +19,7 @@ import { | ||||||
| import { VxeColumn, VxeTable } from '#/adapter/vxe-table'; | import { VxeColumn, VxeTable } from '#/adapter/vxe-table'; | ||||||
| import { | import { | ||||||
|   deleteDemo03Grade, |   deleteDemo03Grade, | ||||||
|  |   deleteDemo03GradeListByIds, | ||||||
|   getDemo03GradePage, |   getDemo03GradePage, | ||||||
| } from '#/api/infra/demo/demo03/erp'; | } from '#/api/infra/demo/demo03/erp'; | ||||||
| import { ContentWrap } from '#/components/content-wrap'; | import { ContentWrap } from '#/components/content-wrap'; | ||||||
|  | @ -56,20 +57,46 @@ function onEdit(row: Demo03StudentApi.Demo03Grade) { | ||||||
| async function onDelete(row: Demo03StudentApi.Demo03Grade) { | async function onDelete(row: Demo03StudentApi.Demo03Grade) { | ||||||
|   const hideLoading = message.loading({ |   const hideLoading = message.loading({ | ||||||
|     content: $t('ui.actionMessage.deleting', [row.id]), |     content: $t('ui.actionMessage.deleting', [row.id]), | ||||||
|     key: 'action_key_msg', |     duration: 0, | ||||||
|  |     key: 'action_process_msg', | ||||||
|   }); |   }); | ||||||
|   try { |   try { | ||||||
|     await deleteDemo03Grade(row.id as number); |     await deleteDemo03Grade(row.id as number); | ||||||
|     message.success({ |     message.success({ | ||||||
|       content: $t('ui.actionMessage.deleteSuccess', [row.id]), |       content: $t('ui.actionMessage.deleteSuccess', [row.id]), | ||||||
|       key: 'action_key_msg', |       key: 'action_process_msg', | ||||||
|     }); |     }); | ||||||
|     getList(); |     await getList(); | ||||||
|   } finally { |   } finally { | ||||||
|     hideLoading(); |     hideLoading(); | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /** 批量删除学生班级 */ | ||||||
|  | async function onDeleteBatch() { | ||||||
|  |   const hideLoading = message.loading({ | ||||||
|  |     content: $t('ui.actionMessage.deleting'), | ||||||
|  |     duration: 0, | ||||||
|  |     key: 'action_process_msg', | ||||||
|  |   }); | ||||||
|  |   try { | ||||||
|  |     await deleteDemo03GradeListByIds(deleteIds.value); | ||||||
|  |     message.success($t('ui.actionMessage.deleteSuccess')); | ||||||
|  |     await getList(); | ||||||
|  |   } finally { | ||||||
|  |     hideLoading(); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const deleteIds = ref<number[]>([]); // 待删除学生班级 ID | ||||||
|  | function setDeleteIds({ | ||||||
|  |   records, | ||||||
|  | }: { | ||||||
|  |   records: Demo03StudentApi.Demo03Grade[]; | ||||||
|  | }) { | ||||||
|  |   deleteIds.value = records.map((item) => item.id); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| const loading = ref(true); // 列表的加载中 | const loading = ref(true); // 列表的加载中 | ||||||
| const list = ref<Demo03StudentApi.Demo03Grade[]>([]); // 列表的数据 | const list = ref<Demo03StudentApi.Demo03Grade[]>([]); // 列表的数据 | ||||||
| const total = ref(0); // 列表的总页数 | const total = ref(0); // 列表的总页数 | ||||||
|  | @ -102,9 +129,6 @@ const getList = async () => { | ||||||
|       return []; |       return []; | ||||||
|     } |     } | ||||||
|     const params = cloneDeep(queryParams) as any; |     const params = cloneDeep(queryParams) as any; | ||||||
|     if (params.birthday && Array.isArray(params.birthday)) { |  | ||||||
|       params.birthday = (params.birthday as string[]).join(','); |  | ||||||
|     } |  | ||||||
|     if (params.createTime && Array.isArray(params.createTime)) { |     if (params.createTime && Array.isArray(params.createTime)) { | ||||||
|       params.createTime = (params.createTime as string[]).join(','); |       params.createTime = (params.createTime as string[]).join(','); | ||||||
|     } |     } | ||||||
|  | @ -202,9 +226,28 @@ onMounted(() => { | ||||||
|           > |           > | ||||||
|             {{ $t('ui.actionTitle.create', ['学生']) }} |             {{ $t('ui.actionTitle.create', ['学生']) }} | ||||||
|           </Button> |           </Button> | ||||||
|  |           <Button | ||||||
|  |             :icon="h(Trash2)" | ||||||
|  |             type="primary" | ||||||
|  |             danger | ||||||
|  |             class="ml-2" | ||||||
|  |             :disabled="isEmpty(deleteIds)" | ||||||
|  |             @click="onDeleteBatch" | ||||||
|  |             v-access:code="['infra:demo03-student:delete']" | ||||||
|  |           > | ||||||
|  |             批量删除 | ||||||
|  |           </Button> | ||||||
|         </TableToolbar> |         </TableToolbar> | ||||||
|       </template> |       </template> | ||||||
|       <VxeTable ref="tableRef" :data="list" show-overflow :loading="loading"> |       <VxeTable | ||||||
|  |         ref="tableRef" | ||||||
|  |         :data="list" | ||||||
|  |         show-overflow | ||||||
|  |         :loading="loading" | ||||||
|  |         @checkbox-all="setDeleteIds" | ||||||
|  |         @checkbox-change="setDeleteIds" | ||||||
|  |       > | ||||||
|  |         <VxeColumn type="checkbox" width="40" /> | ||||||
|         <VxeColumn field="id" title="编号" align="center" /> |         <VxeColumn field="id" title="编号" align="center" /> | ||||||
|         <VxeColumn field="studentId" title="学生编号" align="center" /> |         <VxeColumn field="studentId" title="学生编号" align="center" /> | ||||||
|         <VxeColumn field="name" title="名字" align="center" /> |         <VxeColumn field="name" title="名字" align="center" /> | ||||||
|  |  | ||||||
|  | @ -4,16 +4,16 @@ import type { Demo03StudentApi } from '#/api/infra/demo/demo03/normal'; | ||||||
| import { h, onMounted, reactive, ref } from 'vue'; | import { h, onMounted, reactive, ref } from 'vue'; | ||||||
| 
 | 
 | ||||||
| import { Page, useVbenModal } from '@vben/common-ui'; | import { Page, useVbenModal } from '@vben/common-ui'; | ||||||
| import { Download, Plus } from '@vben/icons'; | import { Download, Plus, Trash2 } from '@vben/icons'; | ||||||
| import { | import { | ||||||
|   cloneDeep, |   cloneDeep, | ||||||
|   downloadFileFromBlobPart, |   downloadFileFromBlobPart, | ||||||
|   formatDateTime, |   formatDateTime, | ||||||
|  |   isEmpty, | ||||||
| } from '@vben/utils'; | } from '@vben/utils'; | ||||||
| 
 | 
 | ||||||
| import { | import { | ||||||
|   Button, |   Button, | ||||||
|   DatePicker, |  | ||||||
|   Form, |   Form, | ||||||
|   Input, |   Input, | ||||||
|   message, |   message, | ||||||
|  | @ -26,6 +26,7 @@ import { | ||||||
| import { VxeColumn, VxeTable } from '#/adapter/vxe-table'; | import { VxeColumn, VxeTable } from '#/adapter/vxe-table'; | ||||||
| import { | import { | ||||||
|   deleteDemo03Student, |   deleteDemo03Student, | ||||||
|  |   deleteDemo03StudentListByIds, | ||||||
|   exportDemo03Student, |   exportDemo03Student, | ||||||
|   getDemo03StudentPage, |   getDemo03StudentPage, | ||||||
| } from '#/api/infra/demo/demo03/normal'; | } from '#/api/infra/demo/demo03/normal'; | ||||||
|  | @ -52,7 +53,6 @@ const queryParams = reactive({ | ||||||
|   pageSize: 10, |   pageSize: 10, | ||||||
|   name: undefined, |   name: undefined, | ||||||
|   sex: undefined, |   sex: undefined, | ||||||
|   birthday: undefined, |  | ||||||
|   description: undefined, |   description: undefined, | ||||||
|   createTime: undefined, |   createTime: undefined, | ||||||
| }); | }); | ||||||
|  | @ -64,9 +64,6 @@ const getList = async () => { | ||||||
|   loading.value = true; |   loading.value = true; | ||||||
|   try { |   try { | ||||||
|     const params = cloneDeep(queryParams) as any; |     const params = cloneDeep(queryParams) as any; | ||||||
|     if (params.birthday && Array.isArray(params.birthday)) { |  | ||||||
|       params.birthday = (params.birthday as string[]).join(','); |  | ||||||
|     } |  | ||||||
|     if (params.createTime && Array.isArray(params.createTime)) { |     if (params.createTime && Array.isArray(params.createTime)) { | ||||||
|       params.createTime = (params.createTime as string[]).join(','); |       params.createTime = (params.createTime as string[]).join(','); | ||||||
|     } |     } | ||||||
|  | @ -109,13 +106,14 @@ function onEdit(row: Demo03StudentApi.Demo03Student) { | ||||||
| async function onDelete(row: Demo03StudentApi.Demo03Student) { | async function onDelete(row: Demo03StudentApi.Demo03Student) { | ||||||
|   const hideLoading = message.loading({ |   const hideLoading = message.loading({ | ||||||
|     content: $t('ui.actionMessage.deleting', [row.id]), |     content: $t('ui.actionMessage.deleting', [row.id]), | ||||||
|     key: 'action_key_msg', |     duration: 0, | ||||||
|  |     key: 'action_process_msg', | ||||||
|   }); |   }); | ||||||
|   try { |   try { | ||||||
|     await deleteDemo03Student(row.id as number); |     await deleteDemo03Student(row.id as number); | ||||||
|     message.success({ |     message.success({ | ||||||
|       content: $t('ui.actionMessage.deleteSuccess', [row.id]), |       content: $t('ui.actionMessage.deleteSuccess', [row.id]), | ||||||
|       key: 'action_key_msg', |       key: 'action_process_msg', | ||||||
|     }); |     }); | ||||||
|     await getList(); |     await getList(); | ||||||
|   } finally { |   } finally { | ||||||
|  | @ -123,6 +121,31 @@ async function onDelete(row: Demo03StudentApi.Demo03Student) { | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /** 批量删除学生 */ | ||||||
|  | async function onDeleteBatch() { | ||||||
|  |   const hideLoading = message.loading({ | ||||||
|  |     content: $t('ui.actionMessage.deleting'), | ||||||
|  |     duration: 0, | ||||||
|  |     key: 'action_process_msg', | ||||||
|  |   }); | ||||||
|  |   try { | ||||||
|  |     await deleteDemo03StudentListByIds(deleteIds.value); | ||||||
|  |     message.success($t('ui.actionMessage.deleteSuccess')); | ||||||
|  |     await getList(); | ||||||
|  |   } finally { | ||||||
|  |     hideLoading(); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const deleteIds = ref<number[]>([]); // 待删除学生 ID | ||||||
|  | function setDeleteIds({ | ||||||
|  |   records, | ||||||
|  | }: { | ||||||
|  |   records: Demo03StudentApi.Demo03Student[]; | ||||||
|  | }) { | ||||||
|  |   deleteIds.value = records.map((item) => item.id); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /** 导出表格 */ | /** 导出表格 */ | ||||||
| async function onExport() { | async function onExport() { | ||||||
|   try { |   try { | ||||||
|  | @ -176,15 +199,6 @@ onMounted(() => { | ||||||
|             </Select.Option> |             </Select.Option> | ||||||
|           </Select> |           </Select> | ||||||
|         </Form.Item> |         </Form.Item> | ||||||
|         <Form.Item label="出生日期" name="birthday"> |  | ||||||
|           <DatePicker |  | ||||||
|             v-model:value="queryParams.birthday" |  | ||||||
|             value-format="YYYY-MM-DD" |  | ||||||
|             placeholder="选择出生日期" |  | ||||||
|             allow-clear |  | ||||||
|             class="w-full" |  | ||||||
|           /> |  | ||||||
|         </Form.Item> |  | ||||||
|         <Form.Item label="创建时间" name="createTime"> |         <Form.Item label="创建时间" name="createTime"> | ||||||
|           <RangePicker |           <RangePicker | ||||||
|             v-model:value="queryParams.createTime" |             v-model:value="queryParams.createTime" | ||||||
|  | @ -227,9 +241,28 @@ onMounted(() => { | ||||||
|           > |           > | ||||||
|             {{ $t('ui.actionTitle.export') }} |             {{ $t('ui.actionTitle.export') }} | ||||||
|           </Button> |           </Button> | ||||||
|  |           <Button | ||||||
|  |             :icon="h(Trash2)" | ||||||
|  |             type="primary" | ||||||
|  |             danger | ||||||
|  |             class="ml-2" | ||||||
|  |             :disabled="isEmpty(deleteIds)" | ||||||
|  |             @click="onDeleteBatch" | ||||||
|  |             v-access:code="['infra:demo03-student:delete']" | ||||||
|  |           > | ||||||
|  |             批量删除 | ||||||
|  |           </Button> | ||||||
|         </TableToolbar> |         </TableToolbar> | ||||||
|       </template> |       </template> | ||||||
|       <VxeTable ref="tableRef" :data="list" show-overflow :loading="loading"> |       <VxeTable | ||||||
|  |         ref="tableRef" | ||||||
|  |         :data="list" | ||||||
|  |         show-overflow | ||||||
|  |         :loading="loading" | ||||||
|  |         @checkbox-all="setDeleteIds" | ||||||
|  |         @checkbox-change="setDeleteIds" | ||||||
|  |       > | ||||||
|  |         <VxeColumn type="checkbox" width="40" /> | ||||||
|         <!-- 子表的列表 --> |         <!-- 子表的列表 --> | ||||||
|         <VxeColumn type="expand" width="60"> |         <VxeColumn type="expand" width="60"> | ||||||
|           <template #content="{ row }"> |           <template #content="{ row }"> | ||||||
|  |  | ||||||
|  | @ -4,16 +4,16 @@ import type { Demo03StudentApi } from '#/api/infra/demo/demo03/normal'; | ||||||
| import { h, onMounted, reactive, ref } from 'vue'; | import { h, onMounted, reactive, ref } from 'vue'; | ||||||
| 
 | 
 | ||||||
| import { Page, useVbenModal } from '@vben/common-ui'; | import { Page, useVbenModal } from '@vben/common-ui'; | ||||||
| import { Download, Plus } from '@vben/icons'; | import { Download, Plus, Trash2 } from '@vben/icons'; | ||||||
| import { | import { | ||||||
|   cloneDeep, |   cloneDeep, | ||||||
|   downloadFileFromBlobPart, |   downloadFileFromBlobPart, | ||||||
|   formatDateTime, |   formatDateTime, | ||||||
|  |   isEmpty, | ||||||
| } from '@vben/utils'; | } from '@vben/utils'; | ||||||
| 
 | 
 | ||||||
| import { | import { | ||||||
|   Button, |   Button, | ||||||
|   DatePicker, |  | ||||||
|   Form, |   Form, | ||||||
|   Input, |   Input, | ||||||
|   message, |   message, | ||||||
|  | @ -25,6 +25,7 @@ import { | ||||||
| import { VxeColumn, VxeTable } from '#/adapter/vxe-table'; | import { VxeColumn, VxeTable } from '#/adapter/vxe-table'; | ||||||
| import { | import { | ||||||
|   deleteDemo03Student, |   deleteDemo03Student, | ||||||
|  |   deleteDemo03StudentListByIds, | ||||||
|   exportDemo03Student, |   exportDemo03Student, | ||||||
|   getDemo03StudentPage, |   getDemo03StudentPage, | ||||||
| } from '#/api/infra/demo/demo03/normal'; | } from '#/api/infra/demo/demo03/normal'; | ||||||
|  | @ -46,7 +47,6 @@ const queryParams = reactive({ | ||||||
|   pageSize: 10, |   pageSize: 10, | ||||||
|   name: undefined, |   name: undefined, | ||||||
|   sex: undefined, |   sex: undefined, | ||||||
|   birthday: undefined, |  | ||||||
|   description: undefined, |   description: undefined, | ||||||
|   createTime: undefined, |   createTime: undefined, | ||||||
| }); | }); | ||||||
|  | @ -58,9 +58,6 @@ const getList = async () => { | ||||||
|   loading.value = true; |   loading.value = true; | ||||||
|   try { |   try { | ||||||
|     const params = cloneDeep(queryParams) as any; |     const params = cloneDeep(queryParams) as any; | ||||||
|     if (params.birthday && Array.isArray(params.birthday)) { |  | ||||||
|       params.birthday = (params.birthday as string[]).join(','); |  | ||||||
|     } |  | ||||||
|     if (params.createTime && Array.isArray(params.createTime)) { |     if (params.createTime && Array.isArray(params.createTime)) { | ||||||
|       params.createTime = (params.createTime as string[]).join(','); |       params.createTime = (params.createTime as string[]).join(','); | ||||||
|     } |     } | ||||||
|  | @ -103,13 +100,14 @@ function onEdit(row: Demo03StudentApi.Demo03Student) { | ||||||
| async function onDelete(row: Demo03StudentApi.Demo03Student) { | async function onDelete(row: Demo03StudentApi.Demo03Student) { | ||||||
|   const hideLoading = message.loading({ |   const hideLoading = message.loading({ | ||||||
|     content: $t('ui.actionMessage.deleting', [row.id]), |     content: $t('ui.actionMessage.deleting', [row.id]), | ||||||
|     key: 'action_key_msg', |     duration: 0, | ||||||
|  |     key: 'action_process_msg', | ||||||
|   }); |   }); | ||||||
|   try { |   try { | ||||||
|     await deleteDemo03Student(row.id as number); |     await deleteDemo03Student(row.id as number); | ||||||
|     message.success({ |     message.success({ | ||||||
|       content: $t('ui.actionMessage.deleteSuccess', [row.id]), |       content: $t('ui.actionMessage.deleteSuccess', [row.id]), | ||||||
|       key: 'action_key_msg', |       key: 'action_process_msg', | ||||||
|     }); |     }); | ||||||
|     await getList(); |     await getList(); | ||||||
|   } finally { |   } finally { | ||||||
|  | @ -117,6 +115,31 @@ async function onDelete(row: Demo03StudentApi.Demo03Student) { | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /** 批量删除学生 */ | ||||||
|  | async function onDeleteBatch() { | ||||||
|  |   const hideLoading = message.loading({ | ||||||
|  |     content: $t('ui.actionMessage.deleting'), | ||||||
|  |     duration: 0, | ||||||
|  |     key: 'action_process_msg', | ||||||
|  |   }); | ||||||
|  |   try { | ||||||
|  |     await deleteDemo03StudentListByIds(deleteIds.value); | ||||||
|  |     message.success($t('ui.actionMessage.deleteSuccess')); | ||||||
|  |     await getList(); | ||||||
|  |   } finally { | ||||||
|  |     hideLoading(); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const deleteIds = ref<number[]>([]); // 待删除学生 ID | ||||||
|  | function setDeleteIds({ | ||||||
|  |   records, | ||||||
|  | }: { | ||||||
|  |   records: Demo03StudentApi.Demo03Student[]; | ||||||
|  | }) { | ||||||
|  |   deleteIds.value = records.map((item) => item.id); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /** 导出表格 */ | /** 导出表格 */ | ||||||
| async function onExport() { | async function onExport() { | ||||||
|   try { |   try { | ||||||
|  | @ -170,15 +193,6 @@ onMounted(() => { | ||||||
|             </Select.Option> |             </Select.Option> | ||||||
|           </Select> |           </Select> | ||||||
|         </Form.Item> |         </Form.Item> | ||||||
|         <Form.Item label="出生日期" name="birthday"> |  | ||||||
|           <DatePicker |  | ||||||
|             v-model:value="queryParams.birthday" |  | ||||||
|             value-format="YYYY-MM-DD" |  | ||||||
|             placeholder="选择出生日期" |  | ||||||
|             allow-clear |  | ||||||
|             class="w-full" |  | ||||||
|           /> |  | ||||||
|         </Form.Item> |  | ||||||
|         <Form.Item label="创建时间" name="createTime"> |         <Form.Item label="创建时间" name="createTime"> | ||||||
|           <RangePicker |           <RangePicker | ||||||
|             v-model:value="queryParams.createTime" |             v-model:value="queryParams.createTime" | ||||||
|  | @ -221,9 +235,28 @@ onMounted(() => { | ||||||
|           > |           > | ||||||
|             {{ $t('ui.actionTitle.export') }} |             {{ $t('ui.actionTitle.export') }} | ||||||
|           </Button> |           </Button> | ||||||
|  |           <Button | ||||||
|  |             :icon="h(Trash2)" | ||||||
|  |             type="primary" | ||||||
|  |             danger | ||||||
|  |             class="ml-2" | ||||||
|  |             :disabled="isEmpty(deleteIds)" | ||||||
|  |             @click="onDeleteBatch" | ||||||
|  |             v-access:code="['infra:demo03-student:delete']" | ||||||
|  |           > | ||||||
|  |             批量删除 | ||||||
|  |           </Button> | ||||||
|         </TableToolbar> |         </TableToolbar> | ||||||
|       </template> |       </template> | ||||||
|       <VxeTable ref="tableRef" :data="list" show-overflow :loading="loading"> |       <VxeTable | ||||||
|  |         ref="tableRef" | ||||||
|  |         :data="list" | ||||||
|  |         show-overflow | ||||||
|  |         :loading="loading" | ||||||
|  |         @checkbox-all="setDeleteIds" | ||||||
|  |         @checkbox-change="setDeleteIds" | ||||||
|  |       > | ||||||
|  |         <VxeColumn type="checkbox" width="40" /> | ||||||
|         <VxeColumn field="id" title="编号" align="center" /> |         <VxeColumn field="id" title="编号" align="center" /> | ||||||
|         <VxeColumn field="name" title="名字" align="center" /> |         <VxeColumn field="name" title="名字" align="center" /> | ||||||
|         <VxeColumn field="sex" title="性别" align="center"> |         <VxeColumn field="sex" title="性别" align="center"> | ||||||
|  |  | ||||||
|  | @ -16,6 +16,7 @@ | ||||||
|     "edit": "Modify {0}", |     "edit": "Modify {0}", | ||||||
|     "create": "Create {0}", |     "create": "Create {0}", | ||||||
|     "delete": "Delete {0}", |     "delete": "Delete {0}", | ||||||
|  |     "deleteBatch": "Delete Batch", | ||||||
|     "detail": "Detail {0}", |     "detail": "Detail {0}", | ||||||
|     "view": "View {0}", |     "view": "View {0}", | ||||||
|     "import": "Import", |     "import": "Import", | ||||||
|  |  | ||||||
|  | @ -16,6 +16,7 @@ | ||||||
|     "edit": "修改{0}", |     "edit": "修改{0}", | ||||||
|     "create": "新增{0}", |     "create": "新增{0}", | ||||||
|     "delete": "删除{0}", |     "delete": "删除{0}", | ||||||
|  |     "deleteBatch": "批量删除", | ||||||
|     "detail": "详情{0}", |     "detail": "详情{0}", | ||||||
|     "view": "查看{0}", |     "view": "查看{0}", | ||||||
|     "import": "导入", |     "import": "导入", | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 子夜
						子夜