<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.depotBizType }}</a-descriptions-item>
				<a-descriptions-item label="车牌">{{ formData.licensePlate }}</a-descriptions-item>
				<a-descriptions-item label="异常分类">{{ formData.alarmType }}</a-descriptions-item>
				<a-descriptions-item label="异常信息">{{ formData.alarmMsg }}</a-descriptions-item>
				<a-descriptions-item label="异常时间">{{ formData.createTime }}</a-descriptions-item>
				<a-descriptions-item label="处理进程状态">{{ formData.saveState }}</a-descriptions-item>
				<a-descriptions-item label="处理信息">{{ formData.saveMsg }}</a-descriptions-item>
				<a-descriptions-item label="处理人员">{{ formData.saveUser }}</a-descriptions-item>
				<a-descriptions-item label="处理时间">{{ formData.saveTime }}</a-descriptions-item>
				<a-descriptions-item label="处理图片">
					<a v-if="formData.savePicUrl" :href="formData.savePicUrl" target="_blank">
						<img :src="formData.savePicUrl" alt="avatar" style="max-height: 100px; max-width: 100px"/></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="depotWorkAlarmForm">
import tool from '@/utils/tool'
import {cloneDeep} from 'lodash-es'
import {required} from '@/utils/formRules'
import depotWorkAlarmApi from '@/api/biz/depotWorkAlarmApi'
import dictOptionsApi from "@/api/biz/dictOptionsApi";
import sysConfig from "@/config";
import fileApi from "@/api/dev/fileApi";
// 抽屉状态
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)
		/*if (formData.value.savePicUrl) {
			// 让其回显
			formData.value.savePicUrl = sysConfig.API_URL + formData.value.savePicUrl
		}*/
	}
}
// 关闭抽屉
const onClose = () => {
	formRef.value.resetFields()
	formData.value = {}
	visible.value = false
}
// 抛出函数
defineExpose({
	onOpen
})
</script>
