<template>
    <a-form-model-item :label="attr.name" :prop="attr.alias">
        <a-cascader
            :value="modelVal"
            :options="map"
            :changeOnSelect="true"
            placeholder="请选择"
            :disabled="disabled"
            @change="change" />
    </a-form-model-item>
</template>

<script>
import map from "../../config/map"
export default {
    name: "mix-linkage",
    model: {
        prop: "modelVal",
        event: 'change'
    },
    props: {
        modelVal: [],
        attr: {
            type: Object,
            default: () => {
            }
        }
    },
    data(){
        return {
            map: map.map,
            setting: {
                link_type: ""
            },
            disabled: false
        }
    },
    created() {
        this.setting = this.attr.setting
        this.setOption()
        this.setDisable(this.attr.display)
    },
    methods: {
        setDisable(display) {
            if (display === 'r' || display === 'v') {
                this.disabled = true;
            } else if (display === 'h') {
                this.textType = 'hidden';
            } else if (display === 'w') {
                this.disabled = false;
            }
        },
        setOption() {
            if (this.setting.link_type === 'china') {
                this.map = map.map
            } else {
                //获取组织 todo
            }
        },
        change(value) {
            this.$emit('change', value);
        }
    }
}
</script>

<style scoped>

</style>
