<!--开票信息查询-->
<template>
  <div class="invoiceInformationList">
    <up-down-layout :header="$t('invoiceInformationList.head')" :handleFlag.sync="handleFlag" :footerFlag.sync="footerFlag">
      <search-form
        @handleFilter="coustomHandleFilter"
        @clearParam="clearParam"
        :menuCode="menuId"
        searchPerms="searchPerms"
        :formValue="queryParas"
        :componentList="componentList"
        resetPerms="resetPerms"
        slot="query">
      </search-form>
      <template slot="table">
        <data-table
          ref="dataTableRef"
          v-show="loadingTable"
          :headTitle="$t('invoiceInformationList.headCenter')"
          :operateBtnLayout="''"
          @getTableData="getTableData"
          :columns="columns"
          :queryParas="queryParas"
          :menuFlag="true"
          :selectedRows.sync="selectedRows"
          :sourceData.sync="showsourceData"
          :api="api"
          :showSelection="false"
          v-bind="elHeightObj"
          :loadCount="loadCount">
          <el-table-column slot="index" fixed="left"
                           type="selection"
                           align="center"
                           label="#"
                           :selectable="selectTable"
                           width="55"></el-table-column>
          <template slot="taxExcludingAmounthead" slot-scope="scope">
            <span>{{scope.data.column.label}}</span>
            <span class="textRed">{{total.taxExcludingAmount}}</span>
          </template>
          <template slot="taxAmounthead" slot-scope="scope">
            <span>{{scope.data.column.label}}</span>
            <span class="textRed">{{total.taxAmount}}</span>
          </template>
          <template slot="totalAmounthead" slot-scope="scope">
            <span>{{scope.data.column.label}}</span>
            <span class="textRed">{{total.totalAmount}}</span>
          </template>
          <template slot="taxExcludingAmount" slot-scope="scope">
            <span :class="{'textRed':isReadText(scope.data.row.taxExcludingAmount)}">{{handlerAccount(scope.data.row.taxExcludingAmount)}}</span>
          </template>
          <template slot="taxAmount" slot-scope="scope">
            <span :class="{'textRed':isReadText(scope.data.row.taxAmount)}">{{handlerAccount(scope.data.row.taxAmount)}}</span>
          </template>
          <template slot="totalAmount" slot-scope="scope">
            <span :class="{'textRed':isReadText(scope.data.row.totalAmount)}">{{handlerAccount(scope.data.row.totalAmount)}}</span>
          </template>
          <template>
            <el-table-column fixed="right" align="center" :label="$t('common.operate')" width="100px">
              <template slot-scope="scope">
                <!--红冲-->
                <auth-button icon="iconfont iconzhongxinjieru" :size="'small'"
                             class="iconCircle" v-if="enableHcom(scope.row)"
                             :menuCode="menuId" perms="hcbtn" :openPerms="true"
                             :title="$t('invoiceInformationList.hcbtn')" :loading="scope.row.hcLoading"
                             @click="handleClick(scope.row, 'H', scope.$index)"></auth-button>
                <!--编辑-->
                <auth-button :size="'small'" :title="$t('invoiceInformationList.editbtn')"
                             icon="iconfont iconbianji" v-if="enableEdit(scope.row)"
                             :menuCode="menuId" perms="editbtn" :openPerms="true"
                             class="iconCircle"
                             @click="handleClick(scope.row, 'E', scope.$index)"></auth-button>
              </template>
            </el-table-column>
          </template>
          <template slot="headButton">
            <div class="rightDiV">
              <!--下载发票-->
              <auth-button :size="'small'" :label="$t('invoiceInformationList.downloadInvoice')"
                           :menuCode="menuId" perms="btnDownloadInvoice" :openPerms="true"
                           icon="iconfont iconycpiliangxiazai" type="primary" :loading="downLoadPdfLoading"
                           @click="downLoadPdf"></auth-button>
              <!--下载模板-->
              <auth-button size="small" type="primary"
                           :label="$t('invoiceInformationList.downloadTemplate')"
                           :menuCode="menuId" perms="btnDownloadTemplate" class="titleHeadHeight"
                           :icon="'iconfont iconycxiazai'" :openPerms="true"
                           :loading="downloadFileByTemplateCodeLoading"
                           @click="downloadFileByTemplateCode"></auth-button>
              <!--导入-->
              <btn-auto-import class="marg10px" :importName="$t('ladingManageList.importFile')" :size="'small'"
                               :menuCode="menuId"
                               perms="btnImportFile" :openPerms="true" @upload="uploadSuccess"></btn-auto-import>
              <!--  导出所有数据 -->
              <btn-export :btnSize="'small'" :openPerms="true" :templateCode="'shourangsql003'" :queryParas="exportQueryParas"
                          :menuCode="menuId" class="marg10px" perms="btnExportFile"></btn-export>
            </div>
          </template>
        </data-table>
      </template>
    </up-down-layout>
    <invoice-information-edit :visible.sync="editVisible" :form="formItem" :menuCode="menuId" :editModel="editModel" ref="edit" @back="diaLogClose"></invoice-information-edit>
  </div>
