<template>
  <div class="Dialog">
    <div class="DialogTit">
      <span class="iconfont" @click="closeDialog()">&#xe720; 返回</span>
      <h1 class="name">{{ title }}</h1>
      <span class="success"></span>
    </div>

    <div class="optionsBox">
      <div class="list">
        <ul>
          <li
            @click="handleClick(item)"
            v-for="item in optionList"
            :key="item.id"
            value="item.id"
            :class="index == item.id ? 'tick' : ''"
          >
            {{ item.name }}
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "LongDialogMenu",
  props: {
    title: "",
    index: 0,
    option_poro: {
      type: Array
    },
    show_prop: {
      type: Object
    },
    show_index: {
      type: Number,
      default: 0
    },
    data_prop: {},
    data_mode: {
      type: String
    }
  },
  methods: {
    handleClick(item) {
      switch (this.data_mode) {
        case "mode":
          this.data_prop.mode_id = item.id;
          this.data_prop.mode_name = item.name;
          this.data_prop.mode = item.id;
          break;
        case "perfusion_apparatus":
          this.data_prop.perfusion_apparatus = item.id;
          this.data_prop.perfusion_apparatus_name = item.name;
          break;
        case "replacement_way":
          this.data_prop.replacement_way = item.id;
          this.data_prop.replacement_way_name = item.name;
          break;
        case "anticoagulant":
          this.data_prop.anticoagulant = item.id;
          this.data_prop.anticoagulant_name = item.name;
          break;
        case "anticoagulant":
          this.data_prop.anticoagulant = item.id;
          this.data_prop.anticoagulant_name = item.name;
          break;
        case "hemodialysis_machine":
          this.data_prop.hemodialysis_machine = item.id;
          this.data_prop.hemodialysis_machine_name = item.name;
          break;

        default:
          break;
      }
      this.show_prop.mode_show[this.show_index] = false;
      this.show_prop.paden_show = true;
    },
    closeDialog() {
      this.show_prop.paden_show = true;
      this.show_prop.mode_show[this.show_index] = false;
    }
  },
  data() {
    return {
      // index: 0,
      optionList: this.option_poro,
      id: this.id_prop
    };
  }
};
</script>

<style style="stylesheet/scss" lang="scss" scoped>
.optionsBox {
  background: #fff;
  max-height: 10.6rem;
  min-height: 5rem;
  overflow-y: scroll;
  @media only screen and (max-width: 812px) {
    min-height: 8rem !important;
  }
  ul {
    li {
      height: 1rem;
      line-height: 1rem;
      border-bottom: 1px #e5e5e5 solid;
      padding: 0 0.38rem;
    }
    .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: 10.6rem;
  min-height: 5rem;
  overflow-y: scroll;
  ul {
    li {
      line-height: 1rem;
    }
  }
}
</style>
