index.vue 3.93 KB
<template>
  <div class="system-container">
    <div class="container">
      <search-form
        class="searchTop border-shadow"
        :formModel="searchForm"
        :formList="todoFormList"
      >
        <span
          class="inline-b"
          slot="form-slot"
        >
          <el-button
            type="primary"
            :size="btn_size"
            icon="el-icon-search"
            :id="todoTableParams.btnId"
          >搜索</el-button>
          <el-button
            type="primary"
            :size="btn_size"
            icon="el-icon-refresh"
            @click="refresh"
          >重置</el-button>
        </span>
      </search-form>
      <h3>待办列表</h3>
      <basic-table
        ref="todoTable"
        :tableParams="todoTableParams"
        :getListApi="getListApi"
        :searchForm="searchForm"
        :hasNum="false"
      >
        <span
          slot="status"
          slot-scope="scope"
        >
          <span
            class="dot"
            :class="scope.scope.enableStatus ? USERSTATUS[scope.scope.enableStatus].split(',')[1] : ''"
          ></span>
          <span class="statusText">{{ scope.scope.enableStatus ? USERSTATUS[scope.scope.enableStatus].split(',')[0] : '--'}}</span>
        </span>
        <span
          slot="table-button"
          slot-scope="scope"
        >
          <el-button
            v-if="scope.scope.status == 1"
            type="text"
            @click="btnClick('todo', scope.scope)"
          >
            待办处理
          </el-button>
        </span>
      </basic-table>
    </div>
  </div>
</template>

<script>
import { getTodoList } from 'services/approval'
export default {
  data() {
    return {
      searchForm: { status: 1 },
      ITEMTYPE: this.$Constants.ITEM_TYPE,
      todoFormList: [
        {
          type: 'select',
          prop: 'status',
          placeholder: '请选择',
          options: [{
            label: '全部待办',
            value: ''
          }, {
            label: '未处理',
            value: 1
          }, {
            label: '已处理',
            value: 2
          }]
        },
        {
          type: 'select',
          prop: 'busType',
          placeholder: '请选择',
          options: [{
            label: '全部类型',
            value: ''
          }, {
            label: '试驾线路修改审核',
            value: 1
          }, {
            label: '上牌资料审核',
            value: 2
          }]
        }
      ],
      todoTableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: 'list',
        tableOption: true,
        tableColumns: [
          {
            label: '事项类型',
            prop: 'busType'
          }, {
            label: '创建人',
            prop: 'username'
          }, {
            label: '车辆类型',
            prop: '',
            formatter: (cellValue) => {
              return '试乘试驶车'
            }
          }, {
            label: '创建时间',
            prop: 'createdDate'
          }, {
            label: '审核状态',
            prop: 'status',
            formatter: (cellValue) => {
              return {
                '1': '待处理',
                '2': '审批成功',
                '3': '驳回'
              }[cellValue.status]
            }
          }
        ]
      },
      getListApi: getTodoList
    }
  },
  methods: {
    refresh() {
      this.searchForm = { status: 1 }
      this.$refs.todoTable.refreshTable()
    },
    btnClick(type, scope) {
      switch (type) {
        case 'todo':
          // 跳转
          console.log(scope)
          const path = '/oEshield#/monitor/fenceManagement';
          if (scope.bizType == 1) history.pushState(null, path, path)
          else if (scope.bizType == 2) this.$router.push({ name: 'vehicleSubmit', params: { approvalId: scope.approvalId, url: 'check' } })
          break
      }
    }
  },
}
</script>

<style>
</style>