<!-- 进度申报审核-->
<script setup lang="ts">
import { onMounted } from 'vue';
import ApprovalAction from '/@//components/workbench/common/ApprovalAction.vue';
import { useRoute } from 'vue-router';
import ProjectProgressReportFormDeatils from '/@/components/investment/common/ProjectProgressReportFormDeatils.vue';
import {
	getInvestmentProjectsProgressGetByProcessInstanceIdAPI,
} from '/@/api/investment/progressOfInvestmentProjects';
import { InvestmentProjectProgress } from '/@/views/invMid/progressReport/interface/type';
import FlowFormView from '/@/components/workbench/common/FlowFormView.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 detailFormData = ref<InvestmentProjectProgress>({} as InvestmentProjectProgress);
const getProjectDetail = (id: string) => {
	getInvestmentProjectsProgressGetByProcessInstanceIdAPI(id).then(res => {
		detailFormData.value = res.data
	});
}
onMounted(() => {
	if (route.query.processInstanceId) {
		taskId.value = <string>route.query.tId;
		projectId.value = <string>route.query.processInstanceId;
		getProjectDetail(projectId.value);
	}
});
</script>

<template>
	<el-card>
		<el-row :gutter="20">
			<el-col :span="isPreview ? 24 : 18">
				<FlowFormView :process-instance-id="projectId" />
				<ProjectProgressReportFormDeatils v-model="detailFormData" title="投资项目进度审核" />
			</el-col>
			<el-col :span="6" v-if="!isPreview">
				<ApprovalAction :status="status" :approval-records="[]" :task-id="taskId"
					:process-instance-id="projectId" />
			</el-col>
		</el-row>
	</el-card>
</template>

<style scoped lang="scss"></style>
