兰宝车间质量管理系统-前端
gssong
2024-05-31 58e6fdef78e4e8a8cb3bd7090ef900e9032cf714
update 优化流程实例接口全部按照业务id操作
已修改6个文件
63 ■■■■ 文件已修改
src/api/workflow/processInstance/index.ts 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/BpmnView/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Process/approvalRecord.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/workflow/leave/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/workflow/leave/leaveEdit.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/workflow/processInstance/index.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/workflow/processInstance/index.ts
@@ -29,33 +29,33 @@
};
/**
 * 通过流程实例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 @@
/**
 * 运行中的实例 删除程实例,删除历史记录,删除业务与流程关联信息
 * @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 @@
/**
 * 撤销流程
 * @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'
  });
};
src/components/BpmnView/index.vue
@@ -51,7 +51,7 @@
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 @@
        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;
src/components/Process/approvalRecord.vue
@@ -67,17 +67,17 @@
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);
  });
};
src/views/workflow/leave/index.vue
@@ -93,7 +93,7 @@
              size="small"
              type="primary"
              icon="Notification"
              @click="handleCancelProcessApply(scope.row.processInstanceVo.id)"
              @click="handleCancelProcessApply(scope.row.id)"
              >撤销</el-button
            >
          </template>
src/views/workflow/leave/leaveEdit.vue
@@ -243,7 +243,7 @@
};
//审批记录
const handleApprovalRecord = () => {
  approvalRecordRef.value.init(processInstanceId.value);
  approvalRecordRef.value.init(form.value.id);
};
//提交回调
const submitCallback = async () => {
src/views/workflow/processInstance/index.vue
@@ -167,6 +167,8 @@
const loading = ref(true);
// 选中数组
const ids = ref<Array<any>>([]);
// 选中业务id数组
const businessKeys = ref<Array<any>>([]);
// 非单个禁用
const single = ref(true);
// 非多个禁用
@@ -257,6 +259,7 @@
// 多选框选中数据
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 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 @@
  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));