<!-- 进度跟踪-基础资产反馈进度 -->
<template>
  <div class="trackScheduleBasePop" style="margin-top: 10px">
    <search-form :formValue.sync="queryParas" @handleFilter="handleFilter" @clearParam="clearParam" :componentList="componentList" :isShowFoldBtn="false"></search-form>
    <data-table :loadCount="loadCount" :queryParas.sync="queryParas" v-bind="{maxHeight:400}" :columns="columns"
    :sourceData="sourceData" :showPage="showPage" :api="trcApi" @getTableData="getTableData" class="sampleTrackTable" ref="sampleData" id="datatableheight">
      <template slot="headButton">
      <!-- 图标 -->
      <div class="flex-spaceB" style="padding-top: 10px">
        <div>
          <span class="effectoutfontStyle">{{form.projectName + form.periods}}期律所抽查资产反馈列表</span>
        </div>
        <div align="right">
          <i class="iconfont iconFlag kefangkuan iconfangkuan"><span class="fontClass iconSpace">{{$t('effectDealFeedBackMain.lendable')}}</span></i>
          <i class="iconfont iconFlag ketuidan iconketuidan"><span class="fontClass iconSpace">{{$t('effectDealFeedBackMain.returnableBill')}}</span></i>
          <i class="iconfont iconFlag yituidan iconyituidan"><span class="fontClass iconSpace">{{$t('effectDealFeedBackMain.returnedOrder')}}</span></i>
          <i class="iconfont iconFlag jidan iconjidan"><span class="fontClass iconSpace">{{$t('effectDealFeedBackMain.urgentSingleAssets')}}</span></i>
          <i class="iconfont iconFlag fengxian1 iconfengxian"><span class="fontClass iconSpace">{{$t('effectDealFeedBackMain.riskOfCancellation')}}</span></i>
          <i class="iconfont iconFlag fengxian2 iconfengxian"><span class="fontClass iconSpace">{{$t('effectDealFeedBackMain.supChargeback')}}</span></i>
          <i class="iconfont iconFlag yinanyuqi iconyinan"><span class="fontClass iconSpace">{{$t('effectDealFeedBackMain.difficultAssets')}}</span></i>
          <i class="iconfont iconFlag yinanyuqi iconyuqi"><span class="fontClass iconSpace">{{$t('effectDealFeedBackMain.overdue')}}</span></i>
        </div>
        </div>
      </template>
      <template  #operate="scope">
              <auth-button size="small" class="iconCircle"
                          :title="$t('effectDealFeedBackMain.sendEmail')" icon="iconfont iconfasongyoujian" @click="sendMail(scope.data.$index,scope.data.row)"></auth-button>
      </template>
      <template slot="append">
        <div class="graphic-table">
          <table width="1630px" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td rowspan="2" width="180px" class="graphic-td"><span>{{$t('effectDealFeedBackMain.summarybs') + (UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.planSampleCount) + $t('effectDealFeedBackMain.bs')}}</span></td>
              <td rowspan="2" width="80px" class="graphic-td"><span>{{UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.pointSampleNumber}}</span></td>
              <td rowspan="2" width="100px" class="graphic-td"><span>{{UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.feedbackQustionNumber}}</span></td>
              <td rowspan="2" width="120px" class="graphic-td"><span>{{UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.resolvedNumber}}</span></td>
              <td rowspan="2" width="150px" class="graphic-td"><span>{{UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.resolvedNumberPercent}}</span></td>
              <td rowspan="2" width="80px" class="graphic-td"><span>{{UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.passed}}</span></td>
              <td rowspan="2" width="80px" class="graphic-td"><span>{{UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.auditing}}</span></td>
              <td rowspan="2" width="80px" class="graphic-td"><span>{{UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.resolving}}</span></td>
              <td rowspan="2" width="80px" class="graphic-td"><span>{{UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.chargeBack}}</span></td>
              <td width="150px" class="graphic-td"><span>{{(UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.numberOfCs) + $t('effectDealFeedBackMain.bs') + (UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.supplementNoOfCs) + $t('effectDealFeedBackMain.problems')}}</span></td>
              <td width="170px" class="graphic-td"><span>{{(UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.numberOfArea) + $t('effectDealFeedBackMain.bs') + (UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.supplementNoOfArea) + $t('effectDealFeedBackMain.problems')}}</span></td>
              <td width="150px" class="graphic-td"><span>{{(UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.numberOfDocuments) + $t('effectDealFeedBackMain.bs') + (UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.supplementNoOfDocuments) + $t('effectDealFeedBackMain.problems')}}</span></td>
              <td width="150px" class="graphic-td"><span>{{(UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.numberOfZd) + $t('effectDealFeedBackMain.bs') + (UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.supplementNoOfZd) + $t('effectDealFeedBackMain.problems')}}</span></td>
              <td rowspan="2" width="60px" class="graphic-td lastTdCss" :style="{left:lastTdLeft}">
                <auth-button :disabled="UtilJs.isEmpty(summaryCount)" size="small" class="iconCircle"
                            :title="$t('common.update')" icon="iconfont iconbianji" @click="modityNumber"></auth-button>
              </td>
            </tr>
            <tr>
              <td colspan="4" class="graphic-td"><span>{{$t('effectDealFeedBackMain.total') + (UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.numberOfTotal) + $t('effectDealFeedBackMain.bs') + (UtilJs.isEmpty(summaryCount) ? 0 : summaryCount.supplementNoOfTotal) + $t('effectDealFeedBackMain.problems')}}</span></td>
            </tr>
          </table>
        </div>
      </template>
    </data-table>
    <div v-show="batchData.length > 0">
      <div v-for="item in list" :key="item.feedbackFrequency">
        <external-transition  class="batchList" :title="$t('enterpriseInfoManage.supplierInfoManage.rank') + item.feedbackFrequency + $t('effectDealFeedBackMain.batch')">
          <template slot="unfolded">
            <data-table :columns="batchColumns"
                        :sourceData="item.getFileInfoDetailConvertTempDTOList"
                        :showPage="showPage"
                        v-bind="{ spanMethod:e => objectSpanMethod(item,e)}"
                        :row-class-name="rowClassName">
              <template slot="suppliersName" slot-scope="scope">
                <span-plus :index="scope.data.$index" :text="scope.data.row.suppliersName"></span-plus>
              </template>
              <template slot="projectCompanyName" slot-scope="scope">
                <span-plus :index="scope.data.$index" :text="scope.data.row.projectCompanyName"></span-plus>
              </template>
              <template slot="chargeUserMemo" slot-scope="scope">
                <span-plus :index="scope.data.$index" :text="scope.data.row.chargeUserMemo"></span-plus>
              </template>
              <template slot="custSupplementNoFile" slot-scope="scope">
                <span-plus :index="scope.data.$index" :text="fileLengthPlus(scope.data.row.supplementNoFileOfCs,scope.data.row.estimateSupplementTimeOfCs)"></span-plus>
              </template>
              <template slot="regiSupplementNoFile" slot-scope="scope">
                <span-plus :index="scope.data.$index" :text="fileLengthPlus(scope.data.row.supplementNoFileOfArea,scope.data.row.estimateSupplementTimeOfArea)"></span-plus>
              </template>
              <template slot="docSupplementNoFile" slot-scope="scope">
                <span-plus :index="scope.data.$index" :text="fileLengthPlus(scope.data.row.supplementNoFileOfDocuments,scope.data.row.estimateSupplementTimeOfDocuments)"></span-plus>
              </template>
              <template slot="zhongDSupplementNoFile" slot-scope="scope">
                <span-plus :index="scope.data.$index" :text="fileLengthPlus(scope.data.row.supplementNoFileOfZd,scope.data.row.estimateSupplementTimeOfZd)"></span-plus>
              </template>
              <!-- 资产标识 -->
              <template slot="sampleFlagDTO" slot-scope="scope">
                <div>
                  <i v-if="scope.data.row.sampleFlagDTO.ifsToLoan === '2'" class="iconfont iconFlag kefangkuan iconfangkuan"></i>
                  <i v-if="scope.data.row.sampleFlagDTO.selectedChargebackFlag === '2'" class="iconfont  iconFlag ketuidan iconketuidan"></i>
                  <i v-if="scope.data.row.sampleFlagDTO.chargebackStatus === '2'" class="iconfont iconFlag yituidan iconyituidan"></i>
                  <i v-if="scope.data.row.sampleFlagDTO.ifsUrgent === '2'" class="iconfont iconFlag jidan iconjidan"></i>
                  <i v-if="scope.data.row.sampleFlagDTO.chargebackRiskFlag === '2'" class="iconfont iconFlag fengxian1 iconfengxian"></i>
                  <i v-if="scope.data.row.sampleFlagDTO.supplementPumpStatus === '2'"  class="iconfont iconFlag fengxian2 iconfengxian"></i>
                  <i v-if="scope.data.row.sampleFlagDTO.difficultQustionFlag === '2'" class="iconfont iconFlag yinanyuqi iconyinan"></i>
                  <i v-if="scope.data.row.sampleFlagDTO.overdueFlag === '2'" class="iconfont iconFlag yinanyuqi iconyuqi"></i>
                </div>
              </template>
              <template slot="feedbackStatus" slot-scope="scope">
                <span>{{scope.data.row.feedbackStatus}}</span>
                <span v-if="scope.data.row.feedbackStatus === $t('coordManageMain.rejected') && scope.data.row.chargebackReason !== ''"><br/>{{$t('chargeback.chargeback_reason')}}<br/></span>
                <span v-if="scope.data.row.feedbackStatus === $t('coordManageMain.rejected') && scope.data.row.chargebackReason !== ''">{{scope.data.row.chargebackReason}}</span>
              </template>
              <template slot="regionCode" slot-scope="scope">
                <div v-if="scope.data.row.regionCodeFlag==='1'&&scope.data.row.relationChargeUserNameOfArea !== ''">
                  <span>{{scope.data.row.relationChargeUserNameOfArea}}</span>
                  <span><br/>{{$t('factorRateList.areaNumber')}}<br/></span>
                  <span v-if="scope.data.row.regionCode !== ''">{{scope.data.row.regionCode}}</span>
                </div>
                <span v-else>{{'——'}}</span>
              </template>
              <template slot="operate" slot-scope="scope">
                <auth-button size="small" class="iconCircle marginLeft"
                            :title="$t('effectDealFeedBackMain.editorialRemarks')" icon="iconfont iconbianji" @click="editRemarks(scope.data.row)"></auth-button>
                <auth-button size="small" class="iconCircle"
                            :title="$t('effectDealFeedBackMain.proDetails')" icon="iconfont iconxiangqing" @click="trackClick(scope.data.row)" v-if="scope.data.row.extOrgAuditResult!=='1'"></auth-button>
                <auth-button size="small" class="iconCircle"
                            :title="$t('effectDealFeedBackMain.symManage')" icon="iconfont iconbiaozhiguanli" @click="assetClick(scope.data.row)"></auth-button>
              </template>
            </data-table>
          </template>
        </external-transition>
      </div>
    </div>
    <!-- 编辑备注 -->
    <modify-summarybs v-if="summarybsVisible" :visible.sync="summarybsVisible" :form="changeForm" @modifyNumber="modifyNumber"></modify-summarybs>
    <edit-memo v-if="editMemoVisible" :visible.sync="editMemoVisible" :form="changeForm" @close="editMemoClose"></edit-memo>
    <track-schedule-qust-detail-pop v-if="trackVisible" :visible.sync="trackVisible" :form="changeForm"></track-schedule-qust-detail-pop>
    <asset-flag-mgr-pop v-if="assetVisible" :visible.sync="assetVisible" :form="changeForm" @close="editMemoClose"></asset-flag-mgr-pop>
    <send-email :visible.sync="emailVisible" editModel="E" :form="sendForm"></send-email>
  </div>
