<template>
	<wd-cell-group title="申请信息">
		<wd-cell title="用车单位" :value="info.usingDepart_dictText" />
		<wd-cell title="车型" :value="info.vehicleModel" />
		<wd-cell title="车牌号" :value="info.carNumber" />
		<wd-cell title="驾驶员姓名" :value="info.driverName" />
		<wd-cell title="派车领导" :value="info.carLeader_dictText" />
		<wd-cell title="出车工作日" :value="info.workingDay + '天'" />
		<wd-cell title="劳动合同号" :value="info.ldhth" />
		<wd-cell title="开始时间" :value="info.startTime" />
		<wd-cell title="结束时间" :value="info.endTime" />
		<wd-cell title="附件" v-if="info.path">
			<template v-for="(img, index) in image" :key="index">
				<wd-img :width="100" :height="100" :src="img" :enable-preview="true" />
			</template>
		</wd-cell>
		<wd-cell title="交办任务" :value="info.taskAssigned" />
		<wd-cell title="备注" :value="info.remarks" />
	</wd-cell-group>
</template>

<script setup>
	import {
		queryCarRentalByIdApi
	} from '@/api/bpm'
	import {
		imgUrl
	} from '@/utils/index'

	const info = ref({})
	const image = ref([])
	const props = defineProps({
		formData: {
			type: Object,
			default: () => {},
		}
	})

	// 申请信息
	const queryById = () => {
		queryCarRentalByIdApi(props.formData.dataId).then((res) => {
			if (res.success) {
				info.value = res.result.records[0]
				if (info.value.fj) {
					image.value = info.value.fj.split(',').map(path => imgUrl(path))
				}
			}
		})
	}

	onMounted(() => {
		queryById()
	})
</script>