readPerDetail.vue 4.16 KB
<template>
  <div>
    <glsx-combi-form ref="readPerDetailFormRef" :formObj="searchForm" :formData="readPerDetailFormData" :inline="true">
      <span slot="footer" slot-scope="scope" class="select-pro">
        <el-button type="default" :size="size" @click="handleReset(scope)">重置</el-button>
        <el-button type="primary" :size="size" @click="handleSearch(scope)">查询</el-button>
      </span>
    </glsx-combi-form>
    <GLTable ref="readPerDetailRef" @setTableFinishFun="setTableFinishFun" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf">
      <div slot="departName" slot-scope="scope" style="display:flex">
        <div v-for="(item, index) in scope.scope.departName" :key="index">
          <el-tag type="info" :size="size" effect="plain" v-if="index < 3" style="margin-right:4px">
            <i class="el-icon-user-solid" style="color: #75acff"></i>
            {{ item }}
          </el-tag>
          <el-tag type="info" :size="size" v-if="scope.scope.departName.length > 3 && index == 3">
            <el-popover placement="top" width="500" trigger="hover">
              <span slot="reference">...({{ scope.scope.departName.length }})</span>
              <div class="entmicro-hover">
                <el-tag class="toptip" type="info" v-for="(i, index) in scope.scope.departName" :size="size" :key="index">
                  <i class="el-icon-user-solid" style="color: #75acff"></i>
                  {{ i }}
                </el-tag>
              </div>
            </el-popover>
          </el-tag>
        </div>
      </div>
    </GLTable>
  </div>
</template>

<script>
import url from '@/assets/empty.png'
export default {
  name: 'readPerDetail',
  props: ['materialId', 'startTime', 'endTime'],
  data() {
    return {
      url,
      searchForm: {
        customerName: '',
        customerPhone: '',
        staffName: '',
        materialId: this.materialId,
        startTime: this.startTime,
        endTime: this.endTime
      },
      getListApi: this.$apis.material.readDetailPage,
      pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
      readPerDetailFormData: [
        {
          label: '名称:',
          name: 'customerName',
          maxlength: 10,
          type: 'input',
          placeholder: '请输入名称'
        },
        {
          label: '客户手机号:',
          name: 'customerPhone',
          placeholder: '请输入客户手机号',
          type: 'input'
        },
        {
          label: '发送人:',
          name: 'staffName',
          maxlength: 10,
          placeholder: '请输入发送人',
          type: 'input'
        }
      ],
      tableParams: {
        listName: 'data',
        tableOption: false,
        tableColumns: [
          {
            label: '客户名称',
            prop: 'customerName'
          },
          {
            label: '电话号码',
            prop: 'customerPhone'
          },
          {
            label: '发送人',
            prop: 'staffName'
          },
          {
            label: '所属企微成员',
            prop: 'departName',
            addHtml: 'departName',
            width: 350
          },
          {
            label: '阅读次数',
            prop: 'readNumber'
          },
          {
            label: '首次阅读时间',
            prop: 'firstReadTime'
          },
          {
            label: '最后阅读时间',
            prop: 'lastReadTime'
          }
        ]
      }
    }
  },
  methods: {
    // 搜索
    handleSearch() {
      this.$refs.readPerDetailRef.refreshTable()
    },
    // 重置
    handleReset() {
      this.searchForm = {
        customerName: '',
        customerPhone: '',
        staffName: '',
        materialId: this.materialId
      }
      this.handleSearch()
    },
    setTableFinishFun() {
      //接收到的数据为空
      this.$refs.readPerDetailRef.data.length ? (this.$refs.readPerDetailRef.tableHeightValues = '') : (this.$refs.readPerDetailRef.tableHeightValues = '280px')
    }
  }
}
</script>

<style lang="scss" scoped>
.toptip {
  margin-right: 4px;
  &:nth-last-of-type(-n + 4) {
    margin-bottom: 0;
  }
}
</style>