<template>
<div>
	<el-form ref="form" :model="form" label-width="140px" >

	      <el-form-item label="姓名" prop="name">
	        <el-input v-model="form.name" placeholder="请输入姓名" />
	      </el-form-item>
	      <el-form-item label="性别" prop="sex">
	        <el-input v-model="form.sex" placeholder="请输入性别" />
	      </el-form-item>
	      <el-form-item label="年龄" prop="age">
	        <el-input v-model="form.age" placeholder="请输入年龄" />
	      </el-form-item>
	      <el-form-item label="地区" prop="address">
	        <el-input v-model="form.address" placeholder="请输入地区" />
	      </el-form-item>
	      <el-form-item label="行为习惯" prop="habits">
	        <el-input v-model="form.habits" placeholder="请输入行为习惯" />
	      </el-form-item>
	      <el-form-item label="患病时间" prop="illnessTime">
	        <el-input v-model="form.illnessTime" placeholder="请输入患病时间" />
	      </el-form-item>
	      <el-form-item label="身体状态" prop="body">
	        <el-input v-model="form.body" placeholder="请输入身体状态" />
	      </el-form-item>
	      <el-form-item label="学习到的章节" prop="study">
	        <el-input v-model="form.study" placeholder="请输入学习到的章节" />
	      </el-form-item>
		  <el-form-item label="学习课程" prop="course">
		    <el-input v-model="form.course" placeholder="请输入学习到的章节" />
		  </el-form-item>
	      <el-form-item label="今日课程完成情况" prop="courseStatus">
	        <el-input v-model="form.courseStatus" placeholder="请输入今日课程完成情况" />
	      </el-form-item>
		  <el-form-item label="家人的疾病" prop="familyDisease">
		    <el-input v-model="form.familyDisease" placeholder="请输入家人的疾病" />
		  </el-form-item>
		  <el-form-item label="疾病" prop="disease">
		    <el-input v-model="form.disease" placeholder="请输入疾病" />
		  </el-form-item>
	      <el-form-item label="是否线下就诊" prop="isLine">
	        <el-input v-model="form.isLine" placeholder="是否线下就诊" />
	      </el-form-item>
	      <el-form-item label="家人的疾病" prop="familyDisease">
	        <el-input v-model="form.familyDisease" placeholder="请输入家人的疾病" />
	      </el-form-item>
	      <el-form-item label="交流状态" prop="talk">
	        <el-input v-model="form.talk" placeholder="请输入交流状态" />
	      </el-form-item>
	      <el-form-item label="用户分类" prop="userType">
	       <el-input v-model="form.userType" placeholder="用户分类" />
	      </el-form-item>
	      <el-form-item label="是否本人会诊" prop="isSelf">
	        <el-input v-model="form.isSelf" placeholder="请输入是否本人会诊" />
	      </el-form-item>
	      <el-form-item label="什么情况加重或缓解" prop="intensify">
	        <el-input v-model="form.intensify" placeholder="请输入什么情况加重或缓解" />
	      </el-form-item>
	      <el-form-item label="是否怕热或者怕冷" prop="isCold">
	        <el-input v-model="form.isCold" placeholder="请输入是否怕热或者怕冷" />
	      </el-form-item>
	      <el-form-item label="怕冷或怕热的部位" prop="coldBody">
	        <el-input v-model="form.coldBody" placeholder="请输入怕冷或怕热的部位" />
	      </el-form-item>
	      <el-form-item label="出汗情况" prop="sweat">
	        <el-input v-model="form.sweat" placeholder="请输入出汗情况" />
	      </el-form-item>
	      <el-form-item label="其他情况" prop="other">
	        <el-input v-model="form.other" placeholder="请输入其他情况" />
	      </el-form-item>
	      <el-form-item label="大小便情况" prop="toilet">
	        <el-input v-model="form.toilet" placeholder="请输入大小便情况" />
	      </el-form-item>
	      <el-form-item label="饮食情况" prop="eat">
	        <el-input v-model="form.eat" placeholder="请输入饮食情况" />
	      </el-form-item>
	      <el-form-item label="经期如何" prop="menses">
	        <el-input v-model="form.menses" placeholder="请输入经期如何 女 55岁以下" />
	      </el-form-item>
	      <el-form-item label="现在使用的药品" prop="medicine">
	        <el-input v-model="form.medicine" placeholder="请输入现在使用的药品" />
	      </el-form-item>
	      <el-form-item label="体质" prop="constitution">
	        <el-input v-model="form.constitution" placeholder="请输入体质" />
	      </el-form-item>
	      <el-form-item label="推荐用药" prop="recommendMedicine">
	        <el-input v-model="form.recommendMedicine" placeholder="请输入推荐用药" />
	      </el-form-item>
	      <el-form-item label="咨询产品" prop="consultProduct">
	        <el-input v-model="form.consultProduct" placeholder="请输入咨询产品" />
	      </el-form-item>
	      <el-form-item label="是否已经购买产品" prop="isBuy">
	        <el-input v-model="form.isBuy" placeholder="请输入是否已经购买产品" />
	      </el-form-item>
	      <el-form-item label="已经购买的产品" prop="buyProduct">
	        <el-input v-model="form.buyProduct" placeholder="请输入已经购买的产品" />
	      </el-form-item>
	      </el-form>
	      <div slot="footer" class="dialog-footer" style="float: right;margin-bottom: 20px;">
	        <el-button type="primary" @click="submitForm">修 改</el-button>
	      </div>
