chore: 请假申请根据不同状态显示按钮

This commit is contained in:
dap 2024-12-17 16:09:13 +08:00
parent 3c1df9c880
commit 15e6209aa3
2 changed files with 26 additions and 4 deletions

View File

@ -47,10 +47,7 @@ export function deleteByInstanceIds(instanceIds: IDS) {
* *
* @param data * @param data
*/ */
export function cancelProcessApply(data: { export function cancelProcessApply(data: { businessId: ID; message?: string }) {
businessId: string;
message?: string;
}) {
return requestClient.putWithMsg<void>( return requestClient.putWithMsg<void>(
'/workflow/instance/cancelProcessApply', '/workflow/instance/cancelProcessApply',
data, data,

View File

@ -13,6 +13,7 @@ import {
vxeCheckboxChecked, vxeCheckboxChecked,
type VxeGridProps, type VxeGridProps,
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import { cancelProcessApply } from '#/api/workflow/instance';
import { commonDownloadExcel } from '#/utils/file/download'; import { commonDownloadExcel } from '#/utils/file/download';
import userSelectModal from '../components/user-select-modal.vue'; import userSelectModal from '../components/user-select-modal.vue';
@ -80,6 +81,14 @@ async function handleDelete(row: Required<LeaveForm>) {
await tableApi.query(); await tableApi.query();
} }
async function handleRevoke(row: Required<LeaveForm>) {
await cancelProcessApply({
businessId: row.id,
message: '申请人撤销流程!',
});
await tableApi.query();
}
function handleMultiDelete() { function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords(); const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: Required<LeaveForm>) => row.id); const ids = rows.map((row: Required<LeaveForm>) => row.id);
@ -146,6 +155,7 @@ function handleTest() {
<template #action="{ row }"> <template #action="{ row }">
<Space> <Space>
<ghost-button <ghost-button
v-if="['draft', 'cancel', 'back'].includes(row.status)"
v-access:code="['workflow:leave:edit']" v-access:code="['workflow:leave:edit']"
@click.stop="handleEdit(row)" @click.stop="handleEdit(row)"
> >
@ -158,6 +168,7 @@ function handleTest() {
@confirm="handleDelete(row)" @confirm="handleDelete(row)"
> >
<ghost-button <ghost-button
v-if="['draft', 'cancel', 'back'].includes(row.status)"
danger danger
v-access:code="['workflow:leave:remove']" v-access:code="['workflow:leave:remove']"
@click.stop="" @click.stop=""
@ -165,6 +176,20 @@ function handleTest() {
{{ $t('pages.common.delete') }} {{ $t('pages.common.delete') }}
</ghost-button> </ghost-button>
</Popconfirm> </Popconfirm>
<Popconfirm
:get-popup-container="getVxePopupContainer"
placement="left"
title="确认撤销?"
@confirm="handleRevoke(row)"
>
<ghost-button
v-if="['waiting'].includes(row.status)"
v-access:code="['workflow:leave:edit']"
@click.stop=""
>
撤销
</ghost-button>
</Popconfirm>
</Space> </Space>
</template> </template>
</BasicTable> </BasicTable>