<template>
  <nm-entity-picker
    label="获取物料信息"
    v-model="materialInfo"
    :text="this.model"
    :value="this.model"
    :materialvalue="materialInfo"
    :action="materialInfoaction"
    :cols="materialInfocols"
    columnName="name"
    columnValue="name"
    disabled
    clearable
  >
  </nm-entity-picker>
</template>

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

export default {
  mixins: [mixins.formSave],
  props: {
    model: {
      type: [String, Number, Array],
      default: ''
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      materialinfo: null,
      materialInfo: this.model,
      materialInfoaction: materialInfoapi.query,
      materialInfocols: cols
    }
  },
  methods: {},
  mounted() {
    console.log(this.materialInfoaction)
  },
  watch: {
    materialInfo: function(val) {
      this.materialinfo = val
      this.$emit('input', val)
    },
    model: function(val) {
      this.materialinfo = val
      // console.log(this.materialinfo, '反写回传model值')
    }
  }
}
</script>
