<template>
	<a-drawer
		:title="'签样单详情'"
		:width="600"
		: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.licensePlate }}</a-descriptions-item>
				<a-descriptions-item label="司机姓名">{{ formData.driverName }}</a-descriptions-item>
				<a-descriptions-item label="水份(%)">{{ formData.samplingShuiFen }}</a-descriptions-item>
				<a-descriptions-item label="容重">{{ formData.samplingRongZhong }}</a-descriptions-item>
				<a-descriptions-item label="不完善率">{{ formData.samplingQueShao }}</a-descriptions-item>
				<a-descriptions-item label="霉变">{{ formData.samplingMeiBian }}</a-descriptions-item>
				<a-descriptions-item label="杂质">{{ formData.samplingZaZhi }}</a-descriptions-item>
				<a-descriptions-item label="价格">{{ formData.samplingPrice }}</a-descriptions-item>
				<a-descriptions-item label="粮食种类">{{ formData.grainGroup }}</a-descriptions-item>
				<a-descriptions-item label="粮食类型">{{ formData.grainType }}</a-descriptions-item>
				<a-descriptions-item label="确认状态">{{ formData.saveState }}</a-descriptions-item>
				<a-descriptions-item label="确认时间">{{ formData.saveTime }}</a-descriptions-item>
				<a-descriptions-item label="扦样状态">{{ formData.samplingType }}</a-descriptions-item>
				<a-descriptions-item label="扦样区图片">
					<a v-if="formData.truckPicInOne" :href="formData.truckPicInOne" target="_blank">
						<img :src="formData.truckPicInOne" alt="avatar" style="max-height: 100px; max-width: 100px"/>
						<p></p></a>
					<a v-if="formData.truckPicInTwo" :href="formData.truckPicInTwo" target="_blank">
						<img :src="formData.truckPicInTwo" alt="avatar" style="max-height: 100px; max-width: 100px"/>
						<p></p></a>
					<a v-if="formData.truckPicOutOne" :href="formData.truckPicOutOne" target="_blank">
						<img :src="formData.truckPicOutOne" alt="avatar" style="max-height: 100px; max-width: 100px"/>
						<p></p></a>
					<a v-if="formData.truckPicOutTwo" :href="formData.truckPicOutTwo" target="_blank">
						<img :src="formData.truckPicOutTwo" alt="avatar" style="max-height: 100px; max-width: 100px"/>
						<p></p></a>
				</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="depotRepayOrderForm">
import {message} from 'ant-design-vue'
import tool from '@/utils/tool'
import {cloneDeep} from 'lodash-es'
import {required, rules} from '@/utils/formRules'
import depotRepayOrderApi from '@/api/biz/depotRepayOrderApi'
import dictOptionsApi from "@/api/biz/dictOptionsApi";
import depotGrainInfoApi from "@/api/biz/depotGrainInfoApi";

// 抽屉状态
const visible = ref(false)
const emit = defineEmits({successful: null})
const formRef = ref()
// 表单数据
const formData = ref({})
const submitLoading = ref(false)
const depotShedOptions = ref([])
const depotOptions = ref([])

// 打开抽屉
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>
