<template>
  <el-select v-model="projectId" placeholder="请选择关联项目" clearable>
    <el-option v-for="dict in projectList" :key="dict.projectName" :label="dict.projectName" :value="dict.id"></el-option>
  </el-select>
</template>

<script>
export default {
  name: 'projectSelect',
  props: {
    value: {},
    deptId: {},
    multiple: {
      type: Boolean,
      default: false
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      projectId: '',
      projectList: []
    };
  },
  watch: {
    value(val) {
      this.projectId = val;
    },
    projectId(val) {
      this.$emit('input', val);
    }
  },
  mounted() {
    this.getList();
  },
  methods: {
    getList() {
      //项目列表
      this.ajax({ url: '/work/project/selectAll' }).then((response) => {
        this.projectList = response.data;
      });
    }
  }
};
</script>