</template>

<script>
import * as format from '@/filters/index'
import editMemo from '@/pages/assetoutfeedback/effectDealFeedBack/editMemo'
import assetFlagMgrPop from '@/pages/assetoutfeedback/coordManage/assetFlagMgrPop'
import modifySummarybs from '@/pages/assetoutfeedback/coordManage/modifySummarybs'
import effectDealFeedBackApi from '@/api/assetoutfeedback/effectDealFeedBack/effectDealFeedBackApi'
import trackScheduleQustDetailPop from '@/components/element/assetoutfeedback/trackScheduleQustDetailPop'
import sendEmail from '@/components/element/assetoutfeedback/sendEmail'
import coordManageApi from '@/api/assetoutfeedback/coordManage/coordManageApi'
import externalTransition from '@/components/element/assetoutfeedback/externalTransition'
import fileApi from '@/api/fileApi.js'
import { downFile } from '@/utils/devUtils'
import { mapGetters } from 'vuex'
import { searchForm, DataTable, SelectDictionary, authButton, SelectProductName, SpanPlus, BaseSelect } from 'newepoch-components'
export default {
  components: { DataTable, searchForm, SelectDictionary, authButton, externalTransition, SelectProductName, editMemo, trackScheduleQustDetailPop, assetFlagMgrPop, SpanPlus, modifySummarybs, BaseSelect, sendEmail },
  computed: {
    ...mapGetters(['userId', 'nikeName']),
    trcApi () {
      return coordManageApi.getTrclistSample
    },
    // 编辑备注
    memoApi () {
      return effectDealFeedBackApi.getMemoInfo
    },
    // 处理单元格合并参数
    rowspan () {
      let list = this.batchData
      list.forEach((i, m) => {
        let spanArr = []
        let spanArr2 = []
        let spanArr3 = []
        let spanArr4 = []
        let qusetionNumber = []
        let traceUserName = []
        let position = 0
        let position1 = 0
        let position2 = 0
        let position3 = 0
        let position4 = 0
        let position5 = 0
        if (i.getFileInfoDetailConvertTempDTOList && i.getFileInfoDetailConvertTempDTOList.length > 0) {
          i.getFileInfoDetailConvertTempDTOList.forEach((item, index) => {
            if (index === 0) {
              item.index = 1
              spanArr.push(1)
              spanArr2.push(1)
              spanArr3.push(1)
              spanArr4.push(1)
              qusetionNumber.push(1)
              traceUserName.push(1)
              position = 0
              position1 = 0
              position2 = 0
              position3 = 0
              position4 = 0
              position5 = 0
            } else {
              // 合并客服
              if (item.feedbackQustionNo === i.getFileInfoDetailConvertTempDTOList[index - 1].feedbackQustionNo && item.assetCode === i.getFileInfoDetailConvertTempDTOList[index - 1].assetCode && (item.relationType === '1' && i.getFileInfoDetailConvertTempDTOList[index - 1].relationType === '1') && item.relationChargeUserName === i.getFileInfoDetailConvertTempDTOList[index - 1].relationChargeUserName) {
                spanArr[position] += 1
                spanArr.push(0)
              } else {
                spanArr.push(1)
                position = index
              }
              // 合并区域业务
              if (item.feedbackQustionNo === i.getFileInfoDetailConvertTempDTOList[index - 1].feedbackQustionNo && item.assetCode === i.getFileInfoDetailConvertTempDTOList[index - 1].assetCode && ((item.relationType === '2' && i.getFileInfoDetailConvertTempDTOList[index - 1].relationType === '2') || (item.relationType === '5' && i.getFileInfoDetailConvertTempDTOList[index - 1].relationType === '5' && item.regionCode === i.getFileInfoDetailConvertTempDTOList[index - 1].regionCode)) && item.relationChargeUserName === i.getFileInfoDetailConvertTempDTOList[index - 1].relationChargeUserName && item.relationChargeUserName === i.getFileInfoDetailConvertTempDTOList[index - 1].relationChargeUserName) {
                spanArr2[position2] += 1
                spanArr2.push(0)
              } else {
                spanArr2.push(1)
                position2 = index
              }
              // 合并中登
              if (item.feedbackQustionNo === i.getFileInfoDetailConvertTempDTOList[index - 1].feedbackQustionNo && item.assetCode === i.getFileInfoDetailConvertTempDTOList[index - 1].assetCode && (item.relationType === '3' && i.getFileInfoDetailConvertTempDTOList[index - 1].relationType === '3') && item.relationChargeUserName === i.getFileInfoDetailConvertTempDTOList[index - 1].relationChargeUserName) {
                spanArr3[position] += 1
                spanArr3.push(0)
              } else {
                spanArr3.push(1)
                position3 = index
              }
              // 合并单证
              if (item.feedbackQustionNo === i.getFileInfoDetailConvertTempDTOList[index - 1].feedbackQustionNo && item.assetCode === i.getFileInfoDetailConvertTempDTOList[index - 1].assetCode && (item.relationType === '4' && i.getFileInfoDetailConvertTempDTOList[index - 1].relationType === '4') && item.relationChargeUserName === i.getFileInfoDetailConvertTempDTOList[index - 1].relationChargeUserName) {
                spanArr4[position] += 1
                spanArr4.push(0)
              } else {
                spanArr4.push(1)
                position4 = index
              }
              // 合并序号和标志
              if (item.assetCode === i.getFileInfoDetailConvertTempDTOList[index - 1].assetCode) {
                item.index = i.getFileInfoDetailConvertTempDTOList[index - 1].index
                qusetionNumber[position1] += 1
                qusetionNumber.push(0)
              } else {
                item.index = i.getFileInfoDetailConvertTempDTOList[index - 1].index + 1
                qusetionNumber.push(1)
                position1 = index
              }
              // 合并跟进人
              if (item.feedbackQustionNo === i.getFileInfoDetailConvertTempDTOList[index - 1].feedbackQustionNo) {
                traceUserName[position1] += 1
                traceUserName.push(0)
              } else {
                traceUserName.push(1)
                position5 = index
              }
            }
          })
        }
        i.spanArr = spanArr
        i.spanArr2 = spanArr
        i.spanArr3 = spanArr
        i.spanArr4 = spanArr
        i.number = qusetionNumber
        i.traceUserName = traceUserName
        i.position = position
        i.position2 = position2
        i.position3 = position3
        i.position4 = position4
        i.position5 = position5
      })
      // 合并标志
      list = list.map((i, index) => {
        if (i.getFileInfoDetailConvertTempDTOList.length > 0) {
          i.getFileInfoDetailConvertTempDTOList.reverse()
          i.getFileInfoDetailConvertTempDTOList = i.getFileInfoDetailConvertTempDTOList.map((item, index) => {
            if (index !== 0 && item.assetCode === i.getFileInfoDetailConvertTempDTOList[index - 1].assetCode) {
              let combind = {}
              for (let e in i.getFileInfoDetailConvertTempDTOList[index - 1].sampleFlagDTO) {
                let t = i.getFileInfoDetailConvertTempDTOList[index - 1].sampleFlagDTO[e]
                if (t === '2') {
                  combind[e] = t
                }
              }
              item.sampleFlagDTO = Object.assign(item.sampleFlagDTO, combind)
            }
            return item
          })
          i.getFileInfoDetailConvertTempDTOList.reverse()
        }
        return i
      })
      return list
    },
    list () {
      return this.rowspan
    }
  },
  props: {
    form: {
      type: Object,
      default () {
        return {}
      }
    },
    editModel: {
      type: String,
      default () {
        return ''
      }
    },
    num: {
      type: Number,
      default () {
        return 0
      }
    },
    feedbackResource: {
      type: String,
      default () {
        return '1'
      }
    },
    userType: {
      type: String,
      default () {
        return '1'
      }
    },
    trackType: {
      type: String,
      default () {
        return ''
      }
    }
  },
  watch: {
    screenWidth (n) {
      this.lastTdLeft = -(this.$refs.sampleData.$el.children[1].children[2].scrollWidth - this.$refs.sampleData.$el.children[1].children[2].offsetWidth - this.$refs.sampleData.$el.children[1].children[2].scrollLeft) + 'px'
    }
  },
  activated () {
    setTimeout(() => {
      this.initWidth()
      this.tableHeightChange()
    }, 100)
    // this.loadCount++
  },
  data () {
    let $this = this
    return {
      emailVisible: false,
      screenWidth: document.body.clientWidth,
      spanArr: [],
      position: [],
      changeForm: {},
      sendForm: {
        projectId: this.form.projectId,
        periods: this.form.periods
      },
      lastTdLeft: '0px',
      summarybsVisible: false,
      assetVisible: false,
      trackVisible: false,
      editMemoVisible: false,
      effectBatchVisible: false, // 基础信息，资料下载弹窗
      title: '',
      keyIdArray: [],
      showPage: false,
      queryParas: {
        traceUserName: '',
        extOrgAuditResult: ''
      },
      loadCount: 0,
      summaryCount: {},
      batchData: [],
      sourceData: [],
      componentList: [
        {
          // 跟进人
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.traceUserName,
          disabled: true,
          prop: 'traceUserName',
          value: 'traceUserName',
          maxlength: 50,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          labelWidth: '130px',
          clearable: true,
          componentName: 'el-input'
        },
        {
          // 资产标志
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.assetFlag,
          disabled: false,
          prop: 'sampleFlag',
          value: 'sampleFlag',
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
          labelWidth: '130px',
          dictTypeCode: 'AUDIT_OUT_ASSET_FLAG',
          clearable: true,
          componentName: SelectDictionary
        },
        {
          // 付款确认书编号
          label: this.$i18n.messages[this.$i18n.locale].common.payCode,
          disabled: false,
          prop: 'assetCode',
          value: 'assetCode',
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          labelWidth: '130px',
          clearable: true,
          componentName: 'el-input'
        },
        {
          // 是否后补
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.repair,
          disabled: false,
          prop: 'extOrgAuditResult',
          value: 'extOrgAuditResult',
          placeholder: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.pleaseChooseyn,
          labelWidth: '130px',
          clearable: true,
          options: [
            {
              id: '1',
              name: $this.$t('common.no')
            },
            {
              id: '2',
              name: $this.$t('common.yes')
            }
          ],
          componentName: BaseSelect
        }
      ],
      columns: [
        {
          // 批次
          prop: 'feedbackFrequency',
          align: 'center',
          width: '60px',
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.feedbackFrequency,
          format: (row) => {
            return $this.$t('enterpriseInfoManage.supplierInfoManage.rank') + row.feedbackFrequency + $this.$t('effectDealFeedBackMain.batch')
          }
        }, {
          // 最早反馈时间
          prop: 'earliestAddTime',
          align: 'center',
          width: '120px',
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.earliestAddTime,
          format: (row) => {
            return format.formatCheckDatetime(row.earliestAddTime, 'yyyy-MM-dd')
          }
        }, {
          // 抽中笔数
          prop: 'pointSampleNumber',
          align: 'center',
          width: '80px',
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.pointSampleNumber
        }, {
          // 反馈问题数
          prop: 'feedbackQustionNumber',
          align: 'center',
          width: '100px',
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.feedbackQustionNumber
        }, {
          // 合规已解决数量
          prop: 'resolvedNumber',
          align: 'center',
          width: '120px',
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.resolvedNumber
        }, {
          // 合规已解决占比(%)
          prop: 'resolvedNumberPercent',
          align: 'center',
          width: '150px',
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.resolvedNumberPercent,
          format: (row) => {
            if (row.resolvedNumberPercent === '0.00') {
              return '0'
            } else {
              return row.resolvedNumberPercent
            }
          }
        }, {
          // 总体状态（笔）
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.headStatus,
          child: [
            {
              // 已通过
              prop: 'passed',
              align: 'center',
              label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.passed
            }, {
              // 审核中
              prop: 'auditing',
              align: 'center',
              label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.auditing
            }, {
              // 解决中
              prop: 'resolving',
              align: 'center',
              label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.resolving
            }, {
              // 已退单
              prop: 'chargeBack',
              align: 'center',
              label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.chargeBack
            }
          ]
        }, {
          // 暂未补回
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.noRecovered,
          child: [
            {
              // 客服尚未补回情况
              prop: 'numberOfCs',
              align: 'center',
              width: '150px',
              label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.numberOfCs,
              format (row) {
                return row.numberOfCs + '笔' + row.supplementNoOfCs + '问题'
              }
            }, {
              // 区域/业务尚未补回情况
              prop: 'numberOfArea',
              align: 'center',
              width: '170px',
              label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.numberOfArea,
              format (row) {
                return row.numberOfArea + '笔' + row.supplementNoOfArea + '问题'
              }
            }, {
              // 单证尚未补回情况
              prop: 'numberOfDocuments',
              align: 'center',
              width: '150px',
              label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.numberOfDocuments,
              format (row) {
                return row.numberOfDocuments + '笔' + row.supplementNoOfDocuments + '问题'
              }
            }, {
              // 中登尚未补回情况
              prop: 'numberOfZd',
              align: 'center',
              width: '150px',
              label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.numberOfZd,
              format (row) {
                return row.numberOfZd + '笔' + row.supplementNoOfZd + '问题'
              }
            }
          ]
        }, {
          // 操作
          prop: 'operate',
          align: 'center',
          slot: true,
          width: '60px',
          fixed: 'right',
          label: this.$i18n.messages[this.$i18n.locale].common.operate
        }

      ],
      batchColumns: [
        {
          // 序号
          prop: 'index',
          align: 'center',
          width: '60px',
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.No
        }, {
          // 付款确认书编号
          prop: 'assetCode',
          align: 'left',
          width: '240px',
          label: this.$i18n.messages[this.$i18n.locale].common.payCode
        }, {
          // 供应商名称
          prop: 'suppliersName',
          align: 'left',
          width: '160px',
          showOverflowTooltip: true,
          label: this.$i18n.messages[this.$i18n.locale].feedbackMaterialIndex.gys
          // slot: true
        }, {
          // 项目公司名称
          prop: 'projectCompanyName',
          align: 'left',
          width: '160px',
          showOverflowTooltip: true,
          label: this.$i18n.messages[this.$i18n.locale].feedbackMaterialIndex.xmg
          // slot: true
        }, {
          // 状态
          prop: 'feedbackStatus',
          align: 'center',
          width: '120px',
          slot: true,
          label: this.$i18n.messages[this.$i18n.locale].documentSealingTaskManage.status
        }, {
          // 客服
          prop: 'customerService',
          align: 'center',
          width: '80px',
          label: this.$i18n.messages[this.$i18n.locale].expressFileReceiveList.customerService,
          format (row) {
            if (row.relationChargeUserNameOfCs && row.relationChargeUserNameOfCs !== '') {
              return row.relationChargeUserNameOfCs
            } else {
              return '——'
            }
          }
        }, {
          // 客服需补资料
          prop: 'custSupplementNoFile',
          align: 'left',
          width: '160px',
          showOverflowTooltip: true,
          // slot: true,
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.custSupplementNoFile,
          format (row) {
            return $this.fileLengthPlus(row.supplementNoFileOfCs, row.estimateSupplementTimeOfCs)
          }
        }, {
          // 区域/业务(区域编号)
          prop: 'regionCode',
          align: 'center',
          slot: true,
          width: '160px',
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.regionCode
        }, {
          // 区域/业务需补资料
          prop: 'regiSupplementNoFile',
          align: 'left',
          width: '160px',
          showOverflowTooltip: true,
          // slot: true,
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.regiSupplementNoFile,
          format (row) {
            return $this.fileLengthPlus(row.supplementNoFileOfArea, row.estimateSupplementTimeOfArea)
          }
        }, {
          // 单证
          prop: 'documents',
          align: 'center',
          width: '80px',
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.documents,
          format (row) {
            if (row.relationChargeUserNameOfDocuments && row.relationChargeUserNameOfDocuments !== '') {
              return row.relationChargeUserNameOfDocuments
            } else {
              return '——'
            }
          }
        }, {
          // 单证需补资料
          prop: 'docSupplementNoFile',
          align: 'left',
          width: '160px',
          showOverflowTooltip: true,
          // slot: true,
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.docSupplementNoFile,
          format (row) {
            return $this.fileLengthPlus(row.supplementNoFileOfDocuments, row.estimateSupplementTimeOfDocuments)
          }
        }, {
          // 中登
          prop: 'zhongD',
          align: 'center',
          width: '80px',
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.zhongD,
          format (row) {
            if (row.relationType === '3' && row.relationChargeUserNameOfZd !== '') {
              return row.relationChargeUserNameOfZd
            } else {
              return '——'
            }
          }
        }, {
          // 中登需补资料
          prop: 'zhongDSupplementNoFile',
          align: 'left',
          width: '160px',
          showOverflowTooltip: true,
          // slot: true,
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.zhongDSupplementNoFile,
          format (row) {
            return $this.fileLengthPlus(row.supplementNoFileOfZd, row.estimateSupplementTimeOfZd)
          }
        }, {
          // 合规
          prop: 'traceUserName',
          align: 'left',
          width: '120px',
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.trace
        }, {
          // 统筹人备注
          prop: 'chargeUserMemo',
          align: 'left',
          width: '160px',
          showOverflowTooltip: true,
          // slot: true,
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.chargeUserMemo
        }, {
          // 资产标志
          prop: 'sampleFlagDTO',
          align: 'center',
          width: '160px',
          slot: true,
          label: this.$i18n.messages[this.$i18n.locale].effectDealFeedBackMain.assetFlag
        }, {
          // 操作
          prop: 'operate',
          align: 'center',
          width: '160px',
          slot: true,
          fixed: 'right',
          label: this.$i18n.messages[this.$i18n.locale].common.operate
        }
      ]
    }
  },
  created () {
    this.$nextTick(() => {
      if (this.userType === '2') {
        this.queryParas.traceUserName = this.nikeName
      } else {
        this.componentList[0].disabled = false
      }
      if (this.trackType === '1') { // 后补进度
        this.queryParas.extOrgAuditResult = '2'
      }
    })
  },
  mounted () {
    window.onresize = () => {
      return (() => {
        this.screenWidth = document.body.clientWidth
      })()
    }
    this.initWidth()
    this.$refs.sampleData.$el.children[1].children[2].addEventListener('scroll', this.offsetWidth)
    this.queryParas = Object.assign(this.queryParas, this.form)
    this.queryParas.feedbackResource = this.feedbackResource
    this.$nextTick(() => {
      this.handleFilter()
    })
  },
  // 合计表格展示格式化过滤
  filters: {
    formatSummary (val) {
      if (typeof (val) === 'undefined') {
        val = 0
      }
    }
  },
  // 实例被销毁前监听器被销毁
  beforeDestroy () {
    this.$refs.sampleData.$el.children[1].children[2].removeEventListener('scroll', this.offsetWidth)
  },
  methods: {
    // 发送邮件
    sendMail (e, row) {
      this.sendForm.auditFileType = this.batchData[e].auditFileType
      this.sendForm.auditFileTypeName = this.$t('coordManageMain.sampleFile')
      this.sendForm.feedbackFrequency = row.feedbackFrequency
      this.emailVisible = true
    },
    // 查询条件清空
    clearParam () {
      if (this.userType === '2') {
        this.queryParas = {
          traceUserName: this.nikeName
        }
      } else {
        this.queryParas = {}
      }
      this.queryParas = Object.assign(this.queryParas, this.form)
    },
    // 导出文件
    importData () {
      this.queryParas = Object.assign(this.queryParas, this.form)
      this.queryParas.feedbackResource = this.feedbackResource
      this.queryParas.isExportFlag = '1' // 导出标志
      let fileId = ''
      this.trcApi.getList(this.queryParas).then(res => {
        if (res.success && res.data.fileId) {
          fileId = res.data.fileId
          this.downloadSuccess(fileId)
        } else {
          this.warning('没有可下载的数据')
        }
      })
    },
    // 共通下载
    downloadSuccess (fileID) {
      if (this.UtilJs.isEmpty(fileID)) {
        this.warning(this.noDownloadFileMsg)
      } else {
        if (this.uuidSwitch) {
          fileApi.file.downloadByUUID(this.$xhr, { uuid: fileID }).then(res => {
            downFile(res)
          })
        } else {
          fileApi.file.download({ keyId: fileID }).then(res => {
            downFile(res)
          })
        }
      }
    },
    // 需补资料长度格式化
    fileLengthPlus (file, time) {
      if (file && file !== '') {
        let dateStr = ''
        dateStr = format.formatCheckDatetime(time, 'yyyy-MM-dd')
        if (dateStr === '') {
          return file
        } else {
          return file + '（预计' + dateStr + '时间补回）'
        }
      } else {
        return '——'
      }
    },
    tableHeightChange () {
      if (document.getElementById('datatableheight').querySelector('.el-table__fixed-body-wrapper').style.maxHeight !== '235px') {
        document.getElementById('datatableheight').querySelector('.el-table__fixed-body-wrapper').style.maxHeight = '225px'
        document.getElementById('datatableheight').firstElementChild.nextElementSibling.firstElementChild.nextElementSibling.nextElementSibling.style.maxHeight = '235px'
      }
    },
    // 表格定长初始化
    initWidth () {
      this.lastTdLeft = -(this.$refs.sampleData.$el.children[1].children[2].scrollWidth - this.$refs.sampleData.$el.children[1].children[2].offsetWidth - this.$refs.sampleData.$el.children[1].children[2].scrollLeft) + 'px'
      // this.lastTdLeft = '-307px'
    },
    // 查询
    handleFilter () {
      this.tableHeightChange()
      this.queryParas.isExportFlag = '0'
      this.queryParas.feedbackResource = this.feedbackResource
      this.loadCount = this.loadCount + 1
    },
    // 获取表格相对宽度
    offsetWidth () {
      this.lastTdLeft = -(this.$refs.sampleData.$el.children[1].children[2].scrollWidth - this.$refs.sampleData.$el.children[1].children[2].offsetWidth - this.$refs.sampleData.$el.children[1].children[2].scrollLeft) + 'px'
    },
    // 获取表结构数据
    getTableData (val) {
      if (!this.UtilJs.isEmpty(val)) {
        this.sourceData = val.getSampleInfoCountDTOList
        this.summaryCount = val.getFileInfoSummaryCountDTO
        this.batchData = val.getFileInfoDetailConvertDTOList
      }
    },
    // 序号
    rowClassName ({ row, rowIndex }) {
      row.No = rowIndex + 1
    },
    // 编辑备注
    editRemarks (row) {
      // 获得编辑数据
      this.memoApi.getDefaultInfo({ identityFlag: '2', assetKeyId: row.assetKeyId, assetModifyTime: row.assetModifyTime }).then(res => {
        if (res.success) {
          this.changeForm = {
            identityFlag: '2',
            chargeUserMemo: res.data.chargeUserMemo,
            assetKeyId: res.data.assetKeyId,
            assetModifyTime: res.data.assetModifyTime
          }
          this.editMemoVisible = true
        }
      })
      // let param = Object.assign({}, { identityFlag: '2' })
      // param = Object.assign(param, this.form)
      // param = Object.assign(param, row)
      // this.memoApi.getDefaultInfo(param).then(res => {
      //   if (res.data && !res.data.errFlag) {
      //     this.changeForm = {}
      //     this.changeForm = Object.assign(this.changeForm, param)
      //     this.changeForm = Object.assign(this.changeForm, res.data)
      //     this.editMemoVisible = true
      //   } else {
      //     this.error('编辑备注失败')
      //   }
      // })
    },
    // 问题详情
    trackClick (row) {
      this.changeForm = row
      this.changeForm.auditFileType = '1001' // 抽样文件
      this.trackVisible = true
    },
    // 标志管理
    assetClick (row) {
      this.changeForm = row
      this.changeForm.feedbackResource = this.queryParas.feedbackResource
      this.assetVisible = true
    },
    // 编辑备注关闭
    editMemoClose (val) {
      if (val) {
        this.handleFilter()
      }
    },
    // 修改预计笔数
    modityNumber () {
      if (!this.UtilJs.isEmpty(this.summaryCount)) {
        this.changeForm = Object.assign(this.changeForm, { 'keyId': this.summaryCount.keyId }, { 'modifyTime': this.summaryCount.earliestAddTime })
        this.summarybsVisible = true
      }
    },
    // 预计抽样笔数修改成功
    modifyNumber (val) {
      this.summaryCount.planSampleCount = val
    },
    // 行合并
    objectSpanMethod (item, { row, column, rowIndex, columnIndex }) {
      if ((columnIndex > -1 && columnIndex < 5) || columnIndex === 13 || columnIndex === 14 || columnIndex === 15 || columnIndex === 16) {
        return {
          rowspan: item.number ? item.number[rowIndex] : 1,
          colspan: 1
        }
      } else if (columnIndex === 5) {
        return {
          rowspan: item.spanArr ? item.spanArr[rowIndex] : 1,
          colspan: 1
        }
      } else if (columnIndex === 7) {
        return {
          rowspan: item.spanArr2 ? item.spanArr2[rowIndex] : 1,
          colspan: 1
        }
      } else if (columnIndex === 11) {
        return {
          rowspan: item.spanArr3 ? item.spanArr3[rowIndex] : 1,
          colspan: 1
        }
      } else if (columnIndex === 9) {
        return {
          rowspan: item.spanArr4 ? item.spanArr4[rowIndex] : 1,
          colspan: 1
        }
      // } else if (columnIndex === 13) {
      //   return {
      //     rowspan: item.traceUserName ? item.traceUserName[rowIndex] : 1,
      //     colspan: 1
      //   }
      }
      return {
        rowspan: 1,
        colspan: 1
      }
    }
  }
}
</script>

<style lang="scss" scoped>
@import '~@/styles/assetoutfeedback/common.scss';
</style>
<style lang="scss">
.batchList{
  padding: 20px 0 0;
  .collapseTitle-header{
    margin: 0 !important;
  }
}
</style>
