<template>
  <div style="padding: 10px;">
    <a-form
      :model="queryParams"
      ref="searchForm"
      layout="inline"
      class="form-model">
      <a-form-item label="问题编号">
        <a-input v-model:value="queryParams.fileNoNumber" placeholder="问题编号或范围值(如:1-100)" allow-clear />
      </a-form-item>
      <a-form-item label="工程名称">
        <a-input v-model:value="queryParams.nm" placeholder="请输入工程名称" allow-clear />
      </a-form-item>
      <a-form-item label="问题来源">
        <a-input v-model:value="queryParams.pblmSource" placeholder="请输入问题来源" allow-clear />
      </a-form-item>
      <a-form-item label="问题印发文件名">
        <a-input v-model:value="queryParams.zgMemo" placeholder="请输入问题印发文件名" allow-clear />
      </a-form-item>
      <a-form-item label="责任处室（单位）">
        <a-select v-model:value="queryParams.dutyDept" placeholder="请选择责任处室（单位）" show-search allow-clear>
          <a-select-option v-for="(item, index) in ywcsList" :key="index" :value="item">{{ item }}</a-select-option>
        </a-select>
      </a-form-item>
      <a-form-item label="问题归类">
        <a-input v-model:value="queryParams.objType" placeholder="请输入问题归类" allow-clear />
      </a-form-item>
<!--      <a-form-item label="申诉审核状态">-->
<!--        <a-select v-model="stat" allow-clear mode="tags">-->
<!--          <a-select-option value="0">未申诉</a-select-option>-->
<!--          <a-select-option value="2">申诉成功</a-select-option>-->
<!--          <a-select-option value="3">驳回</a-select-option>-->
<!--          <a-select-option value="4002">整改单位审核人复核</a-select-option>-->
<!--          <a-select-option value="4003">市级经办人审核</a-select-option>-->
<!--          <a-select-option value="4004">市级审核人审核</a-select-option>-->
<!--          <a-select-option value="4005">监督处经办人审核</a-select-option>-->
<!--          <a-select-option value="4006">监督处审核人审核</a-select-option>-->
<!--          <a-select-option value="4007">省级业务处室经办人审核</a-select-option>-->
<!--          <a-select-option value="4008">省级业务处室审核人复核</a-select-option>-->
<!--          <a-select-option value="4010">监督处经办人复核</a-select-option>-->
<!--        </a-select>-->
<!--      </a-form-item>-->
<!--      <a-form-item label="问题归类">-->
<!--        <a-select v-model="queryParams.ptype" placeholder="请选择问题归类" allow-clear>-->
<!--          <a-select-option v-for="item in duChaTypes" :key="item.NM" :value="item.NM">{{ item.NM }}</a-select-option>-->
<!--        </a-select>-->
<!--      </a-form-item>-->
<!--      <a-form-item label="审核状态">-->
<!--        <a-select v-model="recordWorkflowStat" allow-clear mode="tags">-->
<!--          <a-select-option value="1">待我审核</a-select-option>-->
<!--          <a-select-option value="4002">整改单位审核人复核</a-select-option>-->
<!--          <a-select-option value="4003">市级经办人审核</a-select-option>-->
<!--          <a-select-option value="4004">市级审核人复核</a-select-option>-->
<!--          <a-select-option value="4005">监督处经办人初审</a-select-option>-->
<!--          <a-select-option value="4007">省级业务处室经办人审核</a-select-option>-->
<!--          <a-select-option value="4008">省级业务处室审核人复核</a-select-option>-->
<!--          <a-select-option value="4010">监督处经办人复核</a-select-option>-->
<!--          <a-select-option value="4006">监督处审核人审核</a-select-option>-->
<!--          <a-select-option value="END">申诉成功</a-select-option>-->
<!--        </a-select>-->
<!--      </a-form-item>-->
<!--      <a-form-item label="问题来源时间">-->
<!--        <a-select v-model="queryParams.pblmSourceTm" placeholder="选择问题来源时间" allow-clear>-->
<!--          <a-select-option v-for="item in DuChaYears" :key="item.value" :value="item.value">{{ item.value }}</a-select-option>-->
<!--        </a-select>-->
<!--      </a-form-item>-->
<!--      <a-form-item label="整改文号">-->
<!--        <a-input v-model="queryParams.zgWjName" placeholder="请输入整改文号" allow-clear />-->
<!--      </a-form-item>-->

