new Vue({
  el: '#app',
  data: {
   	symptoms:[
   		{key:"NO_SYMPTOM",name:'无症状',value:'',code:'0'},
   		{key:"HEADACHE",name:'头痛头晕',value:'',code:'1'},
   		{key:"NAUSEA",name:'恶心呕吐',value:'',code:'1'},
   		{key:"VERTIGO_TINNITUS",name:'眼花耳鸣',value:'',code:'1'},
   		{key:"DIFFICULTY_BREATHING",name:'呼吸困难',value:'',code:'1'},
   		{key:"PALPITATIONS",name:'心悸胸闷',value:'',code:'1'},
   		{key:"EPISTAXIS_BLEEDING",name:'鼻衄出血不止',value:'',code:'1'},
   		{key:"LIMBS_NUMB",name:'四肢发麻',value:'',code:'1'},
   		{key:"EXTREMITY_EDEMA",name:'下肢水肿',value:'',code:'1'},
   		{key:"POLYDIPSIA",name:'多饮',value:'',code:'1'},
   		{key:"MORE_FOOD",name:'多食',value:'',code:'1'},
   		{key:"MORE_URINE",name:'多尿',value:'',code:'1'},
   		{key:"BLURRED_VISION",name:'视力模糊',value:'',code:'1'},
   		{key:"INFECTION",name:'感染',value:'',code:'1'},
			{key:"NUMB_HANDS",name:'四肢麻痹',value:'',code:'1'},
			{key:"WEIGHT_LOSS",name:'体重下降',value:'',code:'1'}
   	],//症状
    hypoglycemia:"",//低血糖反应
    remark: "",//其他
    readonly:false,
    objData:''
  },
  mounted: function() {
  	var vm = this
  	var Request = GetRequest();
  	recordAPI.getFollowupProjectData({id:Request["id"],followupProject:1}).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.symptoms;
				for(var key in data){
					if(key == "HYPOG_REACT_CODE"){
						vm.hypoglycemia = data[key]
					}else if(key == "SYMPTOM_OTHER"){
						vm.remark = data[key]
					}else{
						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 = {}
      $(".inline-container-l input:checked").each(function(i,v){//把所有被选中的复选框的值存入数组
           checkID[$(this).attr('name')] = $(this).attr('code')
        });
        $(".row-line-item-2 input:checked").each(function(i,v){//把所有被选中的复选框的值存入数组
           checkID[$(this).attr('name')] = $(this).val()
        });
        checkID['SYMPTOM_OTHER'] = $("textarea").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)
				}
			})
  	}
  }
})