<template>
  <a-modal
    :title="modalTitle"
    :width="850"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @cancel="handleCancel"
  >
    <detail-list title="" :col="2">
      <detail-list-item term="备件名称">{{ model.spareName }}</detail-list-item>
      <detail-list-item term="仓库名称">{{ model.storeName }}</detail-list-item>
      <detail-list-item term="数量">{{ model.num }}</detail-list-item>
      <detail-list-item term="初始数量">{{ model.initNum }}</detail-list-item>
      <detail-list-item term="价格">{{ model.price }}</detail-list-item>
      <detail-list-item term="初始价">{{ model.initPrice }}</detail-list-item>
      <detail-list-item term="采购价">{{ model.initPurchasePrice }}</detail-list-item>
      <detail-list-item term="最高库存">{{ model.maxStock }}</detail-list-item>
      <detail-list-item term="最低库存">{{ model.minStock }}</detail-list-item>
<!--      <detail-list-item term="排序">{{ model.sort }}</detail-list-item>
      <detail-list-item term="创建人">{{ model.createdUserName }}</detail-list-item>
      <detail-list-item term="更新人">{{ model.updateUserName }}</detail-list-item>-->
      <detail-list-item term="是否删除"><badge :status="DictCache.COLOR.DELFLAG[model.delFlag]" :text="delFlagMap[model.delFlag]"></badge></detail-list-item>
      <detail-list-item term="更新日期">{{ model.updateTime }}</detail-list-item>
    </detail-list>
    <detail-list title="" :col="1">
      <detail-list-item term="备注">{{ model.remark }}</detail-list-item>
      <detail-list-item term="二维码"><img-code :src="model.qrCode" :type="3" :code-id="model.id" :width="200"></img-code></detail-list-item>
    </detail-list>
    <template slot="footer">
      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">返回</a-button>
    </template>
  </a-modal>
</template>

<script>
import DetailList from '@/components/tools/DetailList'
const DetailListItem = DetailList.Item

export default {
  name: 'SpareStoreDetail',
  components: {
    DetailList,
    DetailListItem
  },
  data () {
    return {
      confirmLoading: false,
      mdl: {},
      modalTitle: null,
      visible: false,
      // 下拉框map
      delFlagMap: {},
      model: {
        'spareId': null,
        'storeId': null,
        'num': null,
        'price': null,
        'qrCode': null,
        'initPrice': null,
        'initPurchasePrice': null,
        'sort': null,
        'delFlag': null,
        'minStock': null,
        'maxStock': null,
        'remark': null,
        'createdUserId': null,
        'updateUserId': null,
        'updateTime': null,
        'createdUserName': null,
        'updateUserName': null
      }
    }
  },
  created () {
    // 下拉框map
    this.delFlagMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.DELFLAG)
  },
  methods: {
    base (record) {
      this.visible = true
      this.modalTitle = '详情'
      this.model = record
    },
    handleCancel () {
      this.visible = false
      this.confirmLoading = false
    }

  }
}
</script>
