<template>
	<div class="planReleaseDetail pageContent">
		<h3 class="detail_title">轮换计划下发</h3>
		<DIYForm :model="FormData" :options="formOptions" />
		<div class="table_list" v-for="(item, index) in TableOptions" :key="index">
			<h4 class="table_title">{{ item.title }}</h4>
			<a-table :dataSource="item.data" :columns="item.column">
				<template #bodyCell="{ column, record, index }">
					<template v-if="column.key === 'INDEX'">{{ index + 1 }}</template>
					<template v-if="column.key === 'COUNT'">
						<a-input-number v-model:value="record[column.prop]" />
					</template>
					<template v-else-if="column.key === 'CZ'">
						<a-button class="view" @click="onViewRow(record)">查看</a-button>
					</template>
				</template>
			</a-table>
		</div>
		<div class="detail_footer">
			<a-button type="primary" style="width: 200px; height: 40px" @click="onPub">下发</a-button>
		</div>
	</div>
</template>
<script setup name="planReleaseDetail">
	import global from '@/api/basic.info/global'
	const formOptions = [
		{ label: '轮换计划文号', name: '_轮换计划文号', mode: 'input' },
		{ label: '轮换计划名称', name: '_轮换计划名称', mode: 'input' },
		{ label: '计划年度', name: '_计划年度', mode: 'input' },
		{ label: '开始执行时间', name: '_开始执行时间', mode: 'date' },
		{ label: '截止执行时间', name: '_截止执行时间', mode: 'date' },
		{ label: '轮换数量', name: '_轮换数量', mode: 'number' },
		{
			label: '上传附件',
			name: '_上传附件',
			mode: 'file',
			change(ev) {
				return global.uploadFile(ev).then((reg) => {
					return reg
				})
			}
		}
	]

	const TableOptions = [
		{
			title: '轮出库',
			data: [{}],
			column: [
				{ title: '序号', width: 100, align: 'center', key: 'INDEX' },
				{ title: '粮库名称', align: 'center', dataIndex: '_粮库名称' },
				{ title: '仓房名称', align: 'center', dataIndex: '_仓房名称' },
				{ title: '货位名称', align: 'center', dataIndex: '_货位名称' },
				{ title: '品种', align: 'center', dataIndex: '_品种' },
				{ title: '性质', align: 'center', dataIndex: '_性质' },
				{ title: '等级', align: 'center', dataIndex: '_等级' },
				{ title: '数量', align: 'center', key: 'COUNT', prop: '_数量' },
				{ title: '入库年限', align: 'center', dataIndex: '_入库年限' },
				{ title: '入库核定价', align: 'center', dataIndex: '_入库核定价' }
			]
		},
		{
			title: '轮入',
			data: [{}],
			column: [
				{ title: '序号', width: 100, align: 'center', key: 'INDEX' },
				{ title: '粮库名称', align: 'center', dataIndex: '_粮库名称' },
				{ title: '品种', align: 'center', dataIndex: '_品种' },
				{ title: '性质', align: 'center', dataIndex: '_性质' },
				{ title: '生产年限', align: 'center', dataIndex: '_生产年限' },
				{ title: '数量', align: 'center', key: 'COUNT', prop: '_数量' }
			]
		}
	]
	const FormData = reactive({})

	const lists = ['']

	function onPub() {}
</script>
<style lang="less" scoped>
	.pageContent {
		background: #fff;
		padding: 10px 20px;
		.detail_title {
			font-weight: bold;
			font-size: 20px;
			margin: 10px 0;
		}
		.table_title {
			font-size: 16px;
			font-weight: bold;
			margin: 10px 0;
		}
		.detail_footer {
			margin: 20px;
			display: flex;
			justify-content: center;
			align-items: center;
		}
	}
</style>
