<template>
  <ele-modal :visible.sync="visible" title="物料清单">
    <ele-pro-table 
	  :columns="columns" 
	  :datasource="tableList" 
	  cache-key="bomList"
	  :need-page="false"
	>
    </ele-pro-table>
  </ele-modal>
</template>

<script>
  import dictMixins from '@/mixins/dictMixins';
  export default {
	mixins: [dictMixins],
    data () {
      return {
        visible: false,
	    	tableList:[],
        columns: [
          {
            label: '序号',
            type: 'index',
            width: 55,
            align: 'center'
          },
          {
            label: '编码',
            prop: 'listCode'
          },
          {
            label: '名称',
            prop: 'listName'
          },
          {
            label: '类型',
            prop: 'listType',
			formatter: (_row, _column, cellValue) => {
			  return this.getDictValue('类型用途', _row.listType);
			}			
          },
          {
            label: '计量单位',
            prop: 'listUnit'
          },
		  {
		    label: '数量',
		    prop: 'listQuantity'
		  }
        ]
      };
    },
	created () {
	  this.requestDict('类型用途');
	},
    methods: {
      open (row) {
		if(row){
			this.tableList = row.materialList
		}
				this.visible = true;
		}
    }
  };
</script>
