<template>
  <div>
    <van-row class="top_row">
      <van-col :span="9">
        <div style="visibility: hidden">
          <span class="title"></span>
        </div>
      </van-col>
      <van-col :span="14">
        <div class="department">
          <ul>
            <li
              v-for="(item,i) in ['透析临嘱','普通医嘱']"
              :key="i"
              :class="index == i? 'active':'' "
              @click="ClickTab(i)"
            >{{item}}</li>
          </ul>
        </div>
      </van-col>

      <van-col :span="4">
        <router-link to="/add_urgent_schedule"></router-link>
        <div class="search" style="visibility: hidden">
          <van-field v-model="search_input" ref="search_field" placeholder="透析号/姓名" class="field">
            <i class="iconfont" slot="left-icon">&#xe741;</i>
            <van-button
              slot="button"
              size="small"
              type="info"
              style="border: none;"
              @click="searchWithKeyword"
            >搜索</van-button>
          </van-field>
        </div>
      </van-col>
    </van-row>

    <div class="area">
      <DialysisAdviceTable v-show="index==0"></DialysisAdviceTable>
      <NormalAdviceTable v-show="index==1"></NormalAdviceTable>
    </div>
  </div>
</template>

<script>
import DialysisAdviceTable from "./DialysisAdviceTable";
import NormalAdviceTable from "./NormalAdviceTable";
export default {
  name: "RecordPage",
  data() {
    return {
      index: 0,
      search_input: "",
      search_keyword: ""
    };
  },
  components: {
    NormalAdviceTable,
    DialysisAdviceTable
  },
  methods: {
    ClickTab: function(tabIndex) {
      this.index = tabIndex;
    },
    searchWithKeyword: function() {
      this.$refs.search_field.blur();
      this.search_keyword = this.search_input;
    },
    clearKeyword: function() {
      this.search_input = "";
      this.search_keyword = "";
    }
  }
};
</script>

<style style="stylesheet/scss" lang="scss" scoped>
.top_row {
  font-size: 0.3rem;
  padding: 0.3rem 0.3rem;
  // border-bottom: 1px #e5e5e5 solid;
  display: flex;
  align-items: center;
}
.title {
  font-size: 0.34rem;
  font-weight: 600;
  color: $title-color;
}
.department {
  text-align: center;
  ul {
    li {
      float: left;
      font-size: 0.36rem;
      margin: 0 0.2rem;
      height: 0.64rem;
      line-height: 0.64rem;
      padding: 0 0.3rem;
      color: $title-color;

      &.active {
        background: $main-color;
        color: #fff;
        border-radius: 30px;
      }
    }
  }
}
.search {
  color: #a8b3ba;
  width: 4.2rem;
  float: right;

  .iconfont {
    color: #a8b3ba;
    font-size: 0.36rem;
  }
  .field {
    background-color: #ebf1f7;
    height: 0.6rem;
    line-height: 0.6rem;
    padding: 0 0 0 10px;
    border-radius: 30px;
  }
}
.add_schedule_btn {
  margin-left: 10px;
  float: right;
  background-color: #ff7978;
  border: none;
  @media only screen and (max-width: 812px) {
    min-width: 60px !important;
  }
}
</style>

