<template>
  <div>
    <div v-if="isShowDialog" class="Dialog">
      <div class="DialogTit">
        <span @click="close()" class="iconfont">&#xe6e9;</span>
        <h1 class="name">透后评估</h1>
        <span @click="commitInfo" class="success" v-if="hasPermission">保存</span>
        <span style="visibility: hidden;" class="success" v-if="!hasPermission">保存</span>
      </div>
      <div class="warnTxt" v-if="showTxt != ''">
        {{ showTxt }}
      </div>
      
      
      <div class="DialogContent" id="dialogTop">
       <div  class="item">
         <h2 class="name">
           <span  style="color:#7b8c9c" v-if="prescription_prop!=null">目标超滤量:{{prescription_prop.target_ultrafiltration}}</span>
           <span  style="color:#7b8c9c"  v-if="this.$store.getters.user.template_info.template_id != 9 && this.$store.getters.user.template_info.template_id != 17 && this.$store.getters.user.template_info.template_id != 20 && this.$store.getters.user.template_info.template_id != 21 && this.$store.getters.user.template_info.template_id != 22  && this.$store.getters.user.template_info.template_id != 23 && this.$store.getters.user.template_info.template_id != 24 && this.$store.getters.user.template_info.template_id != 26 && this.$store.getters.user.template_info.template_id != 28 && this.$store.getters.user.template_info.template_id != 27 && this.$store.getters.user.template_info.template_id != 29 && this.$store.getters.user.template_info.template_id != 30 && this.$store.getters.user.template_info.template_id != 31 && this.$store.getters.user.template_info.template_id != 32 && this.$store.getters.user.template_info.template_id != 34 && this.$store.getters.user.template_info.org_id!=9555">L</span>
           <span  style="color:#7b8c9c"  v-if="this.$store.getters.user.template_info.template_id == 9 || this.$store.getters.user.template_info.template_id == 17 || this.$store.getters.user.template_info.template_id == 20 || this.$store.getters.user.template_info.template_id == 21 || this.$store.getters.user.template_info.template_id == 22 || this.$store.getters.user.template_info.template_id == 23 || this.$store.getters.user.template_info.template_id == 24 || this.$store.getters.user.template_info.template_id == 26 || this.$store.getters.user.template_info.template_id == 28 || this.$store.getters.user.template_info.template_id == 27 || this.$store.getters.user.template_info.template_id == 29 || this.$store.getters.user.template_info.template_id == 30 || this.$store.getters.user.template_info.template_id == 31 || this.$store.getters.user.template_info.template_id == 32 || this.$store.getters.user.template_info.template_id == 34 || this.$store.getters.user.template_info.org_id==9555">ml</span>
           &nbsp;&nbsp;&nbsp;&nbsp;
           <span  style="color:#7b8c9c" v-if="predialysis!=null">透前体重:{{predialysis.weight_before}}kg</span></h2>
        </div>
  

        <div @click="openPicker" class="item" v-if="isShow('实际治疗时长')">
          <h2 class="name">实际治疗时长</h2>
          <div class="content">
            <span class="text" style="width: 100px">{{timeValue}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div class="item" v-if="isShow('实际超滤量')">
          <label
            v-if="template_id == 6 || template_id == 9 || template_id == 10 || template_id == 11 || template_id == 17 || template_id == 20 || template_id == 21 || template_id == 22 || template_id == 23 || template_id == 24 || template_id == 26 || template_id == 28 || template_id == 27 || template_id == 29 || template_id == 30 || template_id == 31 || template_id == 32 || template_id == 34 || this.$store.getters.user.template_info.org_id == 9555"
            class="name" for="sjcll">实际超滤量(ml)</label>
          <label v-else class="name" for="sjcll">实际超滤量(L)</label>
          <div class="content">
            <input
              type="number"
              id="sjcll"
              @click="newClick($event)"
              @focus="inputFocus"
              v-model="formValue.actual_ultrafiltration"
            />
          </div>
        </div>

        <div class="item" v-if="isShow('透后称重')">
          <label class="name" for="sjcll">透后称重(kg)</label>
          <div class="content">
            <input
              type="number"
              @click="newClick($event)"
              @focus="inputFocus"
              id="sjcll"
              v-model="formValue.weight_after"
            />
          </div>
        </div>

         <div class="item" v-if="isShow('衣物重')">
          <label class="name" for="sjcll">衣物重(kg)</label>
          <div class="content">
            <input
              type="number"
              @click="newClick($event)"
              @focus="inputFocus"
              id="sjcll"
              v-model="formValue.additional_weight"
            />
          </div>
        </div>

        <div class="item" v-if="isShow('体重减少')">
          <label class="name" for="tzjs">体重减少(kg)</label>
          <div class="content">
            <input
              type="number"
              @click="newClick($event)"
              @focus="inputFocus"
              id="tzjs"
              v-model="formValue.weight_loss"
            />
            <!--<span class="text">1</span>-->
            <!--<span class="iconfont">&#xe6f9;</span>-->
          </div>
        </div>

        <div class="item" v-if="isShow('穿刺处血肿')" @click="showSubMenu('puncture_point_haematoma')">
          <h2 class="name">穿刺处血肿</h2>
          <div class="content">
            <span v-if="formValue.puncture_point_haematoma == 0" class="text" style="width: 50px"></span>
            <span v-if="formValue.puncture_point_haematoma == 1" class="text" style="width: 50px">有</span>
            <span v-if="formValue.puncture_point_haematoma == 2" class="text" style="width: 50px">无</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div
          @click="showSubMenu('complication')"
          class="item"
          ref="complication"
          v-if="isShow('并发症')"
        >
          <label class="name" for="bfz">并发症</label>
          <div class="content">
            <span class="text" id="bfz" style="width: 50px">{{formValue.complication}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div class="item" v-if="isShow('并发症其他')">
          <label class="name" for="ml">并发症其他</label>
          <div class="content">
            <input
              @click="newClick($event)"
              @focus="inputFocus"
              id="ml"
              v-model="formValue.other_complication"
            />
          </div>
        </div>

        <div
          @click="showSubMenu('internal_fistula')"
          class="item"
          ref="internal_fistula"
          v-if="isShow('内瘘')"
        >
          <label class="name" for="dg">内瘘</label>
          <div class="content">
            <span class="text" id="dg">{{formValue.internal_fistula}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div @click="showSubMenu('catheter')" class="item" ref="catheter" v-if="isShow('导管')">
          <label class="name" for="dg">导管</label>
          <div class="content">
            <span class="text" id="dg">{{formValue.catheter}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div
          @click="showSubMenu('dialysis_process')"
          class="item"
          ref="dialysis_process"
          v-if="isShow('透析过程')"
        >
          <label class="name" for="dg">透析过程</label>
          <div class="content">
            <span class="text" id="dg">{{getDialysisProcess(formValue.dialysis_process)}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div
          class="item"
          ref="in_advance_minute"
          v-if="formValue.dialysis_process == 2 && isShow('透析过程提前时间') "
        >
          <label class="name" for="dg">透析过程提前时间(min)</label>
          <div class="content">
            <input
              type="number"
              @click="newClick($event)"
              @focus="inputFocus"
              id="txz"
              v-model="formValue.in_advance_minute"
            />
          </div>
        </div>

        <div
          @click="showSubMenu('in_advance_reason')"
          class="item"
          ref="in_advance_reason"
          v-if="formValue.dialysis_process == 2 && isShow('透析过程提前原因')"
        >
          <label class="name" for="dg">透析过程提前原因</label>
          <div class="content">
            <span class="text" id="dg">{{formValue.in_advance_reason}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div
          class="item"
          ref="in_advance_reason_other"
          v-if="formValue.dialysis_process == 2 && isShow('透析过程提前其他原因')"
        >
          <label class="name" for="dg">透析过程提前其他原因</label>
          <div class="content">
            <input
              @click="newClick($event)"
              @focus="inputFocus"
              id="txz"
              v-model="formValue.in_advance_reason_other"
            />
          </div>
        </div>

        <div class="item" ref="hemostasis_minute" v-if="isShow('内瘘管拔针后压迫止血时间')">
          <label class="name" for="dg">内瘘管拔针后压迫止血时间(min)</label>
          <div class="content">
            <input
              type="number"
              @click="newClick($event)"
              @focus="inputFocus"
              id="txz"
              v-model="formValue.hemostasis_minute"
            />
          </div>
        </div>

        <div
          @click="showSubMenu('hemostasis_opera')"
          class="item"
          ref="hemostasis_opera"
          v-if="isShow('内瘘管拔针后压迫止血操作')"
        >
          <label class="name" for="dg">内瘘管拔针后压迫止血操作</label>
          <div class="content">
            <span class="text" id="dg">{{getOpera(formValue.hemostasis_opera)}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div
          @click="showSubMenu('arterial_tube')"
          class="item"
          ref="arterial_tube"
          v-if="isShow('动脉管道')"
        >
          <label class="name" for="dg">动脉管道</label>
          <div class="content">
            <span class="text" id="dg">{{getArterialTubeName(formValue.arterial_tube)}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div
          @click="showSubMenu('intravenous_tube')"
          class="item"
          ref="intravenous_tube"
          v-if="isShow('静脉管道')"
        >
          <label class="name" for="dg">静脉管道</label>
          <div class="content">
            <span class="text" id="dg">{{getIntravenousTubeName(formValue.intravenous_tube)}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>
        <div class="item" v-if="this.$store.getters.user.template_info.template_id == 6">
          <label class="name" for="sjcll">透后净体重(kg)</label>
          <div class="content">
            <input
              type="number"
              readonly
              disabled="disabled"
              id="sjcll"
              v-model="body_weight_after"
            />
          </div>
        </div>

        <div @click="showSubMenu('cruor')" class="item" ref="cruor" v-if="isShow('透析器凝血')">
          <label class="name" for="nx">透析器凝血</label>
          <div class="content">
            <span class="text" id="nx" style="width: 100px">{{formValue.cruor}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div
          class="item"
          v-if="isShow('拔针后穿刺点渗血')"
          @click="showSubMenu('puncture_point_oozing_blood')"
        >
          <h2 class="name">拔针后穿刺点渗血</h2>
          <div class="content">
            <div class="content">
              <span
                v-if="formValue.puncture_point_oozing_blood == 0"
                class="text"
                style="width: 50px"
              ></span>
              <span
                v-if="formValue.puncture_point_oozing_blood == 1"
                class="text"
                style="width: 50px"
              >有</span>
              <span
                v-if="formValue.puncture_point_oozing_blood == 2"
                class="text"
                style="width: 50px"
              >无</span>
              <span class="iconfont">&#xe6f9;</span>
            </div>
          </div>
        </div>

         <div
          @click="showSubMenu('patient_gose')"
          class="item"
          ref="patient_gose"
          v-if="isShow('患者去向')"
        >
          <label class="name" for="patient_gose">患者去向</label>
          <div class="content">
            <span
              class="text"
              id="patient_gose"
              style="width: 50px"
            >{{GetPatientGoes(formValue.patient_gose)}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div
          @click="showSubMenu('internal_fistula_tremor_ac')"
          class="item"
          ref="internal_fistula_tremor_ac"
          v-if="isShow('压迫后内瘘震颤')"
        >
          <label class="name" for="internal_fistula_tremor_ac">压迫后内瘘震颤</label>
          <div class="content">
            <span
              class="text"
              id="internal_fistula_tremor_ac"
              style="width: 50px"
            >{{GetIFTAValue(formValue.internal_fistula_tremor_ac)}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div class="item" v-if="formValue.patient_gose==3&&isShow('科室')">
          <label class="name" for="inpatient_department">科室</label>
          <div class="content">
            <input
              type="text"
              @focus="inputFocus"
              id="inpatient_department"
              v-model="formValue.inpatient_department"
            />
          </div>
        </div>

        <div
          @click="showSubMenu('observation_content')"
          class="item"
          ref="observation_content"
          v-if="formValue.patient_gose==3&&isShow('交待病房护士/患者/陪人观察内容')"
        >
          <label class="name" for="observation_content">交待病房护士/患者/陪人观察内容</label>
          <div class="content">
            <span
              class="text"
              id="observation_content"
              style="width: 50px"
            >{{formValue.observation_content}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div class="item" v-if="formValue.patient_gose==3&&isShow('其他观察内容')">
          <label class="name" for="observation_content_other">其他观察内容</label>
          <div class="content">
            <input
              type="text"
              @focus="inputFocus"
              id="observation_content_other"
              v-model="formValue.observation_content_other"
            />
          </div>
        </div>

        <div class="line"></div>

        <div class="item"  v-if="isShow('实际置换量')">
          <label v-if="template_id == 20 || template_id == 21" class="name" for="sjzhl">实际置换量(ml)</label>
          <label v-if="template_id != 20 && template_id != 21" class="name" for="sjzhl">实际置换量(L)</label>
          <div class="content">
            <input type="tel" @focus="inputFocus" id="sjzhl" v-model="formValue.actual_displacement"/>

          </div>
        </div>

        <div class="item" v-if="isShow('体温')">
          <label class="name" for="tw">体温(℃)</label>
          <div class="content">
            <input
              type="number"
              @click="newClick($event)"
              @focus="inputFocus"
              id="tw"
              v-model="formValue.temperature"
            />

          </div>
        </div>
        <div class="item" v-if="isShow('收缩压')">
          <label class="name" for="ssy">收缩压(mmHg)</label>
          <div class="content">
            <input
              type="number"
              @click="newClick($event)"
              @focus="inputFocus"
              id="ssy"
              v-model="formValue.systolic_blood_pressure"
            />

          </div>
        </div>

        <div class="item" v-if="isShow('舒张压')">
          <label class="name" for="szy">舒张压(mmHg)</label>
          <div class="content">
            <input
              type="number"
              @click="newClick($event)"
              @focus="inputFocus"
              id="szy"
              v-model="formValue.diastolic_blood_pressure"
            />

          </div>
        </div>

        <div class="item" v-if="isShow('卧位收缩压')">
          <label class="name" for="sjcll">卧位收缩压(mmHg)</label>
          <div class="content">
            <input
              type="number"
              @click="newClick($event)"
              @focus="inputFocus"
              id="sjcll"
              v-model="formValue.supine_systolic_blood_pressure"
            />
          </div>
        </div>

        <div class="item" v-if="isShow('卧位舒张压')">
          <label class="name" for="sjcll">卧位舒张压(mmHg)</label>
          <div class="content">
            <input
              type="number"
              @click="newClick($event)"
              @focus="inputFocus"
              id="sjcll"
              v-model="formValue.supine_diastolic_blood_pressure"
            />
          </div>
        </div>

        <div class="item" v-if="isShow('坐位收缩压')">
          <label class="name" for="sjcll">坐位收缩压(mmHg)</label>
          <div class="content">
            <input
              type="number"
              @click="newClick($event)"
              @focus="inputFocus"
              id="sjcll"
              v-model="formValue.setting_pressure"
            />
          </div>
        </div>

        <div class="item" v-if="isShow('坐位舒张压')">
          <label class="name" for="sjcll">坐位舒张压(mmHg)</label>
          <div class="content">
            <input
              type="number"
              @click="newClick($event)"
              @focus="inputFocus"
              id="sjcll"
              v-model="formValue.diastolic_pressure"
            />
          </div>
        </div>
        <div class="item" v-if="isShow('呼吸频率')">
          <label class="name" for="ml">呼吸频率(次/min)</label>
          <div class="content">
            <input
              type="number"
              @click="newClick($event)"
              @focus="inputFocus"
              id="ml"
              v-model="formValue.breathing_rate"
            />

          </div>
        </div>

        <div class="item" v-if="isShow('脉搏')">
          <label class="name" for="ml">脉搏(次/分)</label>
          <div class="content">
            <input
              type="number"
              @click="newClick($event)"
              @focus="inputFocus"
              id="ml"
              v-model="formValue.pulse_frequency"
            />

          </div>
        </div>

        <div
          @click="showSubMenu('symptom_after_dialysis')"
          class="item"
          ref="symptom_after_dialysis"
          v-if="isShow('透后症状')"
        >
          <label class="name" for="thzz">透后症状</label>
          <div class="content">
            <span class="text" id="thzz" style="width: 100px">{{formValue.symptom_after_dialysis}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div @click="showSubMenu('dialysis_intakes')" class="item" ref="dialysis_intakes" v-if="isShow('透析中入量')">
          <label class="name" for="txz">透析中入量</label>
          <div class="content">
            <input type="number" @click="newClick($event)" @focus="inputFocus" id="txz"
                   v-model="formValue.dialysis_intakes"/>
          </div>
        </div>

        <div @click="showSubMenu('dialysis_intakes_unit')" class="item" ref="dialysis_intakes_unit"
             v-if="isShow('透析中入量单位')">
          <label class="name" for="txz">透析中入量单位</label>
          <div class="content">
            <span class="text" id="dg">{{getUnit(formValue.dialysis_intakes_unit)}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div @click="showSubMenu('return_blood')" class="item" ref="return_blood" v-if="isShow('回血')">
          <label class="name" for="hx">回血(ml)</label>
          <div class="content">
            <input type="number" @click="newClick($event)" @focus="inputFocus" id="txz"
                   v-model="formValue.return_blood"/>
          </div>
        </div>

        <div @click="showSubMenu('rehydration_volume')" class="item" ref="rehydration_volume" v-if="isShow('补液量')">
          <label class="name" for="hx">补液量(ml)</label>
          <div class="content">
            <input type="number" @click="newClick($event)" @focus="inputFocus" id="txz"
                   v-model="formValue.rehydration_volume"/>
          </div>
        </div>

        <div @click="showSubMenu('dialysis_during')" class="item" ref="dialysis_during" v-if="isShow('透析中进食')">
          <label class="name" for="hx">透析中进食(ml)</label>
          <div class="content">
            <input type="number" @click="newClick($event)" @focus="inputFocus" id="txz"
                   v-model="formValue.dialysis_during"/>
          </div>
        </div>

        <div @click="showSubMenu('stroke_volume')" class="item" ref="stroke_volume" v-if="isShow('出量')">
          <label class="name" for="hx">出量(ml)</label>
          <div class="content">
            <input type="number" @click="newClick($event)" @focus="inputFocus" id="txz"
                   v-model="formValue.stroke_volume"/>
          </div>
        </div>

        <div @click="showSubMenu('blood_flow')" class="item" ref="blood_flow" v-if="isShow('血流量')">
          <label class="name" for="xll">血流量</label>
          <div class="content">
            <span class="text" id="xll">{{BloodFlowById(formValue.blood_flow)}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

         <div
          @click="showSubMenu('sealing_fluid_dispose')"
          class="item"
          ref="sealing_fluid_dispose"
          v-if="isShow('封管液配置')"
        >
          <label class="name" for="dg">封管液配置</label>
          <div class="content">
            <span class="text" id="dg">{{formValue.sealing_fluid_dispose}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div @click="showSubMenu('sealing_fluid_special')" class="item" ref="sealing_fluid_special"
             v-if="sealing_fluid_dispose_name == '特殊' && isShow('封管液特殊')">
          <label class="name" for="fgypztx">封管液配置(特殊)</label>
          <div class="content">
            <input @click="newClick($event)" @focus="inputFocus" id="fgypztx"
                   v-model="formValue.sealing_fluid_special"/>
          </div>
        </div>

        <div class="line"></div>
        <div @click="showSubMenu('blood_access_part')" class="item" ref="blood_access_part" v-if="isShow('血管通路部位')">
          <label class="name" for="xgtl">血管通路部位</label>
          <div class="content">
            <span class="text" id="xgtl">{{QueryPartById(formValue.blood_access_part_id)}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div @click="showSubMenu('blood_access_opera')" class="item" ref="blood_access_opera" v-if="isShow('血管通路操作')">
          <label class="name" for="xgtlcz">血管通路操作</label>
          <div class="content">
            <span class="text" id="xgtlcz">{{QueryOperaById(formValue.blood_access_part_opera_id)}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>
        <div class="line"></div>

        <div class="line"></div>

        <div
          @click="showSubMenu('tremor_noise')"
          class="item"
          ref="tremor_noise"
          v-if="isShow('内瘘震颤和血管杂音')"
        >
          <label class="name" for="dg">内瘘震颤和血管杂音</label>
          <div class="content">
            <span class="text" id="dg">{{getTremorNoise(formValue.tremor_noise)}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div
          @click="showSubMenu('disequilibrium_syndrome')"
          class="item"
          ref="disequilibrium_syndrome"
          v-if="isShow('失衡综合症')"
        >
          <label class="name" for="dg">失衡综合症</label>
          <div class="content">
            <span
              class="text"
              id="dg"
            >{{getDisequilibriumSyndrome(formValue.disequilibrium_syndrome)}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div
          @click="showSubMenu('disequilibrium_syndrome_option')"
          class="item"
          ref="disequilibrium_syndrome_option"
          v-if="formValue.disequilibrium_syndrome == 2 && isShow('失衡综合症症状')"
        >
          <label class="name" for="dg">失衡综合症症状</label>
          <div class="content">
            <span class="text" id="dg">{{formValue.disequilibrium_syndrome_option}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div class="item" v-if="isShow('透析期间进食')" @click="showSubMenu('is_eat')" ref="is_eat">
          <h2 class="name">透析期间进食</h2>
          <div class="content">
            <span v-if="formValue.is_eat == 0" class="text" style="width: 50px"></span>
            <span v-if="formValue.is_eat == 1" class="text" style="width: 50px">有</span>
            <span v-if="formValue.is_eat == 2" class="text" style="width: 50px">无</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div class="item" v-if="isShow('中心静脉封管(肝素-A端)')">
          <label class="name" for="ml">中心静脉封管(肝素-A端)(ml)</label>
          <div class="content">
            <input
              type="number"
              @click="newClick($event)"
              @focus="inputFocus"
              id="ml"
              v-model="formValue.cvc_a"
            />

          </div>
        </div>

        <div class="item" v-if="isShow('中心静脉封管(肝素-V端)')">
          <label class="name" for="ml">中心静脉封管(肝素-V端)(ml)</label>
          <div class="content">
            <input
              type="number"
              @click="newClick($event)"
              @focus="inputFocus"
              id="ml"
              v-model="formValue.cvc_v"
            />
          </div>
        </div>

        <div
          @click="showSubMenu('channel')"
          class="item"
          ref="channel"
          v-if="isShow('管路')"
        >
          <label class="name" for="dg">管路</label>
          <div class="content">
            <span
              class="text"
              id="dg"
            >{{getChannelName(formValue.channel)}}</span>
            <span class="iconfont">&#xe6f9;</span>
          </div>
        </div>

        <div class="item" v-if="isShow('实际抗凝剂用量')">
          <label class="name" for="sjcll">实际抗凝剂用量</label>
          <div class="content">
            <input
              type="number"
              @click="newClick($event)"
              @focus="inputFocus"
              id="sjcll"
              v-model="formValue.dosage_of_anticoagulants"
            />
          </div>
        </div>

        <div>
          <div class="item" v-if="isShow('KT/V')">
            <label class="name" for="bz">KT/V</label>
            <div class="content">
              <span class="text"></span>
            </div>
          </div>

          <textarea
            @focus="lastInputFocus"
            @blur="lastInputBlur"
            class="textarea"
            id="bz"
            placeholder="请输入内容"
            v-model="formValue.ktv"
          ></textarea>
        </div>
        <div>
          <div class="item">
            <label class="name" for="bz">备注</label>
            <div class="content">
              <span class="text"></span>
            </div>
          </div>

          <textarea
            @focus="lastInputFocus"
            @blur="lastInputBlur"
            class="textarea"
            id="bz"
            placeholder="请输入内容"
            v-model="formValue.remark"
          ></textarea>
        </div>
      </div>
    </div>
    <!--<two-menu title="二级菜单" v-show="true" ></two-menu>-->
    <check-box-sub-menu
      :visibility="visibility"
      v-on:menu-cancle="menuCancle"
      v-on:menu-comfirm="menuComfirm"
      v-on:menu-empty="menuEmpty"
      :propsForm="propForm"
    ></check-box-sub-menu>

    <mt-datetime-picker
      ref="picker"
      type="time"
      hourFormat="{value}小时"
      minuteFormat="{value}分钟"
      @confirm="handleTimeConfirm"
      v-model="time"
    ></mt-datetime-picker>
  </div>
</template>

<script>
// import TwoMenu from "./TwoMenu";
import CheckBoxSubMenu from './subMenu/checkBoxSubMenu'

import {commitAssessmentAfterDislysis} from '@/api/dialysis'
import {Toast} from 'vant'
import {getDataConfig} from '@/utils/data'

import request from '@/utils/request'

export default {
  name: 'PrescriptionDialog',
  props: {
    record: {
      type: Object
    },
    last_record: {
      type: Object
    },
    patient_prop: {
      type: Object
    },
    predialysis: {
      type: Object
    },
    prescription_prop: {
      type: Object
    },
  },
  data () {
    return {
      showTxt: '',
      hasPermission: true,
      puncture_point_oozing_blood_state: false,
      puncture_point_haematoma_state: false,
      eat_state: false,
      template_id: 0,
      isShowDialog: true,
      time: '00:00',
      body_weight_after: '',
      puncture_point_oozing_bloods: [
        {id: 1, name: '有'},
        {id: 2, name: '无'}
      ],
      puncture_point_haematomas: [{id: 1, name: '有'}, {id: 2, name: '无'}],

      eat: [{id: 1, name: '有'}, {id: 2, name: '无'}],
      unit: [{id: 1, name: 'g'}, {id: 2, name: 'ml'}],
      // sub menu prop
      visibility: false,
      propForm: {
        title: '',
        list: [],
        optionList: [],
        isMultiple: 2,
        result: [], // 选中的值
        type: 1, // 用来区分不同子菜单，方便对返回值进行赋值
        selectId: 0,
        isHasOther: 1
      },
      timeValue: '',
      sealing_fluid_dispose_name: '',
      formValue: {
        weight_after: '',
        weight_loss: '',
        additional_weight: '',
        temperature: '',
        systolic_blood_pressure: '',
        diastolic_blood_pressure: '',
        pulse_frequency: '',
        cruor: '',
        symptom_after_dialysis: '',
        dialysis_intakes: '',
        catheter: '',
        complication: '',
        puncture_point_oozing_blood: '',
        puncture_point_haematoma: '',
        remark: '',
        blood_access_part_id: 0,
        blood_access_part_opera_id: 0,
        actual_ultrafiltration: '',
        actual_displacement: '',
        actual_treatment_hour: '',
        actual_treatment_minute: '',
        internal_fistula: '',
        internal_fistula_tremor_ac: '',
        patient_gose: '',
        inpatient_department: '',
        observation_content: '',
        observation_content_other: '',
        dialysis_process: '',
        in_advance_minute: '',
        in_advance_reason: '',
        in_advance_reason_other: '',
        hemostasis_minute: '',
        hemostasis_opera: '',
        tremor_noise: '',
        disequilibrium_syndrome: '',
        disequilibrium_syndrome_option: '',
        arterial_tube: '',
        intravenous_tube: '',
        dialyzer: '',
        is_eat: '',
        breathing_rate: '',
        dialysis_intakes_unit: 0,
        channel: '',
        cvc_a: '',
        cvc_v: '',
        return_blood: '',
        rehydration_volume: '',
        dialysis_during: '',
        stroke_volume: '',
        blood_flow: '',
        sealing_fluid_dispose: '',
        sealing_fluid_special: '',
        dosage_of_anticoagulants: '',
        supine_systolic_blood_pressure: '',
        setting_pressure: '',
        supine_diastolic_blood_pressure: '',
        diastolic_pressure: '',
        other_complication: '',
        ktv:''
      },

      record_date: ''
    }
  },
  watch: {
    'formValue.sealing_fluid_dispose': function () {
      // var tempsealingFluidDisposeOptions = getDataConfig('hemodialysis', 'sealing_fluid_dispose')

      // for (let i = 0; i < tempsealingFluidDisposeOptions.length; i++) {
      //   if (tempsealingFluidDisposeOptions[i].id == this.formValue.sealing_fluid_dispose) {
      //     this.sealing_fluid_dispose_name = tempsealingFluidDisposeOptions[i].name
      //   }
      // }
      // eslint-disable-next-line camelcase
      var sealing_fluid_dispose_name = ''
      var str = this.formValue.sealing_fluid_dispose
      var arr = str.split(',')
      console.log('arr', arr)
      for (let i = 0; i < arr.length; i++) {
        if (arr[i] == '特殊') {
          // eslint-disable-next-line camelcase
          sealing_fluid_dispose_name = '特殊'
        }
      }
      this.sealing_fluid_dispose_name = sealing_fluid_dispose_name
      return this.sealing_fluid_dispose_name
    },
    'formValue.weight_after': {
      handler (newWeight, oldWeight) {
        // eslint-disable-next-line no-unused-vars
        let weight = parseFloat(
          newWeight - this.formValue.additional_weight
        ).toFixed(1)
        if (weight > 0) {
          this.body_weight_after = weight
        } else {
          this.body_weight_after = ''
        }
        if (!this.isShow('衣物重')) {
          this.formValue.additional_weight = 0
        }
        if (!this.isShow2('衣物重')) {
          this.predialysis.additional_weight = 0
        }

        // this.formValue.weight_loss = (this.predialysis.weight_before - this.predialysis.additional_weight) - (this.formValue.weight_after - this.formValue.additional_weight)
        this.formValue.weight_loss = ((this.predialysis.weight_before - this.predialysis.additional_weight) - (this.formValue.weight_after - this.formValue.additional_weight)).toFixed(1)
        if (this.formValue.weight_loss < 0) {
          this.formValue.weight_loss = ''
        }
        if (this.formValue.weight_after == '') {
          this.formValue.weight_loss = ''
        }
      },
      deep: true,
      immediate: false
    },
    'formValue.additional_weight': {
      handler (newWeight, oldWeight) {
        // eslint-disable-next-line no-unused-vars
        if (newWeight > 0) {
          let weight = parseFloat(
            this.formValue.weight_after - newWeight
          ).toFixed(1)
          if (weight > 0) {
            this.body_weight_after = weight
          } else {
            this.body_weight_after = ''
          }
        }

        if (!this.isShow('衣物重')) {
          this.formValue.additional_weight = 0
        }
        if (!this.isShow2('衣物重')) {
          this.predialysis.additional_weight = 0
        }

        this.formValue.weight_loss = ((this.predialysis.weight_before - this.predialysis.additional_weight) - (this.formValue.weight_after - this.formValue.additional_weight)).toFixed(1)
        if (this.formValue.weight_loss < 0) {
          this.formValue.weight_loss = ''
        }

        if (this.formValue.weight_after == '') {
          this.formValue.weight_loss = ''
        }
      },
      deep: true,
      immediate: true
    }
  
  },
  methods: {
    newClick (event) {
      event.currentTarget.select()
    },

    isShow (name) {
      var filedList = this.$store.getters.user.fileds
      for (let i = 0; i < filedList.length; i++) {
        if (filedList[i].module == 5 && filedList[i].filed_name_cn == name && filedList[i].is_show == 1) {
          return true
        }
      }
      return false
    },

    isShow2 (name) {
      var filedList = this.$store.getters.user.fileds
      for (let i = 0; i < filedList.length; i++) {
        if (filedList[i].module == 3 && filedList[i].filed_name_cn == name && filedList[i].is_show == 1) {
          return true
        }
      }
      return false
    },

    puncturePointOozingBlood: function (is_select) {
      this.formValue.puncture_point_oozing_blood = is_select == true ? 1 : 2
    },

    puncturePointHaematoma: function (is_select) {
      this.formValue.puncture_point_haematoma = is_select == true ? 1 : 2
    },

    GetIFTAValue (id) {
      let name = ''
      let internal_fistula_tremor_ac = this.$store.getters.internal_fistula_tremor_ac
      let ifl = internal_fistula_tremor_ac.length
      for (let index = 0; index < ifl; index++) {
        if (internal_fistula_tremor_ac[index].id == id) {
          name = internal_fistula_tremor_ac[index].name
          break
        }
      }
      return name
    },
    GetPatientGoes (id) {
      let name = ''
      let patient_gose = this.$store.getters.patient_gose
      let ifl = patient_gose.length
      for (let index = 0; index < ifl; index++) {
        if (patient_gose[index].id == id) {
          name = patient_gose[index].name
          break
        }
      }
      return name
    },

    inputFocus: function (event) {
      var input = event.target
      setTimeout(function () {
        input.scrollIntoView()
      }, 0)

      if (input.setSelectionRange) {
        setTimeout(function () {
          input.setSelectionRange(0, input.value.length)
        }, 0)
      } else if (input.createTextRange) {
        var rng = input.createTextRange()
        rng.move('character', input.value.length)
        rng.select()
      }
    },
    lastInputFocus: function (event) {
      var input = event.target
      setTimeout(function () {
        input.style.marginBottom = '2rem'
        input.parentNode.scrollIntoView()
      }, 0)
    },
    lastInputBlur: function (event) {
      var input = event.target
      setTimeout(function () {
        input.style.marginBottom = ''
      }, 0)
    },
    showSubMenu: function (val) {
      switch (val) {
        case 'cruor':
          this.propForm.type = 1
          this.isShowDialog = false
          this.propForm.title = '凝血'
          this.propForm.isHasOther = 2
          this.visibility = true
          this.propForm.list = []
          this.propForm.list = getDataConfig('hemodialysis', 'cruor')
          this.propForm.optionList = []
          this.propForm.isMultiple = 2
          if (
            this.formValue.cruor != undefined ||
              this.formValue.cruor != null
          ) {
            if (this.formValue.cruor.length > 0) {
              this.propForm.result = this.formValue.cruor.split(',')
            } else {
              this.propForm.result = []
            }
          } else {
            this.propForm.result = []
          }
          this.propForm.click_ref = 'cruor'
          break
        case 'symptom_after_dialysis':
          this.propForm.type = 2
          this.isShowDialog = false
          this.propForm.title = '透后症状'
          this.propForm.isHasOther = 2

          this.visibility = true
          this.propForm.list = []

          this.propForm.list = getDataConfig('hemodialysis', 'symptoms')
          this.propForm.optionList = []
          this.propForm.isMultiple = 2
          if (
            this.formValue.symptom_after_dialysis != undefined ||
              this.formValue.symptom_after_dialysis != null
          ) {
            if (this.formValue.symptom_after_dialysis.length > 0) {
              this.propForm.result = this.formValue.symptom_after_dialysis.split(
                ','
              )
            } else {
              this.propForm.result = []
            }
          } else {
            this.propForm.result = []
          }
          this.propForm.click_ref = 'symptom_after_dialysis'
          break

        case 'catheter':
          this.propForm.type = 3
          this.isShowDialog = false
          this.propForm.title = '导管'
          this.visibility = true
          this.propForm.isHasOther = 2
          this.propForm.list = []

          this.propForm.list = getDataConfig('hemodialysis', 'catheter')
          this.propForm.optionList = []
          this.propForm.isMultiple = 2
          if (
            this.formValue.catheter != undefined ||
              this.formValue.catheter != null
          ) {
            if (this.formValue.catheter.length > 0) {
              this.propForm.result = this.formValue.catheter.split(',')
            } else {
              this.propForm.result = []
            }
          } else {
            this.propForm.result = []
          }
          this.propForm.click_ref = 'catheter'
          break
        case 'complication':
          this.propForm.type = 4
          this.isShowDialog = false
          this.propForm.title = '并发症'
          this.propForm.isHasOther = 2

          this.visibility = true
          this.propForm.list = []

          this.propForm.list = getDataConfig('hemodialysis', 'complication')
          this.propForm.optionList = []
          this.propForm.isMultiple = 2
          // this.propForm.result = this.formValue.complication.split(",")
          if (
            this.formValue.complication != undefined ||
              this.formValue.complication != null
          ) {
            if (this.formValue.complication.length > 0) {
              this.propForm.result = this.formValue.complication.split(',')
            } else {
              this.propForm.result = []
            }
          } else {
            this.propForm.result = []
          }
          this.propForm.click_ref = 'complication'
          break

        case 'blood_access_part':
          this.propForm.type = 5
          this.isShowDialog = false
          this.propForm.title = '血管通路部位'
          this.propForm.isHasOther = 2

          this.visibility = true
          this.propForm.list = []
          this.propForm.optionList = this.$store.getters.vascular_access
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.formValue.blood_access_part_id
          this.propForm.click_ref = 'blood_access_part'
          break

        case 'blood_access_opera':
          this.propForm.type = 6
          this.isShowDialog = false
          this.propForm.title = '血管通路操作'
          this.propForm.isHasOther = 2

          this.visibility = true
          this.propForm.list = []
          this.propForm.optionList = this.$store.getters.vascular_access_desc
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.formValue.blood_access_part_opera_id
          this.propForm.click_ref = 'blood_access_opera'
          break
        case 'internal_fistula':
          this.propForm.type = 7
          this.isShowDialog = false
          this.propForm.title = '内瘘'
          this.visibility = true
          this.propForm.list = []
          this.propForm.list = getDataConfig(
            'hemodialysis',
            'internal_fistula'
          )
          this.propForm.optionList = []
          this.propForm.isMultiple = 2
          this.propForm.isHasOther = 2

          if (
            this.formValue.internal_fistula != undefined ||
              this.formValue.internal_fistula != null
          ) {
            if (this.formValue.internal_fistula.length > 0) {
              this.propForm.result = this.formValue.internal_fistula.split(',')
            } else {
              this.propForm.result = []
            }
          } else {
            this.propForm.result = []
          }
          this.propForm.click_ref = 'internal_fistula'
          break
        case 'internal_fistula_tremor_ac':
          this.propForm.type = 8
          this.isShowDialog = false
          this.propForm.title = '压迫后内瘘震颤'
          this.visibility = true
          this.propForm.list = []
          this.propForm.isHasOther = 2

          this.propForm.optionList = this.$store.getters.internal_fistula_tremor_ac
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.formValue.internal_fistula_tremor_ac
          this.propForm.click_ref = 'internal_fistula_tremor_ac'
          break
        case 'patient_gose':
          this.propForm.type = 9
          this.isShowDialog = false
          this.propForm.title = '患者去向'
          this.visibility = true
          this.propForm.list = []
          this.propForm.isHasOther = 2

          this.propForm.optionList = this.$store.getters.patient_gose
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.formValue.patient_gose
          this.propForm.click_ref = 'patient_gose'
          break

        case 'observation_content':
          this.propForm.type = 10
          this.isShowDialog = false
          this.propForm.title = '交待病房护士/患者/陪人观察内容'
          this.visibility = true
          this.propForm.isHasOther = 2
          this.propForm.list = []

          this.propForm.list = this.$store.getters.observation_content
          this.propForm.optionList = []
          this.propForm.isMultiple = 2
          if (
            this.formValue.observation_content != undefined ||
              this.formValue.observation_content != null
          ) {
            if (this.formValue.observation_content.length > 0) {
              this.propForm.result = this.formValue.observation_content.split(
                ','
              )
            } else {
              this.propForm.result = []
            }
          } else {
            this.propForm.result = []
          }
          this.propForm.click_ref = 'observation_content'
          break

        case 'dialysis_process':
          this.propForm.type = 11
          this.isShowDialog = false
          this.propForm.title = '透析过程'
          this.visibility = true
          this.propForm.isHasOther = 2

          this.propForm.list = []
          this.propForm.optionList = this.$store.getters.dialysis_process
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.formValue.dialysis_process
          this.propForm.click_ref = 'dialysis_process'
          break

        case 'in_advance_reason':
          this.propForm.type = 12
          this.isShowDialog = false
          this.propForm.title = '透析过程提前原因'
          this.visibility = true
          this.propForm.isHasOther = 2
          this.propForm.list = []

          this.propForm.list = this.$store.getters.in_advance_reason
          this.propForm.optionList = []
          this.propForm.isMultiple = 2
          if (
            this.formValue.in_advance_reason != undefined ||
              this.formValue.in_advance_reason != null
          ) {
            if (this.formValue.in_advance_reason.length > 0) {
              this.propForm.result = this.formValue.in_advance_reason.split(
                ','
              )
            } else {
              this.propForm.result = []
            }
          } else {
            this.propForm.result = []
          }
          this.propForm.click_ref = 'in_advance_reason'
          break

        case 'hemostasis_opera':
          this.propForm.type = 13
          this.isShowDialog = false
          this.propForm.title = '内瘘管拔针后压迫止血操作'
          this.visibility = true
          this.propForm.isHasOther = 2

          this.propForm.list = []
          this.propForm.optionList = this.$store.getters.hemostasis_opera
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.formValue.hemostasis_opera
          this.propForm.click_ref = 'hemostasis_opera'
          break
        case 'tremor_noise':
          this.propForm.type = 14
          this.isShowDialog = false
          this.propForm.title = '内瘘震颤和血管杂音'
          this.visibility = true
          this.propForm.isHasOther = 2

          this.propForm.list = []
          this.propForm.optionList = this.$store.getters.tremor_noise
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.formValue.tremor_noise
          this.propForm.click_ref = 'tremor_noise'
          break
        case 'disequilibrium_syndrome':
          this.propForm.type = 15
          this.isShowDialog = false
          this.propForm.title = '失衡综合症'
          this.visibility = true
          this.propForm.list = []
          this.propForm.isHasOther = 2

          this.propForm.optionList = this.$store.getters.disequilibrium_syndrome
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.formValue.disequilibrium_syndrome
          this.propForm.click_ref = 'disequilibrium_syndrome'
          break
        case 'disequilibrium_syndrome_option':
          this.propForm.type = 16
          this.isShowDialog = false
          this.propForm.title = '失衡综合症情况'
          this.visibility = true
          this.propForm.isHasOther = 2
          this.propForm.list = []

          this.propForm.list = this.$store.getters.disequilibrium_syndrome_option
          this.propForm.optionList = []
          this.propForm.isMultiple = 2
          if (
            this.formValue.disequilibrium_syndrome_option != undefined ||
              this.formValue.disequilibrium_syndrome_option != null
          ) {
            if (this.formValue.disequilibrium_syndrome_option.length > 0) {
              this.propForm.result = this.formValue.disequilibrium_syndrome_option.split(
                ','
              )
            } else {
              this.propForm.result = []
            }
          } else {
            this.propForm.result = []
          }
          this.propForm.click_ref = 'disequilibrium_syndrome_option'
          break
        case 'arterial_tube':
          this.propForm.type = 17
          this.isShowDialog = false
          this.propForm.title = '动脉管道'
          this.propForm.isHasOther = 2
          this.propForm.list = []

          this.visibility = true
          this.propForm.list = []
          this.propForm.optionList = this.$store.getters.arterial_tube
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.formValue.arterial_tube
          this.propForm.click_ref = 'arterial_tube'
          break
        case 'intravenous_tube':
          this.propForm.type = 18
          this.isShowDialog = false
          this.propForm.title = '静脉管道'
          this.visibility = true
          this.propForm.list = []
          this.propForm.isHasOther = 2

          this.propForm.optionList = this.$store.getters.intravenous_tube
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.formValue.intravenous_tube
          this.propForm.click_ref = 'intravenous_tube'
          break
        case 'dialyzer':
          this.propForm.type = 19
          this.isShowDialog = false
          this.propForm.title = '透析器'
          this.visibility = true
          this.propForm.isHasOther = 2

          this.propForm.list = []
          this.propForm.optionList = this.$store.getters.dialyzer
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.formValue.dialyzer
          this.propForm.click_ref = 'dialyzer'
          break
        case 'puncture_point_oozing_blood':
          this.propForm.type = 20
          this.isShowDialog = false
          this.propForm.title = '拔针后穿刺点渗血'
          this.visibility = true
          this.propForm.isHasOther = 2

          this.propForm.list = []
          this.propForm.optionList = this.puncture_point_oozing_bloods
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.formValue.puncture_point_oozing_blood
          this.propForm.click_ref = 'puncture_point_oozing_blood'
          break
        case 'puncture_point_haematoma':
          this.propForm.type = 21
          this.isShowDialog = false
          this.propForm.title = '穿刺处血肿'
          this.visibility = true
          this.propForm.isHasOther = 2

          this.propForm.list = []
          this.propForm.optionList = this.puncture_point_haematomas
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.formValue.puncture_point_haematoma
          this.propForm.click_ref = 'puncture_point_haematoma'
          break
        case 'is_eat':
          this.propForm.type = 22
          this.isShowDialog = false
          this.propForm.title = '透析期间进食'
          this.visibility = true
          this.propForm.isHasOther = 2
          this.propForm.list = []
          this.propForm.optionList = this.eat
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.formValue.is_eat
          this.propForm.click_ref = 'is_eat'
          break
        case 'dialysis_intakes_unit':
          this.propForm.type = 23
          this.isShowDialog = false
          this.propForm.title = '透析中入量单位'
          this.visibility = true
          this.propForm.isHasOther = 2
          this.propForm.list = []
          this.propForm.optionList = this.unit
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.formValue.dialysis_intakes_unit
          this.propForm.click_ref = 'dialysis_intakes_unit'
          break
        case 'channel':
          this.propForm.type = 24
          this.isShowDialog = false
          this.propForm.title = '管路'
          this.visibility = true
          this.propForm.list = []
          this.propForm.isHasOther = 2
          this.propForm.optionList = this.$store.getters.channel
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.formValue.channel
          this.propForm.click_ref = 'channel'
          break
        case 'blood_flow':
          this.propForm.type = 25
          this.isShowDialog = false
          this.propForm.title = '血流量'
          this.propForm.isHasOther = 2

          this.visibility = true
          this.propForm.list = []
          this.propForm.optionList = getDataConfig('hemodialysis', 'blood_flow')
          this.propForm.isMultiple = 1
          this.propForm.selectId = this.formValue.blood_flow
          this.propForm.click_ref = 'blood_flow'
          break
        case 'sealing_fluid_dispose':
          // this.propForm.type = 26
          // this.isShowDialog = false
          // this.propForm.title = '封管液配置'
          // this.propForm.isHasOther = 2

          // this.visibility = true
          // this.propForm.list = []
          // this.propForm.optionList = getDataConfig('hemodialysis', 'sealing_fluid_dispose')
          // this.propForm.isMultiple = 1
          // this.propForm.selectId = this.formValue.blood_flow
          // this.propForm.click_ref = 'sealing_fluid_dispose'

          this.propForm.type = 26
          this.isShowDialog = false
          this.propForm.title = '封管液配置'
          this.propForm.isHasOther = 2

          this.visibility = true
          this.propForm.list = []

          this.propForm.list = getDataConfig('hemodialysis', 'sealing_fluid_dispose')
          this.propForm.optionList = []
          this.propForm.isMultiple = 2
          if (
            this.formValue.sealing_fluid_dispose != undefined ||
              this.formValue.sealing_fluid_dispose != null
          ) {
            if (this.formValue.sealing_fluid_dispose.length > 0) {
              this.propForm.result = this.formValue.sealing_fluid_dispose.split(',')
            } else {
              this.propForm.result = []
            }
          } else {
            this.propForm.result = []
          }
          this.propForm.click_ref = 'sealing_fluid_dispose'
          break
      }
    },
    menuCancle: function () {
      this.visibility = false
      this.isShowDialog = true
      this.$nextTick(() => {
        if (
          this.$refs[this.propForm.click_ref] != undefined &&
            this.$refs[this.propForm.click_ref] != null
        ) {
          this.$refs[this.propForm.click_ref].scrollIntoView()
        }
      })
    },
    menuComfirm: function (val) {
      this.visibility = false
      this.isShowDialog = true
      this.$nextTick(() => {
        if (
          this.$refs[this.propForm.click_ref] != undefined &&
            this.$refs[this.propForm.click_ref] != null
        ) {
          this.$refs[this.propForm.click_ref].scrollIntoView()
        }
      })
      switch (val.type) {
        case 1:
          this.formValue.cruor = val.result.join(',')
          break
        case 2:
          this.formValue.symptom_after_dialysis = val.result.join(',')
          break
        case 3:
          this.formValue.catheter = val.result.join(',')
          break
        case 4:
          this.formValue.complication = val.result.join(',')
          break
        case 5:
          this.formValue.blood_access_part_id = val.selectId
          break
        case 6:
          this.formValue.blood_access_part_opera_id = val.selectId
          break
        case 7:
          this.formValue.internal_fistula = val.result.join(',')
          break
        case 8:
          this.formValue.internal_fistula_tremor_ac = val.selectId
          break
        case 9:
          this.formValue.patient_gose = val.selectId
          break
        case 10:
          this.formValue.observation_content = val.result.join(',')
          break
        case 11:
          this.formValue.dialysis_process = val.selectId
          break
        case 12:
          this.formValue.in_advance_reason = val.result.join(',')
          break
        case 13:
          this.formValue.hemostasis_opera = val.selectId
          break
        case 14:
          this.formValue.tremor_noise = val.selectId
          break
        case 15:
          this.formValue.disequilibrium_syndrome = val.selectId
          break
        case 16:
          this.formValue.disequilibrium_syndrome_option = val.result.join(',')
          break
        case 17:
          this.formValue.arterial_tube = val.selectId
          break
        case 18:
          this.formValue.intravenous_tube = val.selectId
          break
        case 19:
          this.formValue.dialyzer = val.selectId

          break
        case 20:
          if (val.selectId == 1) {
            this.formValue.puncture_point_oozing_blood = val.selectId
            this.puncture_point_oozing_blood_state = true
          } else if (val.selectId == 2) {
            this.formValue.puncture_point_oozing_blood = val.selectId
            this.puncture_point_oozing_blood_state = false
          } else {
            this.formValue.puncture_point_oozing_blood = 0
          }

          break
        case 21:
          if (val.selectId == 1) {
            this.formValue.puncture_point_haematoma = val.selectId
            this.puncture_point_haematoma_state = true
          } else if (val.selectId == 2) {
            this.formValue.puncture_point_haematoma = val.selectId
            this.puncture_point_haematoma_state = false
          } else {
            this.formValue.puncture_point_haematoma = 0
          }
          break
        case 22:
          if (val.selectId == 1) {
            this.formValue.is_eat = val.selectId
            this.eat_state = true
          } else if (val.selectId == 2) {
            this.formValue.is_eat = val.selectId
            this.eat_state = false
          } else {
            this.formValue.is_eat = 0
          }
          break

        case 23:
          this.formValue.dialysis_intakes_unit = val.selectId
          break
        case 24:
          this.formValue.channel = val.selectId
          break
        case 25:
          this.formValue.blood_flow = val.selectId
          break
        case 26:
          this.formValue.sealing_fluid_dispose = val.result.join(',')
          break
      }
    },
    getUnit: function (val) {
      let name = ''
      for (let i = 0; i < this.unit.length; i++) {
        if (this.unit[i].id == val) {
          name = this.unit[i].name
        }
      }
      return name
    },
    QuerySealingFluidDisposeById: function (val) {
      let sealing_fluid_dispose_name = ''
      let sealing_fluid_dispose_arr = getDataConfig('hemodialysis', 'sealing_fluid_dispose')

      for (let i = 0; i < sealing_fluid_dispose_arr.length; i++) {
        if (sealing_fluid_dispose_arr[i].id == val) {
          sealing_fluid_dispose_name = sealing_fluid_dispose_arr[i].name
        }
      }
      return sealing_fluid_dispose_name
    },
    QueryPartById: function (val) {
      let vascular_access_part_name = ''
      let vascular_access = this.$store.getters.vascular_access

      for (let i = 0; i < vascular_access.length; i++) {
        if (vascular_access[i].id == val) {
          vascular_access_part_name = vascular_access[i].name
        }
      }
      return vascular_access_part_name
    },
    QueryOperaById: function (val) {
      let vascular_access_desc_name = ''
      var vascular_access_desc = this.$store.getters.vascular_access_desc

      for (let i = 0; i < vascular_access_desc.length; i++) {
        if (vascular_access_desc[i].id == val) {
          vascular_access_desc_name = vascular_access_desc[i].name
          break
        }
      }

      return vascular_access_desc_name
    },
    BloodFlowById: function (val) {
      let blood_flow_name = ''
      let blood_flow_arr = getDataConfig('hemodialysis', 'blood_flow')

      for (let i = 0; i < blood_flow_arr.length; i++) {
        if (blood_flow_arr[i].id == val) {
          blood_flow_name = blood_flow_arr[i].name
        }
      }
      return blood_flow_name
    },
    commitInfo: function () {
      let ParamsQuery = this.formValue
      ParamsQuery['patient'] = this.$route.query.patient_id
      ParamsQuery['record_date'] = this.record_date
      ParamsQuery['mode'] = '1'
      if (this.record.creater > 0) {
        ParamsQuery['mode'] = '2'
        if (this.$store.getters.user.admin.id != this.record.creater) {
          ParamsQuery['mode'] = '3'
        }
      }
      commitAssessmentAfterDislysis(ParamsQuery)
        .then(response => {
          if (response.data.state == 0) {
            Toast.fail(response.data.msg)
            return false
          } else {
            Toast.success('提交成功')
            this.$emit(
              'did_update',
              response.data.data.assessmentAfterDislysis
            )
            for (const key in response.data.data.assessmentAfterDislysis) {
              this.record[key] =
                  response.data.data.assessmentAfterDislysis[key]
            }
          }
        })
        .catch(err => {
          Toast.fail(err)
        })
    },
    close: function () {
      this.$emit('close')
    },
    openPicker: function () {
      this.$refs.picker.open()
    },
    handleTimeConfirm: function (val) {
      val = val.replace('小时')
      val = val.replace('分钟')
      let timeArray = val.split(':')
      if (parseInt(timeArray[0].substring(0, 1)) == 0) {
        this.formValue.actual_treatment_hour = timeArray[0].charAt(
          timeArray[0].length - 1
        )
      } else {
        this.formValue.actual_treatment_hour = timeArray[0]
      }

      if (parseInt(timeArray[1].substring(0, 1)) == 0) {
        this.formValue.actual_treatment_minute = timeArray[1].charAt(
          timeArray[1].length - 1
        )
      } else {
        this.formValue.actual_treatment_minute = timeArray[1]
      }
      this.timeValue =
          this.formValue.actual_treatment_hour +
          '小时' +
          this.formValue.actual_treatment_minute +
          '分钟'
    },
    open: function () {
      this.isShowDialog = true
      this.visibility = false
      this.$refs.picker.close()
      var dialogTop = document.querySelector('#dialogTop')
      if (dialogTop != null) {
        this.$nextTick(() => {
          dialogTop.scrollTop = 0
        })
      }
    },
    getTremorNoise: function (id) {
      var tremor_noise = this.$store.getters.tremor_noise
      var tremorNoiseName = ''
      for (let i = 0; i < tremor_noise.length; i++) {
        if (tremor_noise[i].id == id) {
          tremorNoiseName = tremor_noise[i].name
        }
      }
      return tremorNoiseName
    },
    getDisequilibriumSyndrome: function (id) {
      var disequilibrium_syndrome = this.$store.getters.disequilibrium_syndrome
      var disequilibriumSyndromeName = ''
      for (let i = 0; i < disequilibrium_syndrome.length; i++) {
        if (disequilibrium_syndrome[i].id == id) {
          disequilibriumSyndromeName = disequilibrium_syndrome[i].name
        }
      }
      return disequilibriumSyndromeName
    },
    getDisequilibriumSyndromeOptionName: function (id) {
      var disequilibrium_syndrome_option = this.$store.getters
        .disequilibrium_syndrome_option
      var disequilibriumSyndromeOptionName = ''
      for (let i = 0; i < disequilibrium_syndrome_option.length; i++) {
        if (disequilibrium_syndrome_option[i].id == id) {
          disequilibriumSyndromeOptionName =
              disequilibrium_syndrome_option[i].name
        }
      }
      return disequilibriumSyndromeOptionName
    },
    getArterialTubeName: function (id) {
      var arterial_tube = this.$store.getters.arterial_tube
      var arterialTubeName = ''
      for (let i = 0; i < arterial_tube.length; i++) {
        if (arterial_tube[i].id == id) {
          arterialTubeName = arterial_tube[i].name
        }
      }
      return arterialTubeName
    },
    getIntravenousTubeName: function (id) {
      var intravenous_tube = this.$store.getters.intravenous_tube
      var intravenousTubeName = ''
      for (let i = 0; i < intravenous_tube.length; i++) {
        if (intravenous_tube[i].id == id) {
          intravenousTubeName = intravenous_tube[i].name
        }
      }
      return intravenousTubeName
    },
    getChannelName: function (id) {
      var channel = this.$store.getters.channel
      var channelName = ''
      for (let i = 0; i < channel.length; i++) {
        if (channel[i].id == id) {
          channelName = channel[i].name
        }
      }
      return channelName
    },
    getDialyzer: function (id) {
      var dialyzer = this.$store.getters.dialyzer
      var dialyzerName = ''
      for (let i = 0; i < dialyzer.length; i++) {
        if (dialyzer[i].id == id) {
          dialyzerName = dialyzer[i].name
        }
      }
      return dialyzerName
    },
    getDialysisProcess: function (id) {
      var dialysis_process = this.$store.getters.dialysis_process
      var dialysisProcessName = ''
      for (let i = 0; i < dialysis_process.length; i++) {
        if (dialysis_process[i].id == id) {
          dialysisProcessName = dialysis_process[i].name
        }
      }
      return dialysisProcessName
    },
    getOpera: function (id) {
      var hemostasis_opera = this.$store.getters.hemostasis_opera
      var hemostasisOperaName = ''
      for (let i = 0; i < hemostasis_opera.length; i++) {
        if (hemostasis_opera[i].id == id) {
          hemostasisOperaName = hemostasis_opera[i].name
        }
      }
      return hemostasisOperaName
    },
    menuEmpty: function (val) {
      this.visibility = false
      this.isShowDialog = true
      switch (val.type) {
        case 5:
          this.formValue.blood_access_part_id = ''
          break
        case 6:
          this.formValue.blood_access_part_opera_id = ''
          break

        case 8:
          this.formValue.internal_fistula_tremor_ac = ''
          break
        case 9:
          this.formValue.patient_gose = ''
          break

        case 11:
          this.formValue.dialysis_process = ''
          break

        case 13:
          this.formValue.hemostasis_opera = ''
          break
        case 14:
          this.formValue.tremor_noise = ''
          break
        case 15:
          this.formValue.disequilibrium_syndrome = ''
          break

        case 17:
          this.formValue.arterial_tube = ''
          break
        case 18:
          this.formValue.intravenous_tube = ''
          break
        case 19:
          this.formValue.dialyzer = ''

          break
      }
    },
    getPermission () {
      request
        .get('/m/api/permission/get', {
          params: {
            create_url: '/m/api/dialysis/assessmentAfterDislysis?mode=1',
            modify_url: '/m/api/dialysis/assessmentAfterDislysis?mode=2',
            modify_other_url: '/m/api/dialysis/assessmentAfterDislysis?mode=3',
            module: 8
          }
        })
        .then(res => {
          console.log(res)
          console.log('透后', this.predialysis)
          if (res.data.state == 0) {
            this.hasPermission = false
          } else if (res.data.state == 1) {
            if (this.record.id != '' && this.record.creater != 0) {
              // 有数据
              if (this.record.creater == this.$store.getters.user.admin.id) {
                // 创建人是自己
                if (res.data.data.is_has_modify == false) {
                  this.hasPermission = false
                  this.showTxt = '你没有修改透后评估权限'
                }
              } else {
                // 创建人不是自己
                if (res.data.data.is_has_modify_other == false) {
                  this.hasPermission = false
                  this.showTxt = '你没有修改他人透后评估权限'
                }
              }
            } else if (this.record.id == '' || this.record.creater == 0) {
              if (res.data.data.is_has_create == false) {
                this.hasPermission = false
                this.showTxt = '你没有新增透后评估权限'
              }
            }
          }
        })
    }
  },
  components: {
    CheckBoxSubMenu
  },
  created () {
   
    this.getPermission()
    let initHour = ''
    let initMinute = ''
    let tempHour = ''
    let tempMinute = ''
    this.template_id = this.$store.getters.user.template_info.template_id

    if (this.record != null && this.record.id != '') {
      for (const key in this.formValue) {
        // console.log(key, this.record[key]);
        this.formValue[key] = this.record[key]
      }
    }

    if (
      (this.record.id == undefined || this.record.id == '') &&
        this.predialysis.id != undefined
    ) {
      this.$set(
        this.formValue,
        'additional_weight',
        this.predialysis['additional_weight'].toString()
      )
    }
    // else  {
    if (this.record != null && this.record.id != '') {

    } else {
      if (this.last_record != null && this.last_record.id > 0) {
        for (var key in this.last_record) {
          if (key != 'actual_treatment_hour' && key != 'actual_treatment_minute' && key != 'weight_loss' && key != 'weight_after' && key != 'systolic_blood_pressure' && key != 'diastolic_blood_pressure' && key != 'pulse_frequency' && key != 'remark') {
            this.$set(
              this.formValue,
              key,
              this.last_record[key]
            )
          }
        }
      }
    }

    if (typeof this.formValue.actual_treatment_hour === 'undefined') {
      tempHour = ''
      initHour = '00'
    } else {
      tempHour = this.formValue.actual_treatment_hour + '小时'
      if (parseInt(this.formValue.actual_treatment_hour) < 10) {
        initHour = '0' + this.formValue.actual_treatment_hour
      } else {
        initHour = this.formValue.actual_treatment_hour
      }
    }
    if (typeof this.formValue.actual_treatment_minute === 'undefined') {
      tempMinute = ''
      initMinute = '00'
    } else {
      tempMinute = this.formValue.actual_treatment_minute + '分钟'

      if (parseInt(this.formValue.actual_treatment_minute) < 10) {
        initMinute = '0' + this.formValue.actual_treatment_minute
      } else {
        initMinute = this.formValue.actual_treatment_minute
      }
    }

    this.time = initHour + ':' + initMinute
    this.timeValue = tempHour + tempMinute

    var date = this.$route.query && this.$route.query.date
    date *= 1000
    var newDate = new Date(date)

    var y = newDate.getFullYear()
    var m = newDate.getMonth() + 1
    var d = newDate.getDate()
    if (isNaN(y) || isNaN(m) || isNaN(d)) {
      newDate = new Date()
      y = newDate.getFullYear()
      m = newDate.getMonth() + 1
      d = newDate.getDate()
    }
    this.record_date =
        y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d)

    this.puncture_point_oozing_blood_state =
        this.formValue.puncture_point_oozing_blood == 0
    this.puncture_point_haematoma_state =
        this.formValue.puncture_point_haematoma == 0
    this.eat_state = this.formValue.is_eat == 0

    if (this.formValue.weight_after == '') {
      this.formValue.weight_loss = ''
    } else {
      this.formValue.weight_loss = this.record.weight_loss
    }
  }
}
</script>

<style style="stylesheet/scss" lang="scss" scoped>
  .textarea {
  width: 100%;
  height: 2.4rem;
  line-height: 0.6rem;
  color: $pgh-color;
  font-size: 0.45rem;
  padding-left: 0.36rem;
  border: none;
  border-bottom: 1px #e5e5e5 solid;
  }
  .DialogContent {
  padding-bottom: 2rem !important;
  }
  .warnTxt {
  font-size: 0.5rem;
  height: 1rem;
  line-height: 1rem;
  text-align: center;
  background: #faa331;
  color: #fff;
  }
</style>
