<template>
	<view class="mb-5">
		<view class="m-3">
			<view class="centerY mt-3">
				<view class="bule_line" style=""></view>
				<text class="font-bold text-dark ml-2 fs-16 line-height1">全年检查计划</text>
			</view>
			<view class="mt-3 bg-white p-3">
				<view class="">
					<view class="mtable-title centerY bg-primary text-white fs-12">
						<view class=" w-20">
							时间
						</view>
						<view class=" text-center w-80">
							检查项
						</view>
					</view>
					<view v-if="yearCheck.length>0" class="mtable-body-item centerY fs-12" v-for="(item,index) in yearCheck" style="color: #868687;">
						<view class="w-20">
							{{item.date}}
						</view>
						<view class="w-80">
							<span>{{item.value}}</span>
						</view>
					</view>
					<view class="px-3 pb-3 mt-n2" v-if="yearCheck.length==0">
						<Empty title="没有随眼底检查" class="py-5" />
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
		import Empty from '@/component/empty/empty.vue'
	import Moment from 'moment'
	let res = {"code":0,"msg":"ok","data":[{"bloodPressure":"血压","footLook":"足外观、足背动脉搏动","signs":"身高/体重","bloodSugar":"血糖","bloodGlucose3":"糖化血红蛋白检查","Waist":"腰围","bloodFat":"TC、HDL⁃C、LDL⁃C、TG","serumCreatinine":"血肌酐、尿素氮"},{"bloodPressure":"血压","urinaryAlbumin":"尿白蛋白/尿肌酐","routineUrine":"尿常规","signs":"身高/体重","bloodSugar":"血糖","Waist":"腰围"},{"bloodPressure":"血压","signs":"身高/体重","bloodSugar":"血糖","liverFunction":"肝功能","Waist":"腰围"},{"bloodPressure":"血压","footLook":"足外观、足背动脉搏动","signs":"身高/体重","bloodSugar":"血糖","bloodGlucose3":"糖化血红蛋白检查","Waist":"腰围","ecg":"心电图"},{"bloodPressure":"血压","fundus":"视力及眼底","signs":"身高/体重","bloodSugar":"血糖","Waist":"腰围"},{"bloodPressure":"血压","signs":"身高/体重","bloodSugar":"血糖","Waist":"腰围","neuropathy":"神经病变的相关检查"},{"bloodPressure":"血压","footLook":"足外观、足背动脉搏动","signs":"身高/体重","bloodSugar":"血糖","bloodGlucose3":"糖化血红蛋白检查","Waist":"腰围"},{"bloodPressure":"血压","routineUrine":"尿常规","signs":"身高/体重","bloodSugar":"血糖","Waist":"腰围"},{"bloodPressure":"血压","signs":"身高/体重","bloodSugar":"血糖","Waist":"腰围"},{"bloodPressure":"血压","footLook":"足外观、足背动脉搏动","signs":"身高/体重","bloodSugar":"血糖","bloodGlucose3":"糖化血红蛋白检查","Waist":"腰围"},{"bloodPressure":"血压","signs":"身高/体重","bloodSugar":"血糖","Waist":"腰围"},{"bloodPressure":"血压","signs":"身高/体重","bloodSugar":"血糖","Waist":"腰围"}],"data2":null}
	export default {
		components: {
			Empty
		},
		name:"AnnualInspectionPlan",
		props:{
			propData: {
				type: Object,
				default () {
					return {
						yearCheck: []
					}
				},
			},
		},
		data() {
			return {
				yearCheck:[]
			}
		},
		watch: {
			propData: {
				handler(val) {
					this.getyearCheck(val)
				},
			},
		},
		created() {
			
		},
		methods: {
			 async getyearCheck(res) {
			      // this.yearCheck = data
			     let data = res.yearCheck ? res.yearCheck : []
			      let data1 = []
			      data.map((item) => {
			        let str = ''
			        let arr = Object.values(item)
			        arr.map((item1, index) => {
			          str += index + 1 + '. ' + item1 + '；'
			        })
			        data1.push(str)
			      })
			      let yearList = (function () {
			        let date = new Date()
			        let arr = []
			        for (let i = 0; i < 12; i++) {
			          arr.push(
			            date.getFullYear() +
			              '-' +
			              Moment(date.getFullYear()).add(i, 'months').format('MM')
			          )
			        }
			        return arr
			      })()
			      // console.log(data1,yearList,this.yearCheck)
			      let yearCheck1 = []
			      yearList.map((item, index) => {
			        yearCheck1.push({ date: item, value: data1[index] })
			      })
			      this.yearCheck = yearCheck1
			    },
		}
	}
</script>

<style lang="scss">
	page {
		background: #F5F9FF;
	}

	.mtable {
		&-title {
			border-radius: 50rpx;
			padding: 20rpx;
			box-shadow: 0px 2px 7px 1px rgba(45, 142, 255, 0.5);
		}

		&-body {
			&-item {
				margin-top: 20rpx;
				border-radius: 50rpx;
				padding: 20rpx;
				background-color: #F6F9FE;
				color: #868687;
			}
		}
	}
</style>
