<template> 
   <div> 
     <template v-if="modelType === 'billSearch'"> 
        <searchConditionBox ref="condition" :config="config"  @conditionAction="conditionAction"  :dictData="dictData" :modelType="modelType" :isPop="isPop"></searchConditionBox>
     </template>
     <template v-else>
        <queryConditionBox   ref="condition" :config="config"  @conditionAction="conditionAction"  :dictData="dictData" :modelType="modelType" :isPop="isPop"></queryConditionBox>
     </template>
    </div>
</template>
<script>
    import searchConditionBox from '@/components/conditionbox/searchconditionbox.vue';
    import queryConditionBox from '@/components/conditionbox/queryconditionbox.vue';
    export default {
        name: 'conditionbox',
        components: {searchConditionBox,queryConditionBox},
        props:{
            config: {
                type: Object,
                default () {
                    return {};
                }
            },
            dictData: {
                type: Object,
                default:null
            },
            isPop: {
                type: Boolean,
                default:false
            },
            modelType: {
                type:String,
                default: 'search'
            }
        } ,
        methods:{
            conditionAction(obj) {
                this.$emit('conditionAction',obj);
            },
            getValue(name) {
                if (this.$refs.condition.getValue) {
                    return this.$refs.condition.getValue(name);
                } else {
                    return null;
                }
                
            },
            setValue(name, value) {
                if (this.$refs.condition.setValue) {
                    this.$refs.condition.setValue(name,value);
                } 
            },
            clear() {
                if (this.$refs.condition.clear) {
                    this.$refs.condition.clear();
                }
            }
        }
        
        
    };
</script>