importDetail.vue 2.72 KB
<template>
  <div class="container">
    <div class="global-title">任务详情</div>
    <div class="main">
      <GLTable :pageSizes="pageSizes" ref="tableRef" :pageConf="pageConf" :searchForm="searchForm" :tableParams="tableParams" :beforeSearchFn="beforeSearchFn" :getListApi="getListApi">
        <div slot="taskStatusSlot" slot-scope="scope">
          <span class="status" :style="{ 'background-color': detailTaskStatusEnum[scope.scope.taskStatus].color }"></span>
          {{ detailTaskStatusEnum[scope.scope.taskStatus] ? detailTaskStatusEnum[scope.scope.taskStatus].label : '--' }}
        </div>
      </GLTable>
    </div>
  </div>
</template>
<script>
export default {
  name: 'index',
  data() {
    return {
      size: 'small',
      detailTaskStatusEnum: {
        0: {
          label: '待执行',
          color: '#C6C6C6'
        },
        2: {
          label: '失败',
          color: '#EB4E4E'
        },
        1: {
          label: '成功',
          color: '#2CCA74'
        }
      },
      getListApi: this.$apis.beforeSale.getTaskDetailListApi,
      pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
      pageSizes: [10, 20, 30, 40, 50],
      searchForm: {},
      tableParams: {
        listName: 'list',
        tableOption: null,
        tableColumns: [
          {
            label: '门店名称',
            prop: 'merchantName',
            width: 260,
            line: 1
          },
          {
            label: '客户名称',
            prop: 'customerName',
            width: 200
          },
          {
            label: '车架号',
            prop: 'vin',
            width: 240,
            line: 1
          },
          {
            label: '产品名称',
            prop: 'packageName',
            width: 280,
            line: 1
          },
          {
            label: '服务期限',
            prop: 'servicePeriod',
            formatter: cell => {
              return cell.servicePeriod ? cell.servicePeriod + '年' : '--'
            }
          },
          {
            label: '任务状态',
            addHtml: 'taskStatusSlot'
          },
          {
            label: '任务状态描述',
            prop: 'failReason',
            width: 280,
            line: 1
          }
        ]
      }
    }
  },
  methods: {
    beforeSearchFn() {
      return new Promise(resolve => {
        this.searchForm = { taskId: this.$route.params.id }
        resolve()
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.container {
  background-color: #fff;
  .main {
    padding: 20px;
  }
}
.status {
  width: 6px;
  height: 6px;
  display: inline-block;
  border-radius: 50%;
  background-color: antiquewhite;
  margin-right: 8px;
  vertical-align: middle;
}
</style>