<template>
  <el-form
    ref="form"
    :model="form"
    :rules="rules"
    label-width="110px"
    :disabled="form.signId != undefined"
  >
    <el-row>
      <el-col :span="24">
        <el-form-item label="跟进人员" prop="followUsers">
          <el-select v-model="form.followUsers" multiple placeholder="请选择" clearable>
            <el-option
              v-for="dict in options.userOptions"
              :key="dict.id"
              :label="dict.name"
              :value="dict.id"
            />
          </el-select>
        </el-form-item>
      </el-col>
    </el-row>
  </el-form>
</template>
<script>
export default {
  name: 'BatchUpdateForm',
  model: {
    prop: 'info',
    event: 'update',
  },
  props: {
    info: {
      type: Object,
      default: () => {},
    },
    options: {
      type: Object,
      default: () => ({
        userOptions: [],
      }),
    },
  },
  data() {
    return {
      admin: JSON.parse(localStorage.getItem('admin')),
      form: JSON.parse(JSON.stringify(this.info)),
      rules: {
        followUsers: {
          required: true,
          message: '跟进人员不能为空',
          trigger: 'blur',
        },
      },
    }
  },
  watch: {
    form: {
      handler(val) {
        this.$emit('update', val)
      },
      deep: true,
      immediate: true,
    },
  },
  methods: {
    validate() {
      return this.$refs.form.validate()
    },
  },
}
</script>

