<template>
	<view class="content">
		<u-form :model="formData" ref="uForm" label-align="right">
			<u-form-item label="库区名称" label-width="130px">
				<u-input readonly v-model="formData.orgName" type="text" />
			</u-form-item>
			<u-form-item label="计划名称" label-width="130px">
				<u-input readonly v-model="formData.planName" type="text" />
			</u-form-item>
			<u-form-item label="计划单号" label-width="130px">
				<u-input readonly v-model="formData.planNumber" type="text" />
			</u-form-item>
			<u-form-item label="计划类型" label-width="130px">
				<u-input readonly v-model="formData.planType" type="text" />
			</u-form-item>
			<u-form-item label="计划开始时间" label-width="130px">
				<u-input readonly v-model="formData.startDate" type="text" />
			</u-form-item>
			<u-form-item label="计划结束时间" label-width="130px">
				<u-input readonly v-model="formData.endDate" type="text" />
			</u-form-item>
			<u-form-item label="计划数量" label-width="130px">
				<u-input readonly v-model="formData.planQuantity" type="text" />
			</u-form-item>
			<u-form-item label="完成数量" label-width="130px">
				<u-input readonly v-model="formData.completedQuantity" type="text" />
			</u-form-item>
			<u-form-item label="计划进度" label-width="130px">
				<u-input readonly v-model="formData.planRate" type="text" />
			</u-form-item>
		</u-form>
	</view>
</template>

<script>
	import * as api from "@/api/statisticalQuery.js"
	export default {

		data() {
			return {
				formData: {}
			}
		},
		onLoad(option) {
			this.getDrtails(option.id)
		},
		methods: {
			getDrtails(id) {
				api.getBuyPlanDetails({
					id
				}).then(res => {
					if (res.code == 200) {
						this.formData = res.data
						this.formData.planType = this.formData.planType == 1 ? '粮食轮换计划' : '油料轮换计划'
						if (this.formData.planRate > 0) {
							this.formData.planRate = (this.formData.planRate * 100).toFixed(2) + '%';
						} else {
							this.formData.planRate = this.formData.planRate + '%'
						}

					}

				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		margin: 10px 20px;

		.tabBox {
			margin: 10px 0 30px 0;

			.u-subsection__bar {
				width: 25%;
			}
		}

		.u-form {
			overflow: hidden;

			.u-form-item {
				float: left;
				margin-right: 10px;
				width: calc(100%/ 2 - 10px);
			}
		}
	}
</style>