<template>
    <el-form class='form' :rules='rules' ref='form' :model='form' label-width='140px'>
        <el-form-item label='值处理方式' prop='DataRuleType'>
            <el-select v-model='form.DataRuleType' placeholder='请选择'>
                <el-option v-for='item in handleTypeArr' :key='item.value' :label='item.label' :value='item.value'></el-option>
            </el-select>
        </el-form-item>
        <!-- components -->
        <no-handle ref='noHandle' v-if='form.DataRuleType == "无需处理，直接使用"'></no-handle>
        <auto-handle ref='autoHandle' v-else-if='form.DataRuleType == "需自动单位转换"' :unitObj='{}'></auto-handle>
        <enum-handle ref='enumHandle' v-else-if='form.DataRuleType == "需按设置枚举转换"'></enum-handle>
        <formula-handle ref='formulaHandle' v-else-if='form.DataRuleType == "需按公式转换"'></formula-handle>
        <split-handle ref='splitHandle' v-else-if='form.DataRuleType == "需拆分处理"'></split-handle>
    </el-form>
</template>

<script>
import noHandle from '@/components/config_point/step3_edit/no_handle'
import autoHandle from '@/components/config_point/step3_edit/auto_handle'
import enumHandle from '@/components/config_point/step3_edit/enum_handle'
import formulaHandle from '@/components/config_point/step3_edit/formula_handle'
import splitHandle from '@/components/config_point/step3_edit/split_handle'
export default {
    data() {
        return {
            form: {
                dict: [],
                DataRuleType: ''
            },
            handleTypeArr: [
                {
                    label: '无需处理，直接使用',
                    value: '无需处理，直接使用'
                },
                {
                    label: '需自动单位转换',
                    value: '需自动单位转换'
                },
                {
                    label: '需按设置枚举转换',
                    value: '需按设置枚举转换'
                },
                {
                    label: '需按公式转换',
                    value: '需按公式转换'
                },
                {
                    label: '需拆分处理',
                    value: '需拆分处理'
                }
            ],
            rules: {
                DataRuleType: [{ required: true, message: '请选择值处理方式', trigger: 'change' }]
            }
        }
    },
    components: {
        noHandle,
        autoHandle,
        enumHandle,
        formulaHandle,
        splitHandle
    }
}
</script>

<style>
</style>
