<template>
  <div class="ele-body">
    <el-card shadow="never" v-loading="loading">
      <search @search="reload"></search>
      <!-- 数据表格 -->
      <ele-pro-table
        ref="table"
        :columns="columns"
        :datasource="datasource"
        cache-key="systemRoleTable"
        :pageSize="20"
      >
        <!-- 表头工具栏 -->
        <template v-slot:toolbar></template>
        <!-- <template v-slot:code="{ row }"
          ><el-link
            type="primary"
            :underline="false"
            @click="goDetail(row, 'view')"
          >
            {{ row.code }}
          </el-link>
        </template>-->
        <!-- 操作列 -->
        <!-- <template v-slot:action="{ row }"></template> -->
      </ele-pro-table>
    </el-card>
  </div>
</template>

<script>
import search from './components/search.vue';
import { evaluatePage } from '@/api/salesServiceManagement/index';

import dictMixins from '@/mixins/dictMixins';
export default {
  mixins: [dictMixins],
  components: {
    search
  },
  data() {
    return {
      evaluateStatus: {
        1: '非常不满意',
        2: '不满意',
        3: '一般',
        4: '满意',
        5: '非常满意'
      },
      // 表格列配置

      // 加载状态
      loading: false
    };
  },
  computed: {
    columns() {
      return [
        {
          columnKey: 'index',
          label: '序号',
          type: 'index',
          width: 55,
          align: 'center',
          showOverflowTooltip: true,
          fixed: 'left'
        },
        {
          slot: 'code',
          prop: 'code',
          label: '编码',
          align: 'center',
          showOverflowTooltip: true
        },
        {
          prop: 'workCode',
          label: '工单编码',
          align: 'center',
          showOverflowTooltip: true
        },
        {
          prop: 'contactName',
          label: '客户名称',
          align: 'center',
          showOverflowTooltip: true
        },
        {
          prop: 'contactCode',
          label: '客户编码',
          align: 'center',
          showOverflowTooltip: true
        },
        {
          prop: 'attitudeRating',
          label: '服务态度评分',
          align: 'center',
          showOverflowTooltip: true,
          formatter: (row) => {
            return this.evaluateStatus[row.attitudeRating];
          }
        },
        {
          prop: 'responseSpeed',
          label: '响应速度评分',
          align: 'center',
          showOverflowTooltip: true,
          formatter: (row) => {
            return this.evaluateStatus[row.responseSpeed];
          }
        },
        {
          prop: 'serviceRating',
          label: '整体满意度',
          align: 'center',
          showOverflowTooltip: true,
          formatter: (row) => {
            return this.evaluateStatus[row.serviceRating];
          }
        },
        {
          prop: 'comment',
          label: '评价内容',
          align: 'center',
          showOverflowTooltip: true,
        },

        {
          prop: 'createUserName',
          label: '创建人',
          align: 'center',
          showOverflowTooltip: true
        },
        {
          prop: 'createTime',
          label: '创建时间',
          align: 'center',
          showOverflowTooltip: true
        }
      ];
    }
  },
  created() {},
  methods: {
    /* 表格数据源 */
    datasource({ page, limit, where, order }) {
      return evaluatePage({ pageNum: page, size: limit, ...where });
    },
    /* 刷新表格 */
    reload(where) {
      this.$refs.table.reload({ page: 1, where });
    }
  }
};
</script>

<style lang="scss" scoped></style>
