<template>
    <view class="container">
        <!-- 控制模式 -->
        <mpattern />
        <!-- 基础控制 -->
        <basics ref="basics" />
        <!-- 分时开关 -->
        <division ref="division" />
    </view>
</template>

<script>
import mpattern from './modules/mpattern.vue'
import basics from './modules/basics.vue'
import division from './modules/division.vue'
export default {
    name: "prodnum-06",
    components: { mpattern, basics, division },
    props: {
        control: Object
    },
    watch: {
        control: function (newVal) {
            if (newVal) {
                console.log(newVal)
                try {
                    let nameList = ['Flow control', 'pressure control', 'Config', 'Sleep time', 'Pilot valve', 'Minimum', 'MOP']
                    this.$refs.basics.itemList = this.__proto__.getControlItem(nameList, newVal.function, newVal.paramcmdvalues, newVal.params)
                } catch (error) {
                    console.error(error)
                }
                try {
                    let division = this.$refs.division;
                    division && division.loadData(newVal.function, newVal.paramcmdvalues, newVal.params)
                } catch (error) {
                    console.error(error)
                }
            } else {

            }
        }
    },
    modules() {

    },
}
</script>

<style lang="scss" scoped>
.container {
    width: 355px;
    margin: 0 auto;
}
</style>