<template>
    <el-select
        :value="value"
        placeholder="请选择交易方式"
        clearable
        filterable
        @change="changeSelect"
        class="filter-item"
    >
        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option>
    </el-select>
</template>

<script>
export default {
    props: {
        value: {
            type: String,
            default: ''
        }
    },
    data() {
        return {
            options: [
                { label: '转让', value: 'TRANSFER' },
                { label: '普通许可', value: 'GENERAL_PERMIT' },
                { label: '独占许可', value: 'EXCLUSIVE_PERMIT' },
                { label: '排他许可', value: 'EXCLUSIVITY_PERMIT' },
                { label: '入股', value: 'INVEST' },
                { label: '其他', value: 'OTHER' }
            ]
        };
    },
    created() {
        this.$http
            .post('/setting/byFlag', { flag: 24 })
            .then(res => {
                this.options = res.map(item => {
                    return {
                        label: item.name,
                        value: item.id
                    };
                });
            })
            .catch(e => {
                console.log(e);
                this.$message.error(e.error);
            });
    },
    methods: {
        changeSelect(val) {
            this.$emit('input', val);
        }
    }
};
</script>

<style lang="less" scoped></style>
