add 添加作废

This commit is contained in:
gssong 2024-12-08 15:32:47 +08:00
parent a9cd07785d
commit d67cc4ded3
3 changed files with 36 additions and 20 deletions

View File

@ -87,6 +87,18 @@ export const deleteByInstanceIds = (instanceIds: Array<string | number> | string
method: 'delete'
});
};
/**
*
* @param data
* @returns
*/
export const processInvalid = (data: any) => {
return request({
url: `/workflow/processInstance/processInvalid`,
method: 'post',
data: data
});
};
export default {
getPageByRunning,

View File

@ -92,12 +92,12 @@
<el-button size="small" type="primary" @click="handleInvalid(scope.row)">确认</el-button>
</div>
<template #reference>
<el-button type="primary" size="small" icon="CircleClose">作废</el-button>
<el-button type="danger" size="small" icon="CircleClose">作废</el-button>
</template>
</el-popover>
</el-col>
<el-col :span="1.5">
<el-button type="primary" size="small" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
<el-button type="danger" size="small" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
</el-col>
</el-row>
<el-row :gutter="10" class="mb8">
@ -158,7 +158,7 @@
</template>
<script lang="ts" setup>
import { getPageByRunning, getPageByFinish, deleteByInstanceIds, getInstanceVariable } from '@/api/workflow/processInstance';
import { getPageByRunning, getPageByFinish, deleteByInstanceIds, getInstanceVariable, processInvalid } from '@/api/workflow/processInstance';
import { listCategory } from '@/api/workflow/category';
import { CategoryVO } from '@/api/workflow/category/types';
import { FlowInstanceQuery, FlowInstanceVO } from '@/api/workflow/processInstance/types';
@ -321,14 +321,14 @@ const changeTab = async (data: string) => {
};
/** 作废按钮操作 */
const handleInvalid = async (row: FlowInstanceVO) => {
await proxy?.$modal.confirm('是否确认作废业务id为【' + row.businessId + '】的数据项');
await proxy?.$modal.confirm('是否确认作废');
loading.value = true;
if ('running' === tab.value) {
let param = {
businessKey: row.businessId,
deleteReason: deleteReason.value
id: row.id,
comment: deleteReason.value
};
//await deleteRunInstance(param).finally(() => (loading.value = false));
await processInvalid(param).finally(() => (loading.value = false));
getProcessInstanceRunningList();
proxy?.$modal.msgSuccess('操作成功');
}

View File

@ -78,7 +78,9 @@
<el-button type="primary" size="small" icon="View" @click="handleOpen(scope.row, 'view')">查看</el-button>
</el-col>
<el-col :span="1.5" v-if="scope.row.flowStatus === 'waiting'">
<el-button type="primary" size="small" icon="Notification" @click="handleCancelProcessApply(scope.row.businessId)">撤销</el-button>
<el-button type="primary" size="small" icon="Notification" @click="handleCancelProcessApply(scope.row.businessId)"
>撤销</el-button
>
</el-col>
</el-row>
</template>
@ -100,10 +102,10 @@
</template>
<script lang="ts" setup>
import { getPageByCurrent, deleteRunAndHisInstance, cancelProcessApply } from '@/api/workflow/processInstance';
import { getPageByCurrent, deleteByInstanceIds, cancelProcessApply } from '@/api/workflow/processInstance';
import { listCategory } from '@/api/workflow/category';
import { CategoryVO } from '@/api/workflow/category/types';
import { ProcessInstanceQuery, ProcessInstanceVO } from '@/api/workflow/processInstance/types';
import { ProcessInstanceQuery, FlowInstanceVO } from '@/api/workflow/processInstance/types';
import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -114,7 +116,8 @@ const categoryTreeRef = ref<ElTreeInstance>();
//
const loading = ref(true);
//
const businessIds = ref<Array<any>>([]);
const businessIds = ref<Array<number | string>>([]);
const instanceIds = ref<Array<number | string>>([]);
//
const single = ref(true);
//
@ -124,7 +127,7 @@ const showSearch = ref(true);
//
const total = ref(0);
//
const processInstanceList = ref<ProcessInstanceVO[]>([]);
const processInstanceList = ref<FlowInstanceVO[]>([]);
const categoryOptions = ref<CategoryOption[]>([]);
const categoryName = ref('');
@ -194,8 +197,9 @@ const resetQuery = () => {
handleQuery();
};
//
const handleSelectionChange = (selection: ProcessInstanceVO[]) => {
const handleSelectionChange = (selection: FlowInstanceVO[]) => {
businessIds.value = selection.map((item: any) => item.businessId);
instanceIds.value = selection.map((item: FlowInstanceVO) => item.id);
single.value = selection.length !== 1;
multiple.value = !selection.length;
};
@ -210,12 +214,12 @@ const getList = () => {
};
/** 删除按钮操作 */
const handleDelete = async (row: ProcessInstanceVO) => {
const businessKey = row.businessId || businessIds.value;
await proxy?.$modal.confirm('是否确认删除业务id为【' + businessKey + '】的数据项');
const handleDelete = async (row: FlowInstanceVO) => {
const instanceIdList = row.id || instanceIds.value;
await proxy?.$modal.confirm('是否确认删除');
loading.value = true;
if ('running' === tab.value) {
await deleteRunAndHisInstance(businessKey).finally(() => (loading.value = false));
await deleteByInstanceIds(instanceIdList).finally(() => (loading.value = false));
getList();
}
proxy?.$modal.msgSuccess('删除成功');
@ -227,9 +231,9 @@ const handleCancelProcessApply = async (businessId: string) => {
loading.value = true;
if ('running' === tab.value) {
let data = {
businessId:businessId,
message:'撤销流程!'
}
businessId: businessId,
message: '撤销流程!'
};
await cancelProcessApply(data).finally(() => (loading.value = false));
getList();
}