<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: 'InStoreList',
  components: {
    DetailList,
    DetailListItem
  },
  data () {
    return {
      confirmLoading: false,
      mdl: {},
      modalTitle: null,
      visible: false,
      // 下拉框map
      model: {
        'inId': null,
        'inNo': null,
        'storeId': null,
        'spareId': null,
        'num': null,
        'price': null,
        'totalPrice': null,
        'createdUserId': null,
        'updateUserId': null,
        'updateTime': null,
        'column13': null,
        'createdUserName': null,
        'updateUserName': null
      },
      // 表头
      columns: [
        {
          title: '入库单号',
          dataIndex: 'inNo'
        },
        {
          title: '入库仓库',
          dataIndex: 'storeId',
          customRender: (text, record, index) => {
            return record.storeName
          }
        },
        {
          title: '备件id',
          dataIndex: 'spareId',
          customRender: (text, record, index) => {
            return record.spareName
          }
        },
        {
          title: '入库数量',
          dataIndex: 'num'
        },
        {
          title: '入库单价',
          dataIndex: 'price',
          customRender: (text, record, index) => {
            return this.BaseTool.Amount.formatter(text)
          }
        },
        {
          title: '入库总价',
          dataIndex: 'totalPrice',
          customRender: (text, record, index) => {
            return this.BaseTool.Amount.formatter(text)
          }
        },
        {
          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>
