<template>
  <div>
    <DialogCom
      title="扫描记录"
      :visible.sync="isShow"
      width="800px"
      :destroy-on-close="true"
    >
      <el-table :data="tableData" border>
        <el-table-column
          label="履职区域"
          align="center"
          :show-overflow-tooltip="true"
          prop="areaName"
        >
        </el-table-column>
        <el-table-column
          label="NFC点位名称"
          align="center"
          :show-overflow-tooltip="true"
          prop="collectionAreaName"
        >
        </el-table-column>

        <el-table-column
          label="扫描时间"
          align="center"
          :show-overflow-tooltip="true"
          width="180px"
          prop="executeTime"
        >
        </el-table-column>
        <el-table-column
          label="扫描方式"
          align="center"
          width="80px"
          :show-overflow-tooltip="true"
          prop="scanMethod"
        >
          <template slot-scope="r">
            <span v-if="r.row.scanMethod === 0">扫描</span>
            <span v-else>拍照</span>
          </template>
        </el-table-column>
        <el-table-column
          label="详情"
          align="center"
          :show-overflow-tooltip="true"
          prop="img"
        >
          <template slot-scope="r">
            <label v-if="r.row.scanMethod == 0">-</label>
            <el-image
              v-else
              style="width: 50px; height: 50px"
              :src="r.row.img"
              :preview-src-list="[r.row.img]"
            ></el-image>
          </template>
        </el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button @click="onHide">取消</el-button>
      </div>
    </DialogCom>
  </div>
</template>
<script>
import * as api from "@/api/resumption/taskManger.js";
export default {
  data() {
    return {
      isShow: false,
      tableData: [],
    };
  },
  methods: {
    async refresh(id, orgId) {
      let detail = (
        await api.findNfcScanRecord({
          orgId: orgId,
          resumptionId: id,
        })
      ).data;
      // console.log(detail);
      if (detail) {
        this.tableData = detail;
      } else {
        this.tableData = [];
      }
    },
    async show(id, orgId) {
      await this.refresh(id, orgId);
      this.isShow = true;
    },
    onHide() {
      this.isShow = false;
    },
    reset() {
      this.tableData = [];
    },
  },
};
</script>

<style lang="scss"></style>
