<template>
<!-- 保理业务信息查询 -->
  <div>
    <up-down-layout :header="$t('factoringBusinessInfoQuery.title1')" :handleFlag.sync="handleFlag">
      <search-form :formValue.sync="queryParas"
                   searchPerms="search"
                   @handleFilter="handleFilter"
                   @clearParam="clearParam"
                   slot="query"
                   resetPerms="reset"
                   :componentList="componentList"></search-form>
      <template slot="table">
        <data-table :api="api" :deleteApi="api"
                    :headTitle = "$t('factoringBusinessInfoQuery.tableHead')"
                    :showSelection="true"
                    selectable="false"
                    :handleFlag.sync="handleFlag"
                    :sourceData.sync="sourceData"
                    :menuFlag="false"
                    :queryParas="queryParas"
                    :loadCount.sync="loadCount"
                    :columns="columns"
                    :otherHeight="'240'"
                    operateBtnLayout=""
                    :IsRight="false"
                    :pageAll="true"
                    :operatWidth="'200'"
                    @selectRowChange="selectRowChange">
                    <template slot="headButton">
                        <div align="right" style="margin-top: 12px;">
                          <auth-button size="small" type="primary" :label="$t('factoringBusinessInfoQuery.noticeDown')" @click="downFils('N')"></auth-button>
                          <auth-button size="small" type="primary" :label="$t('factoringBusinessInfoQuery.projCompConfirmDocDown')" @click="downFils('P')"></auth-button>
                          <auth-button size="small" type="primary" :label="$t('factoringBusinessInfoQuery.LoanDetailsDown')" @click="downFils('L')"></auth-button>
                          <auth-button size="small" type="primary" :label="$t('factoringBusinessInfoQuery.invoiceBulkDown')" @click="downFils('I')"></auth-button>
                          <auth-button size="small" type="primary" :label="$t('factoringBusinessInfoQuery.bankReceiptsBatchDown')" @click="downFils('B')"></auth-button>
                        </div>
                    </template>
                    <!-- 操作 -->
                    <el-table-column align="center" fixed="right"  :label="$t('common.operate')" width="120px">
                      <template slot-scope="scope">
                        <auth-button size="small" class="iconCircle" icon="iconfont iconbianji" :title="$t('factoringBusinessInfoQuery.orderResume')" @click="handleClick(scope.row, 'OR')"></auth-button>
                        <auth-button size="small" class="iconCircle" icon="iconfont iconmore" :title="$t('factoringBusinessInfoQuery.details')" @click="handleClick(scope.row, 'DV')"></auth-button>
                      </template>
                    </el-table-column>
        </data-table>
      </template>
    </up-down-layout>
  </div>
</template>
<script>
import components from 'newepoch-components'
import SelectCoreEnterprise from '@/components/element/shourang/SelectCoreEnterprise'
import SelectFinancialInstitutions from '@/components/element/shourang/SelectFinancialInstitutions'
import BasePage from '@/pages/basePage'
import SelectArea from '@/components/element/shourang/SelectArea'
// import SelectPrimitiveRightsHolder from '@/components/element/SelectPrimitiveRightsHolder'
// import SelectAssestService from '@/components/element/shouji/SelectAssestService'
// import SelectAreaCode from '@/components/element/shouji/SelectAreaCode'
import factoringBusinessInfoQueryApi from '@/api/factoringBusinessInfoQueryApi'

import * as format from '@/filters/index'
// import fileApi from '@/api/fileApi'
// import { downFile } from '@/utils/devUtils'

