<template>
	<view class="container">
		<view class="form">
			<view class="form_item" v-if="details.farmName">
				<view class="left">养殖场名称:</view>
				<view class="nr">{{details.farmName}}</view>
			</view>
			<view class="form_item" v-if="details.breedVariety">
				<view class="left">养殖品种:</view>
				<view class="nr"><block v-for="(dict,i) in yzlist" :key="i"><span v-if="details.breedVariety == dict.itemValue">{{dict.itemText}}</span></block></view>
			</view>
			<view class="form_item" v-if="details.breedScale">
				<view class="left">现有存栏:</view>
				<view class="nr">{{details.breedScale}}头</view>
			</view>
			<view class="form_item" v-if="details.countYear">
				<view class="left">年份:</view>
				<view class="nr">{{details.countYear}}年</view>
			</view>
			<view class="form_item" v-if="details.fecesQuantity">
				<view class="left">固体粪便产生量:</view>
				<view class="nr">{{details.fecesQuantity}}吨/年</view>
			</view>
			<view class="form_item" v-if="details.urineQuantity">
				<view class="left">液体产生量:</view>
				<view class="nr">{{details.urineQuantity}}立方米</view>
			</view>
			<view class="form_item" v-if="details.farmName">
				<view class="left">混合产生量:</view>
				<view class="nr">{{details.mixQuantity}}立方米</view>
			</view>
			<view class="form_item" v-if="details.controlMode1">
				<view class="left">治污模式:</view>
				<view class="nr">{{details.controlMode1}}</view>
			</view>
			<view class="form_item" v-if="details.useMode1">
				<view class="left">利用模式:</view>
				<view class="nr">{{details.useMode1}}</view>
			</view>
			<view class="form_item" v-if="details.chargeAmount">
				<view class="left">收入金额:</view>
				<view class="nr">{{details.chargeAmount}}元</view>
			</view>
			<view class="bz_item" v-if="details.sNote">
				<view class="bz_top">
					备<span class="bz">注:</span>
				</view>
				<view class="bz_bot">
					<textarea style="width: 100%;" v-model="details.sNote" placeholder="请输入备注" disabled="true"/>
				</view>
			</view>
		</view>
		<view class="bot_btn">
			<button class="primary" @click="toback()">返 回</button>
		</view>
		<view class="pagebot"></view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
					details:{
						breedScale: "",
						breedVariety: "",
						chargeAmount: "",
						controlMode: "",
						countYear: "",
						createTime: "",
						createdBy: "",
						entId: "",
						entName: "",
						farmName: "",
						fecesQuantity: "",
						id: "",
						isDel: 0,
						mixQuantity: "",
						reVision: 0,
						sNote: "",
						tenantId: "",
						updatedBy: "",
						updatedTime: "",
						urineQuantity: "",
						useMode: "",
						breedVariety1:'',
						controlMode1:'',
						useMode1:''
					},
					index:'',
					date:'',
					year:'',
					number:'',
					tag:'',
					hobby: [],
					hobby2: [],
					hobby3: [],
					yzlist:[]
			}
		},
		onLoad(options) {
			this.details = JSON.parse(decodeURIComponent(options.item));
		},
		onShow() {
			this.getazsurvMulchRecord()
			this.getazsurvMulchRecord1()
			this.getazsurvMulchRecord2()
		},
		methods:{
			// 养殖品种
			getazsurvMulchRecord(){
				this.hobby = []
				let params = {}
				params.dictCode = 'dict_breed_type'
				this.$http.get('/applet/Dict/getDictByType',{params:params}).then(res=>{
					this.yzlist = res.data.data
					for(var i=0;i<res.data.data.length;i++){
						this.hobby.push({
							text:res.data.data[i].itemText,
							value:res.data.data[i].itemValue
						})
						console.log(this.hobby)
					}
				})
			},
			// 治污模式
			getazsurvMulchRecord1(){
				this.hobby2 = []
				let params = {}
				params.dictCode = 'surv_control_mode'
				this.$http.get('/applet/Dict/getDictByType',{params:params}).then(res=>{
					for(var i=0;i<res.data.data.length;i++){
						this.hobby2.push({
							text:res.data.data[i].itemText,
							value:res.data.data[i].itemValue
						})
					}
					for(var i=0;i<this.hobby2.length;i++){
						if(this.details.controlMode){
							if(this.details.controlMode == this.hobby2[i].value){
								this.details.controlMode1 = this.hobby2[i].itemText
							}
						}
					}
				})
			},
			// 利用模式
			getazsurvMulchRecord2(){
				this.hobby3 = []
				let params = {}
				params.dictCode = 'surv_use_mode'
				this.$http.get('/applet/Dict/getDictByType',{params:params}).then(res=>{
					for(var i=0;i<res.data.data.length;i++){
						this.hobby3.push({
							text:res.data.data[i].itemText,
							value:res.data.data[i].itemValue
						})
						console.log(this.hobby3)
					}
					for(var i=0;i<this.hobby3.length;i++){
						if(this.details.useMode){
							if(this.details.useMode == this.hobby3[i].value){
								this.details.useMode1 = this.hobby3[i].itemText
							}
						}
					}
				})
			},
			toback(){
				uni.navigateBack({
					delta:1
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		height: 100%;
		background-color: #fff;
	}
	.form{
		padding: 0 30rpx;
	}
	.form_item{
		display: flex;
		justify-content: space-between;
		padding: 30rpx 0rpx;
		border-bottom:1rpx solid #e4e4e4;
	}
	.left{
		font-weight: bold;
	}
	.nr{
		flex: 1;
		color: #767676;
		padding-left: 16rpx;
		text-align: right;
	}
	.dw{
		color: greenyellow;
	}
	.item_pic{
		border-bottom:1rpx solid #e4e4e4;
		padding: 30rpx 0rpx;
		font-weight: 500;
	}
	.imgList{
		display: flex;
		flex-wrap: wrap;
	}
	.imgList image{
		width: 130rpx;
		height: 130rpx;
		margin-right: 24rpx;
		margin-top: 20rpx;
	}
	.imgList image:nth-child(4n){
		margin-right: 0rpx;
	}
	.bz_item{
		padding: 40rpx 0rpx;
	}
	.bz_top{
		font-weight: bold;
		margin-bottom: 20rpx;
	}
	.bz{
		margin-left: 30rpx;
	}
	.bz_bot{
		color: #767676;
		line-height: 50rpx;
	}
	.bot_btn{
		padding: 0 30rpx;
		margin-top: 30rpx;
	}
	.primary{
		width: 100%;
		height: 90rpx;
		background-color: #0F6EFF;
		border: none;
		border-radius: 50rpx;
		color:#fff;
		font-weight: bold;
	}
	.dw{
		margin-left: 5rpx;
	}
	.pagebot{
		height: 200rpx;
	}
</style>