<template>
    <el-dialog title="信号源配置" :visible.sync="openSignalModal" width="700px">
        <el-form :model="form">
            <el-form-item label="IPC转发服务器" :label-width="formLabelWidth">
                <el-select placeholder="请选择IPC转发服务器" v-model="form.ipc" value="">
                </el-select>
            </el-form-item>

            <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-select placeholder="请选择信号源类型"  value="" v-model="form.type">
                    <el-option label="IPC" value=""></el-option>
                </el-select>
            </el-form-item>

            <el-form-item label="信号源URL" :label-width="formLabelWidth">
                <el-input v-model="form.url" autocomplete="off"></el-input>
            </el-form-item>

            <el-form-item label="信号源预览URL" :label-width="formLabelWidth">
                <el-input v-model="form.preurl" autocomplete="off"></el-input>
            </el-form-item>

            <el-form-item label="使用信号源预览" :label-width="formLabelWidth">
                <el-checkbox v-model="form.checked">

                </el-checkbox>
            </el-form-item>

            <el-form-item label="分辨率" :label-width="formLabelWidth">
                <el-select placeholder="请选择分辨率" value="" v-model="form.ratio">
                    <el-option label="720P" value=""></el-option>
                    <el-option label="1080P" value=""></el-option>
                </el-select>
            </el-form-item>

            <el-form-item label="用户名" :label-width="formLabelWidth">
                <el-input v-model="form.username" autocomplete="off"></el-input>
            </el-form-item>

            <el-form-item label="密码" :label-width="formLabelWidth">
                <el-input v-model="form.password" autocomplete="off"></el-input>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="openSignalModal = false">取 消</el-button>
            <el-button type="primary" @click="openSignalModal = false">确 定</el-button>
        </div>
    </el-dialog>
</template>

<script>
    import PubSub from 'pubsub-js'

    export default {
        data() {
            return {
                openSignalModal:false,
                form: {
                    name: '', // 信号源名称
                    url:'',// 信号源url
                    preurl:'',// 信号源预览url
                    username:'',// 用户名
                    password:'',// 密码
                    ipc:'',
                    type:'',
                    checked:false,
                    ratio:'',// 分辨率

                },
                formLabelWidth: '120px'
            }
        },
        mounted() {
            PubSub.subscribe('addSignal',(msg,data) => {
                this.openSignalModal = true
            })
        }
    }
</script>

<style scoped>

</style>
