<template>
    <el-dialog title="新建预案设置" :visible.sync="openPrePlanModal" width="700px">
        <el-form :model="form">
            <el-form-item label="预案名称" :label-width="formLabelWidth">
                <el-input v-model="form.name" autocomplete="off"></el-input>
            </el-form-item>

            <el-form-item label="拼接屏数量" :label-width="formLabelWidth">
                <el-input-number v-model="form.num1" controls-position="right" @change="handleChange" :min="1" :max="9"></el-input-number>&ensp;X&ensp;
                <el-input-number v-model="form.num2" controls-position="right" @change="handleChange2" :min="1" :max="9"></el-input-number>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="openPrePlanModal = false">取 消</el-button>
            <el-button type="primary" @click="openPrePlanModal = false">确 定</el-button>
        </div>
    </el-dialog>
</template>

<script>
    import PubSub from 'pubsub-js'

    export default {
        data() {
            return {
                openPrePlanModal:false,
                form: {
                    name: '', // 预案名称
                    num1:0,// 拼接屏数量1
                    num2:0,// 拼接屏数量2
                },
                formLabelWidth: '120px'
            }
        },
        mounted() {
            PubSub.subscribe('addPrePlan',(msg,data) => {
                this.openPrePlanModal = true
            })
        },
        methods: {
            handleChange(value) {
                this.form.num1 = value
            },
            handleChange2(value) {
                this.form.num2 = value
            }
        }
    }
</script>

<style scoped>

</style>
