<template>
    <div style="width:100%">
        <div class="item-style">
            <i-switch v-model="value"></i-switch>
        </div>
        <div v-show="value">
            <div>
                <div>
                    <label class="item-style">键值对-label</label>
                    <Input style="width: 92%;margin-left: 10px;margin-right: 11px;" clearable
                           v-model="getRomout.label" @on-change="changeVal()"/>
                </div>
                <div>
                    <label class="item-style">键值对-value</label>
                    <Input style="width: 92%;margin-left: 10px;margin-right: 11px;" clearable
                           v-model="getRomout.value" @on-change="changeVal()"/>
                </div>
                <div>
                    <label class="item-style">键值对-url</label>
                    <Input style="width: 92%;margin-left: 10px;margin-right: 11px;" clearable
                           v-model="getRomout.url" @on-change="changeVal()"/>
                </div>
            </div>
            <dynamic></dynamic>
            <div class="title-style">是否展示</div>
            <showFlag></showFlag>
            <div class="title-style">校验</div>
            <validateArr></validateArr>
            <div class="title-style">联动</div>
            <linkageChangeValue></linkageChangeValue>
        </div>
    </div>


</template>

<script>
    import * as components from './style';
    import {PropertyMixin} from '../../service/main-tool-editor-type-mixin';
    import validateArr from '../main-tool-editor-type-box-validateArr';
    import showFlag from '../main-tool-editor-type-showFlag';
    import linkageChangeValue from '../main-tool-editor-type-box-linkageChangeValue';
    import dynamic from '../main-tool-editor-type-box-dynamic';

    export default {
        components: {
            ...components,
            dynamic,
            showFlag,
            validateArr,
            linkageChangeValue
        },
        mixins: [PropertyMixin],
        position: 'mainToolEditorTypeSelectHeightLevel',
        name: 'main-tool-editor-type-selectHeightLevel',
        data() {
            return {
                value: this.editor.value || 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 为事件新增一项
                if (!currentInstance.data.property.dynamic) {
                    currentInstance.data.property.dynamic = {
                        label: "",
                        value: "",
                        url: "",
                        paramsList: []
                    };
                }
                return currentInstance.data.property.dynamic;
            },
            applicationState() {

                return this.$store.state.application;
            },
            viewportState() {
                return this.$store.state.viewport;
            }
        },
        methods: {
            changeVal(el) {

                debugger;
            },
            handleChange() {

            }
        },
        watch: {
            getRomout(n, o) {
                debugger;

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

<style scoped>

</style>
