<template>
  <el-select filterable :value="value === 0 ? undefined : value" @change="change" v-bind="$attrs" clearable>
    <el-option v-for="dock in getDock" :key="dock.id" :label="$l(dock, 'title')" :value="dock.id"></el-option>
  </el-select>
</template>

<script>
/**
 * 码头
 */
export default {
  name: "dockSelect",
  inheritAttrs: false,
  props: {
    value: Number,
    allDocks: Array,
    portType: String
  },
  model: {
    prop: "value",
    event: "change",
  },
  data() {
    return {};
  },
  computed: {
    getDock() {
      if(!this.portType) return this.allDocks;
      return this.allDocks.filter(item=>item.portType==this.portType)
    },
  },
  methods: {
    change(val) {
      this.$emit("change", val);
    },
  },
};
</script>
