<template>
  <a-modal
    :title="modalTitle"
    :width="850"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @cancel="handleCancel"
  >
    <a-table
      bordered
      :data-source="data"
      :columns="columns"
      tableLayout="auto"
      rowKey="id">
    </a-table>
    <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: 'StoreList',
  components: {
    DetailList,
    DetailListItem
  },
  data () {
    return {
      confirmLoading: false,
      mdl: {},
      modalTitle: null,
      visible: false,
      // 下拉框map
      model: {
        'spareId': null,
        'storeId': null,
        'num': null,
        'sort': null,
        'delFlag': null,
        'remark': null,
        'createdUserId': null,
        'updateUserId': null,
        'updateTime': null,
        'createdUserName': null,
        'updateUserName': null
      },
      // 表头
      columns: [
        {
          title: '备件名称',
          dataIndex: 'spareName'
        },
        {
          title: '仓库名称',
          dataIndex: 'storeName'
        },
        {
          title: '数量',
          dataIndex: 'num'
        },
        {
          title: '备注',
          dataIndex: 'remark'
        },
        {
          title: '创建日期',
          dataIndex: 'createdTime'
        }
      ],
      data: []
    }
  },
  created () {
    // 下拉框map
  },
  methods: {
    base (record) {
      this.visible = true
      this.modalTitle = '仓库信息'
      this.model = record
      this.data = record.rows
    },
    handleCancel () {
      this.visible = false
      this.confirmLoading = false
    }

  }
}
</script>
