<template>
<div class="card-wrapper">
  <div class="card-title" :style="`color:${color}`">
    <div class="dot"/>
    {{title}}
    <p v-if="showTab">
      <span :class="{on: curTab === '处置中'}" @click="handleClick('处置中')">处置中</span>
      |
      <span :class="{on: curTab === '已完成'}" @click="handleClick('已完成')">已完成</span>
    </p>
    <div class="line">
      <img src="@/assets/images/card-title-line.png"/>
    </div>
  </div>
  <div class="card-content">
    <slot />
  </div>
</div>
</template>

<script>
export default {
  name: 'Mode2',
  props: {
    title: {
      type: String,
      default: '标题',
    },
    color: {
      type: String,
    },
    showTab: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      curTab: '处置中',
    }
  },
  methods: {
    handleClick(type) {
      this.curTab = type
      this.$store.commit('SET_CUR_TAB', type)
    },
  },
}
</script>

<style lang="stylus" scoped>
.card-wrapper
  .card-title
    display flex
    align-items center
    font-size .11rem
    font-weight bold
    >p
      font-weight normal
      margin-left .05rem
      font-size .09rem
      >span
        color #999
        cursor pointer
        &:hover
        &.on
          color #fff
    .dot
      width .03rem
      height .1rem
      background $edgeColor
      margin-right .05rem
    .line
      margin-left .05rem
      flex 1
      >img
        width 100%
        min-height .05rem
  .card-content
    padding 0.03rem 0 0
    >div
      width 100%
      height 100%
</style>
