index.vue 4.08 KB
<template>
  <div class="square-main" v-loading="loading">
    <GLDialog title="发送人筛选" :visible.sync="dialogVisible">
      <el-form :inline="true" :model="tableSearchForm">
        <el-form-item size="small" label="员工姓名">
          <el-input v-model="tableSearchForm.staffName" placeholder="输入关键字搜索"></el-input>
        </el-form-item>
        <el-form-item size="small">
          <el-button type="primary" @click="handleSearch">查询</el-button>
        </el-form-item>
      </el-form>
      <GLTable :hasNum="true" v-if="dialogVisible" @refreshTable="handleSearch" ref="table" :layout="layout"
               :tableData="tableData" :tableTotal="tableTotal" :pageConf="pageConf" :tableParams="tableParams">
        <div fixed="left" slot="options" slot-scope="scope">
          <el-radio :label="scope.scope.idBefEncryption" v-model="selectId"></el-radio>
        </div>
      </GLTable>
      <span slot="footer" class="dialog-footer">
        <el-button plain size="small" @click="handleCancel">取 消</el-button>
        <el-button size="small" type="primary" @click.native="handleSelect">确 定</el-button>
      </span>
    </GLDialog>
  </div>
</template>
<script>
import {utils} from 'glsx-common'
import util from '@/utils/util'

export default {
  name: 'SelectEmployees ',
  data() {
    return {
      selectId: null,
      // loading: false,
      dialogVisible: false,
      tableSearchForm: {},
      pageConf: {pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total'},
      tableParams: {
        listName: 'data',
        tableOption: false,
        // 行数据的key
        mutiSelectUniqueKey: 'id',
        tableColumns: [
          {
            label: '',
            prop: '',
            fixed: 'left',
            width:'80',
            addHtml: 'options'
          },
          {
            label: '员工姓名',
            prop: 'staffName',
            width:'220',
          },
          {
            label: '企业微信',
            prop: 'entmicroName'
          }
        ]
      },
      layout: 'sizes, prev, pager, next, jumper, ->, total',
      tableData: [],
      tableTotal: 0,
      selectEmp: [],
      typeselect: '',
      selectUuid: ''
    }
  },
  methods: {
    selectableStaff() {
      let params = {
        ...JSON.parse(JSON.stringify(this.tableSearchForm)),
        pageSize: this.$refs.table.page.pageSize,
        pageNum: this.$refs.table.page.pageNum,
        loginStatus: 1
      }
      this.$apis.collocation.wechatDepositNotAccessList(params).then(res => {
        this.tableData = res.data ? res.data : []
        this.tableTotal = res.count
      })
    },
    init() {
      this.tableSearchForm = {}
      this.dialogVisible = true
      this.$nextTick(() => {
        this.$refs.table.page.pageNum = 1
        this.selectableStaff()
      })
    },
    handleSearch() {
      this.selectableStaff()
    },
    handleClose() {
      this.handleCancel()
    },
    handleCancel: utils.debounce(function () {
      this.dialogVisible = false
    }, 300),
    handleSelect: utils.debounce(function () {
      if (!this.selectId) {
        this.$message.error('请选择发送人')
        return
      }
      let list = this.tableData.filter(item => {
        return item['idBefEncryption'] == this.selectId
      })
      let selectEmp = {
        staffName: list[0].staffName,
        staffCloudIdList: list[0].idBefEncryption,
        staffId: list[0].id
      }
      this.dialogVisible = false
      this.$emit('selectSender', selectEmp)
    }, 300)
  }
}
</script>
<style lang="scss" scoped>
/deep/ .glsx-table .emptyBg .noDataImg {
  margin-top: 150px !important;
}

/deep/ .el-radio:focus:not(.is-focus):not(:active):not(.is-disabled) .el-radio__inner {
  box-shadow: none;
}

/deep/ .el-radio__label {
  display: none;
}

.dialog-jump {
  color: #5850ff;
  float: left;
  line-height: 24px;
  text-decoration: underline;
  cursor: pointer;
}

.square-main {
  /deep/ {
    .el-table {
      height: 40vh;
      overflow-y: auto;
    }

    .el-table::before {
      left: 0;
      bottom: 0;
      width: 100%;
      height: 0px;
    }
  }
}
</style>