diff --git a/apps/web-antd/src/views/system/post/data.ts b/apps/web-antd/src/views/system/post/data.ts index 0a00f6494..43e746522 100644 --- a/apps/web-antd/src/views/system/post/data.ts +++ b/apps/web-antd/src/views/system/post/data.ts @@ -64,19 +64,28 @@ export function useGridFormSchema(): VbenFormSchema[] { fieldName: 'name', label: '岗位名称', component: 'Input', + componentProps: { + placeholder: '请输入岗位名称', + allowClear: true, + }, }, { fieldName: 'code', label: '岗位编码', component: 'Input', + componentProps: { + placeholder: '请输入岗位编码', + allowClear: true, + }, }, { fieldName: 'status', label: '岗位状态', component: 'Select', componentProps: { - allowClear: true, options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + placeholder: '请选择岗位状态', + allowClear: true, }, }, ]; @@ -89,26 +98,32 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { { field: 'id', title: '岗位编号', + minWidth: 200, }, { field: 'name', title: '岗位名称', + minWidth: 200, }, { field: 'code', title: '岗位编码', + minWidth: 200, }, { field: 'sort', title: '显示顺序', + minWidth: 100, }, { field: 'remark', title: '岗位备注', + minWidth: 200, }, { field: 'status', title: '岗位状态', + minWidth: 100, cellRender: { name: 'CellDict', props: { type: DICT_TYPE.COMMON_STATUS }, @@ -117,6 +132,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { { field: 'createTime', title: '创建时间', + minWidth: 180, formatter: 'formatDateTime', }, { diff --git a/apps/web-antd/src/views/system/post/index.vue b/apps/web-antd/src/views/system/post/index.vue index 20cb29e3e..920830e41 100644 --- a/apps/web-antd/src/views/system/post/index.vue +++ b/apps/web-antd/src/views/system/post/index.vue @@ -4,7 +4,7 @@ import type { SystemPostApi } from '#/api/system/post'; import { ref } from 'vue'; -import { Page, useVbenModal } from '@vben/common-ui'; +import { confirm, Page, useVbenModal } from '@vben/common-ui'; import { downloadFileFromBlobPart, isEmpty } from '@vben/utils'; import { message } from 'ant-design-vue'; @@ -27,7 +27,7 @@ const [FormModal, formModalApi] = useVbenModal({ }); /** 刷新表格 */ -function onRefresh() { +function handleRefresh() { gridApi.query(); } @@ -51,15 +51,29 @@ function handleEdit(row: SystemPostApi.Post) { async function handleDelete(row: SystemPostApi.Post) { const hideLoading = message.loading({ content: $t('ui.actionMessage.deleting', [row.name]), - key: 'action_key_msg', + duration: 0, }); try { await deletePost(row.id as number); - message.success({ - content: $t('ui.actionMessage.deleteSuccess', [row.name]), - key: 'action_key_msg', - }); - onRefresh(); + message.success($t('ui.actionMessage.deleteSuccess', [row.name])); + handleRefresh(); + } finally { + hideLoading(); + } +} + +/** 批量删除岗位 */ +async function handleDeleteBatch() { + await confirm($t('ui.actionMessage.deleteBatchConfirm')); + const hideLoading = message.loading({ + content: $t('ui.actionMessage.deletingBatch'), + duration: 0, + }); + try { + await deletePostList(checkedIds.value); + checkedIds.value = []; + message.success($t('ui.actionMessage.deleteSuccess')); + handleRefresh(); } finally { hideLoading(); } @@ -74,23 +88,6 @@ function handleRowCheckboxChange({ checkedIds.value = records.map((item) => item.id!); } -/** 批量删除岗位 */ -async function handleDeleteBatch() { - const hideLoading = message.loading({ - content: $t('ui.actionMessage.deleting'), - duration: 0, - key: 'action_process_msg', - }); - try { - await deletePostList(checkedIds.value); - checkedIds.value = []; - message.success($t('ui.actionMessage.deleteSuccess')); - onRefresh(); - } finally { - hideLoading(); - } -} - const [Grid, gridApi] = useVbenVxeGrid({ formOptions: { schema: useGridFormSchema(), @@ -128,7 +125,7 @@ const [Grid, gridApi] = useVbenVxeGrid({