<script setup lang="ts">
import {reactive,ref} from 'vue';
import layout from '/@/views/h5/layout/index.vue';
import {getCommitteeApplicationByProcessInstanceId} from "/@/api/common";
import {useRoute} from "vue-router"
const router = useRoute()
interface showText {
	title?: string;
	label?: string;
	content?: string;
	key?: string;
	isFile?: boolean;
	isOneCol?:boolean;
	unit?: string;
	isTableTitle?: boolean;
	children?: showText[]
}
const showTextArray = reactive<showText[]>([
	{label:'申请部门',key:'applicationDept',isFile:false},
	{label:'申请时间',key:'createTime',isFile:false},
	{label:'提交评审事项',key:'reviewNotes',isFile:false,isOneCol:true},
	{label: '项目名称', key: 'projectName', isFile: false},
	{label:'评审资料清单',key:'attachmentList',isFile:true},
	{label:'申请部门(单位)意见',key:'applicationDeptOpinion',isFile:false,isOneCol:true},
	{label:'投资发展部意见',key:'investmentDeptOpinion',isFile:false,isOneCol:true},
	{label:'相关配合部门意见',key:'cooperationDeptOpinion',isFile:false,isOneCol:true},
	{label:'集团分管领导意见',key:'groupLeaderOpinion',isFile:false,isOneCol:true},
])
const testData = reactive({
	applicationDept: '投资发展部',
	createTime: '2024-09-20',
	reviewNotes: '关于XX市智慧城市建设项目中期评审的申请',
	projectName: 'XX市智慧城市建设项目',
	attachmentList: '/attachments/review-documents.zip',
	applicationDeptOpinion: '项目进展顺利，已完成前期投资目标的85%，建议进行中期评审。',
	investmentDeptOpinion: '经审核，项目资金使用合理，进度符合预期，同意提交评审。',
	cooperationDeptOpinion: '配合部门已完成相关技术支持工作，无异议。',
	groupLeaderOpinion: '项目具有示范意义，建议加快推进并组织专家评审。'
});
const processInstanceId = ref()
onMounted(()=>{
	processInstanceId.value = router.query.processInstanceId
	if (processInstanceId.value){
		getCommitteeApplicationByProcessInstanceId(processInstanceId.value).then(res => {
			Object.assign(testData,res.data)
		})
	}
})

</script>

<template>
	<layout title="专委会评审信息审核" task-id="" :process-instance-id="processInstanceId">
		<div class="investment-list" >
			<div class="investment-item" v-for="item in showTextArray" :key="item.key" :class="item.isOneCol ? 'one-col' : ''">
				<div class="title" v-if="item.title">{{item.title}}</div>
				<div class="label">{{item.label}}</div>
				<div class="content">
					<upload-file v-if="item.isFile" :model-value="JSON.parse(testData[item.key])" disabled/>
					<div v-else><span>{{testData[item.key]}}</span><span v-if="item.unit">{{item.unit}}</span></div>
				</div>
			</div>
		</div>
	</layout>
</template>

<style scoped lang="scss">
.investment-list {
	height: 100%;
	display: flex;
	flex-wrap: wrap;
	font-size: 14px;
	box-sizing: border-box;

}
.investment-list .investment-item {
	width: 50%;
	margin: 8px 0;
	box-sizing: border-box;
}
.investment-list .investment-item .title {
	width: 100%;
	font-size: 16px;
	font-weight: 700;
}
.investment-list .investment-item .label {
	color: #858585;
	padding: 0;
	margin-bottom: 5px;
	text-align: left;
	box-sizing: border-box;
}
.investment-list .investment-item .content {
	color: #333333;
	line-height: 1;
}
.investment-list .one-col {
	width: 100%;
}
</style>