<!--      <a-form-item label="整改状态">-->
<!--        <a-select-->
<!--          v-model="workflowStats"-->
<!--          placeholder="请选择整改状态"-->
<!--          mode="multiple"-->
<!--          :max-tag-count="1"-->
<!--          :filter-option="filterOption"-->
<!--          show-search-->
<!--          allow-clear>-->
<!--          <a-select-option v-for="item in rectifyProcStates" :key="item.code" :value="item.code">{{ item.name }}</a-select-option>-->
<!--        </a-select>-->
<!--      </a-form-item>-->
<!--      <a-form-item label="当前要求完成时限">-->
<!--        <a-range-picker v-model="currentRange" format="YYYY-MM-DD" value-format="YYYY-MM-DD" separator="至" allow-clear />-->
<!--      </a-form-item>-->
<!--      <a-form-item label="是否按期销号">-->
<!--        <a-select v-model="queryParams.isPdSche" placeholder="是否按期销号" allow-clear>-->
<!--          <a-select-option value="0">否</a-select-option>-->
<!--          <a-select-option value="1">是</a-select-option>-->
<!--        </a-select>-->
<!--      </a-form-item>-->
<!--      <a-form-item label="调度年份">-->
<!--        <a-date-picker-->
<!--          v-model="queryParams.schdYear"-->
<!--          :open="isOpen"-->
<!--          @change="onChange"-->
<!--          @panelChange="panelYearChange"-->
<!--          @openChange="handYearChange"-->
<!--          format="YYYY"-->
<!--          value-format="YYYY"-->
<!--          mode="year"-->
<!--          disabled-->
<!--          :editable="false"-->
<!--          :allow-clear="false"-->
<!--          placeholder="调度年份" />-->
<!--      </a-form-item>-->
      <a-button
        ref="queryButton"
        @click="queryByParams(1)"
        
        :loading="loading"
        type="primary"
        style="color:rgba(255,255,255,1);float:right;margin-right:10px;z-index: 1;">查询</a-button>
    </a-form>
<!--    <a-row type="flex" justify="space-between" style="border-top:1px solid #0014ff2e;">-->
<!--      <a-col :span="24" class="el-row-operation">-->
<!--        <a-button @click="batchBack" type="primary" :disabled="loading" size="small" style="color:rgba(255,255,255,1);float:left;margin-right:10px;">退回修改</a-button>-->
<!--        <a-button @click="batchArgee" type="primary" :disabled="loading" size="small" style="color:rgba(255,255,255,1);float:left;margin-right:10px;">同意上报</a-button>-->
<!--      </a-col>-->
<!--    </a-row>-->
    <a-table
      :columns="columns"
      :data-source="tableData"
      :loading="loading"
      ref="pblmDataTable"
      row-key="recordId"
      bordered
      style="width: 100%;"
      :style="{height: height + 'px'}"
      :scroll="{x: 'max-content', y: height - 54}"
      :pagination="false">
