<!-- 项目退出-->
<script setup lang="ts">
import {onMounted} from 'vue';
import type { ProjectTask } from '../projectExitPlan/interface/type';
import ApprovalAction from '/@//components/workbench/common/ApprovalAction.vue';
import { getProjectExitPlanByProcessInstanceId } from '/@/api/investment/projectExitPlan';
import ProjectExitPlanFormDetail from '/@/components/investment/common/ProjectExitPlanFormDetail.vue';
import FlowFormView from '/@/components/workbench/common/FlowFormView.vue'
import {ref} from "vue";
const route = useRoute();
const isPreview = route.query.isPreview === 'true'
const taskId = ref<string>('0');
const status = ref<'pending' | 'reviewed' | 'withdrawable'>('pending');
const projectId = ref<string>('0');
const detailForm = ref<ProjectTask>({} as ProjectTask);
const getDetail = (id:string) =>{
	getProjectExitPlanByProcessInstanceId(id).then(res =>{
		detailForm.value = res.data
	});
}

onMounted(() =>{
	if (route.query.processInstanceId){
		taskId.value = <string>route.query.taskId;
		projectId.value = <string>route.query.processInstanceId;
		getDetail(projectId.value);
	}
});
</script>
<template>
	<el-card style="height: 100%;">
		<el-row :gutter="20">
			<el-col :span="isPreview ? 24 : 18">
				<el-scrollbar>
					<FlowFormView :process-instance-id="projectId"/>
					<project-exit-plan-form-detail :model-value="detailForm" title="项目退出审核"/>
				</el-scrollbar>
			</el-col>
			<el-col :span="6" v-if="!isPreview">
				<ApprovalAction :status="status" :task-id="taskId" :process-instance-id="projectId"/>
			</el-col>
		</el-row>
		
	</el-card>
</template>
<style scoped></style>