<template>
  <div>
    <a-card>
      <div :class="[$style.btns]">
        <audit-advanced-export
          ref="exportData"
          :class-style="[$style.buttonSpacing]"
          :v-if="true"
          :config-id="111"
          :expressions="exportExpressions"
          :exclebxh="false"
        ></audit-advanced-export>
      </div>
      <!-- 高级搜索组件 -->
      <audit-advanced-query
        :class="$style.advancedQuery"
        :expand="expand"
        :search-data="formData"
        :ref-name="searchform"
        :search-style="{ height: '210px', left: '20px', top: '60px' }"
        :search-fun="handleSearch"
        @searchedClick="searchedClick"
        @resetForm="resetForm"
      >
        <template>
          <a-row>
            <a-col :span="8">
              <a-form-model-item :label="'审计发现标题'" prop="findTitle">
                <a-input v-model="formData.findTitle" allow-clear />
              </a-form-model-item>
            </a-col>
            <a-col :span="8">
              <a-form-model-item :label="'项目名称'" prop="projectName">
                <a-input v-model="formData.projectName" allow-clear />
              </a-form-model-item>
            </a-col>
            <a-col :span="8">
              <a-form-model-item :label="'整改责任主体'" prop="auditedUnit">
                <sd-group-picker
                  ref="unitSelect"
                  v-model="formData.auditedUnit"
                  :single="true"
                  :read-only="false"
                  @change="changeunit"
                />
              </a-form-model-item>
            </a-col>
          </a-row>
          <a-row>
            <a-col :span="8">
              <a-form-model-item :label="'整改状态'" prop="rectStatus">
                <sd-select
                  v-model="formData.rectStatus"
                  :allow-clear="true"
                  :options="StatusOptions"
                />
              </a-form-model-item>
            </a-col>
            <a-col :span="8">
              <a-form-model-item :label="'是否属于审计意见书问题'" prop="giveOpinion">
                <sd-select
                  v-model="formData.giveOpinion"
                  :allow-clear="true"
                  :options="giveOpinions"
                />
              </a-form-model-item>
            </a-col>
            <a-col :span="8">
              <a-form-model-item :label="'问题性质'" prop="problemNature">
                <sd-select
                  v-model="formData.problemNature"
                  :allow-clear="true"
                  :options="problemNatureOpinions"
                />
              </a-form-model-item>
            </a-col>
            <!-- <a-col :span="8">
              <div :class="$style.buttonContent">
                <a-button :loading="exportLoading" type="primary" @click="exportQuestion"
                  >导出审计整改台账</a-button
                >
              </div>
            </a-col> -->
          </a-row>
          <a-row>
            <a-col :span="8">
              <a-form-model-item :label="'整改类型'" prop="rectType">
                <sd-select
                  v-model="formData.rectType"
                  :allow-clear="true"
                  :options="rectTypeOpinions"
                />
              </a-form-model-item>
            </a-col>
            <a-col :span="8">
              <a-form-model-item :label="'销\u2002号\u2002状\u2002态\u2002'" prop="cancellStatus">
                <sd-select
                  v-model="formData.cancellStatus"
                  :allow-clear="true"
                  :options="cancellStatusOptions"
                />
              </a-form-model-item>
            </a-col>
            <a-col :span="8">
              <a-form-model-item label="项目年份" prop="planYear">
                <a-date-picker
                  v-model="formData.planYear"
                  mode="year"
                  picker="YYYY"
                  format="YYYY"
                  :allow-clear="false"
                  placeholder="选择年度"
                  :input-read-only="true"
                  :value="year"
                  :open="endOpen"
                  @panelChange="yearChange"
                  @openChange="handleEndOpenChange"
                ></a-date-picker>
              </a-form-model-item>
            </a-col>
          </a-row>
          <!-- <a-row>
            <a-col :span="12" class="recitifyrectstatus">
              <a-form-model-item :label="'确认状态'" prop="confirmStatus">
                <sd-select
                  v-model="formData.confirmStatus"
                  :allow-clear="true"
                  :options="confirmStatusOptions"
                />
              </a-form-model-item>
            </a-col>
          </a-row> -->
        </template>
      </audit-advanced-query>

      <sd-data-table-ex
        ref="WTQDDataTable"
        :projectlist="true"
        :filter-expressions="expressions"
        :columns="columns"
        :actions="actions"
        form-id="iamrectifyquestion"
        data-url="api/xcoa-mobile/v1/iamrectifyquestion/all-list"
        :search-fields="[
          'findTitle',
          'projectName',
          'auditedUnitName',
          'rectStatus',
          // 'confirmStatus',
        ]"
        show-selection
        :show-advance-query="true"
        :process-req="processReq"
        @searchbtnClick="searchbtnClick"
      >
        <div slot="isLink" slot-scope="text, record">
          <a @click="isViewBtn(record)">{{ text }}</a>
        </div>
      </sd-data-table-ex>
    </a-card>
  </div>
