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
*/
export function cancelProcessApply(data: {
businessId: string;
message?: string;
}) {
export function cancelProcessApply(data: { businessId: ID; message?: string }) {
return requestClient.putWithMsg<void>(
'/workflow/instance/cancelProcessApply',
data,

View File

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