storelevelOption.vue 2.6 KB
<template>
<div class="condition-item">
    <li class="condition-item">
        <span class="condition-item-text">{{$t('asisTab.storeLevel')}}: </span>
        <div class="condition-item-option">
            <el-select v-model="storeLevel" :placeholder="$t('pholder.gateLevel')" class="floor-sel-box">
                <el-option v-for="item in storeLevelList" :key="item.value" :label="$t('asisTab.' + item.label)" :value="item.value"></el-option>
            </el-select>
            <el-select v-if="storeLevel === 'floor'" v-model="storeFloorVal" filterable :placeholder="$t('pholder.floorSelect')" class="floor-sel-box">
                <el-option v-for="item in shopFloorData" :key="item.id" :label="item.name" :value="item.id"></el-option>
            </el-select>
        </div>
    </li>
    <format-option-content v-if="storeLevel === 'format'" :storeLevel="true" :objectVal="2" @formatValWatch="storeFormatValReceive"></format-option-content>
</div>
</template>

<script>
export default {
    props: {
        shopFloorData: {
            type: Array
        },
        shopFloorVal: {
        }
    },
    data() {
        return {
            storeLevelList: [
                {
                    label: 'floor',
                    value: 'floor',
                },
                // {
                //     label: 'format',
                //     value: 'format',
                // }
                
            ],
            storeFloorVal: '',
            storeLevel: '',
            storemutiFormatVal: [],
            storemutiFormatTwoVal: [],
            storeformatLevel: null,
        }
    },
    watch: {
        shopFloorData(val){
            if(val.length&&this.storeLevel =='floor'){
                let oVal = this.storeFloorVal;
                this.storeFloorVal = val[0].id;
                if(oVal == this.storeFloorVal)this.$emit('storelevel',{
                    FloorVal: this.storeFloorVal
                });
            }
        },
        storeLevel(val) {
            let obj = {
                Level: val
            }
            this.$emit('storelevel',obj)
        },
        storeFloorVal(val) {
            let obj = {
                FloorVal: val
            }
            this.$emit('storelevel',obj)
        }
    },
    created() {
        // console.log(this.shopFloorVal)
        this.storeLevel = 'floor';
        this.storeformatLevel = 1;
    },
    mounted() {
        this.storeFloorVal = JSON.parse(JSON.stringify(this.shopFloorVal));
    },
    methods: {
        storeFormatValReceive(valObj) {
            this.$emit('storelevel', valObj)
        },
    }
}
</script>

<style scoped>

</style>