<!--      <template slot="isPblmDel" slot-scope="text">-->
<!--        <a-tooltip placement="topLeft">-->
<!--          <template slot="title">-->
<!--            <span v-if="text.isPblmDel == '1'">是</span>-->
<!--            <span v-if="text.isPblmDel == '0'">否</span>-->
<!--            <span v-if="text.isPblmDel == '2'">已立行立改</span>-->
<!--          </template>-->
<!--          <span v-if="text.isPblmDel == '1'">是</span>-->
<!--          <span v-if="text.isPblmDel == '0'">否</span>-->
<!--          <span v-if="text.isPblmDel == '2'">已立行立改</span>-->
<!--        </a-tooltip>-->
<!--      </template>-->
      <template #bodyCell="{ column, record }">
        <template v-if="column.dataIndex === 'action'">
          <a-button @click="getRowData(record)" type="link">查看</a-button>
        </template>
      </template>
    </a-table>
    <a-pagination
      :current="queryParams.pageNum"
      show-size-changer
      :pageSize="queryParams.pageSize"
      @update:pageSize="queryParams.pageSize = $event"
      :total="total"
      :page-size-options="['10','20','50','100']"
      :show-total="total => `共${total}条`"
      @showSizeChange="handleSizeChange"
      @change="handlePageNumChange"
      style="margin-top: 30px;"
    />

    <!-- 申诉记录 -->
    <a-modal
      title="详情查看"
      v-model:open="showAppealRecord"
      @cancel="showAppealRecord = false"
      :footer="null"
      width="90%">
      <cqsssh v-if="showAppealRecord" :msgNo="currentRow.recordId?currentRow.recordId:''" :isModel="true" @closeModel="closeModel"></cqsssh>
    </a-modal>

    <a-modal
      title="审核意见"
      v-model:open="showOpinion"
      @cancel="showOpinion = false"
      width="500px">
      <div style="display: flex; align-items: center; justify-content: center;padding: 10px;">
        <span style="width: 80px;">审核意见:</span>
        <a-input v-model:value="opinion" type="textarea" placeholder="请输入审核意见" />
      </div>
      <template #footer>
        <a-button @click="submitBatch" :loading="subLoading" type="primary">确定</a-button>
        <a-button @click="showOpinion = false">取消</a-button>
      </template>
    </a-modal>
  </div>
</template>

