detaiCustomeGroup.vue 5.36 KB
<template>
  <div>
    <BasicInof :form="'customerGroup'" :eventBus="eventBus" :id="$route.params.id"></BasicInof>
    <div class="group-detail-container">
      <glsx-combi-form ref="showSearch" :formObj="searchForm" :formData="searchFormData">
        <div slot="footer" class="search-btns">
          <el-button :size="size" @click="update">更新</el-button>
          <el-button :size="size" @click="handleReset">重置</el-button>
          <el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
        </div>
      </glsx-combi-form>
      <!-- 表格区域 开始 -->
      <GLTable style="margin-top: 20px;" ref="table" :getListApi="getListApi" :searchForm="searchForm" :tableParams="tableParams" :hasPage="false" :pageConf="pageConf">
        <div class="table-btns" slot="optionBtns" slot-scope="scope">
          <el-button type="text" :disabled="scope.scope.status == 1 || (scope.scope.status == 0 && scope.scope.remindStatus == 1)" @click="remind(scope.scope)">提醒发送</el-button>
        </div>
      </GLTable>
    </div>
  </div>
</template>
<script>
import Vue from 'vue'
import BasicInof from './components/basicInfo.vue'
export default {
  components: {
    BasicInof
  },
  data() {
    return {
      searchForm: {},
      eventBus: new Vue(),
      searchFormData: [
        {
          label: '群聊名称',
          name: 'keyWord',
          type: 'input',
          maxlength: 20
        },
        {
          label: '群主',
          name: 'staffId',
          type: 'select',
          isClear: true,
          optionLabel: 'staffName',
          optionId: 'staffId',
          optionList: []
        },
        {
          label: '消息送达状态',
          name: 'status',
          type: 'select',
          isClear: true,
          optionLabel: 'label',
          optionId: 'value',
          optionList: [
            {
              label: '全部',
              value: ''
            },
            {
              label: '未发送',
              value: '0'
            },
            {
              label: '已发送',
              value: '1'
            },
            {
              label: '发送失败',
              value: '2'
            }
          ]
        }
      ],
      tableParams: {
        listName: '',
        tableOption: false,
        tableColumns: [
          {
            label: '群聊名称',
            prop: 'groupName'
          },
          {
            label: '群主',
            prop: 'staffName'
          },
          {
            label: '群主所在部门',
            prop: 'departmentName'
          },
          {
            label: '群客户人数',
            prop: 'customerCount'
          },
          {
            label: '消息送达状态',
            prop: 'status',
            formatter: cellValue => {
              return {
                0: '未发送',
                1: '已发送',
                2: '发送失败'
              }[cellValue.status]
            }
          },
          {
            label: '确认发送时间',
            prop: 'senderTime'
            // formatter: cellValue => {
            //   return new Date(cellValue.createdDate).toLocaleDateString().replace(/\//g, '-')
            // }
          },
          {
            label: '操作',
            prop: 'optionBtns',
            addHtml: 'optionBtns',
            fixed: 'right'
          }
        ]
      },
      pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
      getListApi: this.$apis.customerTransform.groupDetailList,
      footerLeft: 0,
      footerWidth: 0
    }
  },
  mounted() {
    const id = this.$route.params.id
    this.getCustomerDetail(id)
    this.searchForm.massId = id
    let clientHeight = document.documentElement.clientHeight
    this.footerLeft = document.querySelector('.base-container-right').offsetLeft
    this.footerWidth = document.documentElement.clientWidth - this.footerLeft
    this.boxHeight = clientHeight - 200
  },
  methods: {
    remind(data) {
      this.$apis.customerTransform
        .remindUserGroup({
          id: data.id,
          type: 2
        })
        .then(res => {
          this.handleSearch()
          this.$message({
            type: 'success',
            message: '已提醒'
          })
          // this.$set(this.employeelist[index], 'isRemind', true)
        })
    },
    handleSearch() {
      this.$refs.table.refreshTable()
    },
    handleReset() {
      this.searchForm = {
        massId: this.$route.params.id
      }
    },
    getCustomerDetail(id) {
      this.$apis.customerTransform.customerDetail({ id }).then(res => {
        this.searchFormData[1].optionList = res.userList
      })
    },
    update() {
      const id = this.$route.params.id
      this.$apis.customerTransform.groupDetailUpdate({ id }).then(res => {
        console.log(res)
        if (res) {
          this.handleSearch()
        }
      })
    }
  }
}
</script>
<style lang="scss" scope>
.group-detail-container {
  // margin-bottom: 84px;
  padding: 20px;
  background-color: #ffffff;
  box-shadow: 0px 1px 5px 0px rgba(38, 38, 38, 0.1);
  .search-btns {
    // float: right;
    text-align: right;
  }
}
.footer-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  bottom: 0px;
  height: 64px;
  width: 100%;
  background: #ffffff;
  box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
  z-index: 4;
}
</style>