<template>
  <!-- <v-combobox
    v-model="vmodel"
    :items="materialInfoaction"
    item-disabled="itemdisabled"
    item-text="label"
    item-value="value"
    label="请选择物料"
    :isMultiple="isMultiple"
    outlined
    disable-lookup
    filled
    clearable
    solo
    :return-object="runObject"
    :disabled="disabled"
  ></v-combobox> -->
  <nm-combobox :value_="vmodel" v-model="v_model" :isMultiple="isMultiple" :disabled="disabled" :returnobject="returnObject" :dataSource="materialInfoaction" label="请选择物料"> </nm-combobox>
</template>

<script>
import { mixins } from 'xmanager-ui'

const materialInfoapi = $api.materialApp.material

export default {
  mixins: [mixins.formSave],
  props: {
    returnObject: {
      type: Boolean,
      default: false
    },
    model: {
      type: [String, Object],
      default: ''
    },
    itemdisabled: {
      type: Boolean,
      default: false
    },
    disabled: {
      type: Boolean,
      default: false
    },
    isMultiple: {
      type: Boolean,
      default: false
    },
    unitDataRules: {
      type: Array,
      default: () => {
        return []
      }
    }
  },
  data() {
    return {
      vmodel: this.model,
      v_model: this.model,
      materialInfoaction: []
    }
  },

  methods: {
    getData() {
      materialInfoapi.select().then(data => {
        this.materialInfoaction = data
      })
    }
  },
  created() {
    materialInfoapi.select().then(data => {
      this.materialInfoaction = data
    })
  },
  watch: {
    v_model: function(val) {
      this.vmodel = val
      this.v_model = val
      this.$emit('input', val)
    },
    model: function(val) {
      this.v_model = val
      this.vmodel = val
    }
  }
}
</script>
