<template>
  <el-select v-model="processId" placeholder="请选择工艺">
    <el-option v-for="item in craftList" :key="item.processId" :label="item.processName" :value="item.processId" />
  </el-select>
</template>

<script>
import { mapGetters } from 'vuex';

export default {
  name: 'CraftSelect',
  props: {
    value: {
      type: [String, Number, undefined],
      required: false
    }
  },
  data() {
    return {
      craftList: []
    }
  },
  mounted() {
    this.getCraftList();
  },
  computed: {
    ...mapGetters(['processList']),
    processId: {
      get() {
        return this.$props.value;
      },
      set(value) {
        this.$emit('input', value);
        this.$emit('change', value);
      }
    }
  },
  methods: {
    getCraftList() {
      console.log(this.processList)
      this.craftList = this.processList;
    }
  }
}
</script>