<template>
  <div class="flex" style="flex:1; ">
    <criteria-paged :model="model" v-ref:paged>
      <criteria partial='criteria' @condition-changed='$parent.selfSearch' v-ref:cri>
        <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>

          <div class="col-sm-3">
            <label  class="font_normal_body">员工姓名</label>
            <input type="text" class="input_search" style="width:60%" v-model="model.name"
                   condition="name like '%{}%'" placeholder='员工姓名'>
          </div>
          <div class="col-sm-3">
            <label  class="font_normal_body">&nbsp;&nbsp;&nbsp;登录名</label>
            <input type="text" class="input_search" style="width:60%" v-model="model.ename"
                   condition="ename like '%{}%'" placeholder='登录名'>
          </div>
          <div class="col-sm-3">
            <label  class="font_normal_body">所在部门</label>
            <input type="text" class="input_search" style="width:60%" v-model="model.f_department_name"
                   condition="f_department_name like '%{}%'" placeholder='所在部门'>
          </div>
          <div class="col-sm-3">
            <label  class="font_normal_body">所属角色</label>
            <input type="text" class="input_search" style="width:60%" v-model="model.f_role_name"
                   condition="f_role_name like '%{}%'" placeholder='所属角色'>
          </div>

          <div class="span" style="float:right;">
            <button class="button_search button_spacing" style="width:80px;margin-left:30px;"@click="$parent.$parent.search()" v-el:cx>查询</button>

          </div>
        </div>
      </criteria>
      <data-grid class="list_area table_sy" :model="model" partial='list' v-ref:grid>
        <template partial='head'>
          <tr>
            <th style="text-align: center;">序号</th>
            <th style="text-align: center;">员工编号</th>
            <th style="text-align: center;">员工名称</th>
            <th style="text-align: center;">登录名</th>
            <th style="text-align: center;">电话</th>
            <th style="text-align: center;">所属部门</th>
            <th style="text-align: center;">所属角色</th>
            <th style="text-align: center;">状态</th>
          </tr>
        </template>
        <template partial='body'>
          <td style="text-align: center;">{{$index+1}}</td>
          <td style="text-align: center;">{{row.userid}}</td>
          <td style="text-align: center;">{{row.name}}</td>
          <td style="text-align: center;">{{row.ename}}</td>
          <td style="text-align: center;">{{row.f_user_telephone}}</td>
          <td style="text-align: center;">{{row.f_department_name}}</td>
          <td style="text-align: center;">{{row.f_role_name}}</td>
          <td style="text-align: center;">{{row.state}}</td>
        </template>
      </data-grid>
    </criteria-paged>
  </div>
</template>
<script>
  import { PagedList } from 'vue-client'
  import * as Util from '../Util'

  export default {
    title: '用户列表',
    data () {
      return {
        model: new PagedList('rs/sql/ldap_getAllUser', 20)
      }
    },
    ready () {
      this.search()
    },
    methods: {
      search () {
        this.$refs.paged.$refs.cri.search()
      },
      async selfSearch (args) {
        let getUserList = await this.$LdapService.getOrgByType('user',this.$login.f.orgid)
        args.condition += `${getUserList}`
        this.model.search(args.condition, args.model)
        this.$dispatch('search')
      },
    },
    computed: {
    }
  }
</script>
