index.vue 4.93 KB
<template>
  <div class="system-container">
    <div class="container">
      <search-form
        class="searchTop border-shadow vehicle"
        :formModel="searchForm"
        :formList="submitFormList"
      >
        <span
          class="inline-b"
          slot="form-slot"
        >
          <el-button
            type="primary"
            :size="btn_size"
            icon="el-icon-search"
            :id="submitTableParams.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="vehicleSubmitTable"
        :tableParams="submitTableParams"
        :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.isbutton"
            type="text"
            @click="btnClick('submit', scope.scope)"
          >
            提交上牌资料
          </el-button>
        </span>
      </basic-table>
    </div>
  </div>
</template>

<script>
import { getDocList } from 'services/vehicledoc'
import { dictInfo } from 'services/common'
export default {
  data() {
    return {
      searchForm: {},
      submitFormList: [
        {
          type: 'input',
          inputType: 'text',
          prop: 'keywords',
          placeholder: '特约店编码|店名称|围栏名称',
        },
        {
          type: 'select',
          prop: 'submitStatus',
          placeholder: '请选择提交状态',
          options: []
        },
        {
          type: 'select',
          prop: 'approvalStatus',
          placeholder: '请选择审核状态',
          options: []
        }
      ],
      submitTableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        tableOption: {
          width: 120
        },
        listName: 'list',
        tableColumns: [
          {
            label: '所属大区',
            prop: 'area'
          }, {
            label: '所属省',
            prop: 'province'
          }, {
            label: '所属市',
            prop: 'city'
          }, {
            label: '特约店名称',
            prop: 'shopName',
            width: 110
          }, {
            label: '特约店编码',
            prop: 'shopCode'
          }, {
            label: '店级别',
            prop: 'shopLevel'
          }, {
            label: '车辆类型',
            prop: 'vehicleType',
            width: 120,
            formatter: () => {
              return '试乘试驾车辆'
            }
          }, {
            label: '车架号',
            prop: 'vin',
            width: 150
          }, {
            label: '车型',
            prop: 'modelName',
            width: 120
          }, {
            label: '配置',
            prop: 'configDesc',
            width: 130
          }, {
            label: '外色',
            prop: 'color'
          }, {
            label: '内色',
            prop: 'innerColor'
          }, {
            label: '提交状态',
            prop: 'submitStatus',
            formatter: (cellValue) => {
              return this.submitStatusList.find(item => item.dictValue == cellValue.submitStatus).dictLabel
            }
          }, {
            label: '审核状态',
            prop: 'approvalStatus'
          }, {
            label: '审核结果备注',
            prop: 'remark',
            width: 100
          }
        ]
      },
      getListApi: getDocList,
      submitStatusList: [],
      approvalStatusList: []
    }
  },
  watch: {
    '$route'(val) {
      console.log(val)
      if (val.path == '/vehicleSubmit') this.$refs.vehicleSubmitTable.refreshTable()
    }
  },
  mounted() {
    dictInfo('submitStatus').then(res => {
      this.submitFormList[1].options = res.data
      this.submitStatusList = res.data
    })
    dictInfo('approval_status').then(res => {
      this.submitFormList[2].options = res.data
      this.approvalStatusList = res.data
    })
  },
  methods: {
    refresh() {
      this.searchForm = {}
      this.$refs.vehicleSubmitTable.refreshTable()
    },
    btnClick(pType, scope) {
      console.log(scope)
      switch (pType) {
        case 'submit':
          this.$router.push({ name: 'addVehicle', params: { vehicleId: scope.vehicleId, url: 'submit', status: scope.status } })
          break
      }
    },
  },
}
</script>