<template>
  <div>
    <Table :columns="columns" :data="tableList"></Table>
  </div>
</template>

<script>
import axios from 'axios'

export default {
  name: 'details-modal',
  props: {
    rowData: {
      type: Object,
      default() {
        return {}
      }
    },
    parameter: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  data() {
    return {
      openDetails: true,
      tableList: [],
      columns: [
        {
          title: '物料名称',
          key: 'materialName'
        },
        {
          title: '标签值',
          key: 'materialRfid'
        },
        {
          title: '门幅',
          key: 'materialWidth',
          width: 120,
          align: 'center',
          render: (h, params) => {
            return h('div', [
              h('Icon', {
                props: {
                  type: 'person'
                }
              }),
              h('strong', params.row.materialWidth + 'cm')
            ])
          }
        },
        {
          title: '长度',
          key: 'quantity',
          width: 100,
          align: 'center',
          render: (h, params) => {
            return h('div', [
              h('Icon', {
                props: {
                  type: 'person'
                }
              }),
              h('strong', params.row.quantity + 'cm')
            ])
          }
        },
        {
          title: '技术员',
          key: 'userName',
          width: 100,
          align: 'center'
        }
      ]
    }
  },
  mounted() {
    this.getDetails()
  },
  methods: {
    getDetails() {
      axios
        .post('/cloudApi/stockDetail/appointInfo', {
          ...this.parameter,
          materialCode: this.rowData.code
        })
        .then(res => {
          this.tableList = res.data.data
        })
    }
  }
}
</script>

<style lang="less" scoped>
</style>
