<template>
<div>
  <tools-page :need-back='false' title="通讯录"></tools-page>
    用户名：
    <input v-model="name">
    <table class="table table-hover">
        <tbody v-for="row in model.data | filterBy name in 'username'">
            <tr>
                <td>{{row.username}}
                    <br> {{row.name}}
                    <br>
                    <button class="btn btn-info btn-sm ">
                      {{row.f_fgsdianhua}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="glyphicon glyphicon-earphone" @click='makeAPhoneCall(row.f_fgsdianhua)'></span>
                    </button>
                </td>
            </tr>
        </tbody>
    </table>
    <div style="height:50px;"></div>
  </div>
</template>

<script>

import co from 'co'
import {
    PagedList
}
from 'vue-client'
import Vue from 'vue'

let info = function*(self, org) {
  let back = yield self.$post(Vue.url + 'rcq/communiCation', {data: {organizname: org}},
    {
        resolveMsg: null,
        rejectMsg: null
    })
    let hotline = {name: '西安奥枫软件有限公司', f_fgsdianhua: '15339035958'}
    back.data.push(hotline)
    self.model = back
}

export default {
    title: '通讯录',
    data() {
        return {
            model: {}
        }
    },
    ready() {
        let infomathis = info(this, Vue.user.parent.name)
        co(infomathis)
    },
    methods: {
      makeAPhoneCall(phoneNo) {
        HostApp.makeAPhoneCall(phoneNo)
      }
    }
}

</script>
