<template>

  <div class="auto" style="height: auto">
    <modal :show.sync="show" width="1500px" title="机表票据开具" v-ref:modal large backdrop="false">
      <!--<header slot="modal-header" class="modal-header" style="text-align: center">-->
        <!--<h4 class="modal-title">机表电子票开具</h4>-->
      <!--</header>-->
      <article slot="modal-body" class="modal-body">
        <tabset v-ref:tabs :close="false">
          <tab header='未开记录' v-if="eticket">
            <un-open-hand :row="data" v-if="$refs.tabs.renderData[$refs.tabs.active].header === '未开记录'"></un-open-hand>
          </tab>
          <tab header='已开发票' v-if="eticket">
            <has-open-hand :row="data" v-if="$refs.tabs.renderData[$refs.tabs.active].header === '已开发票'"></has-open-hand>
          </tab>
          <tab header='未开记录' v-if="receipt" >
            <un-open-receipt :row="data" v-if="$refs.tabs.renderData[$refs.tabs.active].header === '未开记录'"></un-open-receipt>
          </tab>
          <tab header='已开收据' v-if="receipt">
            <has-open-receipt :row="data" v-if="$refs.tabs.renderData[$refs.tabs.active].header === '已开收据'"></has-open-receipt>
          </tab>
        </tabset>
      </article>
      <footer slot="modal-footer" class="modal-footer">

      </footer>
    </modal>
  </div>
</template>

<script>

  import UnOpenHand from './UnOpenHand'
  import HasOpenHand from './HasOpenHand'

  let getHandChargeGen = async function(self) {
    await self.$getConfig(self,'handUserConfig')
    self.receipt = self.config.printType.includes('receipt')
    self.eticket = self.config.printType.includes('eticket')
  }
  export default {
    title: '电子票开具',
    components: {
      UnOpenHand, HasOpenHand
    },
    data () {
      return {
        receipt:false,
        eticket:false,
        config: {
          // printType: ['receipt','eticket'], // 收据/电子票/专用发票/国税发票
          printType: ['receipt'], // 收据/电子票/专用发票/国税发票
        },
      }
    },
    props: ['show', 'data'],
    ready(){
      getHandChargeGen(this)

    }
  }

</script>
