<template>
    <div class="waitingCalled">
        <div class="waitingOne" v-for="(item,index) in waitingCalled" :key="index">
            <div class="waitingOneLeft">
                <img src="https://images.shengws.com/201809182128111.png?imageView2/2/w/500/h/500/q/90" alt="">
                <div class="name">
                    <p>{{ item.patient_name }}</p>
                    <p>签到时间：{{ item.create_time }}</p>
                </div>
            </div>
            <div class="waitingOneRight" @click="call(item.patient_id)">
                <img src="../../../assets/img/volume.png" alt="">
            </div>
        </div>
        <div class="NoData" v-show="waitingCalled.length == 0">
            <img src="@/assets/img/data.jpg" alt="">
        </div>
    </div>
</template>

<script>
import axios from 'axios'
export default {
    props:{
        waitingCalled:Array
    },
    data(){
        return{
            patientArr:[]
        }
    },
    created(){

    },
    methods:{
        call(patient_id){
            console.log('patient_id',patient_id)
            let org_id =  parseInt(sessionStorage.getItem("org_id"));
            let admin_user_id = parseInt(sessionStorage.getItem("admin_user_id"));
            axios.get('/api/index/callpatient?org_id=' + org_id + '&patient_id=' + patient_id + '&admin_user_id=' + admin_user_id).then(res => {
                console.log(res)
                // let patientArr = res.data.queue_list.data
                // this.patientArr = patientArr
                // this.$emit('child-event',this.patientArr)
                if(res.data.code == 200){
                    this.$message({
                        message: res.data.msg,
                        type: 'success'
                    });
                }
                
            })
            
        }
    }
    // watch:{
    //     waitingCalled:{
    //         handler(val){
    //             console.log('val',val)
    //             this.waitingCalled = val
    //         },
    //         deep:true
    //     }
    // }
}
</script>

<style lang="scss" scoped>
.waitingCalled{
    width: 100%;
    .waitingOne{
        border: 1px #e5e5ee solid;
        padding: 9px 0;
        margin: 0 15px 15px 0;
        float: left;
        width: 360px;
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px;
        .waitingOneLeft{
            display: flex;
            img{
                width: 45px;
                height: 45px;
                border-radius: 50%;
                margin-right: 15px;
            }
            .name{
                >p:first-child{
                    font-size: 16px;
                    font-weight: bold;
                    color:#000;
                }
                >p:last-child{
                    font-size: 12px;
                    color:#999999;
                    margin-top: 10px;
                }
            }
            
        }
        .waitingOneRight{
            img{
                width: 30px;
                margin-top: 6px;
            }
        }
    }
}
</style>