<script>
import moment from 'moment';
import { h } from 'vue';
import pblmDelayInfo from '@/views/PblmRectify/Components/pblmDelayInfo.vue';
import pblmDetail from '@/views/PblmRectify/Components/pblmDetail.vue';
import pblmRectifyEdit from '@/views/PblmRectify/Components/pblmRectifyEdit.vue';
import pblmRectifyInfo from '@/views/PblmRectify/Components/pblmRectifyInfo.vue';
import pblmRectifyTimeLine from '@/views/PblmRectify/Components/pblmRectifyTimeLine.vue';
import pblmRectifyTimeLineOver from '@/views/PblmRectify/Components/pblmRectifyTimeLineOver.vue';
import pblmMonthlyReport from '@/views/PblmRectifyMonthlyReport/Components/pblmMonthlyReport.vue';
import upload from '@/widgets/uploadFile.vue';
import request from '../../utils/gw_ajax_request';
import { formatDateTime, formatDateTime2 } from '../../utils/gw_date';
import {
  getDuChaYears,
  getDutyDept,
  getRectifyProcStates1,
  requestOverdueAppealList,
} from './Common/rectify_api';
import cqsssh from './Components/cqsssh.vue';
export default {
  data() {
    return {
      moment,
      stat: [],
      queryParams: {
        nm: '', // 工程名称
        pblmSourceTm: undefined, // 问题来源时间
        ptype: undefined, // 问题归类
        pblmSource: '', // 问题来源
        zgWjName: '', // 整改文号
        zgMemo: '', // 问题印发文件名
        dutyDept: undefined, // 责任处室（单位）
        isPdSche: undefined, // 是否按期销号
        // schdYear: moment(new Date().getFullYear().toString()).format('YYYY'), // 调度年份
        pageNum: 1,
        pageSize: 10,
        recordWorkflowStat: '1',
        recordStat: '',
        startTime: '',
        endTime: '',
        objType: '',
      },
      recordWorkflowStat: [],
      recordStat: [],
      total: 0,
      workflowStats: [], // 整改状态
      currentRange: [], // 当前要求完成时限
      DuChaYears: getDuChaYears(),
      duChaTypes: [],
      ywcsList: [],
      rectifyProcStates: getRectifyProcStates1(), // 整改流程所有流程状态
      isOpen: false,
      isYear: null,
      dialogFormVisible: false, // 控制导出弹窗
      loading: false,
      height: window.innerHeight - 300,
      tableData: [],
      tableHeight: 0,
      selectedRowKeys: [],
      selectedRowData: [],
      columns: [
        {
          title: '问题编码',
          dataIndex: 'fileNoNumber',
          width: 90,
          fixed: 'left',
          align: 'center',
        },
        {
          title: '问题',
          dataIndex: 'inspPblmDesc',
          width: 200,
          align: 'center',
          customRender: ({ text }) => h('span', {}, text),
          customCell: () => {
            return {
              style: {
                maxWidth: '200px',
                overflow: 'hidden',
                whiteSpace: 'nowrap',
                textOverflow: 'ellipsis',
              },
            };
          },
        },
        {
          title: '工程名称',
          dataIndex: 'nm',
          width: 100,
          align: 'center',
          customRender: ({ text }) => h('span', {}, text),
          customCell: () => {
            return {
              style: {
                maxWidth: '100px',
                overflow: 'hidden',
                whiteSpace: 'nowrap',
                textOverflow: 'ellipsis',
              },
            };
          },
        },
        // {
        //   title: '问题详情',
        //   dataIndex: 'problemDetails',
        //   width: 150,
        //   align: 'center',
        //   customRender: ({ text }) => h('span', {}, text),
        //   customCell: () => {
        //     return {
        //       style: {
        //         maxWidth: '150px',
        //         overflow: 'hidden',
        //         whiteSpace: 'nowrap',
        //         textOverflow: 'ellipsis'
        //       }
        //     }
        //   }
        // },
        {
          title: '问题来源',
          dataIndex: 'pblmSource',
          width: 180,
          align: 'center',
          customRender: ({ text }) => h('span', {}, text),
          customCell: () => {
            return {
              style: {
                maxWidth: '180px',
                overflow: 'hidden',
                whiteSpace: 'nowrap',
                textOverflow: 'ellipsis',
              },
            };
          },
        },
        {
          title: '问题印发文件名',
          dataIndex: 'zgMemo',
          width: 200,
          align: 'center',
          customRender: ({ text }) => h('span', {}, text),
          customCell: () => {
            return {
              style: {
                maxWidth: '200px',
                overflow: 'hidden',
                whiteSpace: 'nowrap',
                textOverflow: 'ellipsis',
              },
            };
          },
        },
        {
          title: '县（市、区）',
          dataIndex: 'adName',
          width: 120,
          align: 'center',
        },
        {
          title: '设区市/直管县',
          dataIndex: 'upAdName',
          width: 130,
          align: 'center',
        },
        {
          title: '责任处室',
          dataIndex: 'dutyDept',
          width: 200,
          align: 'center',
        },
        {
          title: '问题归类',
          dataIndex: 'objType',
          width: 200,
          align: 'center',
        },
        {
          title: '超期整改记录',
          dataIndex: 'recordNotes',
          width: 200,
          align: 'center',
          customRender: ({ text }) => h('span', {}, text),
          customCell: () => {
            return {
              style: {
                maxWidth: '200px',
                overflow: 'hidden',
                whiteSpace: 'nowrap',
                textOverflow: 'ellipsis',
              },
            };
          },
        },
        {
          title: '申诉审核状态',
          dataIndex: 'reviewStatus',
          width: 200,
          align: 'center',
        },
        {
          title: '审核日期',
          dataIndex: 'reviewTm',
          width: 200,
          align: 'center',
        },
        // {
        //   title: '问题印发文号',
        //   dataIndex: 'zgWjName',
        //   width: 120,
        //   align: 'center',
        //   customRender: ({ text }) => h('span', {}, text),
        //   customCell: () => {
        //     return {
        //       style: {
        //         maxWidth: '120px',
        //         overflow: 'hidden',
        //         whiteSpace: 'nowrap',
        //         textOverflow: 'ellipsis'
        //       }
        //     }
        //   }
        // },
        // {
        //   title: '问题是否已销号',
        //   scopedSlots: { customRender: 'isPblmDel' },
        //   width: 140,
        //   align: 'center',
        //   customCell: () => {
        //     return {
        //       style: {
        //         maxWidth: '140px',
        //         overflow: 'hidden',
        //         whiteSpace: 'nowrap',
        //         textOverflow: 'ellipsis'
        //       }
        //     }
        //   }
        // },
        // {
        //   title: '整改要求',
        //   dataIndex: 'pblmSggtn',
        //   width: 100,
        //   align: 'center',
        //   customRender: ({ text }) => h('span', {}, text),
        //   customCell: () => {
        //     return {
        //       style: {
        //         maxWidth: '100px',
        //         overflow: 'hidden',
        //         whiteSpace: 'nowrap',
        //         textOverflow: 'ellipsis'
        //       }
        //     }
        //   }
        // },
        // {
        //   title: '年度初始整改时限',
        //   dataIndex: 'nlZgDate',
        //   width: 150,
        //   align: 'center',
        //   customRender: ({ text }) => h('span', {}, text),
        //   customCell: () => {
        //     return {
        //       style: {
        //         maxWidth: '150px',
        //         overflow: 'hidden',
        //         whiteSpace: 'nowrap',
        //         textOverflow: 'ellipsis'
        //       }
        //     }
        //   }
        // },
        // {
        //   title: '当前要求整改完成时限',
        //   dataIndex: 'zgDate',
        //   width: 200,
        //   align: 'center',
        //   customRender: ({ text }) => h('span', {}, text),
        //   customCell: () => {
        //     return {
        //       style: {
        //         maxWidth: '200px',
        //         overflow: 'hidden',
        //         whiteSpace: 'nowrap',
        //         textOverflow: 'ellipsis'
        //       }
        //     }
        //   }
        // },
        // {
        //   title: '超期次数',
        //   dataIndex: 'totalNum',
        //   width: 100,
        //   align: 'center',
        //   customRender: ({ text }) => h('span', {}, text),
        //   customCell: () => {
        //     return {
        //       style: {
        //         maxWidth: '100px',
        //         overflow: 'hidden',
        //         whiteSpace: 'nowrap',
        //         textOverflow: 'ellipsis'
        //       }
        //     }
        //   }
        // },
        {
          title: '操作',
          dataIndex: 'action',
          width: 100,
          fixed: 'right',
          align: 'center',
        },
      ],
      showAppealRecord: false,
      appealRecordData: null,
      appealRecordLine: [],
      appealContent: '',
      gwComFiles: [],
      currentRow: {},
      btnLoading: false,
      opinionNote: '', // 审核意见
      showOpinion: false,
      opinion: '',
      subLoading: false,
      isAgree: 0,
    };
  },
  components: {
    cqsssh,
  },
  created() {
    this.getDuChaTypes();
    this.getDutyDept();
    this.queryByParams(1);
  },
  // mounted () {
  //   // 浏览器自适应
  //   this.tableHeight = window.innerHeight - 300
  //   window.addEventListener('resize', () => {
  //     return (() => {
  //       this.tableHeight = window.innerHeight - 300
  //     })()
  //   })
  // },
  methods: {
    closeModel() {
      this.showAppealRecord = false;
      this.queryByParams(1);
    },
    // 问题归类
    getDuChaTypes() {
      request.get('/dc/insp/pblm/getListType').then((res) => {
        if (res.success) {
          this.duChaTypes = res.data;
        }
      });
    },
    getDutyDept() {
      getDutyDept().then((res) => {
        this.ywcsList = res.data;
      });
    },
    onChange() {
      this.isOpen = false;
      this.isYear = null;
    },
    handYearChange(open) {
      if (open) {
        this.isOpen = true;
      } else {
        this.isOpen = false;
      }
    },
    panelYearChange(value) {
      this.queryParams.schdYear = moment(value).format('YYYY');
      this.isYear = moment(value).format('YYYY');
      this.isOpen = false;
    },
    filterOption(input, option) {
      return (
        option.componentOptions.children[0].text
          .toLowerCase()
          .indexOf(input.toLowerCase()) >= 0
      );
    },
    isNumber(val) {
      var regPos = /^[+]{0,1}(\d+)$/; // 非负浮点数
      if (regPos.test(val)) {
        return true;
      } else {
        return false;
      }
    },
    queryByParams(pageNum) {
      this.clearSelectData();
      // this.recordWorkflowStat = []
      // this.recordStat = []
      // if(this.stat && this.stat.length>0){
      //   this.stat.forEach((item,index)=>{
      //      if(item.includes("4")){
      //        this.recordWorkflowStat.push(item)
      //      }else{
      //        this.recordStat.push(item)
      //      }
      //   })
      // }
      // this.queryParams.recordWorkflowStat = this.recordWorkflowStat.join(",")
      // this.queryParams.recordStat = this.recordStat.join(",")
      // if(this.recordWorkflowStat && this.recordWorkflowStat.length>0){
      //   this.queryParams.recordWorkflowStat = this.recordWorkflowStat.join(",")
      // }

      if (this.queryParams.fileNoNumber) {
        if (this.queryParams.fileNoNumber.indexOf('-') > -1) {
          var numList = this.queryParams.fileNoNumber.split('-');
          if (
            ((!numList[0] || !numList[1]) && numList.length != 2) ||
            !this.isNumber(numList[0]) ||
            !this.isNumber(numList[1])
          ) {
            this.$message.warning('请输入正确的编号范围！');
            return;
          }
        }
      }
      // this.queryParams.startTime = this.currentRange[0] ? this.currentRange[0] + ' 00:00:00' : ''
      // this.queryParams.endTime = this.currentRange[1] ? this.currentRange[1] + ' 23:59:59' : ''
      // this.queryParams.workflowStat = this.workflowStats.join(',')
      this.queryParams.pageNum = pageNum;
      this.loading = true;
      requestOverdueAppealList(this.queryParams).then((res) => {
        this.loading = false;
        if (res.data !== null) {
          if (res.data && res.data.list.length > 0) {
            res.data.list.forEach((item) => {
              item.reviewTm = formatDateTime2(item.reviewTm);
            });
          }
          this.tableData = res.data.list;
          this.total = res.data.total;
        } else {
          this.tableData = [];
          this.total = 0;
        }
      });
    },
    handleSelectionChange(val, row) {
      this.selectedRowKeys = val;
      this.selectedRowData = row;
    },
    handleSizeChange(current, size) {
      this.queryParams.pageSize = size;
      this.queryByParams(1);
    },
    handlePageNumChange(item) {
      this.queryParams.pageNum = item;
      this.queryByParams(item);
    },
    getRowData(row) {
      this.currentRow = row;
      this.opinionNote = '';
      this.appealRecord(row.recordId);
    },
    appealRecord(id) {
      this.showAppealRecord = true;
      this.appealRecordData = null;
      this.appealRecordLine = [];
      this.gwComFiles = [];
      const params = {
        id,
      };
      request
        .post(`/bis/insp/BisInspZgPblmRecord/getAuditListInfo`, params)
        .then((res) => {
          if (res.success) {
            this.appealRecordData = res.data;
            res.data.adjustAudits.forEach((item) => {
              if (item.opStatus !== '正在进行中') {
                this.appealRecordLine.push({
                  id: item.id,
                  timestamp: formatDateTime2(item.intm),
                  type: 'check-circle',
                  color: '#0bbd87',
                  workflowStatName: item.workflowStatName,
                  content: `${item.auditPersName} - ${item.opStatus} - ${item.adjustRcord}`,
                });
              } else {
                this.appealRecordLine.push({
                  timestamp: formatDateTime(new Date()),
                  type: 'ellipsis',
                  workflowStatName: item.workflowStatName,
                  content: '正在进行中',
                });
              }
            });
            this.appealContent = res.data.appealContent || '';
            this.gwComFiles = res.data.gwComFiles;
          } else {
            this.$message.warning(res.message);
          }
        });
    },
    clearSelectData() {
      this.selectedRowKeys = [];
      this.selectedRowData = [];
    },
    // 同意申诉
    agreeAppeal() {
      const params = {
        id: this.appealRecordData.id,
        isAgree: 1,
        opinionNote: this.opinionNote,
      };
      if (this.opinionNote == '') {
        params.opinionNote = '同意';
      }
      this.btnLoading = true;
      request
        .post(`/bis/insp/BisInspZgPblmRecord/auditAppeal`, params)
        .then((res) => {
          this.btnLoading = false;
          if (res.success) {
            this.$message.success('同意申诉成功!');
            this.showAppealRecord = false;
            this.queryByParams(1);
          } else {
            this.$message.error(res.message);
          }
        });
    },
    backAppeal() {
      this.$confirm({
        title: '提示',
        content: '确认退回吗?',
        okType: 'warning',
        onOk: () => {
          this.btnLoading = true;
          const params = {
            id: this.appealRecordData.id,
            isAgree: 0,
            opinionNote: this.opinionNote,
          };
          if (this.opinionNote == '') {
            params.opinionNote = '不同意';
          }
          request
            .post(`/bis/insp/BisInspZgPblmRecord/auditAppeal`, params)
            .then((res) => {
              this.btnLoading = false;
              if (res.success) {
                this.$message.success('退回成功!');
                this.showAppealRecord = false;
                this.queryByParams(1);
              } else {
                this.$message.error(res.message);
              }
            });
        },
      });
    },
    closeChannel(val) {
      this.btnLoading = true;
      const params = {
        id: this.appealRecordData.id,
      };
      request
        .post(`/bis/insp/BisInspZgPblmRecord/openOrCloseChannel`, params)
        .then((res) => {
          this.btnLoading = false;
          if (res.success) {
            this.$message.success(val == '0' ? '关闭成功!' : '开启成功!');
            this.showAppealRecord = false;
            this.queryByParams(1);
          } else {
            this.$message.error(res.message);
          }
        });
    },
    getCheckboxProps(row) {
      return {
        props: {
          disabled: !row.reviewButton,
        },
      };
    },
    // 下载
    downloadFile(downloadFiles, fileName) {
      request
        .get(`file/downFile/` + downloadFiles, { responseType: 'arraybuffer' })
        .then((res) => {
          const blob = new Blob([res], { type: 'application/vnd.ms-excel' });
          const objectUrl = URL.createObjectURL(blob);
          // window.location.href = objectUrl;
          const link = document.createElement('a');
          link.href = objectUrl;
          link.download = fileName; // 文件名
          link.click(); // 下载文件
          URL.revokeObjectURL(objectUrl); // 释放内存
        });
    },
    batchBack() {
      if (this.selectedRowKeys.length == 0) {
        return this.$message.error('请选择需要退回的内容.');
      }
      this.isAgree = 0;
      this.showOpinion = true;
    },
    batchArgee() {
      if (this.selectedRowKeys.length == 0) {
        return this.$message.error('请选择需要提交的内容.');
      }
      this.isAgree = 1;
      this.showOpinion = true;
    },
    submitBatch() {
      this.subLoading = true;
      let opinionNote = '';
      const data = [];
      if (this.opinion == '') {
        if (this.isAgree == 0) {
          opinionNote = '不同意';
        } else {
          opinionNote = '同意';
        }
      } else {
        opinionNote = this.opinion;
      }
      this.selectedRowData.forEach((item) => {
        const obj = {
          id: item.recordId,
          isAgree: this.isAgree,
          opinionNote,
        };
        data.push(obj);
      });
      request
        .post(`/bis/insp/BisInspZgPblmRecord/batch/auditAppeal`, data)
        .then((res) => {
          this.subLoading = false;
          this.showOpinion = false;
          this.opinion = '';
          if (res.success) {
            this.queryByParams(1);
            this.$message.success('操作成功!');
          } else {
            this.$message.error(res.message);
          }
        });
    },
  },
};
</script>

<style lang='less' scoped>
.form-model /deep/ .ant-form-item {
  width: 18%;
}
/deep/ .ant-table-scroll {
  position: relative;
  z-index: 1;
}

/deep/.ant-table-fixed-left,
/deep/ .ant-table-fixed-right {
  z-index: 2;
}
</style>
