<template>
  <div class="form-show-scrollY">
    <div class="form-template">
      <BreadCrumb
        :curmbFirst="'履约管理'"
        :curmbSecond="breadTxt"
        :curmbThird="'录入量表'"
        :jumPathThird="jumPathThird"
      />
      <div class="resident-content f-main-content screenSet">

        <el-row :gutter="24" align="middle" type="flex" class="form-header">
          <el-col :span="18">{{titleText}}</el-col>
          <el-col :span="6" v-if="showBtn=='1'">
            <el-button type="primary" size="small" class="formSubmit" @click="formSubmit(1)">提交</el-button>
            <el-button class="button-white formTempSave" size="small" plain @click="formSubmit(2)">暂存</el-button>
          </el-col>
        </el-row>

        <div class="title-box">
          <h1>{{titleText}}</h1>
          <h2>{{titleSmText}}</h2>
        </div>

        <!--模板页面除了显示居民基本信息，将病种展示作为组件引入-->

        <div class="form-container">
          <!--脑卒中-->
          <stroke v-if="scaleNo=='SCALE0003'" :showBtn="showBtn" :scaleType="scaleNo" :checkStart="checkStart" @checkEnd="checkEnd" :saveWay="saveWay" />
          <!--高血压-->
          <hypertension v-if="scaleNo=='SCALE0001'" :showBtn="showBtn" :scaleType="scaleNo" :checkStart="checkStart" @checkEnd="checkEnd" :saveWay="saveWay" ></hypertension>
          <!--糖尿病-->
          <diabetes v-if="scaleNo=='SCALE0002'" :showBtn="showBtn" :scaleType="scaleNo" :checkStart="checkStart" @checkEnd="checkEnd" :saveWay="saveWay" ></diabetes>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import BreadCrumb from '@/components/breadcrumb'

  // 脑卒中
  import stroke from './patient-scale/stroke'
  import hypertension from './patient-scale/hypertension'
  import diabetes from './patient-scale/diabetes'
  export default {
    data(){
      return {
        titleText: '',
        titleSmText: '',
        breadTxt: '录入管理',
        jumPathThird: '/followup/record-manage/record-list',
        checkStart: false,
        showBtn: '1', //值为0隐藏右上角按钮，值为1显示按钮
//        resourceId: '',
        saveWay: 1,
        scaleNo: ''
      }
    },
    components: {
      stroke,
      hypertension,
      BreadCrumb,
      diabetes,
    },
    methods: {
      formSubmit(val){
        this.saveWay = val
        this.checkStart = true;
      },
      checkEnd(val){
        this.checkStart = false
      }
    },
    created(){
      this.scaleNo = this.$route.query.scaleNo;
      console.log('scaleNo=>',this.scaleNo)
      // 0003 脑卒中、0002 糖尿病、0001 高血压
      if(this.scaleNo == 'SCALE0003'){
        this.titleText = '心脑血管病危险因素社区、乡镇人群履约表';
        this.titleSmText = '（适用于社区、乡镇脑卒中高危人群满6个月、12个月时履约和中危人群满12个月时履约使用）';
      }else if(this.scaleNo == 'SCALE0001'){
        this.titleText = '高血压患者履约服务记录表';
        this.titleSmText = '（本表为高血压患者在接受履约服务时由医生填写）';
      }else if(this.scaleNo == 'SCALE0002'){
        this.titleText = '2 型糖尿病患者履约服务记录表 ';
        this.titleSmText = '（本表为2型糖尿病患者在接受履约服务时由医生填写）';
      }
      if(this.$route.query.showBtn=='0'){
        this.showBtn = String(this.$route.query.showBtn);
      }
    },
  }
</script>

<style lang="scss" scoped>

  @import '../../../style/followup/followup-common';
  @import '../../../style/followup/element-reset.css';

  .form-show-scrollY{
    width: 100%; height: 100%; overflow: hidden; overflow-y: scroll;
    &::-webkit-scrollbar{
      width: 8px; height: 8px;
      background: #fff;
    }
  }
  .form-template{
    .form-header{
      /*position: fixed;*/
      /*z-index:100000;*/
      line-height: 60px;
      height: 60px;
      border-bottom: 1px solid #e1e1e1;
    }
    .patient-base-info{
      line-height: 60px;
      height: 60px;
      border-bottom: 1px dashed #ccc;
      [class*=el-col-]{
        float: left;
      }
    }
    .title-box{
      padding: 20px;
      text-align: center;
      h1{
        font-size: 18px;
        font-weight: normal;
      }
      h2{
        font-size: 16px;
        font-weight: normal;
        margin-top: 15px;
      }
    }
    .formSubmit{
      float: right;
      margin-left: 10px;
    }
    .formTempSave{
      float: right;
    }
    .form-container{
      padding: 0 10px;
    }

  }
  .title{
    font-weight: bold;
  }

</style>
