<template>
  <div id="">
    <a-table
      ref="MonthlyReportHistoryTable"
      :data-source="monthlyReportHistory"
      :columns="columns"
      style="width: 100%;height: 500px;"
      :loading="loading"
      :rowKey="rowKey"
      :pagination="false"
      border>
      <span slot="intm" slot-scope="text">
        <span :class="formatDeadLineDate(formatDateTime(text.intm)).class" style="">
          <!-- {{ formatDeadLineDate(formatDateTime(text.inTm)).value.substr(0,10) }} -->
          {{ text.intm ? text.intm.substr(0, 10) : '' }}
        </span>
      </span>
      <span slot="ym" slot-scope="text">
        <span :class="formatDeadLineDate(formatDateTime(text.ym)).class" style="">
          <!-- {{ formatDeadLineDate(formatDateTime(text.ym)).value.substr(0,7) }} -->
          {{ text.ym ? text.ym.substr(0, 7) : '' }}
        </span>
      </span>
    </a-table>
  </div>
</template>

<script>
import request from '../../../utils/gw_ajax_request';
import { formatDateTime2 } from '../../../utils/gw_date';
import {
  distributePblmToSjdw,
  formatWorkflowStat,
  savePblmRectifyInfo,
} from '../../PblmRectify/Common/rectify_api';
import { formatDeadLineDate } from '../../PblmRectify/Common/rectify_date';
export default {
  props: {
    pblmId: {
      type: String,
      default: '',
    },
    currentPblmFileNoNumber: {
      type: String,
      default: '',
    },
  },
  data() {
    return {
      monthlyReportHistory: [],
      loading: false,
      columns: [
        {
          title: '进度上报日期',
          dataIndex: 'intm',
          align: 'center',
          ellipsis: true,
        },
        {
          title: '月报时间',
          dataIndex: 'ym',
          align: 'center',
          ellipsis: true,
        },
        {
          title: '进度上报人',
          dataIndex: 'persName',
          align: 'center',
          ellipsis: true,
        },
        {
          title: '整改工作进展情况',
          dataIndex: 'zgContent',
          align: 'center',
          ellipsis: true,
        },
        {
          title: '预计完成日期',
          dataIndex: 'expectedZgDate',
          align: 'center',
          ellipsis: true,
        },
      ],
      rowKey: 'id',
    };
  },
  computed: {
    formatDateTime() {
      return formatDateTime2;
    },
    formatDeadLineDate() {
      return formatDeadLineDate;
    },
    formatWorkflowStat() {
      return formatWorkflowStat;
    },
  },
  created() {
    this.getApprovalHistory();
  },
  methods: {
    async getApprovalHistory() {
      this.loading = true;
      const data = {
        id: this.pblmId,
        fileNoNumber: this.currentPblmFileNoNumber,
      };
      // console.log("问题ID" + this.bisInspPblmAudit.pblmId);
      await request.post('/dc/insp/pblm/getBisInspPblmZg', data).then((res) => {
        this.loading = false;
        this.monthlyReportHistory = res.data.list;
        this.monthlyReportHistory.forEach((item) => {
          if (item.id) {
            this.rowKey = 'id';
          } else {
            this.rowKey = 'pblmId';
          }
        });
      });
    },
  },
};
</script>

<style lang='less' scoped>

</style>
