<template>
 <j-modal
    :title="title"
    :width="900"
    :visible="visible"
   
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">
    
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
    
        
    <a-col :md="6" :sm="8">
      <a-form-item label="真实名字">
        <a-input placeholder="请输入真实名字" v-model="queryParam.realname"></a-input>
      </a-form-item>
    </a-col>
    
          <a-col :md="6" :sm="8">
            <a-form-item label="性别">
              <a-select v-model="queryParam.sex" placeholder="请选择性别">
                <a-select-option value="">请选择</a-select-option>
                <a-select-option value="1">男</a-select-option>
                <a-select-option value="2">女</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
    
    
          
            
    
            <a-col :md="6" :sm="8">
              <a-form-item label="手机号码">
                <a-input placeholder="请输入手机号码查询" v-model="queryParam.phone"></a-input>
              </a-form-item>
            </a-col>
    
         
    
          <a-col :md="6" :sm="8">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
             
              
            </span>
          </a-col>
    
        </a-row>
      </a-form>
    </div>
    
    <a-table
      ref="table"
      size="middle"
      bordered
      rowKey="id"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="ipagination"
      :loading="loading"
      class="j-table-force-nowrap"
      :rowSelection="{selectedRowKeys: selectedKeys, onChange: onSelectChanges}"
    @change="handleTableChange" >
    <template slot="avatarslot" slot-scope="text, record, index">
      <div class="anty-img-wrap">
        <a-avatar shape="square" :src="getAvatarView(record.avatar)" icon="user"/>
      </div>
    </template>
      
    </a-table>
  

 </j-modal>

</template>
<script>
import '@/assets/less/TableExpand.less'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import {putAction,getFileAccessHttpUrl} from '@/api/manage';
import {frozenBatch} from '@/api/api'
import JInput from '@/components/jeecg/JInput'
import JSuperQuery from '@/components/jeecg/JSuperQuery'
  export default {
    name: "RoleModal",
    mixins:[JeecgListMixin],
    components: {
      JInput,
      JSuperQuery
    },
    data(){
      return {
        queryParam: {},
        recycleBinVisible: false,
        roleId:"",
        autoExpandParent: true,
        checkStrictly: true,
        title:"人员",
        visible: false,
        loading: false,
        selectedKeys:[],
        selectUsers:[],
        
      columns: [
        {
          title: '#',
          dataIndex: '',
          key:'rowIndex',
          width:60,
          align:"center",
          customRender:function (t,r,index) {
            return parseInt(index)+1;
          }
        },
      
        {
          title: '用户姓名',
          align: "center",
          width: 100,
          dataIndex: 'realname',
        },
        {
          title: '头像',
          align: "center",
          width: 120,
          dataIndex: 'avatar',
          scopedSlots: {customRender: "avatarslot"}
        },
      
        {
          title: '性别',
          align: "center",
          width: 80,
          dataIndex: 'sex_dictText',
          sorter: true
        },
        {
          title: '手机号码',
          align: "center",
          width: 120,
          dataIndex: 'phone'
        },
        {
          title: '部门',
          align: "center",
          width: 120,
          dataIndex: 'orgCodeTxt'
        },
        {
          title: '入职时间',
          align: "center",
          width: 120,
          dataIndex: 'entryDate'
        }
       
      ],
      superQueryFieldList: [
        { type: 'input', value: 'username', text: '用户账号', },
        { type: 'input', value: 'realname', text: '用户姓名', },
        { type: 'select', value: 'sex', text: '性别', dictCode: 'sex' },
      ],
      url: {
        list: "/sys/user/queryRuleByUser"
      },
      }
    },
    methods: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
      getAvatarView: function (avatar) {
        return getFileAccessHttpUrl(avatar)
      },
     onSelectChanges(selectedRowKeys, selectionRows) {
       console.log(selectedRowKeys,selectionRows);
       this.selectedKeys = selectedRowKeys;
      // this.selectUsers=selectionRows;
       
     },
      
      add (e) {
       this.visible = true;
       this.queryParam.departIds=e;
      this.$options.methods.searchQuery.call(this)
      },
      
      show(roleId){
        this.roleId=roleId
        this.visible = true;
      },
      close () {
        this.$emit('close');
        this.visible = false;
        this.queryParam.realname=null;
        this.queryParam.phone=null;
        this.selectUsers=[];
        this.selectedKeys=[];
      },
      handleOk(){
        this.$emit('ok', this.selectedKeys);
        this.close();
      },
      handleCancel () {
        this.close()
      }
      
    },
 
  }

</script>
<style lang="less" scoped>
  .drawer-bootom-button {
    position: absolute;
    bottom: 0;
    width: 100%;
    border-top: 1px solid #e8e8e8;
    padding: 10px 16px;
    text-align: right;
    left: 0;
    background: #fff;
    border-radius: 0 0 2px 2px;
  }

</style>