</template>

<script>
import { upDownLayout, searchForm, DataTable, btnImport, btnExport,
  SelectCoreEnterprise, SelectFinancialInstitutions, btnAutoImport,
  btnDownload, btnBatchDownload, authButton } from 'newepoch-components'
import BasePage from '@/pages/basePage'
import invoiceApi from '@/api/invoiceApi'
import * as format from '@/filters/index'
import InvoiceInformationEdit from '@/pages/shourang/invoiceInformation/invoiceInformationEdit'
import { IMPORT_API } from '@/constant'
import mixin from '@/pages/mixin'
import fileApi from '@/api/fileApi'
import { downFile } from '@/utils/devUtils'

export default {
  extends: new BasePage(),
  mixins: [mixin],
  name: 'invoiceInformation',
  components: {
    InvoiceInformationEdit,
    upDownLayout,
    searchForm,
    DataTable,
    btnImport,
    btnExport,
    btnDownload,
    btnBatchDownload,
    authButton,
    btnAutoImport
  },
  computed: {
    api () {
      return invoiceApi.assetmgrinvoice
    },
    exportQueryParas () {
      return this.ExQueryParas
    }
  },
  data () {
    return {
      queryParas: {},
      ExQueryParas: {},
      downloadFileByTemplateCodeLoading: false,
      loadingTable: true,
      downLoadPdfLoading: false,
      importApi: IMPORT_API,
      batchfileID: [],
      total: {},
      fm: new FormData(),
      selectedRows: [],
      formItem: {},
      editModel: 'E',
      editVisible: false,
      footerFlag: true,
      sourceData: [],
      showsourceData: [],
      componentList: [
        // 核心企业
        {
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.coreEnterprises,
          value: 'coreEnterpriseId',
          componentName: SelectCoreEnterprise,
          placeholder: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.selectCoreEnterprises,
          labelWidth: '160px'
        },
        // 计划管理人/再保理银行
        {
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.refactorBank,
          value: 'planningManagerId',
          componentName: SelectFinancialInstitutions,
          placeholder: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.selectrefactorBank,
          labelWidth: '160px'
        },
        // 供应商名称
        {
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.supplierName,
          value: 'creditor',
          componentName: 'el-input',
          clearable: true,
          placeholder: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.inputsupplierName,
          labelWidth: '160px'
        },
        // 付款确认书编号
        {
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.paymentConfNum,
          value: 'assetCode',
          componentName: 'el-input',
          clearable: true,
          placeholder: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.inputpaymentConfNum,
          labelWidth: '160px'
        },
        // 计息日期
        {
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.accrualDate,
          value: 'accrualDate',
          name: 'accrualDate',
          componentName: 'el-date-picker',
          startPlaceholder: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.selectStartaccrualDate,
          endPlaceholder: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.endStartaccrualDate,
          labelWidth: '160px',
          type: 'daterange',
          format: 'timestamp'
        },
        // 资料是否完整
        {
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.dataComplete,
          value: 'dataCompleteFlag',
          componentName: 'SelectDictionary',
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
          labelWidth: '160px',
          dictTypeCode: 'ZD0003'
        },
        // 发票类型
        {
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.invoiceType,
          value: 'invoiceType',
          componentName: 'SelectDictionary',
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
          labelWidth: '160px',
          dictTypeCode: 'SCRS0104'
        },
        // 发票号码
        {
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.invoiceNum,
          value: 'invoiceNo',
          componentName: 'el-input',
          clearable: true,
          placeholder: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.inputinvoiceNum,
          labelWidth: '160px'
        },
        // 发票状态
        {
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.invoiceStatus,
          value: 'invoiceStatus',
          componentName: 'SelectDictionary',
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
          labelWidth: '160px',
          dictTypeCode: 'SCRS0105'
        },
        // 开票人
        {
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.drawer,
          value: 'openInvoiceName',
          componentName: 'el-input',
          clearable: true,
          placeholder: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.inputdrawer,
          labelWidth: '160px'
        },
        // 开票日
        {
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.invoiceDate,
          value: 'openDate',
          componentName: 'el-date-picker',
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
          labelWidth: '160px',
          format: 'timestamp'
        }
      ],
      columns: [
        // 付款确认书编号
        {
          prop: 'assetCode',
          align: 'left',
          sortable: true,
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.paymentConfNum,
          width: '150px'
        },
        // 核心企业
        {
          prop: 'coreEnterpriseName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.coreEnterprises,
          width: '200px'
        },
        // 计划管理人/再保理银行
        {
          prop: 'planningManagerName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.refactorBank,
          width: '180px'
        },
        // 供应商名称
        {
          prop: 'buyTaxpayerName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.supplierName,
          width: '200px'
        },
        // 供应商税号
        {
          prop: 'buyTaxpayerNo',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.supplierTaxNum,
          width: '180px'
        },
        // 银行账号
        {
          prop: 'bankNo',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.bankAccount,
          width: '180px'
        },
        // 地址电话
        {
          prop: 'addressPhone',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.addressTelephone,
          width: '180px'
        },
        // 发票代码
        {
          prop: 'invoiceCode',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.invoiceCode,
          width: '150px'
        },
        // 发票号码
        {
          prop: 'invoiceNo',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.invoiceNum,
          width: '150px'
        },
        // 开票日期
        {
          prop: 'openDate',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.invoiceDate,
          width: '110px',
          format: (row) => {
            let opendata = ''
            if (row.openDate) {
              opendata = format.formatDateTpcModify(Number(row.openDate))
            }
            return opendata
          }
        },
        // 商品名称
        {
          prop: 'itemName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.commodityName,
          width: '100px'
        },
        // 不含税金额（元）
        {
          prop: 'taxExcludingAmount',
          align: 'right',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.taxFreeAmount,
          width: '135px',
          headslot: true,
          slot: true,
          format: (row) => {
            if (row.taxExcludingAmount === 0) {
              return ''
            }
            return format.thousandFilter(row.taxExcludingAmount)
          }
        },
        // 税率
        {
          prop: 'taxRate',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.taxRate,
          width: '100px',
          format: (row) => {
            if (row.taxRate === 0 || !row.taxRate) {
              return ''
            }
            return (row.taxRate * 100).toFixed(2)
            // return (row.suppliersRateBiz * 100)
          }
        },
        // 税额（元）
        {
          prop: 'taxAmount',
          align: 'right',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.taxAmount,
          width: '95px',
          headslot: true,
          slot: true,
          format: (row) => {
            if (row.taxAmount === 0) {
              return ''
            } else {
              return format.thousandFilter(row.taxAmount)
            }
          }
        },
        // 价税合计（元）
        {
          prop: 'totalAmount',
          align: 'right',
          headslot: true,
          slot: true,
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.TaxTotal,
          width: '120px',
          format: (row) => {
            if (row.totalAmount === 0) {
              return ''
            } else {
              return format.thousandFilter(row.totalAmount)
            }
          }
        },
        // 保理起息日期
        {
          prop: 'factoringStartDate',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.factorStartDate,
          width: '120px',
          format: (row) => {
            let factorStartDate = ''
            if (row.factoringStartDate) {
              factorStartDate = format.formatDateTpcModify(Number(row.factoringStartDate))
            }
            return factorStartDate
          }
        },
        // 保理到期日期
        {
          prop: 'factoringExpirationDate',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.factorEndDate,
          width: '120px',
          format: (row) => {
            let factorEndDate = ''
            if (row.factoringExpirationDate) {
              factorEndDate = format.formatDateTpcModify(Number(row.factoringExpirationDate))
            }
            return factorEndDate
          }
        },
        // 资料是否完整
        {
          prop: 'dataCompleteFlag',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.dataComplete,
          width: '120px',
          format: (row) => {
            return format.formatDict(row.dataCompleteFlag, 'ZD0003')
          }
        },
        // 开票人
        {
          prop: 'openInvoiceName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.drawer,
          width: '100px'
        },
        // 收款人
        {
          prop: 'payee',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.Payee,
          width: '100px'
        },
        // 复核人
        {
          prop: 'reviewer',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.Reviewer,
          width: '100px'
        },
        // 发票类型
        {
          prop: 'invoiceType',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.invoiceType,
          width: '100px',
          format: (row) => {
            return format.formatDict(row.invoiceType, 'SCRS0104')
          }
        },
        // 发票状态
        {
          prop: 'invoiceStatus',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.invoiceStatus,
          width: '100px',
          format: (row) => {
            return format.formatDict(row.invoiceStatus, 'SCRS0105')
          }
        }
      ]
    }
  },
  methods: {
    // 处理金额
    handlerAccount (data) {
      if (!data || data.toString() === 0) {
        return ''
      }
      return format.thousandFilter(data)
    },
    // 是否标红
    isReadText (data) {
      if (data && Number(data) < 0) {
        return true
      }
      return false
    },
    // 可编辑
    enableEdit (data) {
      return data.invoiceType === '2' && data.invoiceStatus === '1' && data.openInvoiceType === '0'
    },
    // 可红冲
    enableHcom (data) {
      return data.invoiceType === '1' && data.invoiceStatus === '1' && data.openInvoiceType === '0'
    },
    downLoadPdf () {
      if (this.selectedRows.length > 0) {
        let keyIds = []
        this.selectedRows.forEach(it => {
          keyIds.push(it.keyId)
        })
        this.downLoadPdfLoading = true
        this.api.downLoadPdf({ keyIds: keyIds }).then(res => {
          fileApi.file.download({ keyId: res.data }).then(res => {
            downFile(res)
          })
        }).finally(() => {
          this.downLoadPdfLoading = false
        })
      } else {
        this.warning(this.$i18n.messages[this.$i18n.locale].invoiceInformationList.downloadInfo)
      }
    },
    getTableData (data) {
      this.loadingTable = false
      this.sourceData = []
      this.total = {}
      // 需先有值再有数据才会更新，否则不会更新金额
      // this.showsourceData = []
      // this.$refs.dataTableRef.vLoading = true
      invoiceApi.assetmgrinvoice.getAmount(this.queryParas).then(res => {
        this.$set(this.total, 'taxExcludingAmount', format.thousandFilter(res.data.taxExcludingAmount))
        this.$set(this.total, 'taxAmount', format.thousandFilter(res.data.taxAmount))
        this.$set(this.total, 'totalAmount', format.thousandFilter(res.data.totalAmount))
        this.sourceData.push(...data)
        // this.$set(this, 'showsourceData', data)
        // this.showsourceData.push(...this.sourceData)
      }).finally(res => {
        // this.$refs.dataTableRef.vLoading = false
        this.$nextTick(() => {
          this.loadingTable = true
        })
      })
    },
    check (row) {
      return row.invoiceStatus === '1'
    },
    // 禁选条件
    selectTable (row, index) {
      return row.invoiceType !== '2'
    },
    // 红冲、编辑
    handleClick (data, model, index) {
      if (model === 'E') {
        this.formItem = Object.assign({}, data)
        this.editModel = 'E'
        this.editVisible = true
        this.$refs['edit'].parentDialogVisible()
      } else {
        this.$set(this.showsourceData[index], 'hcLoading', true)
        invoiceApi.assetmgrinvoice.getdash(data).then(res => {
          if (res.data === false) {
            let message = this.$i18n.messages[this.$i18n.locale].invoiceInformationList.openerror
            let title = this.$i18n.messages[this.$i18n.locale].invoiceInformationList.openerrortitle
            let close = this.$i18n.messages[this.$i18n.locale].common.close
            this.$alert('<i class="el-icon-warning fontColor"></i><br/>' + message, title, {
              confirmButtonText: close,
              dangerouslyUseHTMLString: true,
              center: true
            })
          } if (res.data === true) {
            this.success(this.$i18n.messages[this.$i18n.locale].invoiceInformationList.openInvoiceSuccessInfo)
            this.coustomHandleFilter()
          }
        }).finally(() => {
          this.$set(this.showsourceData[index], 'hcLoading', false)
        })
      }
    },
    // 导入逻辑
    uploadSuccess (file) {
      this.fm = new FormData()
      this.fm.append('file', file)
      this.api.importExcel(this.fm).then(res => {
        if (res.data.failData.length > 0) {
          this.api.filegenTemplateCode({ map: { api: { data: res.data.failData } } }, res.data.templateCode).then(res => {
            if (res.success) {
              fileApi.file.download({ keyId: res.data }).then(res => {
                downFile(res, this.reName, this.inlineName)
              })
            } else {
              this.error(this.$i18n.messages[this.$i18n.locale].invoiceInformationList.importFaile)
            }
          })
        } else {
          this.success(this.$i18n.messages[this.$i18n.locale].invoiceInformationList.importSuccess)
          this.coustomHandleFilter()
        }
      })
    },
    // 下载发票
    beforeBtchDownload () {
      if (this.selectedRows.length === 0) {
        return this.$message({
          type: 'warning',
          message: this.$i18n.messages[this.$i18n.locale].invoiceInformationList.downloadInfo
        })
      } else {
        this.batchfileID = []
        this.selectedRows.forEach(it => {
          this.batchfileID.push(it)
        })
        return true
      }
    },
    // 下载模板
    downloadFileByTemplateCode () {
      this.downloadFileByTemplateCodeLoading = true
      fileApi.file.downloadFileByTemplateCode({ templateCode: 'assetassignee08' }).then(res => {
        downFile(res)
      }).finally(res => {
        this.downloadFileByTemplateCodeLoading = false
      })
    },
    // 导入成功
    // importSuccess (returnData) {
    //   let data = []
    //   returnData.forEach((item, index) => {
    //     let flag = true
    //     item.forEach(it1 => {
    //       if (!this.UtilJs.isEmpty(it1)) {
    //         flag = false
    //       }
    //     })
    //     if (!flag) {
    //       item.index = index
    //       data.push(item)
    //     }
    //   })
    //   if (data instanceof Array && data.length > 1) {
    //     let isCheck = this.UtilJs.arrayRegCheck('付款确认书编号', data, 0, null, '', '', true, '请输入中英文格式')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.arrayRegCheck('供应商名称', data, 1, null, '', '', true, '请输入')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.arrayRegCheck('供应商税号', data, 2, null, '', '', true, '请输入')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.arrayRegCheck('银行账号', data, 3, null, '', '', true, '请输入')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.arrayRegCheck('地址电话', data, 4, null, '', '', true, '请输入')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.arrayRegCheck('发票代码', data, 5, null, '', '', true, '请输入')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.arrayRegCheck('发票号码', data, 6, null, '', '', true, '请输入')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.arrayRegCheck('开票日期', data, 7, null, '', '', true, '请输入')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.arrayRegCheck('商品名称', data, 8, null, '', '', true, '请输入')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.arrayRegCheck('不含税金额（元）', data, 9, null, '', '', true, '请输入')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.arrayRegCheck('税率', data, 10, null, '', '', true, '请输入')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.arrayRegCheck('税额（元）', data, 11, null, '', '', true, '请输入')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.arrayRegCheck('价税合计（元）', data, 12, null, '', '', true, '请输入')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.arrayRegCheck('保理起息日期', data, 13, null, '', '', true, '请输入')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.arrayRegCheck('保理到期日期', data, 14, null, '', '', true, '请输入')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.dictFormatCheck('资料是否完整', data, 15, 'ZD0003', false, '请输入是否')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.arrayRegCheck('开票人', data, 16, null, '', '', true, '请输入')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.arrayRegCheck('收款人', data, 17, null, '', '', true, '请输入')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.arrayRegCheck('复核人', data, 18, null, '', '', true, '请输入')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.arrayRegCheck('发票类型', data, 19, null, '', '', true, '请输入')
    //     if (!isCheck) {
    //       return false
    //     }
    //     isCheck = this.UtilJs.dictFormatCheck('发票状态', data, 20, 'ZD0052', false, '请输入是否')
    //     if (!isCheck) {
    //       return false
    //     }
    //     let importDatas = []
    //     data.forEach((it, index) => {
    //       if (index > 0) {
    //         importDatas.push(
    //           {
    //             accountName: it[0],
    //             accountNumber: it[1],
    //             openingBank: it[2],
    //             largeSerialName: it[3],
    //             largeSerialNumber: it[4],
    //             province: it[5],
    //             city: it[6],
    //             existBlacklist: it[7]
    //             // modifyUserName: store.getters.nikeName
    //           }
    //         )
    //       }
    //     })
    //     let $this = this
    //     invoiceApi.assetmgrinvoice.creates(importDatas).then(res => {
    //       if (res.success && res.data) {
    //         $this.coustomHandleFilter()
    //         $this.success(this.$i18n.messages[this.$i18n.locale].invoiceInformationList.importSuccess)
    //       } else {
    //         $this.error(this.$i18n.messages[this.$i18n.locale].invoiceInformationList.importFaile)
    //       }
    //     })
    //   } else {
    //     this.warning(this.$i18n.messages[this.$i18n.locale].invoiceInformationList.noloadData)
    //   }
    // },
    diaLogClose () {
      this.coustomHandleFilter()
    },
    coustomHandleFilter () {
      let queryParas = this.queryParas
      if (queryParas.accrualDate && queryParas.accrualDate.length === 2) {
        this.queryParas.factoringStartDate = queryParas.accrualDate[0]
        this.queryParas.factoringExpirationDate = queryParas.accrualDate[1]
      } else {
        if (this.queryParas.factoringStartDate) {
          delete this.queryParas.factoringStartDate
        }
        if (this.queryParas.factoringExpirationDate) {
          delete this.queryParas.factoringExpirationDate
        }
        delete this.queryParas.accrualDate
      }
      this.ExQueryParas = queryParas
      this.handleFilter()
    }
    // getDataByApi () {
    //   this.api.getPage(this.queryParas).then(res => {
    //     if (res.success) {
    //       if (res.data && res.data[this.datasField]) {
    //         this.$refs.dataTableRef.buildTableData(res.data['datas'], res.data['totalRow'])
    //         this.sourceData = res.data['datas']
    //         this.getTableData(this.sourceData)
    //       }
    //     }
    //   })
    // }
  }
}
</script>

<style scoped lang="scss">
  @import '~@/styles/shourang/invoiceInformation/invoiceInformationList.scss';
</style>
