<template>
  <el-col :span="span">
    <el-form-item :label="label" :rules="requireRule(!disabled && required, label)" :prop="prop">
      <el-select ref="select" v-model="parent.model[prop]" :multiple="multiple" :clearable="clearable" filterable
        :disabled="disabled" value-key="userId" collapse-tags>
        <el-option v-for="item in data" :key="item.userId" :value="item" :label="item.userName" :title="item.userName" />
      </el-select>
    </el-form-item>
  </el-col>
</template>

<script>
import mixin from '../../../../components/CustomElement/mixin'

import { listUser } from '@/api/system/user'

/**
 * 下拉框组件
 */
export default {
  mixins: [mixin],
  props: {
    multiple: {
      type: Boolean,
      default: false
    },
    showEmpty: {
      type: Boolean,
      default: false
    },
    emptyLabel: {
      type: String,
      default: '全部'
    },
    dict: {
      type: Array,
      default: () => []
    },
    //查询参数1
    param: {
      type: String,
      default: ''
    },
    setFirst: {
      type: Boolean,
      default: true
    },
    span: {
      type: Number,
      default: 12
    }
  },
  data() {
    return {
      data: []

    }
  },
  created() {
    listUser({pageNum: 0, pageSize: 0}).then(({ code, rows }) => {
      if (code === 200) {
        this.data = rows
      }
    })
  }
}
</script>
