<template>
    <div>
      <div class="jiange">
        <el-radio-group v-model="titleradio">
            <el-radio v-for="(item,index ) in xingwei" :label="item.value" :key="index">{{ item.label }}</el-radio>
        </el-radio-group>
      </div>
      <div>
        <div v-if="titleradio == 1">
          <table border="1" class="table">
            <thead>
              <tr>
                <td>无法配合完成护理评估成人量表</td>
                <td>0</td>
                <td>1</td>
                <td>2</td>
              </tr>
            </thead>
            <tbody>
              <tr class="bg_color">
                <td>1、脸部肌肉/表情</td>
                <td v-for="(item,index) in chengr_face" :key="index">
                  <el-radio v-model="radio_crface" :label="item.value" @change="chengrface">{{ item.label }}</el-radio>
                </td>
              </tr>
              <tr class="">
                <td>2、休息</td>
                <td v-for="(item,index) in chengr_rest" :key="index">
                  <el-radio v-model="radio_crrest" :label="item.value" @change="chengrface">{{ item.label }}</el-radio>
                </td>
              </tr>
              <tr class="bg_color">
                <td>3、肌紧张 </td>
                <td v-for="(item,index) in chengr_jijinz" :key="index">
                  <el-radio v-model="radio_crjijinz" :label="item.value" @change="chengrface">{{ item.label }}</el-radio>
                </td>
              </tr>
              <tr class="">
                <td>4、发声</td>
                <td v-for="(item,index) in chengr_fasheng" :key="index">
                  <el-radio v-model="radio_fasheng" :label="item.value" @change="chengrface">{{ item.label }}</el-radio>
                </td>
              </tr>
              <tr class="bg_color">
                <td>5、安抚</td>
                <td v-for="(item,index) in chengr_anfu" :key="index">
                  <el-radio v-model="radio_anfu" :label="item.value" @change="chengrface">{{ item.label }}</el-radio>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
        <div v-if="titleradio == 2">
          <table border="1" class="table" style="white-space:pre-wrap;">
            <thead>
              <tr>
                <td style="width: 17%;">老年痴呆症疼痛估量表</td>
                <td style="width: 27%;">0</td>
                <td style="width: 27%;">1</td>
                <td style="width: 27%;">2</td>
              </tr>
            </thead>
             <tbody>
             <tr class="bg_color">
                <td>1、呼吸</td>
                <td v-for="(item,index) in laor_huxi" :key="index" >
                  <div>
                    <el-radio v-model="radio_lrhuxi" :label="item.value" @change="laorhuxi"
                    style="white-space: normal;">
                    {{ item.label }}
                    </el-radio>
                  </div>
                </td>
              </tr>
              <tr class="">
                <td>2、负面声音表达</td>
                <td v-for="(item,index) in laor_fumian" :key="index">
                  <div style="Word-break: break-all">
                    <el-radio v-model="radio_lrfumian" :label="item.value" @change="laorhuxi"
                    style="white-space: normal;">{{ item.label }}</el-radio>
                  </div>
                </td>
              </tr>
               <tr class="bg_color">
                <td>3、面部表情</td>
                <td v-for="(item,index) in laor_mianbu" :key="index">
                  <el-radio v-model="radio_lrmianbu" :label="item.value" @change="laorhuxi"
                  style="white-space: normal;">{{ item.label }}</el-radio>
                </td>
              </tr>
              <tr class="">
                <td>4、身体语言</td>
                <td v-for="(item,index) in laor_shengti" :key="index">
                  <el-radio v-model="radio_lrshengti" :label="item.value" @change="laorhuxi"
                  style="white-space: normal;">{{ item.label }}</el-radio>
                </td>
              </tr>
              <tr class="bg_color">
                <td>5、可安抚程度</td>
                <td v-for="(item,index) in laor_keanfu" :key="index">
                  <el-radio v-model="radio_lrkeanfu" :label="item.value" @change="laorhuxi"
                  style="white-space: normal;">{{ item.label }}</el-radio>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
        <div v-if="titleradio == 3">
          <table border="1" class="table">
            <thead>
              <tr>
                <td>重症监护患者疼痛观察量表</td>
                <td>0</td>
                <td>1</td>
                <td>2</td>
              </tr>
            </thead>
            <tbody>
              <tr class="bg_color">
                <td>1、面部表情</td>
                <td v-for="(item,index) in zhongzhen_mianbu" :key="index">
                  <el-radio v-model="radio_zzmianbu" :label="item.value" @change="zhongzheng"
                  style="white-space: normal;">{{ item.label }}</el-radio>
                </td>
              </tr>
              <tr class="">
                <td>2、身体运动</td>
                <td v-for="(item,index) in zhongzhen_shengti" :key="index">
                  <el-radio v-model="radio_zzshengti" :label="item.value" @change="zhongzheng"
                  style="white-space: normal;">{{ item.label }}</el-radio>
                </td>
              </tr>
              <tr class="bg_color">
                <td>3、肌紧张（对上肢被动屈伸的评估）</td>
                <td v-for="(item,index) in zhongzhen_jjinz" :key="index">
                  <el-radio v-model="radio_zzjjinz" :label="item.value" @change="zhongzheng"
                  style="white-space: normal;">{{ item.label }}</el-radio>
                </td>
              </tr>
              <tr class="">
                <td>4、机械通气的顺应（插管患者）</td>
                <td v-for="(item,index) in zhongzhen_jixie" :key="index">
                  <el-radio v-model="radio_zzjixie" :label="item.value" @change="zhongzheng"
                  style="white-space: normal;">{{ item.label }}</el-radio>
                </td>
              </tr>
              <tr class="bg_color">
                <td>5、发声（未插管患者）</td>
                <td v-for="(item,index) in zhongzhen_fashen" :key="index">
                  <el-radio v-model="radio_zzfasheng" :label="item.value" @change="zhongzheng"
                  style="white-space: normal;">{{ item.label }}</el-radio>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
        <div v-if="titleradio == 4">
          <table border="1" class="table">
            <thead>
              <tr>
                <td>2月-7岁患儿疼痛评估量表</td>
                <td>0</td>
                <td>1</td>
                <td>2</td>
              </tr>
            </thead>
            <tbody>
              <tr class="bg_color">
                <td>1、Face（脸）</td>
                <td v-for="(item,index) in huanz_face" :key="index">
                  <el-radio v-model="radio_hzface" :label="item.value" @change="huanzhe">{{ item.label }}</el-radio>
                </td>
              </tr>
              <tr class="">
                <td>2、Leg（腿）</td>
                <td v-for="(item,index) in huanz_leg" :key="index">
                  <el-radio v-model="radio_hzleg" :label="item.value" @change="huanzhe">{{ item.label }}</el-radio>
                </td>
              </tr>
              <tr class="bg_color">
                <td>3、Activity（活动度）</td>
                <td v-for="(item,index) in huanz_activ" :key="index">
                  <el-radio v-model="radio_hzactiv" :label="item.value" @change="huanzhe">{{ item.label }}</el-radio>
                </td>
              </tr>
              <tr class="">
                <td>4、Cry(哭闹)</td>
                <td v-for="(item,index) in huanz_cry" :key="index">
                  <el-radio v-model="radio_hzcry" :label="item.value" @change="huanzhe">{{ item.label }}</el-radio>
                </td>
              </tr>
              <tr class="bg_color">
                <td>5、Consolability（可安慰性）</td>
                <td v-for="(item,index) in huanz_consola" :key="index">
                  <el-radio v-model="radio_hzcon" :label="item.value" @change="huanzhe">{{ item.label }}</el-radio>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
