ny
昨天 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<script lang="ts" setup>
import { computed, onMounted, unref, watch } from 'vue';
import { useRoute } from 'vue-router';
 
import { usePopup } from '@jnpf/ui/popup';
import { decodeByBase64 } from '@jnpf/utils';
 
import { useTabs } from '@vben/hooks';
 
import { checkInfo } from '#/api/workFlow/task';
import FlowParser from '#/views/workFlow/components/FlowParser.vue';
 
defineOptions({ name: 'WorkFlowDetail' });
 
const route = useRoute();
const { closeCurrentTab } = useTabs();
const [registerFlowParser, { openPopup: openFlowParser }] = usePopup();
 
const getConfig = computed(() => route.query.config);
 
watch(
  () => unref(getConfig),
  () => {
    // initData();
  },
  { deep: true },
);
 
function initData() {
  // type 1-我发起的 2-待办 3-抄送
  if (!unref(getConfig)) return;
  const config = JSON.parse(decodeByBase64(unref(getConfig) as string));
  const data = {
    id: config.taskId,
    flowId: config.flowId,
    opType: config.opType,
    operatorId: config.operatorId,
    hideCancelBtn: true,
  };
  checkInfo(data.operatorId || data.id, data.opType)
    .then((res) => {
      data.opType = res.data.opType;
      openFlowParser(true, data);
    })
    .catch(() => {
      closeCurrentTab();
    });
}
function handleClose(close = true) {
  close && closeCurrentTab();
}
 
onMounted(() => {
  initData();
});
</script>
<template>
  <div class="jnpf-content-wrapper bg-white">
    <FlowParser @register="registerFlowParser" @reload="handleClose" />
  </div>
</template>