<template>
  <el-dialog title="设置制作人" :visible="visible" width="320px" :show-close="false" @close="dialogClose">
    <el-select v-model="producer" placeholder="请选择制作人" multiple>
      <el-option v-for="item in memberList" :key="item.id" :label="item.name" :value="item.id" />
    </el-select>

    <div slot="footer">
      <el-button @click="dialogClose">取消</el-button>
      <el-button type="primary" @click="addChapterNode">确定</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: 'SetProducer',
  props: {
    visible: {
      type: Boolean,
      required: true,
    },
    id: {
      type: String,
      default: '',
    },
    memberList: {
      type: Array,
      required: true,
    },
  },
  data() {
    return {
      producer: [],
    };
  },
  methods: {
    dialogClose() {
      this.$emit('close');
      this.producer = [];
    },
    addChapterNode() {
      this.$emit('chapterSetProducer', { node_id: this.id, producer_id_list: this.producer });
      this.producer = [];
    },
  },
};
</script>

<style lang="scss" scoped>
.el-select {
  width: 100%;
}
</style>
