<template>
  <div v-if="visibility" class="Dialog">
    <div class="DialogTit">
      <div class="back" @click="cancle()">
        <span class="iconfont">&#xe720; </span>返回
      </div>
      <h1 class="name">{{patient_prop.name}} [透析号 {{patient_prop.dialysis_no}} ]</h1>
      <span @click="comfirm" class="success" >确定</span
      >
    </div>

    <div class="DialogContent">
        <div class="item">
          <label class="name" for="txms">本次透析日期</label>
          <div class="content">
            <span class="text" id="txms"> {{dialysis_date}}</span>

          </div>
        </div>
        <div class="item">
          <label class="name" for="txms">透前体重（kg）</label>
          <div class="content">
            <span class="text" id="txms">{{predialysis.weight_before}}</span>

          </div>
        </div>
        <div class="item">
          <label class="name" for="txms">干体重（kg）</label>
          <div class="content">
            <span class="text" id="txms">{{dry}}</span>

          </div>
        </div>
        <div class="item">
          <label class="name" for="txms">衣物重（kg）</label>
          <div class="content">
            <span class="text" id="txms">{{predialysis.additional_weight}}</span>

          </div>
        </div>
        <div class="item">
          <label class="name" for="txms">体重增加（kg）</label>
          <div class="content">
            <span class="text" id="txms">{{add_weight}}</span>

          </div>
        </div>
        <div class="item">
          <label class="name" for="txms">透后体重（kg）</label>
          <div class="content">
            <span class="text" id="txms">{{record.weight_after}}</span>

          </div>
        </div>
        <div class="item">
          <label class="name" for="txms">体重减少（kg）</label>
          <div class="content">
            <span class="text" id="txms">{{record.weight_loss}}</span>

          </div>
        </div>
        <div class="item">
          <label class="name" for="txms">上次透后体重（kg）</label>
          <div class="content">
            <span class="text" id="txms">{{predialysis.weight_after_last_transparency}}</span>

          </div>
        </div>
    </div>
  </div>
</template>

<script>
  import {parseTime} from '@/utils'

  export default {
    name: 'MsgTip',
    created () {
      if (this.predialysis&&this.predialysis.weight_before > 0 && this.predialysis.weight_after_last_transparency > 0) {
        this.add_weight = parseFloat(this.predialysis.weight_before - this.predialysis.weight_after_last_transparency).toFixed(2)
      }

      console.log(this.dry_weight )
      if(this.dry_weight != null){
        this.dry = this.dry_weight.dry_weight
      }else{

        this.dry = this.last_predialysis.dry_weight

      }


    },
    data () {
      return {
        result: [],
        id: 0,
        selectName: '',
        add_weight:0,
        dry:0,
      }
    },
    props: {
      predialysis: {
        type: Object
      },
      visibility: {
        type: Boolean,
        default: false
      },
      last_predialysis: {
        type: Object
      },
      record: {
        type: Object
      },
      last_record: {
        type: Object
      },
      patient_prop: {
        type: Object
      },
      prescription_prop: {
        type: Object
      },dry_weight:{
        type: Object
      },
    },
    computed: {
    dialysis_date: function () {
      return parseTime(this.$route.query.date, '{y}/{m}/{d}')
      }
    },
    methods: {


      cancle: function () {
        this.$emit('menu-msg-tip')
      },
      comfirm: function () {
        this.$emit('menu-msg-tip')
      },
      getValue: function () {
        let form = {}

        let results = []

        for (let i = 0; i < this.propsForm.list.length; i++){
          for (let a = 0; a < this.propsForm.result.length; a++){
            if( this.propsForm.list[i].id == this.propsForm.result[a]){
              results.push(this.propsForm.list[i])
            }
          }
        }

        var obj5={}
        results = results.reduce((cur, next) => {
          obj5[next.id] ? '' : obj5[next.id] = true && cur.push(next)
          return cur
        }, [])

        results

        return results
      },

    },
    watch: {
      visibility (val) {
        //初始化数据操作
      }
    }
  }
</script>

<style style="stylesheet/scss" lang="scss" scoped>
  .optionsBox {
  background: #fff;
  max-height: 10rem;
  min-height: 5rem;
  @media only screen and (max-width: 812px) {
  min-height: 8rem !important;
  }
  ul {
  overflow-y: scroll;
  max-height: 9rem;
  li {
  height: 1.1rem;
  line-height: 1.1rem;
  border-bottom: 1px #e5e5e5 solid;
  padding: 0 0.38rem;
  font-size: 0.36rem;
  color: $title-color;
  }
  .tick {
  position: relative;
  &::before {
  content: "";
  display: inline-block;
  border: 2px solid $main-color;
  border-top-width: 0;
  border-right-width: 0;
  width: 0.3rem;
  height: 0.15rem;
  -webkit-transform: rotate(-50deg);
  position: absolute;
  top: 0.38rem;
  right: 0.44rem;
  }
  }
  }
  }
  .CheckBox {
  background: #fff;
  max-height: 6.8rem;
  min-height: 5rem;
  overflow-y: scroll;
  @media only screen and (max-width: 812px) {
  max-height: 8rem !important;
  min-height: 8rem !important;
  }

  ul {
  li {
  line-height: 1rem;
  }
  }
  }
</style>
