iusseDetail.vue 5.46 KB
<template>
  <div>
    <div class="container">
      <div class="title flex">用户详情</div>
      <div class="user-box flex">
        <div class="item flex">
          <div class="label">用户企微名:</div>
          {{staffDetail.staffName}}
        </div>
        <div class="item flex">
          <div class="label">登录商户:</div>
          {{ staffDetail.merchantName }}{{ staffDetail.merchantId }}
        </div>
      </div>
      <div class="title flex">提问记录</div>
      <div class="table-box">
        <div class="date-box flex">
          <div class="label">日期搜索:</div>
          <el-date-picker
            v-model="searchDate"
            type="daterange"
            unlink-panels
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :picker-options="beforeRangePickerOptions"
            @change="changeDate"
          >
          </el-date-picker>
        </div>
        <GLTable
          ref="listRef"
          :getListApi="getListApi"
          :searchForm="searchForm"
          :noDataImg="url"
          :tableParams="tableParams"
          :pageConf="pageConf"
        >
          <div
            slot-scope="scope"
            slot="content"
          >
            <el-tooltip
              placement="bottom"
              :content="scope.scope.content"
              effect="light"
              :tabindex="100868"
              popper-class="popper-class"
            >
              <div class="tooltip-content flex">
                <div :class="['icon flex',scope.scope.contentType == 0?'question':'answering']">{{ scope.scope.contentType == 0?'问':'答'}}</div>
                <div class="text"> {{ scope.scope.content }}</div>
              </div>
            </el-tooltip>
          </div>
        </GLTable>
      </div>
    </div>
    <GLFooter class="gl-footer">
      <el-button
        @click="$router.back()"
        type="primary"
      >返回</el-button>
    </GLFooter>
  </div>
</template>

<script type='text/ecmascript-6'>
import url from '@/assets/empty.png'
import * as dayjs from 'dayjs'
export default {
  name: '',
  data () {
    return {
      url,
      pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
      searchForm: {
        beginDate: '',
        endDate: '',
        staffUuid: this.$route.query.id
      },
      searchDate: '',
      getListApi: this.$apis.chatLibrary.getStaffChatRecordPage,
      tableParams: {
        listName: 'data',
        tableColumns: [
          {
            label: '更新时间',
            width: 210,
            prop: 'chatTime'
            // formatter: cellVal => {
            //   return dayjs(cellVal.chatTime).format('YYYY-MM-DD HH:mm')
            // }
          },
          {
            label: '用户问题及AI答复',
            addHtml: 'content',
          },
        ]
      },
      beforeRangePickerOptions: {},
      staffDetail: {
        staffName: '',
        merchantName: '',
        merchantId: ''
      }
    }
  },
  mounted () {
    this.getStaffChatRecordDetail()
  },
  methods: {
    changeDate (e) {
      let beginDate = '',
        endDate = ''
      if (e) {
        beginDate = dayjs(e[0]).format('YYYY-MM-DD')
        endDate = dayjs(e[1]).format('YYYY-MM-DD')
      }
      this.searchForm.beginDate = beginDate
      this.searchForm.endDate = endDate
      this.$refs.listRef.refreshTable()
    },
    async getStaffChatRecordDetail () {
      const res = await this.$apis.chatLibrary.getStaffChatRecordDetail({
        staffUuid: this.$route.query.id
      })
      this.staffDetail = res || {}
      this.beforeRangePickerOptions = {
        disabledDate (date) {
          let disabled = true
          try {
            res.dateList.map(e => {
              if (dayjs(date).format('YYYY-MM-DD') == e) throw false
            })
          } catch (error) {
            disabled = false
          }
          return disabled
        }
      }
    }
  }
}
</script>

<style scoped lang='scss'>
.flex {
  display: flex;
  align-items: center;
}
.container {
  background: #ffffff;
  min-height: calc(100vh - 136px);
  margin-bottom: 16px;
  .title {
    height: 58px;
    padding: 0 20px;
    font-weight: 700;
    font-size: 16px;
    color: #333333;
    border-bottom: 1px solid #e5e5e5;
  }
  .user-box {
    min-height: 84px;
    padding: 0 20px;
    gap: 0 192px;
    .item {
      font-size: 14px;
      color: #333333;
      line-height: 20px;
      .label {
        color: #666666;
        width: 154px;
        text-align: right;
      }
    }
  }
  .table-box {
    padding: 0 20px 78px;
    .date-box {
      height: 64px;
      padding-left: 16px;
    }
    .el-date-editor--daterange.el-input__inner {
      width: 232px;
    }
    .el-range-editor.is-active:hover {
      border-color: #5850ff;
      width: 232px;
    }
    .tooltip-content {
      .icon {
        width: 22px;
        height: 22px;
        border: 1px solid transparent;
        border-radius: 4px;
        font-weight: 600;
        font-size: 14px;
        justify-content: center;
        letter-spacing: 0;
        margin-right: 9px;
      }
      .question {
        border-color: #fdb7574d;
        color: #fdb757;
        background: #fdb7571a;
      }
      .answering {
        border-color: #5850ff4d;
        color: #5850ff;
        background: #5850ff1a;
      }
      .text {
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        max-width: 90%;
      }
    }
  }
}
</style>