<template>
  <nm-entity-picker
    label="获取物料清单"
    v-model="billofmaterial"
    :materialvalue="billofmaterial"
    :action="billofmaterialaction"
    :cols="billofmaterialcols"
    :text="this.model"
    :value="this.model"
    columnName="name"
    columnValue="id"
    disabled
    clearable
  >
  </nm-entity-picker>
</template>

<script>
import { mixins } from 'xmanager-ui'
import cols from '../../views/billOfMaterial/index/cols'
const billofmaterialapi = $api.materialApp.billOfMaterial

export default {
  mixins: [mixins.formSave],
  props: {
    model: {
      type: [String, Number, Array],
      default: ''
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      billofmaterial: this.model,
      billofmaterialaction: billofmaterialapi.query,
      billofmaterialcols: cols
    }
  },
  methods: {},
  mounted() {
    console.log(this.billofmaterialaction)
  },
  watch: {
    billofmaterial: function(val) {
      this.billofmaterial = val
      this.$emit('input', val)
    },
    model: function(val) {
      this.billofmaterial = val
    }
  }
}
</script>
