new Vue({
  el: '#app',
  data: {
   	inspects:[
   		{key:"EXAM_DATE",name:'检查时间',value:"",unit:'',code:'1'},
   		{key:"BS_FPG",name:'空腹血糖',value:"",unit:'mmol/L',code:'2'},
   		{key:"NO_BS_FPG",name:'餐后血糖',value:"",unit:'mmol/L',code:'3'},
   		{key:"RANDOM_BLOOD_SUGAR",name:'随机血糖',value:"",unit:'mmol/L',code:'4'},
   		{key:"BLOOD_FAT_TRIGLYCERIDE",name:'甘油三酯',value:"",unit:'mmol/L',code:'5'},
   		{key:"BLOOD_FAT_TC",name:'总胆固醇',value:"",unit:'mmol/L',code:'6'},
   		{key:"RENAL_FUNCTION_CREATININE",name:'血清肌酐',value:"",unit:'umol/L',code:'7'},
   		{key:"RENAL_FUNCTION_BUN",name:'血尿素氮',value:"",unit:'mmol/L',code:'28'},
   		{key:"GHB",name:'糖化血红蛋白',value:"",unit:'%',code:'9'},
   		{key:"BLOOD_FAT_LDLC",name:'低密度脂蛋白',value:"",unit:'mmol/L',code:'10'},
   		{key:"MICROALBUMINURIA",name:'尿微量白蛋白',value:"",unit:'μg/min',code:'11'}
   	],
   	objData:''
  },
  mounted: function() {
  	var vm = this
  	var Request = GetRequest();
  	recordAPI.getFollowupProjectData({id:Request["id"],followupProject:3}).then(function(res){
			if(res.status==200){
				var data = res.data;
				vm.objData = res.data
//				delete data["create_time"];delete data["followup_id"];delete data["followup_project"];delete data["id"];
				var allData = vm.inspects;
				for(var key in data){
					for(var j=0;j<allData.length;j++){
						if(allData[j].key == key){
							allData[j].value = data[key]
							break;
						}
					}
				}
			}
		})
  },
  methods:{
		saveButton:function(){
				var vm = this;
	      params = {id: vm.objData.followup_id, followupProject:vm.objData.followup_project}
	      var checkID = {}
	      $(".row-inline-item input").each(function(i,v){//把所有被选中的复选框的值存入数组
	           checkID[$(this).attr('name')] = $(this).val()
	        });
	        console.log(checkID)
	        params.followupProjectData = JSON.stringify(checkID);
					recordAPI.ModifyFollowupResult(params).then(function(res){
					if(res.status==200){
						toastr.error("保存成功")
					}else{
						toastr.error(res.msg)
					}
				})
		}
  }
})