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