<template>
	<el-card style="height: 100%;">
		<el-row :gutter="20">
			<el-col :span="isPreview ? 24 : 18">
				<el-scrollbar>
					<FlowFormView :process-instance-id="projectId"/>
					<ProjectExitFeedbackDetail :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>
<script setup lang="ts">
import { getProjectExitPlanFeedbackByProcessInstanceId } from "/@/api/investment/projectExitPlan";
import ProjectExitFeedbackDetail from "/@/components/investment/common/ProjectExitFeedbackDetail.vue";
import ApprovalAction from "/@/components/workbench/common/ApprovalAction.vue";
import FlowFormView from '/@/components/workbench/common/FlowFormView.vue'
import type { ProjectTask } from '/@/views/invMid/projectExitPlan/interface/type';
const taskId = ref<string>('0');
const status = ref<'pending' | 'reviewed' | 'withdrawable'>('pending');
const projectId = ref<string>('0');
const route = useRoute()
const isPreview = route.query.isPreview === 'true'
const detailForm = ref<ProjectTask>({} as ProjectTask);
const getDetail = (id:string) =>{
	getProjectExitPlanFeedbackByProcessInstanceId(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>