drawRecord.vue 3.31 KB
<template>
  <div>
    <el-drawer title="发送记录" :visible.sync="drawVisible" direction="rtl" size="50%">
      <div class="horizon"></div>
      <div class="drawer-body">
        <div class="record-panel">
          <div class="record-border">
            <div class="record-status">发送成功</div>
            <div class="record-num">{{ successCount }}</div>
          </div>
          <div class="record-border">
            <div class="record-status">发送失败</div>
            <div class="record-num">{{ failCount }}</div>
          </div>
        </div>
        <GLTable ref="proGroupRef" @refreshTable="getListData" :layout="layout" :tableData="tableData" :tableTotal="tableTotal" :tableParams="tableParams" :pageConf="pageConf">
          <div slot="status" slot-scope="scope">
            <span style="color: #EB4E4E" v-if="scope.scope.status == 2">发送失败</span>
            <span style="color: #2CCA74" v-else-if="scope.scope.status == 3">发送成功</span>
          </div>
        </GLTable>
      </div>
    </el-drawer>
  </div>
</template>
<script>
export default {
  data() {
    return {
      successCount: 0,
      failCount: 0,
      drawVisible: false,
      tableData: [],
      tableParams: {
        listName: 'data',
        tableOption: false,
        tableColumns: [
          {
            label: '员工',
            prop: 'staffName',
            minwidth: 240
          },
          {
            label: '发送时间',
            prop: 'sendTime',
            minwidth: 180
          },
          {
            label: '发送结果',
            prop: 'status',
            addHtml: 'status',
            minwidth: 180
          }
        ]
      },
      layout: 'sizes, prev, pager, next, jumper, ->, total',
      tableTotal: 0,
      pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' }
    }
  },
  methods: {
    getListData() {
      this.loading = true
      const params = {
        pageSize: this.$refs.proGroupRef.page.pageSize,
        pageNum: this.$refs.proGroupRef.page.pageNum,
        id: this.recordId
      }
      this.$apis.friendGroup.batchmomentRecord(params).then(res => {
        this.loading = false
        if (res) {
          this.tableData = res.data
          this.tableTotal = res.count
        }
      })
    },
    init(row) {
      const { id, successCount = 0, failCount = 0 } = row
      this.recordId = id
      this.successCount = successCount
      this.failCount = failCount
      this.drawVisible = true
      this.$nextTick(() => {
        this.getListData()
      })
    }
  }
}
</script>
<style scoped lang="scss">
.drawer-body {
  padding: 20px;
}
.horizon {
  width: 100%;
  height: 1px;
  background: #e8e8ea;
}
.record-panel {
  display: flex;
  .record-border {
    width: 50%;
    height: 66px;
    padding: 8px 20px;
    background: #ffffff;
    border: 1px solid #e8e8ea;
    border-radius: 4px;
    box-sizing: border-box;
    margin-bottom: 16px;
    &:first-child {
      margin-right: 20px;
      .record-num {
        color: #2cca74;
      }
    }
    .record-status {
      font-weight: 400;
      font-size: 14px;
      color: #666666;
      letter-spacing: 0;
      line-height: 22px;
    }
    .record-num {
      font-size: 20px;
      color: #eb4e4e;
      letter-spacing: 0;
      line-height: 24px;
      margin-top: 6px;
    }
  }
}
</style>