<template>
    <div style="width:100%">
        <div class="item-style">
            <i-switch v-model="value"></i-switch>
        </div>
        <div v-show="value">
            <Select v-model="type" @on-change="updateType" style="width:96.5%;" >
                <Option v-for="item in dataArr" :value="item.value||''" :key="item.value">{{ item.label }}</Option>
            </Select>
            <div v-show="isHidden">
                    <Label  class="item-style">选项类型</Label>
                    <Container>
                        <Select v-model="dataType"  @on-change="updateDataType"  style="width:96.5%;max-width: 254px;" >
                            <Option style="max-width: 254px;" v-for="item in dataTypeArr" :value="item.value||''" :key="item.value">{{ item.label }}</Option>
                        </Select>
                    </Container>
                    <Label  class="item-style">请输入按钮名称</Label>
                    <Container>
                        <Input v-model="btnName" placeholder="请输入按钮名称" clearable style="width: 300px" />
                    </Container>
            </div>
        </div>
    </div>
</template>

<script>
    import * as components from './style';
    import {PropertyMixin} from '../../service/main-tool-editor-type-mixin';
 /*   import LookUp from '../main-tool-editor-type-box-lookup';
    import LookType from '../main-tool-editor-type-box-looktype';*/
    export default {
        components: {
            ...components,
       /*     LookType,
            LookUp*/
        },
        mixins: [PropertyMixin],
        position: 'mainToolEditorTypeLabelHeightLevel',
        name: 'main-tool-editor-type-labelHeightLevel',
        data() {
            return {
                val:'',
                value: this.editor.value || false,
                type:"",
                dataArr:[
                    {
                        "label":"lookup-fee 查看收费标准",
                        "value":"lookup-fee"
                    },
                    {
                        "label":"lookup-map 查看地图",
                        "value":"lookup-map"
                    },
                    {
                        "label":"lookup-number 查看编号",
                        "value":"lookup-number"
                    },
                    {
                        "label":"lookup-query  查看查询",
                        "value":"lookup-query"
                    },
                    {
                        "label":"lookup-project 查看项目",
                        "value":"lookup-project"
                    },
                    {
                        "label":"lookup-sample 查看材料样本",
                        "value":"lookup-sample"
                    }
                ],
                dataTypeArr:[
                    {
                        "label":"环评批复文号",
                        "value":"1"
                    },
                    {
                        "label":"身份证号",
                        "value":"2"
                    },
                    {
                        "label":"车牌号",
                        "value":"3"
                    },
                    {
                        "label":"网签合同号",
                        "value":"4"
                    },
                    {
                        "label":"申请号",
                        "value":"5"
                    },
                    {
                        "label":"请求号查询",
                        "value":"6"
                    },
                    {
                        "label":"房屋权属证号",
                        "value":"7"
                    },
                    {
                        "label":"监管协议号",
                        "value":"8"
                    },
                    {
                        "label":"小餐饮查询页面信息",
                        "value":"9"
                    },{
                        "label":"二手房合约备案卖家房屋产权证号",
                        "value":"10"
                    },
                    {
                        "label":"网签合同号：先调合同变更申请方校验接口",
                        "value":"11"
                    },
                    {
                        "label":"买方请求号查询",
                        "value":"12"
                    },
                    {
                        "label":"请求号查询",
                        "value":"13"
                    },
                    {
                        "label":"异地就医网上查询",
                        "value":"14"
                    },
                    {
                        "label":"医保卡个人账户查询",
                        "value":"15"
                    },
                    {
                        "label":"出具医疗（大额）保险费、生育保险费缴费电子发票查询",
                        "value":"16"
                    },
                    {
                        "label":"卫生许可事项",
                        "value":"18"
                    }
                ],
                dataType:"",
                btnName:"",
                isHidden:false,

            };
        },
        mounted() {
            this.initCurrtField();
            this.setInstanceProps(this.value);
        },
        computed: {
            getRomout() {
                debugger;
                let currentInstance = this.$store.state.viewport.instances.get(this.$store.state.viewport.currentEditInstanceKey);
                //note 为事件新增一项
                return currentInstance;
            },
            applicationState() {
                return this.$store.state.application;
            },
            viewportState() {
                return this.$store.state.viewport;
            }
        },
        methods: {
            updateDataType(val){
                let currentInstance =this.getRomout;
                currentInstance.data.excat[0].data.type=val;
            },
            updateType(val){
                debugger;
                let currentInstance =this.getRomout;
                currentInstance.data.excat[0].type=val;

                //note 判断是否是查询,如果是，则显示底部俩
                if(val=="lookup-query"){
                    this.isHidden=true;
                    currentInstance.data.excat[0].isHidden=true;
                }else{
                    this.isHidden=false;
                    currentInstance.data.excat[0].isHidden=false;
                }
            },
            initCurrtField () {
                debugger;
                let currentInstance =this.getRomout;
                if (!currentInstance.data.excat) {
                    currentInstance.data.excat=[{
                        "type":"",
                        "isHidden":false,
                        "data": {
                            "type": "",
                            "btnName":""
                        }
                    }];
                }else{

                    if(!currentInstance.data.data){
                        currentInstance.data.data={
                            heightLevel:false
                        }
                    }
                    this.value=currentInstance.data.data.heightLevel;
                    this.type= currentInstance.data.excat[0].type;
                    this.isHidden= currentInstance.data.excat[0].isHidden;
                    this.dataType= currentInstance.data.excat[0].data.type;
                    this.btnName= currentInstance.data.excat[0].data.btnName;
                }
                debugger
            },
            changeVal(el) {
                debugger;
            },
            handleChange() {

            }
        },
        watch: {
            btnName(n, o){
                if (n === o) {
                    return;
                }
                let currentInstance =this.getRomout;
                currentInstance.data.excat[0].data.btnName=n;
            },
            getRomout(n, o) {
                debugger;
            },
            value(n, o) {
                if (n === o) {
                    return;
                }
                this.setInstanceProps(n);
            }
        }
    };
</script>

<style scoped>

</style>