</template>

<script>
export default{
  data(){
    return{
      titleradio:1,
      radio_crface:'',
      radio_crrest:'',
      radio_crjijinz:'',
      radio_fasheng:'',
      radio_anfu:'',

      radio_lrhuxi:'',
      radio_lrfumian:'',
      radio_lrmianbu:'',
      radio_lrshengti:'',
      radio_lrkeanfu:'',

      radio_zzmianbu:'',
      radio_zzshengti:'',
      radio_zzjjinz:'',
      radio_zzjixie:'',
      radio_zzfasheng:'',

      radio_hzface:'',
      radio_hzleg:'',
      radio_hzactiv:'',
      radio_hzcry:'',
      radio_hzcon:'',

      xingwei:[{value:1,label:'成人量表'},{value:2,label:'老年痴呆症量表'},{value:3,label:'重症患者量表'},{value:4,label:'2月-7岁患者量表'}],
      chengr_face:[{label:'脸部肌肉放松',value:0,name:'face'},{label:'脸部肌肉紧张、皱眉，脸部肌肉扭曲',value:1,name:'face'},{label:'经常或一直皱眉、咬紧牙床',value:2,name:'face'}],
      chengr_rest:[{label:'安静、表情安详，肢体活动正常',value:0,name:'rest'},{label:'偶然有些休息不好，或改变体位',value:1,name:'rest'},{label:'躁动不安，无法休息；频繁改变休息体位',value:2,name:'rest'}],
      chengr_jijinz:[{label:'肌张力正常，肌肉放松',value:0,name:'jinzhang'},{label:'肌张力增加，手指或脚趾屈曲',value:1,name:'jinzhang'},{label:'肌肉僵硬',value:2,name:'jinzhang'}],
      chengr_fasheng:[{label:'无异声发声',value:0,name:'fasheng'},{label:'偶尔发出呻吟，哼声，哭泣或啜泣',value:1,name:'fasheng'},{label:'频繁或持续地发出呻吟，哼声，哭泣或啜泣',value:2,name:'fasheng'}],
      chengr_anfu:[{label:' 满足的，放松的',value:0,name:'anfu'},{label:'通过谈话或分散注意力得到了安抚',value:1,name:'anfu'},{label:'很难通过抚摸或谈话得到安抚',value:2,name:'anfu'}],

      laor_huxi:[{label:'正常',value:0},{label:'偶尔呼吸困难，短时期的换气过度',value:1},
                {label:'呼吸困难，要发出吵闹声响，长时期的换气过度，Cheyne-Strokes呼吸',value:2}],
      laor_fumian:[{label:'无异常发声',value:0},{label:'偶尔呻吟，哼声，哭泣；低沉的声音带有负面语气',value:1},
                  {label:'频繁或持续地、重复性的叫嚷，大声呻吟，哭泣',value:2}],
      laor_mianbu:[{label:'微笑，无特殊表情',value:0},{label:' 脸部肌肉紧张，皱眉；难过，恐惧',value:1},{label:'经常或一直皱眉，愁眉苦脸',value:2}],
      laor_shengti:[{label:'放松或保持正常的姿势	',value:0},{label:'肌张力紧张，绷紧，紧张步伐，坐立不安',value:1},
                  {label:'肌肉僵硬，紧握拳头，膝盖提起，拉扯或推开，推攘',value:2}],
      laor_keanfu:[{label:'满足的，放松的',value:0},{label:'通过谈话、分散注意力或触摸',value:1},
                {label:'通过分散注意力或触摸、安慰，也不可安抚患者',value:2}],

      zhongzhen_mianbu:[{label:'脸部肌肉放松',value:0},{label:'脸部肌肉紧张、皱眉，眼轮匝肌紧固',value:1},
                        {label:'经常或一直皱眉、眼轮匝肌紧固、眼部紧闭，呈痛苦面容',value:2}],
      zhongzhen_shengti:[{label:'完全无运动（无运动）',value:0},{label:'缓慢地运动、触摸痛点、通过运动寻求帮助（保护性运动）',value:1},
                          {label:'拽管、试图坐起、捶打，撞击床位、试图下床、烦躁不安',value:2}],
      zhongzhen_jjinz:[{label:'对被动运动无抵抗（放松）',value:0},{label:'对被动运动有抵抗紧张（僵硬）',value:1},
                      {label:'对被动运动强烈抵抗并不能停止（非常紧张、僵硬）',value:2}],
      zhongzhen_jixie:[{label:'未报警，机械通气顺畅（可耐受机械通气或转移）',value:0},{label:'自主呼吸报警（呛咳但可耐受）',value:1},
                      {label:'与呼吸机不同步，抵抗机械通气，频繁报警（抵偿机械通气）',value:2}],
      zhongzhen_fashen:[{label:'无异常发声',value:0},{label:'偶尔发出呻吟，哼声，哭泣或啜泣',value:1},
                        {label:'频繁或持续地发出呻吟，哼声，哭泣或啜泣',value:2}],

      huanz_face:[{label:'微笑无特殊表情',value:0},{label:'偶尔出现痛苦表情、皱眉、不愿交流',value:1},
                  {label:'经常或持续出现下颚颤抖或紧咬下颚',value:2}],
      huanz_leg:[{label:'放松或保持平常的姿势',value:0},{label:'不安，紧张，持续于不舒服姿势',value:1},{label:'踢腿或腿部拖动',value:2}],
      huanz_activ:[{label:'安静躺着，正常体位或轻松活动',value:0},{label:'扭动、翻来覆去、紧张',value:1},{label:' 身体痉挛，呈成弓形，僵硬',value:2}],
      huanz_cry:[{label:'不哭',value:0},{label:'呻吟声，啜泣，偶尔诉痛',value:1},{label:'一直哭泣，尖叫，经常诉痛',value:2}],
      huanz_consola:[{label:'满足，放松',value:0},{label:'通过抚摸拥抱和语言可以被安慰',value:1},{label:'难于被安慰',value:2}],
      face_val:0,
      rest_val:0,
      jijinz_val:0,
      fasheng_val:0,
      anfu_val:0,

      huxi_val:0,
      fumian_val:0,
      mianbu_val:0,
      shengti_val:0,
      keanfu_val:0,

      zzmian_val:0,
      zzshengti_val:0,
      zzjjinz_val:0,
      zzjixie_val:0,
      zzfasheng_val:0,

      hzface_val:0,
      hzleg_val:0,
      hzactiv_val:0,
      hzcry_val:0,
      hzcon_val:0,
      Totalpoints:0,
    }
  },
  methods:{
    chengrface(e){
      console.log('1111',this.radio_crface,e);
      if(e == this.radio_crface){
        this.face_val = e
      }if(e == this.radio_crrest){
        this.rest_val = e
      }if(e == this.radio_crjijinz){
        this.jijinz_val = e
      }if(e == this.radio_fasheng){
        this.fasheng_val = e
      }if(e == this.radio_anfu) {
        this.anfu_val = e
      }
      const total = this.face_val + this.rest_val + this.jijinz_val + this.fasheng_val + this.anfu_val
      var params={
        titleradio:this.titleradio,
        radio_crface:this.radio_crface,
        radio_crrest:this.radio_crrest,
        radio_crjijinz:this.radio_crjijinz,
        radio_fasheng:this.radio_fasheng,
        radio_anfu:this.radio_anfu,
        total:total,
      }
      this.$emit('submit',params)
    },
    laorhuxi(e){
      if(e == this.radio_lrhuxi){
        this.huxi_val = e
      }if(e == this.radio_lrfumian){
        this.fumian_val = e
      }if(e == this.radio_lrmianbu){
        this.mianbu_val = e
      }if(e == this.radio_lrshengti){
        this.shengti_val = e
      }if(e == this.radio_lrkeanfu) {
        this.keanfu_val = e
      }
      const total = this.huxi_val + this.fumian_val + this.mianbu_val + this.shengti_val + this.keanfu_val
      var params={
        titleradio:this.titleradio,
        radio_lrhuxi:this.radio_lrhuxi,
        radio_lrfumian:this.radio_lrfumian,
        radio_lrmianbu:this.radio_lrmianbu,
        radio_lrshengti:this.radio_lrshengti,
        radio_lrkeanfu:this.radio_lrkeanfu,
        total:total,
      }
      this.$emit('submit',params)
    },
    zhongzheng(e){
      if(e == this.radio_zzmianbu){
        this.zzmian_val = e
      }if(e == this.radio_zzshengti){
        this.zzshengti_val = e
      }if(e == this.radio_zzjjinz){
        this.zzjjinz_val = e
      }if(e == this.radio_zzjixie){
        this.zzjixie_val = e
      }if(e == this.radio_zzfasheng) {
        this.zzfasheng_val = e
      }
      const total = this.zzmian_val + this.zzshengti_val + this.zzjjinz_val + this.zzjixie_val + this.zzfasheng_val
      var params={
        titleradio:this.titleradio,
        radio_zzmianbu:this.radio_zzmianbu,
        radio_zzshengti:this.radio_zzshengti,
        radio_zzjjinz:this.radio_zzjjinz,
        radio_zzjixie:this.radio_zzjixie,
        radio_zzfasheng:this.radio_zzfasheng,
        total:total,
      }
      this.$emit('submit',params)
    },
    huanzhe(e){
      if(e == this.radio_hzface){
        this.hzface_val = e
      }if(e == this.radio_hzleg){
        this.hzleg_val = e
      }if(e == this.radio_hzactiv){
        this.hzactiv_val = e
      }if(e == this.radio_hzcry){
        this.hzcry_val = e
      }if(e == this.radio_hzcon) {
        this.hzcon_val = e
      }
      const total = this.hzface_val + this.hzleg_val + this.hzactiv_val + this.hzcry_val + this.hzcon_val
      var params={
        titleradio:this.titleradio,
        radio_hzface:this.radio_hzface,
        radio_hzleg:this.radio_hzleg,
        radio_hzactiv:this.radio_hzactiv,
        radio_hzcry:this.radio_hzcry,
        radio_hzcon:this.radio_hzcon,
        total:total,
      }
      this.$emit('submit',params)
    }
  },
  mounted(){
    this.$emit('Totalpoints',this.Totalpoints)
  },
  computed:{
    // tt_Totalpoints(){
    //   if( this.radio == '成人量表'){
    //     return this.Totalpoints = this.face_val + this.rest_val + this.jijinz_val + this.fasheng_val + this.anfu_val
    //     // return this.radio_crface + this.radio_crrest + this.radio_crjijinz + this.radio_fasheng + this.radio_anfu
    //   }else if(this.radio == '老年痴呆症量表'){
    //     return this.huxi_val + this.fumian_val + this.mianbu_val + this.shengti_val + this.keanfu_val
    //   }else if (this.radio == '重症患者量表') {
    //     return this.zzmian_val + this.zzshengti_val + this.zzjjinz_val + this.zzjixie_val + this.zzfasheng_val
    //   }else if (this.radio == '2月-7岁患者量表') {
    //     return this.hzface_val + this.hzleg_val + this.hzactiv_val + this.hzcry_val + this.hzcon_val
    //   }

    // }
  }

}
</script>

<style lang="scss" scoped>
  .jiange{
      margin-left: 20px;
      color: black;
      line-height: 40px;
  }
  .table{
      border: 1px solid #DCDFE6;
      border-collapse:collapse;
      border-spacing: 0;
      width: 98%;
      margin:10px auto;
      thead td{
          text-align: center;
      }
      tbody td{
          font-size: 15px;
          padding: 5px;
      }
      tr td{
          line-height: 30px;
      }
      .bg_color{
          background: rgb(243, 240, 240);
      }
      input{
          -webkit-appearance: checkbox;
      }
  }

</style>
