<template>
  <nm-combobox :value_="vmodel" v-model="v_model" :isMultiple="isMultiple" :disabled="disabled" :returnobject="returnObject" :dataSource="materialGroupaction" label="请选择物料组"> </nm-combobox>
</template>

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

const materialGroupapi = $api.materialApp.materialGroup

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,
      materialGroupaction: []
    }
  },

  methods: {
    getData() {
      materialGroupapi.select().then(data => {
        this.materialGroupaction = data
      })
    }
  },
  created() {
    materialGroupapi.select().then(data => {
      this.materialGroupaction = 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>
