<template>
	<el-dialog v-model="visible" title="盘点详情" width="900px" @close="onClose">
		<el-descriptions :column="3" border style="margin-bottom: 16px">
			<el-descriptions-item label="盘点编号">{{ detail.check_no }}</el-descriptions-item>
			<el-descriptions-item label="状态">{{ detail.status_display }}</el-descriptions-item>
			<!-- <el-descriptions-item label="用时">{{ detail.duration_display }}</el-descriptions-item> -->
			<el-descriptions-item label="开始时间">{{ detail.start_time_display || detail.start_time }}</el-descriptions-item>
			<el-descriptions-item label="结束时间">{{ detail.end_time_display || detail.end_time }}</el-descriptions-item>
			<el-descriptions-item label="盘点人">{{ detail.checker_name }}</el-descriptions-item>
			<!-- <el-descriptions-item label="发起人">{{ detail.creator_name }}</el-descriptions-item>
			<el-descriptions-item label="备注">{{ detail.remark }}</el-descriptions-item>
			<el-descriptions-item label="设备总数">{{ detail.devices_count }}</el-descriptions-item>
			<el-descriptions-item label="已盘点">{{ detail.scanned_devices_count }}</el-descriptions-item>
			<el-descriptions-item label="差异数">{{ detail.difference_devices_count }}</el-descriptions-item> -->
		</el-descriptions>

		<el-table :data="detail.details || []" height="420px">
			<el-table-column type="index" label="序号" width="60" />
			<el-table-column prop="device_code" label="设备编号" min-width="140" />
			<el-table-column prop="device_name" label="设备名称" min-width="140" />
			<el-table-column prop="device_category" label="分类" min-width="120" />
			<!-- <el-table-column prop="device_unit" label="单位" width="80" /> -->
			<el-table-column prop="original_quantity" label="原数量" width="90" />
			<el-table-column prop="scanned_quantity" label="实盘数量" width="100" />
			<el-table-column prop="difference" label="差异" width="80" />
			<el-table-column prop="difference_type" label="差异类型" min-width="120" />
			<el-table-column prop="last_scan_time_display" label="最后扫描时间" min-width="160" />
		</el-table>
	</el-dialog>
</template>

<script setup lang="ts">
import { ref } from 'vue';

const visible = ref(false);
const detail = ref<any>({});

const openWithData = (data: any) => {
	detail.value = data || {};
	visible.value = true;
};

const onClose = () => {
	detail.value = {};
};

defineExpose({ visible, openWithData });
</script>

<style scoped>
</style>


