update 优化流程实例接口全部按照业务id操作
This commit is contained in:
parent
2c9daae153
commit
58e6fdef78
@ -29,33 +29,33 @@ export const getPageByFinish = (query: ProcessInstanceQuery): AxiosPromise<Proce
|
||||
};
|
||||
|
||||
/**
|
||||
* 通过流程实例id获取历史流程图
|
||||
* 通过业务id获取历史流程图
|
||||
*/
|
||||
export const getHistoryImage = (processInstanceId: string) => {
|
||||
export const getHistoryImage = (businessKey: string) => {
|
||||
return request({
|
||||
url: `/workflow/processInstance/getHistoryImage/${processInstanceId}` + '?t' + Math.random(),
|
||||
url: `/workflow/processInstance/getHistoryImage/${businessKey}` + '?t' + Math.random(),
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 通过流程实例id获取历史流程图运行中,历史等节点
|
||||
* 通过业务id获取历史流程图运行中,历史等节点
|
||||
*/
|
||||
export const getHistoryList = (instanceId: string): AxiosPromise<Record<string, any>> => {
|
||||
export const getHistoryList = (businessKey: string): AxiosPromise<Record<string, any>> => {
|
||||
return request({
|
||||
url: `/workflow/processInstance/getHistoryList/${instanceId}` + '?t' + Math.random(),
|
||||
url: `/workflow/processInstance/getHistoryList/${businessKey}` + '?t' + Math.random(),
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取审批记录
|
||||
* @param processInstanceId 流程实例id
|
||||
* @param businessKey 业务id
|
||||
* @returns
|
||||
*/
|
||||
export const getHistoryRecord = (processInstanceId: string) => {
|
||||
export const getHistoryRecord = (businessKey: string) => {
|
||||
return request({
|
||||
url: `/workflow/processInstance/getHistoryRecord/${processInstanceId}`,
|
||||
url: `/workflow/processInstance/getHistoryRecord/${businessKey}`,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
@ -75,24 +75,24 @@ export const deleteRunInstance = (data: object) => {
|
||||
|
||||
/**
|
||||
* 运行中的实例 删除程实例,删除历史记录,删除业务与流程关联信息
|
||||
* @param processInstanceId 流程实例id
|
||||
* @param businessKey 业务id
|
||||
* @returns
|
||||
*/
|
||||
export const deleteRunAndHisInstance = (processInstanceId: string | string[]) => {
|
||||
export const deleteRunAndHisInstance = (businessKey: string | string[]) => {
|
||||
return request({
|
||||
url: `/workflow/processInstance/deleteRunAndHisInstance/${processInstanceId}`,
|
||||
url: `/workflow/processInstance/deleteRunAndHisInstance/${businessKey}`,
|
||||
method: 'delete'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 已完成的实例 删除程实例,删除历史记录,删除业务与流程关联信息
|
||||
* @param processInstanceId 流程实例id
|
||||
* @param businessKey 业务id
|
||||
* @returns
|
||||
*/
|
||||
export const deleteFinishAndHisInstance = (processInstanceId: string | string[]) => {
|
||||
export const deleteFinishAndHisInstance = (businessKey: string | string[]) => {
|
||||
return request({
|
||||
url: `/workflow/processInstance/deleteFinishAndHisInstance/${processInstanceId}`,
|
||||
url: `/workflow/processInstance/deleteFinishAndHisInstance/${businessKey}`,
|
||||
method: 'delete'
|
||||
});
|
||||
};
|
||||
@ -112,12 +112,12 @@ export const getPageByCurrent = (query: ProcessInstanceQuery): AxiosPromise<Proc
|
||||
|
||||
/**
|
||||
* 撤销流程
|
||||
* @param processInstanceId 流程实例id
|
||||
* @param businessKey 业务id
|
||||
* @returns
|
||||
*/
|
||||
export const cancelProcessApply = (processInstanceId: string) => {
|
||||
export const cancelProcessApply = (businessKey: string) => {
|
||||
return request({
|
||||
url: `/workflow/processInstance/cancelProcessApply/${processInstanceId}`,
|
||||
url: `/workflow/processInstance/cancelProcessApply/${businessKey}`,
|
||||
method: 'post'
|
||||
});
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ const loading = ref(false);
|
||||
const bpmnVisible = ref(true);
|
||||
const historyList = ref([]);
|
||||
|
||||
const init = (instanceId) => {
|
||||
const init = (businessKey) => {
|
||||
loading.value = true;
|
||||
bpmnVisible.value = true;
|
||||
nextTick(async () => {
|
||||
@ -67,7 +67,7 @@ const init = (instanceId) => {
|
||||
MoveCanvasModule
|
||||
] as ModuleDeclaration[]
|
||||
});
|
||||
const resp = await processApi.getHistoryList(instanceId);
|
||||
const resp = await processApi.getHistoryList(businessKey);
|
||||
xml.value = resp.data.xml;
|
||||
taskList.value = resp.data.taskList;
|
||||
historyList.value = resp.data.historyList;
|
||||
|
@ -67,17 +67,17 @@ const tabActiveName = ref('bpmn');
|
||||
const bpmnViewRef = ref<BpmnView>();
|
||||
|
||||
//初始化查询审批记录
|
||||
const init = async (instanceId: string) => {
|
||||
const init = async (businessKey: string) => {
|
||||
visible.value = true;
|
||||
loading.value = true;
|
||||
tabActiveName.value = 'bpmn';
|
||||
historyList.value = [];
|
||||
processApi.getHistoryRecord(instanceId).then((resp) => {
|
||||
processApi.getHistoryRecord(businessKey).then((resp) => {
|
||||
historyList.value = resp.data;
|
||||
loading.value = false;
|
||||
});
|
||||
await nextTick(() => {
|
||||
bpmnViewRef.value.init(instanceId);
|
||||
bpmnViewRef.value.init(businessKey);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -93,7 +93,7 @@
|
||||
size="small"
|
||||
type="primary"
|
||||
icon="Notification"
|
||||
@click="handleCancelProcessApply(scope.row.processInstanceVo.id)"
|
||||
@click="handleCancelProcessApply(scope.row.id)"
|
||||
>撤销</el-button
|
||||
>
|
||||
</template>
|
||||
|
@ -243,7 +243,7 @@ const handleStartWorkFlow = async (data: LeaveVO) => {
|
||||
};
|
||||
//审批记录
|
||||
const handleApprovalRecord = () => {
|
||||
approvalRecordRef.value.init(processInstanceId.value);
|
||||
approvalRecordRef.value.init(form.value.id);
|
||||
};
|
||||
//提交回调
|
||||
const submitCallback = async () => {
|
||||
|
@ -167,6 +167,8 @@ const categoryTreeRef = ref<ElTreeInstance>();
|
||||
const loading = ref(true);
|
||||
// 选中数组
|
||||
const ids = ref<Array<any>>([]);
|
||||
// 选中业务id数组
|
||||
const businessKeys = ref<Array<any>>([]);
|
||||
// 非单个禁用
|
||||
const single = ref(true);
|
||||
// 非多个禁用
|
||||
@ -257,6 +259,7 @@ const resetQuery = () => {
|
||||
// 多选框选中数据
|
||||
const handleSelectionChange = (selection: ProcessInstanceVO[]) => {
|
||||
ids.value = selection.map((item: any) => item.id);
|
||||
businessKeys.value = selection.map((item: any) => item.businessKey);
|
||||
single.value = selection.length !== 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
@ -281,14 +284,14 @@ const getProcessInstanceFinishList = () => {
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row: any) => {
|
||||
const id = row.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除id为【' + id + '】的数据项?');
|
||||
const businessKey = row.businessKey || businessKeys.value;
|
||||
await proxy?.$modal.confirm('是否确认删除业务id为【' + businessKey + '】的数据项?');
|
||||
loading.value = true;
|
||||
if ('running' === tab.value) {
|
||||
await deleteRunAndHisInstance(id).finally(() => (loading.value = false));
|
||||
await deleteRunAndHisInstance(businessKey).finally(() => (loading.value = false));
|
||||
getProcessInstanceRunningList();
|
||||
} else {
|
||||
await deleteFinishAndHisInstance(id).finally(() => (loading.value = false));
|
||||
await deleteFinishAndHisInstance(businessKey).finally(() => (loading.value = false));
|
||||
getProcessInstanceFinishList();
|
||||
}
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
@ -308,7 +311,7 @@ const handleInvalid = async (row: ProcessInstanceVO) => {
|
||||
loading.value = true;
|
||||
if ('running' === tab.value) {
|
||||
let param = {
|
||||
processInstanceId: row.id,
|
||||
businessKey: row.businessKey,
|
||||
deleteReason: deleteReason.value
|
||||
};
|
||||
await deleteRunInstance(param).finally(() => (loading.value = false));
|
||||
|
Loading…
x
Reference in New Issue
Block a user