<!-- 车辆年检信息 -->
<template>
  <div class="app-container">
    <!-- 搜索工作栏 -->
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="车牌号" prop="licenseNumber">
        <el-input v-model="queryParams.licenseNumber" placeholder="请输入车牌号" clearable
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="联系人" prop="cusName" label-width="90">
        <el-input v-model="queryParams.cusName" placeholder="请输入联系人姓名" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-s-comment" size="mini">一键提醒</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
      <el-table-column label="序号" width="50" align="center" prop="num">
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ queryParams.pageSize * (queryParams.pageNo - 1) + scope.$index + 1
            }}</span>
        </template>
      </el-table-column>
      <el-table-column label="车牌号" align="center" prop="licenseNumber" width="100">
        <template v-slot="scope">
          <router-link :to="'./check/' + scope.row.id" class="link-type">
            <span>{{ scope.row.licenseNumber }}</span>
          </router-link>
        </template>
      </el-table-column>
      <el-table-column label="车辆品牌" align="center" prop="brandStr" />
      <el-table-column label="车辆型号" align="center" prop="modelStr" />
      <el-table-column label="车辆类别" align="center" prop="carCategory">
        <template v-slot="scope">
          <dict-tag :type="DICT_TYPE.DICT_CAR_CATEGORY" :value="scope.row.carCategory" />
        </template>
      </el-table-column>
      <el-table-column label="车辆性质" align="center" prop="carNature">
        <template v-slot="scope">
          <dict-tag :type="DICT_TYPE.DICT_CAR_NATURE" :value="scope.row.carNature" />
        </template>
      </el-table-column>
      <el-table-column label="上次年检时间" align="center" prop="inspectionDate" width="180">
        <template v-slot="scope">
          <span>{{ parseTime(scope.row.inspectionDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="下次年检时间" align="center" prop="nextInspectionDate" width="180">
        <template v-slot="scope">
          <span>{{ parseTime(scope.row.nextInspectionDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="联系人" align="center" prop="cusName" />
      <el-table-column label="联系方式" align="center" prop="phoneNumber" />
      <el-table-column label="临近年检天数" align="center" prop="njCont" />
      <el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" width="200">
        <template v-slot="scope">
          <el-button size="mini" type="text" icon="el-icon-s-comment">推送提醒</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
      @pagination="getList" />
  </div>
</template>
<script>
import * as CarMainApi from '@/api/base/carmain';
export default {
  name: "inspection",
  components: {
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 车辆信息列表
      list: [],
      // 是否展开，默认全部展开
      isExpandAll: true,
      // 重新渲染表格状态
      refreshTable: true,
      // 选中行
      currentRow: {},
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
        licenseNumber: null,
        cumName:null,
        selectSign:'01'
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询列表 */
    async getList() {
      try {
        this.loading = true;
        const res = await CarMainApi.remindCarMainPage(this.queryParams);
        this.list = res.data.records;
        this.total = res.data.total;
      } finally {
        this.loading = false;
      }
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
  }
};
</script>
