<template>
  <a-modal
    v-model="isShow"
    :footer="null"
    class="inventoryChecking-print-type-modal"
    :maskClosable="false"
    centered
    title="导出excel"
    @cancel="isShow=false"
  >
    <div style="line-height: 48px;padding: 0 30px;">
      <div>盘点单号：{{ itemData&&itemData.checkWarehouseNo }}</div>
      <div>盘点类型：{{ (itemData&&itemData.checkTypeDictValue) || '--' }}
        <span v-if="itemData&&itemData.checkType=='SELECT'">({{ (itemData&&itemData.warehouseFlagDictValue) || '--' }})</span>
      </div>
      <div>产品范围：
        <a-radio-group v-model="productScopeFlag">
          <a-radio :value="true">
            所有盘点产品
          </a-radio>
          <a-radio :value="false">
            有盈亏的产品
          </a-radio>
        </a-radio-group>
      </div>
      <div class="btn-cont" style="text-align: center;padding-top: 20px;">
        <a-button id="inventoryChecking-export-save" @click="isShow=false">取消</a-button>
        <a-button type="primary" id="inventoryChecking-export-back" @click="handleSave()" style="margin-left: 15px;">确定导出</a-button>
      </div>
    </div>
  </a-modal>
</template>

<script>
import { commonMixin } from '@/utils/mixin'
export default {
  mixins: [commonMixin],
  props: {
    openModal: { //  弹框显示状态
      type: Boolean,
      default: false
    },
    itemData: {
      type: Object,
      default: () => {
        return null
      }
    },
    nowType: {
      type: String,
      default: ''
    }
  },
  data () {
    return {
      isShow: this.openModal, //  是否打开弹框
      productScopeFlag: true
    }
  },
  methods: {
    // 确认
    handleSave () {
      this.$emit('ok', 'export', { productScopeFlag: this.productScopeFlag })
    }
  },
  watch: {
    //  父页面传过来的弹框状态
    openModal (newValue, oldValue) {
      this.isShow = newValue
    },
    //  重定义的弹框状态
    isShow (newValue, oldValue) {
      if (!newValue) {
        this.$emit('close')
      }
    }
  }
}
</script>

<style lang="less">
  .inventoryChecking-print-type-modal{
    .btn-cont {
      text-align: center;
      margin: 15px 0 10px;
    }
  }
</style>
