index.vue 5.16 KB
<template>
  <div class="square-main" v-loading="loading">
    <el-dialog title="客户列表" :visible.sync="dialogVisible" :before-close="handleClose">
      <!-- <GLCombiForm ref="formSearch" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm> -->
      <GLTable v-loading="loading" ref="table" :layout="layout" :tableData="tableData" :tableTotal="tableTotal" :pageConf="pageConf" :tableParams="tableParams" @refreshTable="handleSearch" @selectionTable="selectionTable"></GLTable>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="handleCancel" type="primary">关闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { utils } from 'glsx-common'
import util from '@/utils/util'
export default {
  name: 'selectEmp',
  data() {
    return {
      loading: false,
      dialogVisible: false,
      status: '',
      createTime: [],
      optionstatus: [
        {
          value: '',
          label: '全部'
        },
        {
          value: '0',
          label: '正常'
        },
        {
          value: '-1',
          label: '删除好友'
        }
      ],
      tableSearchForm: {},
      pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
      tableParams: {
        listName: 'data',
        tableOption: false,
        tableColumns: [
          {
            label: '访问页面',
            prop: 'addTime'
          },
          {
            label: '访问时间',
            prop: 'addTime'
          }
        ]
      },
      layout: 'sizes, prev, pager, next, jumper, ->, total',
      tableData: [],
      staffName: [],
      tableTotal: 0,
      selectItem: [],
      selectEmp: [],
      pStatus: null,
      staffIds: null,
      staffId: null
    }
  },
  methods: {
    getFollower() {
      var params = {
        ...JSON.parse(JSON.stringify(this.tableSearchForm)),
        pageSize: this.$refs.table.page.pageSize,
        pageNum: this.$refs.table.page.pageNum,
        custState: this.selectRow.codeState,
        staffIds: this.staffId ? [this.staffId] : null
      }
      if (this.createTime && this.createTime.length > 0) {
        params.beginTime = this.createTime[0]
        params.endTime = this.createTime[1]
      }
      if (this.pStatus) {
        params.status = 0
      }
      if (this.staffIds) {
        params.staffIds = this.staffIds
      }
      this.loading = true
      this.$apis.channel.getCustomer(params).then(res => {
        this.loading = false
        this.tableData = res.data
        this.tableTotal = res.count
      })
    },
    getChannelCodeStaffList() {
      var params = {
        pageSize: 1000,
        pageNum: 1,
        codeState: this.selectRow.codeState
      }
      this.$apis.channel.getChannelCodeStaffList(params).then(res => {
        this.staffName = [{ staffName: '全部', staffId: null }].concat(res.data)
      })
    },
    init(item, value, day) {
      this.createTime = []
      this.pStatus = null
      this.staffIds = null
      this.timeStatus = true
      if (value == 'day' && !day) {
        this.createTime = [util.getDay(0), util.getDay(0)]
        this.timeStatus = false
      }
      if (value == 'day' && day) {
        if (day.indexOf('~') == -1) {
          this.createTime = [day, day]
        } else {
          this.createTime = [day.split('~')[0], day.split('~')[1]]
        }
        this.timeStatus = false
      }
      if (value == 'status' && !day) {
        this.pStatus = 'status'
      }
      if (value == 'status' && day) {
        this.pStatus = 'status'
        if (day.indexOf('~') == -1) {
          this.createTime = [day, day]
        } else {
          this.createTime = [day.split('~')[0], day.split('~')[1]]
        }
        this.timeStatus = false
      }
      if (value == 'staffIds') {
        this.staffIds = item.staffId
      }
      if (value == 'statusAndStaffIds') {
        this.pStatus = 'status'
        this.staffIds = item.staffId
      }
      this.selectRow = item
      this.tableSearchForm = {}
      this.dialogVisible = true
      this.getChannelCodeStaffList()
      this.$nextTick(() => {
        this.$refs.table.page.pageNum = 1
        this.getFollower()
      })
    },
    handleSearch() {
      this.getFollower()
    },
    selectionTable(val) {
      this.selectItem = val
    },
    handleClose() {
      this.handleCancel()
    },
    handleDetail(scope) {
      this.$history.push('/custom/clientManage/clientDetail?id=' + scope.oneId)
    },
    handleCancel: utils.debounce(function() {
      this.dialogVisible = false
    }, 300)
  }
}
</script>

<style lang="scss" scoped>
.dialog-jump {
  color: #5850ff;
  float: left;
  line-height: 24px;
  text-decoration: underline;
  cursor: pointer;
}
.emp-form {
  /deep/ {
    .el-date-editor,
    .el-input {
      width: 215px;
    }
  }
}
.square-main {
  /deep/ {
    .el-table {
      height: 35vh;
      overflow-y: auto;
    }
    .el-form-item {
      margin-right: 20px;
    }
    .el-table::before {
      left: 0;
      bottom: 0;
      width: 100%;
      height: 0px;
    }
  }
}
.form-row {
  img {
    width: 50px;
    height: 50px;
    vertical-align: middle;
  }
}
</style>