</div>
 <!-- <div style="background-color: #f0f2f5; padding-bottom: 20px; min-height: 100%; " >
    <div style="padding: 20px; background-color: #fff;">
      用户信息
    </div>
    <div class="contentx" v-if="item!=null">
        <div class="desct">
          用户信息
        </div>
        <el-descriptions title="" :column="2" border>
        <el-descriptions-item label="姓名" ><span v-if="item!=null">{{item.name}}</span></el-descriptions-item>
        <el-descriptions-item label="年龄" ><span v-if="item!=null">{{item.age}}</span></el-descriptions-item>
        <el-descriptions-item label="性别" ><dict-tag :options="sexOptions" :value="item.sex"/></el-descriptions-item>
        <el-descriptions-item label="地区" ><span v-if="item!=null">{{item.address}}</span></el-descriptions-item>
        <el-descriptions-item label="行为习惯" ><span v-if="item!=null">{{item.habits}}</span></el-descriptions-item>
        <el-descriptions-item label="患病时间" ><span v-if="item!=null">{{item.illnessTime}}</span></el-descriptions-item>
		<el-descriptions-item label="身体状态" ><span v-if="item!=null">{{item.body}}</span></el-descriptions-item>
		<el-descriptions-item label="学习到的章节" ><span v-if="item!=null">{{item.study}}</span></el-descriptions-item>
		<el-descriptions-item label="今日课程完成情况" ><span v-if="item!=null">{{item.courseStatus}}</span></el-descriptions-item>
		<el-descriptions-item label="提及的家人" ><span v-if="item!=null">{{item.family}}</span></el-descriptions-item>
		<el-descriptions-item label="家人的疾病" ><span v-if="item!=null">{{item.familyDisease}}</span></el-descriptions-item>
		<el-descriptions-item label="交流状态" ><span v-if="item!=null">{{item.talk}}</span></el-descriptions-item>
        <el-descriptions-item label="创建时间" ><span v-if="item!=null">{{item.createTime}}</span></el-descriptions-item>
        <el-descriptions-item label="修改时间" ><span v-if="item!=null">{{item.updateTime}}</span></el-descriptions-item>
        </el-descriptions>
    </div>
</div> -->
</template>

<script>
import {getUserInfo} from '@/api/qw/externalContact'
import { addExternalContactInfo, updateExternalContactInfo } from "@/api/qw/externalContactInfo";
  export default {
    name: "externalContactinfo",

    data() {
      return {
        sexOptions: [],
        form:{
				id: null,
				externalContactId: null,
				name: null,
				sex: null,
				age: null,
				address: null,
				habits: null,
				illnessTime: null,
				body: null,
				study: null,
				courseStatus: null,
				family: null,
				familyDisease: null,
				talk: null,
				userType: null,
				isSelf: null,
				intensify: null,
				isCold: null,
				coldBody: null,
				sweat: null,
				other: null,
				toilet: null,
				eat: null,
				menses: null,
				medicine: null,
				constitution: null,
				recommendMedicine: null,
				consultProduct: null,
				isBuy: null,
				buyProduct: null
			}
      }
    },
    created() {
      this.getDicts("sys_user_sex").then(response => {
        this.sexOptions = response.data;
      });
    },
    methods: {
      getDetails(id) {
		  this.form={
					id: null,
					externalContactId: null,
					name: null,
					sex: null,
					age: null,
					address: null,
					habits: null,
					illnessTime: null,
					body: null,
					study: null,
					courseStatus: null,
					family: null,
					familyDisease: null,
					talk: null,
					userType: null,
					isSelf: null,
					intensify: null,
					isCold: null,
					coldBody: null,
					sweat: null,
					other: null,
					toilet: null,
					eat: null,
					menses: null,
					medicine: null,
					constitution: null,
					recommendMedicine: null,
					consultProduct: null,
					isBuy: null,
					buyProduct: null
		  	}
			this.form.externalContactId=id
          getUserInfo(id).then(response => {

			if(response.data!=null&&response.data!=''){
				this.form = response.data;
			}
          });
      },
	  cancel(){
		  this.open = false;
	  },
	    /** 提交按钮 */
	    submitForm() {
	      this.$refs["form"].validate(valid => {
	        if (valid) {
	          if (this.form.id != null) {
	            updateExternalContactInfo(this.form).then(response => {
	              this.msgSuccess("修改成功");
	              this.open = false;
	               this.$parent.$parent.closeInfo();
	            });
	          } else {
	            addExternalContactInfo(this.form).then(response => {
	              this.msgSuccess("新增成功");
	              this.open = false;
	               this.$parent.$parent.closeInfo();
	            });
	          }
	        }
	      });
	    },
    }
  }
</script>
<style>
  .contentx{
      height: 100%;
      background-color: #fff;
      padding: 0px 20px 20px;


      margin: 20px;
  }
  .el-descriptions-item__label.is-bordered-label{
    font-weight: normal;
  }
  .el-descriptions-item__content {
    max-width: 150px;
    min-width: 100px;
  }
  .desct{
      padding-top: 20px;
      padding-bottom: 20px;
      color: #524b4a;
      font-weight: bold;
    }
</style>


