<template>
  <!-- <v-combobox
    v-model="vmodel"
    :items="equipmentData"
    item-disabled="itemdisabled"
    item-text="label"
    item-value="value"
    label="设备"
    :isMultiple="isMultiple"
    outlined
    disable-lookup
    clearable
    hide-selected
    solo
    :return-object="runObject"
    :disabled="disabled"
  ></v-combobox> -->
  <nm-combobox :value_="vmodel" v-model="vmodel" :isMultiple="isMultiple" :returnobject="returnObject" :dataSource="equipmentData" label="请选择设备"> </nm-combobox>
</template>

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

const api = $api.materialApp.equipment

export default {
  mixins: [mixins.formSave],
  props: {
    returnObject: {
      type: Boolean,
      default: false
    },
    model: {
      type: String,
      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,
      equipmentData: this.getData()
    }
  },
  methods: {
    // query() {
    //   return new Promise(resolve => {
    //     this.$nextTick(() => {
    //       unitapi.getUnit().then(data => {
    //         this.unitData = data
    //         resolve(this.unitData)
    //       })
    //     })
    //   })
    // },
    getData() {
      api.select().then(data => {
        this.equipmentData = data
      })
    }
  },
  watch: {
    vmodel: function(val) {
      this.vmodel = val
      this.$emit('input', val)
    }
  }
}
</script>