</template>

<script>
import { message, Modal } from 'ant-design-vue'
import moment from 'moment'
import { getUserInfo } from '@/common/store-mixin'
import axios from '@/common/services/axios-instance'
import TableColumnTypes from '@/common/services/table-column-types'
import crossWindowWatcher from '@/common/services/cross-window-watcher'
import auditAdvancedQueryMixins from '../../components/audit-advanced-query-mixins'
import auditAdvancedGroupMixins from '../../components/audit-advanced-group-mixins'
import auditAdvancedQuery from '../../components/audit-advanced-query.vue'
import auditAdvancedExport from '../../components/audit-advanced-export'
import components from './_import-components/audit-question-list-import'
import download from '@/common/services/download'

export default {
  name: 'AuditQuestionList',
  metaInfo: {
    title: '整改问题清单列表',
  },
  components: {
    ...components,
    auditAdvancedQuery,
    auditAdvancedExport,
  },
  mixins: [auditAdvancedQueryMixins, auditAdvancedGroupMixins],
  data() {
    return {
      endOpen: false,
      year: null,
      expand: false,
      searchform: 'searchform',
      expressions: [],
      exportExpressions: [],
      formData: {
        projectName: '',
        findTtile: '',
        auditedUnit: '',
        rectStatus: '',
        giveOpinion: '',
        rectType: '',
        cancellStatus: '',
        endType: '',
        problemNature: '',
        planYear: '',
        //  confirmStatus: '',
      },
      columns: [
        {
          title: '序号',
          dataIndex: 'sortNumber',
          width: '80px',
          customRender: (text, record, index) => `${index + 1}`,
        },
        {
          title: 'id',
          dataIndex: 'id',
          sdHidden: true,
        },
        {
          title: 'questionId',
          dataIndex: 'questionId',
          sdHidden: true,
        },
        {
          title: '问题名称（定性描述）',
          dataIndex: 'findTitle',
          width: '300px',
          scopedSlots: { customRender: 'isLink' },
        },

        {
          title: '问题编号',
          dataIndex: 'findCode',
          defaultSortOrder: 'descend',
          sorter: true,
          sortDirections: ['ascend', 'descend'],
          width: '200px',
        },
        {
          title: '审计依据',
          dataIndex: 'iamBasis',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '项目名称',
          dataIndex: 'projectName',
          sorter: true,
          sortDirections: ['ascend', 'descend'],
          width: '380px',
        },
        {
          title: '整改要求',
          dataIndex: 'requirement',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '问题性质',
          dataIndex: 'problemNatureStr',
          width: '100px',
        },
        {
          title: '是否属于审计意见书问题',
          dataIndex: 'giveOpinion',
          width: '200px',
        },
        {
          title: '审计处理意见',
          dataIndex: 'handleSuggestion',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '整改责任主体',
          dataIndex: 'auditedUnitName',
          width: '220px',
        },
        {
          title: '计划完成日期',
          dataIndex: 'draftFinishDate',
          sdRender: TableColumnTypes.date,
          width: '170px',
        },
        {
          title: '整改状态',
          dataIndex: 'rectStatus',
          sorter: true,
          sortDirections: ['ascend', 'descend'],
          width: '100px',
        },
        {
          title: '是否超期未整改',
          dataIndex: 'isTrue',
          width: '150px',
          sdHidden: true,
        },
        {
          title: '整改完成日期',
          dataIndex: 'finishDate',
          sdRender: TableColumnTypes.date,
          width: '170px',
        },
        {
          title: '销号状态',
          dataIndex: 'cancellStatus',
          width: '150px',
        },
        // {
        //   title: '确认状态',
        //   dataIndex: 'confirmStatus',
        //   width: '100px',
        //   sdHidden: true,
        // },
        {
          title: '结束/发布标记（流程是否结束）',
          dataIndex: 'endType',
          width: '100px',
          sdHidden: true,
        },

        {
          title: '流程实例id',
          dataIndex: 'instId',
          width: '100px',
          sdHidden: true,
        },
        {
          dataIndex: 'auditedContactsAccount',
          sdHidden: true,
        },
        // {
        //   title: '审计发现问题整改（金额类）（万元）',
        //   children: [
        {
          title: '调整会计账目',
          dataIndex: 'adjustAccounts',
          width: '200px',
          sdCandidate: true,
        },
        {
          title: '收回资金：增加收入数额',
          dataIndex: 'recoveryFunds',
          width: '250px',
          sdCandidate: true,
        },
        {
          title: '收回资金：督促清理往来款项收回资金',
          dataIndex: 'avoidingWasteAmount',
          width: '350px',
          sdCandidate: true,
        },
        {
          title: '收回资金：其他',
          dataIndex: 'reduceInvestmentAmount',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '挽回损失：节约成本费用（开支）数额',
          dataIndex: 'costSavingAmount',
          width: '350px',
          sdCandidate: true,
        },
        {
          title: '挽回损失：工程审减金额',
          dataIndex: 'engineeringReduction',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '挽回损失：清退不当得利',
          dataIndex: 'improperClearanceAmount',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '挽回损失：其他',
          dataIndex: 'recoveryLossAmount',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '归还原资金渠道',
          dataIndex: 'repaymentChannels',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '补缴税费',
          dataIndex: 'paymentTaxesFees',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '其他',
          dataIndex: 'otherAmount',
          width: '220px',
          sdCandidate: true,
        },
        //   ],
        // },
        // {
        //   title: '审计发现问题整改（非金额类）（个）',
        //   children: [
        {
          title: '新建制度、流程、标准（项）',
          dataIndex: 'newItems',
          width: '300px',
          sdCandidate: true,
        },

        {
          title: '修订制度、流程、标准（项）',
          dataIndex: 'reviseItems',
          width: '300px',
          sdCandidate: true,
        },
        //   ],
        // },
        // {
        //   title: '追责问责处理情况',
        //   children: [
        {
          title: '移送纪检监察部门案件线索（件）',
          dataIndex: 'transferMonitorClue',
          width: '300px',
          sdCandidate: true,
        },
        {
          title: '追责问责人次',
          dataIndex: 'personNum',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '组织处理：批评教育',
          dataIndex: 'dealWayOne',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '组织处理：责令书面检查',
          dataIndex: 'dealWayTwo',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '组织处理：通报批评',
          dataIndex: 'dealWayThree',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '组织处理：诫勉',
          dataIndex: 'dealWayFour',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '组织处理：停职',
          dataIndex: 'dealWayFive',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '组织处理：调离工作岗位',
          dataIndex: 'dealWaySix',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '组织处理：降职',
          dataIndex: 'dealWaySeven',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '组织处理：改任非领导职务',
          dataIndex: 'dealWayEight',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '组织处理：责令辞职',
          dataIndex: 'dealWayNine',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '组织处理：免职',
          dataIndex: 'dealWayTen',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '扣减薪酬',
          dataIndex: 'dealWayEleven',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '禁入限制',
          dataIndex: 'dealWayTwelve',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '经济处罚金额（万元）',
          dataIndex: 'amountSum',
          width: '220px',
          sdCandidate: true,
        },
        //   ],
        // },
        // {
        //   title: '根据审计建议给予党纪、政务和内部纪律处分',
        //   children: [
        {
          title: '合计',
          dataIndex: 'mentNum',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '党纪处分：警告',
          dataIndex: 'dealMannerOne',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '党纪处分：严重警告',
          dataIndex: 'dealMannerTwo',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '党纪处分：撤销党内职务',
          dataIndex: 'dealMannerThree',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '党纪处分：留党察看',
          dataIndex: 'dealMannerFour',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '党纪处分：开除党籍',
          dataIndex: 'dealMannerFive',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '政务处分：警告',
          dataIndex: 'dealMannerSix',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '政务处分：记过',
          dataIndex: 'dealMannerSeven',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '政务处分：记大过',
          dataIndex: 'dealMannerEight',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '政务处分：降级',
          dataIndex: 'dealMannerNine',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '政务处分：撤职',
          dataIndex: 'dealMannerTen',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '政务处分：开除',
          dataIndex: 'dealMannerEleven',
          width: '220px',
          sdCandidate: true,
        },
        {
          title: '内部纪律处分',
          dataIndex: 'dealMannerTwelve',
          width: '220px',
          sdCandidate: true,
        },
        //   ],
        // },
        {
          title: '向司法机关移送或报告案件线索',
          dataIndex: 'accountability',
          width: '300px',
          sdCandidate: true,
        },
        {
          title: '其中：涉案人员',
          dataIndex: 'otherItems',
          width: '300px',
          sdCandidate: true,
        },
        {
          title: '操作',
          dataIndex: 'opt',
          aligen: 'center',
          customRender: (text, record, index) => {
            // if (record.rectStatus !== '已整改' && record.rectStatus !== '风险接受') {
            //   // if (record.endType === '5' && record.problemNature === 'wt') {
            //   return (
            //     <span>
            //       <a vOn:click={(evt) => this.delayApply(record)}>延期申请</a>
            //     </span>
            //   )
            // }

            if (
              record.endType === '5' &&
              record.problemNature === 'wt' &&
              record.auditedContactsAccount === getUserInfo().account
            ) {
              return (
                <span>
                  <a vOn:click={(evt) => this.questionReboot(record)}>问题重启</a>
                </span>
              )
            }
          },
          width: '100px',
        },
      ],
      actions: [
        {
          label: '导出',
          permission: null, // 纯前端操作，不需要权限控制
          callback: () => {
            this.$refs.exportData.exportdata()
          },
        },
        {
          label: '批量导出附件',
          id: 'exportdataFiles',
          permission: null, // 纯前端操作，不需要权限控制
          callback: this.exportdataFiles,
        },
        // {
        //   label: '导出审计整改台账',
        //   sdHidden: true,
        //   id: 'exportQuestion',
        //   permission: null, // 纯前端操作，不需要权限控制
        //   callback: this.exportQuestion,
        // },
        // {
        //   label: '导出审计情况统计',
        //   permission: null, // 纯前端操作，不需要权限控制
        //   callback: this.exportSituationStatistics,
        // },
        // {
        //   label: '导出项目整改完成情况',
        //   permission: null, // 纯前端操作，不需要权限控制
        //   callback: this.exportResultStatistics,
        // },
        // {
        //   label: '导出审计机构基本情况',
        //   permission: null, // 纯前端操作，不需要权限控制
        //   callback: this.exportOne,
        // },
        // {
        //   label: '导出业务审计情况',
        //   permission: null, // 纯前端操作，不需要权限控制
        //   callback: this.exportTwo,
        // },
        // {
        //   label: '导出国资委报表',
        //   permission: null, // 纯前端操作，不需要权限控制
        //   callback: this.exportThree,
        // },
      ],
      //  typeId: null;
      advSearchForm: {
        projectName: '',
        findTtile: '',
        auditedUnit: '',
        rectStatus: [],
        giveOpinion: [],
        problemNature: [],
        rectType: [],
        cancellStatus: [],
        planYear: '',
        // confirmStatus: [],
      },
      unitName: '',
      StatusOptions: [],
      giveOpinions: [],
      problemNatureOpinions: [],
      rectTypeOpinions: [],
      cancellStatusOptions: [],
      confirmStatusOptions: [],
    }
  },
  mounted() {
    // 初始化数据字典信息
    this.initDictionaryInfo()
  },
  methods: {
    yearChange(value) {
      this.year = value
      this.formData.planYear = value.format('YYYY')
      if (document.getElementsByClassName('ant-calendar-picker-container').length > 0) {
        document.getElementsByClassName('ant-calendar-picker-container')[0].style.display = 'none'
      }
    },
    handleEndOpenChange(open) {
      this.endOpen = open
    },
    initDictionaryInfo() {
      axios({
        url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=RECT_STATUS',
        method: 'get',
      }).then((res) => {
        this.StatusOptions = res.data.map((val) => {
          return {
            id: val.id,
            name: val.name,
          }
        })
      })
      // 是否属于审计意见书问题
      axios({
        url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=WHETHER',
        method: 'get',
      }).then((res) => {
        this.giveOpinions = res.data.map((val) => {
          return {
            id: val.id,
            name: val.name,
          }
        })
      })
      // 问题性质
      axios({
        url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=IAM_PROBLEM_NATURE',
        method: 'get',
      }).then((res) => {
        this.problemNatureOpinions = res.data.map((val) => {
          return {
            id: val.id,
            name: val.name,
          }
        })
      })
      // 整改类型
      axios({
        url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=RECT_TYPE',
        method: 'get',
      }).then((res) => {
        this.rectTypeOpinions = res.data.map((val) => {
          return {
            id: val.id,
            name: val.name,
          }
        })
      })
      axios({
        url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=CANCELL_STATUS',
        method: 'get',
      }).then((res) => {
        if (res.status === 200) {
          this.cancellStatusOptions = res.data
        }
      })
      // axios({
      //   url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=CONFIRMS_STATUS',
      //   method: 'get',
      // }).then((res) => {
      //   this.confirmStatusOptions = res.data.map((val) => {
      //     return {
      //       id: val.id,
      //       name: val.name,
      //     }
      //   })
      // })
    },
    changeunit(values) {
      this.unitName = ''
      values.forEach((element) => {
        this.unitName = element.name
      })
    },
    // 查看
    isViewBtn(record) {
      // const url = '/audit-question-form?record=' + record.questionId // 新页面要打开的路由地址
      // crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
      //   if (refreshFlag) {
      //     this.refresh()
      //   }
      // })
      window.open('#/sd-webflow/done-pages/' + record.instId)
    },
    // 延期申请(旧 无流程)
    // delayApply(record) {
    //   const url = '/audit-delay-form?record=' + record.questionId // 新页面要打开的路由地址
    //   crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
    //     if (refreshFlag) {
    //       this.refresh()
    //     }
    //   })
    // },

    delayApply(record) {
      axios({
        url:
          `api/xcoa-mobile/v1/spicRectifyQuestionDelay/enable-status?rectFeedbackId=` +
          record.questionId,
        method: 'get',
      }).then((res) => {
        if (res.data) {
          Modal.info({
            content: '延期申请未结束',
          })
        } else {
          const url = `/sd-flow-guide?code=SPIC_RECT_DELAY&rectFeedbackId=${record.questionId}`
          crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
            if (refreshFlag) {
              this.refresh()
            }
          })
        }
      })
    },

    // 问题重启
    questionReboot(record) {
      axios({
        url: 'api/xcoa-mobile/v1/spic-common/restart-feedback?id=' + record.questionId,
        method: 'get',
      }).then((res) => {
        if (res.data) {
          Modal.info({
            title: '提示',
            content: '重启成功!',
          })
          this.refresh()
        } else {
          Modal.warning({
            title: '提示',
            content: '重启失败，请联系管理员!',
          })
        }
      })
    },

    refresh() {
      return this.$refs.WTQDDataTable.refresh(true)
    },
    // 查询
    handleSearch() {
      this.expressions = []

      // 审计发现标题
      if (this.formData.findTitle) {
        this.expressions.push({
          dataType: 'str',
          name: 'findTitle',
          op: 'like',
          stringValue: `%${this.formData.findTitle}%`,
        })
      }

      // 整改责任主体
      if (this.formData.auditedUnit) {
        this.expressions.push({
          dataType: 'str',
          name: 'auditedUnitName',
          op: 'like',
          stringValue: `%${this.unitName}%`,
        })
      }

      // 项目名称
      if (this.formData.projectName) {
        this.expressions.push({
          dataType: 'str',
          name: 'projectName',
          op: 'like',
          stringValue: `%${this.formData.projectName}%`,
        })
      }

      // 整改状态
      if (this.formData.rectStatus.length > 0) {
        this.expressions.push({
          dataType: 'str',
          name: 'rectStatus',
          op: 'like',
          stringValue: `%${this.formData.rectStatus[0].id}%`,
        })
      }

      // 是否属于审计意见书问题
      if (this.formData.giveOpinion.length > 0) {
        this.expressions.push({
          dataType: 'str',
          name: 'giveOpinion',
          op: 'like',
          stringValue: `%${this.formData.giveOpinion[0].id}%`,
        })
      }

      // 问题性质
      if (this.formData.problemNature.length > 0) {
        this.expressions.push({
          dataType: 'str',
          name: 'problemNature',
          op: 'like',
          stringValue: `%${this.formData.problemNature[0].id}%`,
        })
      }

      // 整改类型
      if (this.formData.rectType.length > 0) {
        this.expressions.push({
          dataType: 'str',
          name: 'rectType',
          op: 'like',
          stringValue: `%${this.formData.rectType[0].id}%`,
        })
      }

      // 销号状态
      if (this.formData.cancellStatus.length > 0) {
        this.expressions.push({
          dataType: 'str',
          name: 'cancellStatus',
          op: 'like',
          stringValue: `%${this.formData.cancellStatus[0].id}%`,
        })
      }
      // 项目年份
      if (this.formData.planYear.length > 0) {
        this.expressions.push({
          dataType: 'str',
          name: 'planYear',
          op: 'eq',
          stringValue: `${this.formData.planYear}`,
        })
      }

      // 确认状态
      // if (this.formData.confirmStatus.length > 0) {
      //   this.expressions.push({
      //     dataType: 'str',
      //     name: 'confirmStatus',
      //     op: 'like',
      //     stringValue: `%${this.formData.confirmStatus[0].id}%`,
      //   })
      // }
      // this.expand = false
    },
    searchedClick() {
      this.expand = !this.expand
    },
    // 重置年份
    resetForm() {
      // this.formData.confirmStatus = []
      this.formData.rectStatus = []
      this.formData.giveOpinion = []
      this.formData.problemNature = []
      this.formData.rectType = []
      this.formData.cancellStatus = []
      this.advSearchForm.auditedUnit = ''
      this.unitName = ''
    },
    // 导出问题附件
    exportdataFiles() {
      const selectedRowKeys = this.$refs.WTQDDataTable.getSelectedRowKeys()
      if (selectedRowKeys.length === 0) {
        Modal.warning({
          title: '提示',
          content: '请选择要一键导出附件的问题（最多可选择10条）',
        })
      } else {
        const timestamp = new Date().getTime()
        console.log(timestamp)
        axios({
          method: 'get',
          url: 'api/xcoa-mobile/v1/spic-common/exportFindFiles/' + selectedRowKeys,
          responseType: 'blob',
        }).then((res) => {
          if (res.data) {
            let blob = null
            let fileName = res.headers['content-disposition']?.split('fileName=')[1]
            if (fileName === null || fileName === undefined) {
              fileName = '.zip'
            }
            blob = new Blob([res.data], { type: 'application/zip' })
            const time = moment(moment()).format('yyyyMMDD')
            fileName = '审计问题证明性材料-' + time + '.zip'
            if ('msSaveOrOpenBlob' in navigator) {
              // 适配ie
              window.navigator.msSaveOrOpenBlob(blob, fileName)
            } else {
              // 其他浏览器
              const blobUrl = window.URL.createObjectURL(blob)
              const a = document.createElement('a')
              a.style.display = 'none'
              a.href = blobUrl
              a.setAttribute('download', fileName)
              a.click()
            }
            message.success('导出成功')
          } else {
            message.error('导出失败，请联系系统管理员')
          }
        })
      }
    },
    // 导出审计整改台账
    exportQuestion() {
      axios({
        method: 'post',
        url: 'api/xcoa-mobile/v1/spicProblemListExport/exportRectLedger',
        responseType: 'blob',
        data: {
          unitIds: '',
          dateStart: '',
          dateEnd: '',
        },
      }).then((res) => {
        const url = URL.createObjectURL(res.data)
        download(url, '审计整改台账表.xlsx')
      })
    },
    // 导出审计情况统计
    exportSituationStatistics() {
      axios({
        method: 'post',
        url: 'api/xcoa-mobile/v1/spicProblemListExport/exportSituationStatistics',
        responseType: 'blob',
        data: {
          unitIds: '',
          dateStart: '',
          dateEnd: '',
        },
      }).then((res) => {
        const url = URL.createObjectURL(res.data)
        download(url, '审计情况统计报表.xls')
      })
    },
    // 导出审计项目整改完成情况及成果统计月度
    exportResultStatistics() {
      axios({
        method: 'post',
        url: 'api/xcoa-mobile/v1/spicProblemListExport/exportResultStatistics',
        responseType: 'blob',
        data: {
          unitIds: '',
          dateStart: '',
          dateEnd: '',
        },
      }).then((res) => {
        const url = URL.createObjectURL(res.data)
        download(url, '审计项目整改完成情况及成果统计月度表.xls')
      })
    },
    // 导出单位及内部审计机构基本情况
    exportOne() {
      axios({
        method: 'post',
        url: 'api/xcoa-mobile/v1/iam-audits-statistics/exportIamOrgExcel',
        responseType: 'blob',
        data: {
          unitIds: '',
          dateStart: '',
          dateEnd: '',
        },
      }).then((res) => {
        const url = URL.createObjectURL(res.data)
        download(url, '单位及内部审计机构基本情况表.xls')
      })
    },
    // // 导出单位内部业务审计情况
    exportTwo() {
      axios({
        method: 'post',
        url: 'api/xcoa-mobile/v1/iam-audits-statistics/exportIamDwywExcel',
        responseType: 'blob',
        data: {
          unitIds: '',
          dateStart: '',
          dateEnd: '',
        },
      }).then((res) => {
        const url = URL.createObjectURL(res.data)
        download(url, '单位内部业务审计情况表.xls')
      })
    },
    // 导出单位内部审计工作情况
    exportThree() {
      axios({
        method: 'post',
        url: 'api/xcoa-mobile/v1/iam-auditWork-statistics/exportGZWExcel',
        responseType: 'blob',
        data: {
          unitIds: '',
          dateStart: '',
          dateEnd: '',
        },
      }).then((res) => {
        const url = URL.createObjectURL(res.data)
        download(url, '国资委报表.xls')
      })
    },
    processReq(req) {
      const url = req.url
      if (url === 'api/xcoa-mobile/v1/iamrectifyquestion/all-list') {
        this.exportExpressions = req.data.expressions
      }

      return req
    },
  },
}
</script>

<style module lang="scss">
@use '@/common/design' as *;
.btns {
  position: absolute;
  top: 24px;
  right: 20.5px;
  z-index: 100;
  display: none;
}
.buttonSpacing {
  margin-left: 5px;
}

.advancedQuery {
  :global(.ant-col .ant-form-item-label) {
    width: 35% !important;
  }

  :global(.ant-col .ant-form-item-control-wrapper) {
    width: 60% !important;
  }
}

:global(.recitifyrectstatus) {
  :global(.ant-form-item-label) {
    margin-left: 2em;
  }
}
</style>
