CtyMapping.vue 1.38 KB
Newer Older
fukai 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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
<template>
  <el-select :disabled="isDisabled" @change="handleChange" clearable filterable placeholder="请选择国家(地区)" v-bind="$attrs" v-model="selectedValue">
    <el-option :key="item.value" :label="item.key + ' - ' + item.label" :value="item.value" v-for="item in options"></el-option>
  </el-select>
</template>

<script>
import commonDepend from "../../mixin/commonDepend.js";
import Api from "../../service/Api.js";

export default {
  data() {
    return {
      options: []
    };
  },
  mixins: [commonDepend],
  inject: {
    root: {
      default: () => null
    }
  },
  props: {
    value: {
      type: String,
      default: ""
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    selectedValue: {
      get() {
        return this.value;
      },
      set(val) {
        this.$emit("input", val);
      }
    },
    isDisabled() {
      return this.$store.state.Status.mode === "display" || this.disabled;
    }
  },
  created() {
    // 调接口获取三位国家bopcty,stb->ctycod,两位国家cty
    this.init();
  },
  methods: {
    handleChange(value) {
      this.$emit("change", value);
      this.changeModify();
    },
    async init() {
      let res = await Api.post("/Collection/cty/queryCtyMappingList");
      if (res.respCode === SUCCESS) {
        this.options = res.data;
      }
    }
  }
};
</script>

<style scoped>
</style>