dockSelect.vue 760 Bytes
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
<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>