<template>
	<a-drawer
		:title="'卸货详情'"
		:width="800"
		:visible="visible"
		:destroy-on-close="true"
		:footer-style="{ textAlign: 'right' }"
		@close="onClose"
	>
		<a-form ref="formRef" :model="formData" :rules="formRules" layout="vertical">
			<a-descriptions :column="1" size="middle" bordered class="mb-2">
				<a-descriptions-item label="车辆预约编码">{{ formData.truckBookId }}</a-descriptions-item>
				<a-descriptions-item label="车牌">{{ formData.licensePlate }}</a-descriptions-item>
				<a-descriptions-item label="后车牌">{{ formData.licensePlateBack }}</a-descriptions-item>
				<a-descriptions-item label="司机姓名">{{ formData.driverName }}</a-descriptions-item>
				<a-descriptions-item label="库位">{{ formData.shedName }}</a-descriptions-item>
				<a-descriptions-item label="载货照时间">{{ formData.onePicTime }}</a-descriptions-item>
				<a-descriptions-item label="载货照">
					<a v-if="formData.onePicUrl" :href="formData.onePicUrl" target="_blank">
						<img :src="formData.onePicUrl" alt="avatar" style="max-height: 100px; max-width: 100px"/></a>
				</a-descriptions-item>
				<a-descriptions-item label="卸货照时间">{{ formData.twoPicTime }}</a-descriptions-item>
				<a-descriptions-item label="卸货照">
					<a v-if="formData.twoPicUrl" :href="formData.twoPicUrl" target="_blank">
						<img :src="formData.twoPicUrl" alt="avatar" style="max-height: 100px; max-width: 100px"/></a>
				</a-descriptions-item>
				<a-descriptions-item label="粮食种类">{{ formData.grainGroup }}</a-descriptions-item>
				<a-descriptions-item label="粮食类型">{{ formData.grainType }}</a-descriptions-item>
			</a-descriptions>
		</a-form>
		<template #footer>
			<a-button style="margin-right: 8px" @click="onClose">关闭</a-button>
		</template>
	</a-drawer>
</template>

<script setup name="depotTruckBookForm">
import tool from '@/utils/tool'
import {cloneDeep} from 'lodash-es'
import {required, rules} from '@/utils/formRules'
import depotTruckBookApi from '@/api/biz/depotTruckBookApi'
import dictOptionsApi from "@/api/biz/dictOptionsApi"
// 抽屉状态
const visible = ref(false)
const emit = defineEmits({successful: null})
const formRef = ref()
// 表单数据
const formData = ref({})
const submitLoading = ref(false)

// 打开抽屉
const onOpen = (record) => {
	visible.value = true
	if (record) {
		let recordData = cloneDeep(record)
		formData.value = Object.assign({}, recordData)
	}
}
// 关闭抽屉
const onClose = () => {
	formRef.value.resetFields()
	formData.value = {}
	visible.value = false
}
// 默认要校验的
const formRules = {}
// 抛出函数
defineExpose({
	onOpen
})
</script>
