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' method: 'delete'
}); });
}; };
/**
*
* @param data
* @returns
*/
export const processInvalid = (data: any) => {
return request({
url: `/workflow/processInstance/processInvalid`,
method: 'post',
data: data
});
};
export default { export default {
getPageByRunning, getPageByRunning,

View File

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