<template>
    <div style="width: 100%">
        <Label>查看类型</Label>
        <Container>
        <Select v-model="val" @on-change="updateType" style="width:96.5%;" >
            <Option v-for="item in optionsData" :value="item.value||''" :key="item.value">{{ item.label }}</Option>
        </Select>
    </Container>
    </div>
</template>

<script>
    import * as components from './style';
    import {PropertyMixin} from '../../service/main-tool-editor-type-mixin';
    export default {
        components: {
            ...components
        },
        mixins: [PropertyMixin],
        position: 'mainToolEditorTypeLookup',
        name: 'main-tool-editor-type-lookup',
        data () {
            return {
                val:'',
                dataArr:[
                    {
                        "label":"lookup-fee 查看收费标准",
                        "value":"lookup-fee"
                    },
                    {
                        "label":"lookup-map 查看地图",
                        "value":"lookup-map"
                    },
                    {
                        "label":"lookup-number 查看编号",
                        "value":"lookup-number"
                    },
                    {
                        "label":"lookup-project 查看项目",
                        "value":"lookup-project"
                    },
                    {
                        "label":"lookup-sample 查看材料样本",
                        "value":"lookup-sample"
                    }
                ]
            };
        },
        props: {
            instanceInfo: Object,
            editor: Object
        },
        computed: {
            applicationState () {
                return this.$store.state.application;
            },
            viewportState () {
                return this.$store.state.viewport;
            },
            optionsData () {
                debugger;
               /* if (localStorage.getItem("page") && localStorage.getItem("page") != null) {

                } else {
                    /!*this.$Modal.success({
                        title: "友情提示",
                        content: "请先全局设置！"
                    });*!/
                    return;
                }
                let pageObj = eval('(' + localStorage.getItem("page") + ')');//JSON.parse(localStorage.getItem("page"));
                console.log(pageObj);*/
                let optionData= this.dataArr||[];
              /*  optionData.forEach(function (el,index) {
                    el.selectName="templateCache."+el.label;
                });*/
                let _data =  optionData;
                return _data;
            }
        },
        methods: {
            updateType(val){
                debugger;
            },
            initCurrtField () {
                debugger;
                let currentInstance = this.$store.state.viewport.instances.get(this.$store.state.viewport.currentEditInstanceKey);
                if (!currentInstance.excat) {
                    currentInstance.excat=[{
                        "type":"",
                        "data": {

                        }
                    }];
                }else{
                    this.val= currentInstance.excat[0].type;
                }
                debugger
            },
            handleChange () {

            }
        },
        mounted() {
            debugger;
            this.initCurrtField();
        },
        watch: {
           /* field (n, o) {

                if (n === o) {
                    return;
                }
                deep:true//对象内部的属性监听，也叫深度监听

                //  this.setInstanceProps(n);
            },
            val (n, o) {
                debugger;
                if (n === o) {
                    return;
                }
                this.setInstanceProps(n);
            }*/
        }
    };
</script>

<style>

</style>
