update 优化流程实例接口全部按照业务id操作

This commit is contained in:
gssong 2024-05-31 22:11:25 +08:00
parent 2c9daae153
commit 58e6fdef78
6 changed files with 33 additions and 30 deletions

View File

@ -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'
});
};

View File

@ -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;

View File

@ -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);
});
};

View File

@ -93,7 +93,7 @@
size="small"
type="primary"
icon="Notification"
@click="handleCancelProcessApply(scope.row.processInstanceVo.id)"
@click="handleCancelProcessApply(scope.row.id)"
>撤销</el-button
>
</template>

View File

@ -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 () => {

View File

@ -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));