<script lang="ts" setup>
|
import { nextTick, onMounted, reactive } from 'vue';
|
import { useRoute } from 'vue-router';
|
|
import { useAccessStore } from '@vben/stores';
|
|
import { getFlowTaskInfo } from '#/api/workFlow/task';
|
import FlowProcessMain from '#/components/FlowProcess/src/Main.vue';
|
|
interface State {
|
nodeList: any;
|
flowInfo: any;
|
loading: boolean;
|
key: number;
|
}
|
|
const state = reactive<State>({
|
nodeList: {},
|
flowInfo: {},
|
loading: false,
|
key: Date.now(),
|
});
|
const route = useRoute();
|
const accessStore = useAccessStore();
|
|
function init() {
|
const query = route.query;
|
if (!query.token) return;
|
state.loading = true;
|
accessStore.setAccessToken(query.token as string);
|
nextTick(() => {
|
getBeforeInfo(query);
|
});
|
}
|
function getBeforeInfo(query) {
|
getFlowTaskInfo(query.id || '0', { operatorId: query.operatorId, flowId: query.flowId, opTypw: query.opTypw })
|
.then((res) => {
|
state.flowInfo = res.data.flowInfo || {};
|
state.nodeList = res.data.nodeList || [];
|
state.loading = false;
|
state.key = Date.now();
|
})
|
.catch(() => {
|
state.loading = false;
|
});
|
}
|
|
onMounted(() => {
|
init();
|
});
|
</script>
|
<template>
|
<FlowProcessMain
|
class="pt-[10px]"
|
:flow-info="state.flowInfo"
|
:node-list="state.nodeList"
|
:is-preview="true"
|
:no-show-scale="true"
|
v-if="state.flowInfo.id"
|
:key="state.key" />
|
</template>
|