<template>
  <el-card>
    <el-form :inline="true" :model="query" class="query-form" size="mini"
             style="margin-bottom: 10px"
    >
      <el-form-item class="query-form-item" label="错误类型：" prop="type">
        <el-select
          v-model="query.type"
          placeholder="请选择错误类型"
          clearable
          style="width: 210px"
        >
          <el-option
            label="1: 未上传医保替换码"
            :value="1"
          />
          <el-option
            label="2: 已上传替换码"
            :value="2"
          />
        </el-select>

      </el-form-item>

      <el-form-item>
        <el-button-group>
          <el-button
            type="primary"
            icon="el-icon-refresh"
            @click="onReset"
          >重置
          </el-button>
          <el-button type="primary" @click="getList"
                     icon="el-icon-search"
          >查询
          </el-button
          >
        </el-button-group>
      </el-form-item>
    </el-form>
    <el-table :data="list" style="width: 100%;" :row-style="{height: '32px' }"
              highlight-current-row
    >
      <el-table-column type="index" label="序号"></el-table-column>
      <el-table-column label="单据号 " prop="orderId" width="160"></el-table-column>
      <el-table-column label="自动赋码 " prop="autoCode" width="220"></el-table-column>
      <el-table-column label="手动赋码 " prop="manuCode" width="220"></el-table-column>
      <el-table-column label="错误类型" prop="type" width="140">
        <template slot-scope="scope">
          <span>{{ errorTypes[scope.row.type] }}</span>
        </template>
      </el-table-column>

      <el-table-column label="更新时间" prop="updateTime" width="180"></el-table-column>
      <el-table-column label="更新人" prop="updateUser" width="80"></el-table-column>
      <el-table-column label="备注" prop="remark" width="380"></el-table-column>

      <el-table-column label="操作" fixed="right" width="140">
        <template slot-scope="scope">
        </template>
      </el-table-column>
    </el-table>
    <pagination
      :total="total"
      :limit.sync="query.limit"
      :page.sync="query.page"
      @pagination="getList()"
    >
    </pagination>

  </el-card>
</template>

<script>
import { getList } from '@/api/collect/collectErrorlog'

export default {
  components: {},
  data() {
    return {
      query: {
        page: 1,
        limit: 10,
        orderId: null,
        type: null,
        workplaceStatus: 1,
        deptCode: ''
      },
      errorTypes:{
        1: "未上传医保替换码",
        2: "已上传替换码"
      },
      showSearch: true,
      Dictionary: false,
      loading: false,
      list: [],
      total: null,
    }
  },
  computed: {},
  methods: {
    hideSearch() {
      this.showSearch = !this.showSearch
    },
    onReset() {
      this.$router.push({
        path: ''
      })
      this.query = {
        page: 1,
        limit: 10,
        workplaceStatus: null
      }
      this.getList()
    },
    getList() {
      getList(this.query).then(res => {
        if (res.code != 20000) {
          return this.$message.error(res.message)
        }
        this.list = res.data.list || []
        this.total = res.data.total || 0
      })
    },
  },
  created() {
    this.getList()
  }
}
</script>

<style scoped>
.type-tips {
  margin-top: 8px;
  display: flex;
  align-items: center;
  padding: 6px 10px;
  background: #f5f7fa;
  border-radius: 4px;
}

</style>
