<template>
    <div class="page_configure">
        <div style="display:flex;align-items:center;margin-bottom:12px;justify-content: space-between;">
            <div>接诊台列表</div>
            <el-button type="primary" @click="newVisible = true">新增</el-button>
        </div>
        <el-table :data="tableData" border style="width: 100%">
            <el-table-column prop="date" label="接诊台号" align="center"></el-table-column>
            <el-table-column label="诊台负责医生" align="center">
                <template slot-scope="scope">
                    <el-tag size="medium">{{ scope.row.name }}</el-tag>
                </template>
            </el-table-column>
            <el-table-column label="操作" align="center">
                <template slot-scope="scope">
                    <el-button size="mini" type="primary" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
                    <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
                </template>
            </el-table-column>
        </el-table>
        <el-dialog title="新增诊台" width="800px" :visible.sync="newVisible" >
            <el-form :model="form" :rules="rules" ref="form" label-width="140px">
                <el-form-item label="诊台号 : " required prop="type">
                    <el-input v-model.trim="form.type" placeholder="" ></el-input>
                </el-form-item>
                <el-form-item label="诊台负责医生 : " required  prop="doctor">
                    <el-select style="width:100%" v-model="form.doctor" placeholder="请选择" multiple filterable allow-create default-first-option>
                        <el-option
                        v-for="item in typeOptions"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="newVisible=false">取 消</el-button>
                <el-button type="primary" @click="submitAction('form')">保 存</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
export default {
    data(){
        return{
            tableData: [{
                date: '2016-05-02',
                name: '王小虎',
                address: '上海市普陀区金沙江路 1518 弄'
                }, {
                date: '2016-05-04',
                name: '王小虎',
                address: '上海市普陀区金沙江路 1517 弄'
                }, {
                date: '2016-05-01',
                name: '王小虎',
                address: '上海市普陀区金沙江路 1519 弄'
                }, {
                date: '2016-05-03',
                name: '王小虎',
                address: '上海市普陀区金沙江路 1516 弄'
            }],
            newVisible:false,
            form: {
                id: 0,
                type: "",
                doctor:[],
            },
            rules: {
              type: [{ required: true, message: "请输入诊台号" }],
              doctor: [{ required: true, message: "请选择接诊台负责医生"}],  
            },
            typeOptions:[{ value: 1, label: '张三'},{ value: 2, label: '李四'}],
        }
    },
    methods:{
        handleEdit(){},
        handleDelete(){},
    }
}
</script>