export default {
  extends: new BasePage('factoringBusinessInfoQuery'),
  name: 'factoringBusinessInfoQueryList',
  components: {
    searchForm: components.searchForm,
    upDownLayout: components.upDownLayout,
    DataTable: components.DataTable,
    authButton: components.authButton
  },
  data () {
    return {
      formatDict: format.formatDict,
      templateCode: 'shourang002',
      handleFlag: true,
      forceAllFiles: false,
      gsmEditVisible: false,
      gsmEditItem: {},
      gsmBatchSetVisible: false,
      gsmBatchSetItem: {},
      loadCount: 0,
      queryParas: {
        fileBussType: '1',
        projectCompanyId: null
      },
      queryData: {},
      componentList: [
        {
          // 供应商名称
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.supplierName,
          value: 'supplierName',
          componentName: 'el-input',
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          labelWidth: '160px'
        },
        {
          // 核心企业
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.coreEnterpriseName,
          disabled: false,
          value: 'coreEnterpriseId',
          labelWidth: '160px',
          clearable: true,
          componentName: SelectCoreEnterprise
        },
        {
          // 计划管理人/再保理银行
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.planningManagerName,
          disabled: false,
          value: 'planningManagerId',
          labelWidth: '160px',
          clearable: true,
          componentName: SelectFinancialInstitutions
        },
        {
          // 保理专员姓名
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.factorCommissionerName,
          value: 'factorCommissionerName',
          componentName: 'el-input',
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          labelWidth: '160px'
        },
        {
          // 付款确认书编号
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.payCode,
          disabled: false,
          value: 'payCode',
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          labelWidth: '160px',
          clearable: true,
          componentName: 'el-input'
        },
        {
          // 项目公司名称
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.projectCompanyName,
          disabled: false,
          value: 'projectCompanyName',
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          labelWidth: '160px',
          clearable: true,
          componentName: 'el-input'
        },
        {
          // 合同名称
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.contractName,
          disabled: false,
          value: 'contractName',
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          labelWidth: '160px',
          clearable: true,
          componentName: 'el-input'
        },
        {
          // 保理金额
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.factorAmount,
          disabled: false,
          value: 'factorAmount',
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          labelWidth: '160px',
          clearable: true,
          componentName: 'el-input'
        },
        {
          // 期数
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.specialPlanPeriods,
          value: 'specialPlanPeriods',
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          labelWidth: '160px',
          componentName: 'el-input'
        },
        {
          // 区域专员姓名
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.regionAttacheName,
          value: 'regionAttacheName',
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          labelWidth: '160px',
          componentName: 'el-input'
        },
        {
          // 区域编号
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.regionCode,
          disabled: false,
          value: 'regionCode',
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
          componentName: 'el-input',
          clearable: true,
          labelWidth: '160px'
        },
        {
          // 区域
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.region,
          value: 'region',
          labelWidth: '160px',
          componentName: SelectArea,
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseSelect,
          multiple: true
        }
      ],
      columns: [
        {
          // 产品名称
          prop: 'productName',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.productName,
          width: '200px'
        },
        {
          // 核心企业
          prop: 'coreEnterpriseName',
          align: 'center',
          width: '101px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.coreEnterpriseName
        },
        {
          // 计划管理人/再保理银行
          prop: 'planningManagerName',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].documentSealingTaskManage.refactorBank,
          width: '280px'
        },
        {
          // 期数
          prop: 'specialPlanPeriods',
          align: 'center',
          width: '101px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.specialPlanPeriods
        },
        {
          // 区域
          prop: 'region',
          align: 'center',
          width: '101px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.region
        },
        {
          // 区域编号
          prop: 'regionCode',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.regionCode,
          width: '100px'
        },
        {
          // 项目公司名称
          prop: 'projectCompanyName',
          align: 'center',
          width: '135px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.projectCompanyName
        },
        {
          // 付款确认书编号
          prop: 'payCode',
          align: 'center',
          width: '143px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.payCode
        },
        {
          // 供应商名称
          prop: 'suppliersName',
          align: 'center',
          width: '115px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.suppliersName
        },
        {
          // 状态
          prop: 'status',
          align: 'center',
          width: '115px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.status
        },
        {
          // 保理金额
          prop: 'factorAmount',
          align: 'center',
          width: '115px',
          sortable: true,
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.factorAmount,
          format: (row) => { return format.thousandFilter(row.factorAmount) }
        },
        {
          // 基础合同名称
          prop: 'basicContractName',
          align: 'center',
          width: '115px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.basicContractName
        },
        {
          // 项目名称
          prop: 'projectName',
          align: 'center',
          width: '115px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.projectName
        },
        {
          // 合同类型
          prop: 'contractType',
          align: 'center',
          width: '115px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.contractType
        },
        {
          // 放款金额
          prop: 'loanAmount',
          align: 'center',
          width: '130px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.loanAmount,
          format: (row) => { return format.thousandFilter(row.loanAmount) }
        },
        {
          // 放款日期
          prop: 'loanDate',
          align: 'center',
          width: '115px',
          sortable: true,
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.loanDate,
          format: (row) => { return format.formatDate(row.loanDate) }
        },
        {
          // 账款到期日
          prop: 'dueDate',
          align: 'center',
          width: '115px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.dueDate,
          format: (row) => { return format.formatDate(row.dueDate) }
        },
        {
          // 利息
          prop: 'interest',
          align: 'center',
          width: '130px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.interest,
          format: (row) => { return format.thousandFilter(row.interest) }
        },
        {
          // 费率
          prop: 'factoringInterestRate',
          align: 'center',
          width: '130px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.factoringInterestRate
        },
        {
          // 收款人名称
          prop: 'payee',
          align: 'center',
          width: '115px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.payee
        },
        {
          // 收款账号
          prop: 'receivingAccount',
          align: 'center',
          width: '135px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.receivingAccount
        },
        {
          // 账号名称
          prop: 'accountName',
          align: 'center',
          width: '135px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.accountName
        },
        {
          // 发票号码
          prop: 'invoiceNum',
          align: 'center',
          width: '143px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.invoiceNum
        },
        {
          // 开票状态
          prop: 'billingStatus',
          align: 'center',
          width: '135px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.billingStatus
          // ,
          // format: (row) => { return format.formatDict(row.billingStatus, '') }
        },
        {
          // 是否有补寄
          prop: 'anyReMails',
          align: 'center',
          width: '135px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.anyReMails
          // ,
          // format: (row) => { return format.formatDict(row.anyReMails, 'ZD0003') }
        },
        {
          // 保理专员姓名
          prop: 'factorCommissionerName',
          align: 'center',
          width: '113px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.factorCommissionerName
        },
        {
          // 业务人员
          prop: 'businessPersonnel',
          align: 'center',
          width: '113px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.businessPersonnel
        },
        {
          // 区域专员姓名
          prop: 'regionAttacheName',
          align: 'center',
          width: '113px',
          label: this.$i18n.messages[this.$i18n.locale].factoringBusinessInfoQuery.regionAttacheName
        }
      ],
      sourceData: [
        {
          productName: '123456'
        }
      ],
      selectRows: []
    }
  },
  computed: {
    api () {
      return factoringBusinessInfoQueryApi.factoringBusinessInfoQuery
    }
  },
  mounted () {
    // this.loadCount = this.loadCount + 1
    // this.handleFilter()
  },
  methods: {
    downFils (type) {
      // 'N':通知书下载,'P':项目公司确权文件下载,'L':放款明细下载,'I':发票批量下载,'B':银行回单批量下载
    },
    clearParam () {
      this.queryParas = {
        pageIndex: 1,
        pageSize: 10
      }
    },
    handleClick (row, emonType) {
      if (emonType === 'E') {
        this.gsmEditItem = Object.assign({}, row)
        this.gsmEditVisible = true
      } else if (emonType === 'L') {
      }
    },
    selectRowChange (selectRows) {
      this.selectRows = selectRows
    }
  },
  filters: {},
  watch: {
  }
}
</script>
<style scoped>

</style>
