import request from '@/utils/request'

// 查询已办任务列表
export const finishedList = async (query: any) => {
  return await request({
    url: '/flowable/task/finishedList',
    method: 'get',
    params: query
  })
}

// 任务流转记录
export const flowRecord = async (query: any) => {
	return await request({
		url: "/flowable/task/flowRecord",
		method: "get",
		params: query,
	});
};

// 撤回任务
export const revokeProcess = async (data: any) => {
	return await request({
		url: "/flowable/task/revokeProcess",
		method: "post",
		data: data,
	});
};

// 部署流程实例
export const deployStart = async (deployId: string) => {
	return await request({
		url: "/flowable/process/startFlow/" + deployId,
		method: "get",
	});
};

// 查询流程定义详细
export const getDeployment = async (id: string) => {
	return await request({
		url: "/system/deployment/" + id,
		method: "get",
	});
};

// 新增流程定义
export const addDeployment = async (data: any) => {
	return await request({
		url: "/system/deployment",
		method: "post",
		data: data,
	});
};

// 修改流程定义
export const updateDeployment = async (data: any) => {
	return await request({
		url: "/system/deployment",
		method: "put",
		data: data,
	});
};

// 删除流程定义
export const delDeployment = async (id: string) => {
	return await request({
		url: "/flowable/instance/delete/" + id,
		method: "delete",
	});
};

// 导出流程定义
export const exportDeployment = async (query: any) => {
	return await request({
		url: "/system/deployment/export",
		method: "get",
		params: query,
	});
};
