<!--提单统筹管理-->
<template>
  <div>
    <up-down-layout :handleFlag.sync="handleFlag" :header="$t('ladingPlanManageList.ladingManage')">
      <search-form @clearParam="clearParam" @handleFilter="handleFilter" :menuCode="menuId"
                   @selectChanged="selectChanged"
                   searchPerms="search" resetPerms="reset" :formValue.sync="queryParas" v-model="queryParas"
                   :componentList="componentList" slot="query">
      </search-form>
      <template slot="table">
        <el-form :model="formTableData" ref="formTableData" :show-message="false">
          <data-table :menuCode="menuId" :headTitle="$t('ladingPlanManageList.ladingManageInfoList')" :cellStyle="cellStyle"
                      :row-style="rowStyle"
                      :api="api" :handleFlag.sync="handleFlag" :showSelection="true" @selectRowChange="selectionData" v-bind="elHeightObj"
                      :queryParas="queryParas" :sourceData.sync="formTableData.sourceData" :menuFlag="true"
                      :loadCount.sync="loadCount" :columns="columns" :operateBtnLayout="operateBtnLayout">
            <template slot="headButton">
              <el-row>
                <el-col :span="24" class="textRight">
                  <auth-button icon="iconfont iconpiliangshezhichanpinxinxi" size="medium"
                               :menuCode="menuId" perms="batchSetProductInfo" :openPerms="true"
                               type="primary" :label="$t('ladingPlanManageList.batchSetProductInfo')" @click="batchSetProductInfo"></auth-button>
                  <auth-button icon="iconfont icondaoru" size="medium" type="primary"
                               :menuCode="menuId" perms="showImport" :openPerms="true"
                               :label="$t('common.import')" @click="showImport"></auth-button>
                  <auth-button icon="iconfont iconshangchuan" size="medium" type="primary"
                               :menuCode="menuId" perms="showBatchUpload" :openPerms="true"
                               :label="$t('ladingPlanManageList.batchUpload')" @click="showBatchUpload"></auth-button>
                  <auth-button icon="iconfont icondaochu" size="medium" type="primary" :loading="loading"
                               :menuCode="menuId" perms="exportData" :openPerms="true"
                               :label="$t('common.export')" @click="exportData"></auth-button>
                  <auth-button icon="iconfont iconxiazai1" size="medium" type="primary"
                               :menuCode="menuId" perms="showImportFileHistory" :openPerms="true"
                               :label="$t('ladingPlanManageList.downloadImportFile')" @click="showImportFileHistory"></auth-button>
                  <auth-button icon="iconfont icontuisong" size="medium" type="primary"
                               :menuCode="menuId" perms="batchPush" :openPerms="true"
                               :label="$t('ladingPlanManageList.batchPush')" @click="batchPush"></auth-button>
                </el-col>
              </el-row>
            </template>
            <el-table-column align="center" min-width="300px" :label="$t('common.operate')" fixed="right">
              <template slot-scope="scope">
                <btn-upload :classType="true" :menuCode="menuId" perms="upload" :openPerms="true" :rowData="scope.row" :fileID="scope.row.hasFile"
                            v-if="scope.row.stopStatus !== '1'"
                            class="marginLeft10"
                            @uploadSuccess="uploadSuccess" :uploadApi="uploadApi"></btn-upload>
                <btn-download :size="'small'"
                              v-if="scope.row.hasFile === '1'"
                              :fileID="scope.row.fileId"
                              class="marginLeft10"
                              :title="$t('common.downLoad')"
                              :openPerms="true" :menuCode="menuId" perms="downloadBtnPer"
                              :classType="false">
                </btn-download>
                <btn-upload v-if="replenishDataShow(scope.row)"
                            :menuCode="menuId" perms="replenishData" :openPerms="true" :uploadApi="uploadApi"
                            :classType="true" class="marginLeft10" icon="iconfont iconziliaobuchong" :rowData="scope.row"
                            :title="$t('ladingPlanManageList.replenishData')" @uploadSuccess="replenishData"></btn-upload>
                <auth-button size="small" class="iconCircle marginLeft10" icon="iconfont iconlvli"
                             :menuCode="menuId" perms="showRecordInfo" :openPerms="true"
                             :title="$t('ladingPlanManageList.record')" @click="showRecordInfo(scope.row)"></auth-button>
                <auth-button size="small" class="iconCircle" icon="iconfont icontuisong11"
                             :menuCode="menuId" perms="showSinglePush" :openPerms="true"
                             :title="$t('ladingPlanManageList.singlePush')" @click="showSinglePush(scope.row)"></auth-button>
                <auth-button size="small" class="iconCircle" icon="iconfont iconbianji"
                             :menuCode="menuId" perms="edit" :openPerms="true"
                             :title="$t('common.edit')" @click="showEdit(scope.row)"></auth-button>
              </template>
            </el-table-column>
          </data-table>
        </el-form>
      </template>
    </up-down-layout>
    <lading-manage-edit :visible.sync="ladingManageVisible" editModel="E" :form="item" @close="handleFilter" :menuCode="menuId"></lading-manage-edit>
    <import-file-history-edit :visible.sync="importFileHistoryVisible" editModel="V" :form="item" :menuCode="menuId"></import-file-history-edit>
    <record-info-edit :visible.sync="recordInfoVisible" editModel="V" :form="item"></record-info-edit>
    <import-edit code="20" :menuCode="menuId" :visible.sync="importVisible" editModel="E" :form="item" @close="handleFilter"></import-edit>
    <batch-upload-edit :menuCode="menuId" :visible.sync="batchUploadVisible" editModel="E" :form="item" @close="handleFilter"></batch-upload-edit>
    <single-push :visible.sync="singlePushVisible" :editModel="singlePusheditModel" :form="item" @closeAndShow="showResult" :menuCode="menuId"></single-push>
    <single-push-result :visible.sync="singlePushResultVisible" :editModel="'V'" :form="item" @close="handleFilter"></single-push-result>
    <batch-product-info-edit :visible.sync="importProductVisible" editModel="E" :form="item" @close="handleFilter"></batch-product-info-edit>
  </div>
</template>

<script>
import BasePage from '@/pages/basePage'
import { upDownLayout, searchForm, DataTable, authButton, btnImport, btnBatchUpload,
  SelectCoreEnterpriseCascade, SelectProductName, SelectFinancialInstitutionsCascade, SelectPeriodsCascade,
  SelectAssetsServiceCascade, SelectPrimitiveRightsHolderCascade, SelectAreaCommissioner, SelectSmallArea,
  btnDownload, btnUpload } from 'newepoch-components'
import SelectCompanyName from '@/components/element/shourang/SelectCompanyName'
import ladingManageApi from '@/api/ladingManageApi'
import { UPLOAD_API } from '@/constant'
import LadingManageEdit from '@/pages/shouji/ladingManage/ladingManageEdit.vue'
import ImportFileHistoryEdit from '@/pages/shouji/ladingPlanManage/importFileHistoryEdit'
import batchProductInfoEdit from '@/pages/shouji/ladingPlanManage/batchProductInfoEdit'
import RecordInfoEdit from '@/pages/shouji/ladingPlanManage/recordInfoEdit'
import ImportEdit from '@/pages/shouji/guideSheetManage/importEdit.vue'
import componentsApi from '@/api/componentsApi'
import BatchUploadEdit from '@/pages/shouji/ladingPlanManage/batchUploadEdit'
import SinglePush from './singlePush'
import singlePushResult from './singlePushResult'
import * as format from '@/filters/index'
import fileApi from '@/api/fileApi.js'
import { downFile } from '@/utils/devUtils'
import mixin from '@/pages/mixin'
export default {
  extends: new BasePage(),
  mixins: [mixin],
  name: 'ladingPlanManageList',
  components: {
    SinglePush,
    singlePushResult,
    LadingManageEdit,
    ImportFileHistoryEdit,
    RecordInfoEdit,
    ImportEdit,
    BatchUploadEdit,
    upDownLayout,
    searchForm,
    DataTable,
    authButton,
    btnImport,
    SelectCompanyName,
    btnBatchUpload,
    btnDownload,
    btnUpload,
    batchProductInfoEdit
  },
  mounted () {
    if (this.queryParas) {
      this.queryParas = Object.assign({}, { pageIndex: 1, pageSize: 10 })
    }
  },
  // activated () {
  //   if (this.queryParas) {
  //     this.queryParas = Object.assign({}, { pageIndex: 1, pageSize: 10 })
  //   }
  // },
  data () {
    const labelWidth = '165px' // 整体搜索文字大小
    const labelWidthCenter = '165px' // 整体搜索文字大小
    const labelWidthRight = '165px' // 整体搜索文字大小
    return {
      loading: false,
      importProductVisible: false,
      areaCommissionerMemoVisible: false,
      abnormalDataAdjustmentVisible: false,
      ladingManageVisible: false,
      importFileHistoryVisible: false,
      recordInfoVisible: false,
      importVisible: false,
      batchUploadVisible: false,
      singlePushVisible: false,
      singlePusheditModel: 'E',
      singlePushResultVisible: false,
      operateBtnLayout: '',
      expressForm: '',
      formTableData: {
        sourceData: []
      },
      uploadApi: UPLOAD_API,
      selectedRows: [],
      componentList: [
        // 产品名称
        {
          label: this.$i18n.messages[this.$i18n.locale].common.productName,
          value: 'projectId',
          name: 'projectName',
          componentName: SelectProductName,
          clearable: true,
          labelWidth: labelWidth
        },
        // 期数
        {
          label: this.$i18n.messages[this.$i18n.locale].common.periodsNum,
          value: 'specialPlanPeriodsId',
          name: 'specialPlanPeriodsId',
          placeholder: '请输入',
          queryName: 'projectId',
          queryValue: 'projectId',
          componentName: SelectPeriodsCascade,
          clearable: true,
          labelWidth: labelWidthCenter
        },
        // 核心企业
        {
          label: this.$i18n.messages[this.$i18n.locale].common.coreEnterprises,
          value: 'coreEnterpriseId',
          name: 'coreEnterpriseId',
          queryName: 'projectId',
          queryValue: 'projectId',
          clearable: true,
          componentName: SelectCoreEnterpriseCascade,
          labelWidth: labelWidthRight
        },
        // 计划管理人/再保理银行
        {
          label: this.$i18n.messages[this.$i18n.locale].common.refactorBank,
          value: 'planningManagerId',
          queryName: 'projectId',
          queryValue: 'projectId',
          componentName: SelectFinancialInstitutionsCascade,
          labelWidth: labelWidth
        },
        // 原始权益人
        {
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.rightsHolder,
          value: 'initialOwnersId',
          queryName: 'projectId',
          queryValue: 'projectId',
          clearable: true,
          componentName: SelectPrimitiveRightsHolderCascade,
          labelWidth: labelWidthCenter
        },
        // 资产服务机构
        {
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.assetServiceOrgan,
          value: 'assetServiceId',
          queryName: 'projectId',
          queryValue: 'projectId',
          clearable: true,
          componentName: SelectAssetsServiceCascade,
          labelWidth: labelWidthRight
        },
        // 区域
        {
          label: this.$i18n.messages[this.$i18n.locale].common.area,
          value: 'coreArea',
          name: 'coreArea',
          multiple: false,
          componentName: SelectSmallArea,
          queryName: 'coreCompanyId',
          queryValue: 'coreEnterpriseId',
          clearable: true,
          labelWidth: labelWidth
        },
        // 区域专员
        {
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.areaCommissioner,
          value: 'coreAreaAttache',
          componentName: SelectAreaCommissioner,
          clearable: true,
          labelWidth: labelWidthCenter
        },
        // 项目公司名称
        {
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.projectCompanyName,
          value: 'debtor',
          clearable: true,
          componentName: 'el-input',
          labelWidth: labelWidthRight
        },
        // 项目名称
        {
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.projectName,
          value: 'projectContractName',
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          componentName: 'el-input',
          clearable: true,
          labelWidth: labelWidth
        },
        // 区域编号
        {
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.areaCode,
          value: 'regionCode',
          placeholder: this.$i18n.messages[this.$i18n.locale].common.pleaseInput,
          componentName: 'el-input',
          clearable: true,
          labelWidth: labelWidthCenter
        },
        // 提单模式
        {
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.ladingMode,
          value: 'ladingWay',
          componentName: 'SelectDictionary',
          clearable: true,
          dictTypeCode: 'ZD0101',
          labelWidth: labelWidthRight
        },
        // 预提单确认状态
        {
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.advanceLadingStatus,
          value: 'planLadingConfirmStatus',
          componentName: 'SelectDictionary',
          dictTypeCode: 'ZD0102',
          clearable: true,
          labelWidth: labelWidth
        },
        // 正式提单确认状态
        {
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.formalLadingStatus,
          value: 'officalLadingConfirmStatus',
          componentName: 'SelectDictionary',
          dictTypeCode: 'ZD0103',
          clearable: true,
          labelWidth: labelWidthCenter
        }
      ],
      columns: [
        {
          // 付款确认书编号
          prop: 'assetCode',
          align: 'left',
          width: '250px',
          label: this.$i18n.messages[this.$i18n.locale].guideSheetManage.payCode
        },
        // 供应商名称
        {
          prop: 'creditor',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.supplierName,
          width: '200px'
        },
        // 收款人名称
        {
          prop: 'receiverName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.payee,
          width: '200px'
        },
        // 项目名称
        {
          prop: 'projectContractName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.projectName,
          width: '200px'
        },
        // 区域
        {
          prop: 'coreAreaName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].common.area,
          width: '120px'
        },
        // 区域编号
        {
          prop: 'regionCode',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.areaCode,
          width: '160px'
        },
        // 区域专员
        {
          prop: 'coreAreaAttacheName',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.areaCommissioner,
          width: '100px'
        },
        // 区域专员备注
        {
          prop: 'coreAreaRemark',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.areaCommissionerMemo,
          width: '200px'
        },
        // 产品名称
        {
          prop: 'projectName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].common.productName,
          width: '200px'
        },
        // 期数
        {
          prop: 'specialPlanPeriods',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].common.periodsNum,
          width: '60px',
          format: (row) => {
            if (!row.specialPlanPeriods || row.specialPlanPeriods.toString() === '0') {
              return ''
            } else {
              return row.specialPlanPeriods
            }
          }
        },
        // 核心企业
        {
          prop: 'coreEnterpriseName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].common.coreEnterprises,
          width: '200px'
        },
        // 计划管理人/再保理银行
        {
          prop: 'planningManagerName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].common.refactorBank,
          width: '200px'
        },
        // 提单类型
        {
          prop: 'ladingType',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.ladingType,
          width: '100px',
          format: (row) => { return format.formatDict(row.ladingType, 'ZD0100') }
        },
        // 原始权益人
        {
          prop: 'initialOwnersName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.rightsHolder,
          width: '200px'
        },
        // 资产服务机构
        {
          prop: 'assetServiceName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.assetServiceOrgan,
          width: '200px'
        },
        // 应收账款金额
        {
          prop: 'factoringMoney',
          align: 'right',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.accountReceivable,
          width: '150px',
          format: (row) => { return format.thousandFilter(row.factoringMoney) }
        },
        // 项目公司名称（债务人）
        {
          prop: 'debtor',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.projectCompanyName,
          width: '200px'
        },
        // 开户行
        {
          prop: 'receiverBank',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.openingBank,
          width: '200px'
        },
        // 收款账号
        {
          prop: 'receiverBankAccount',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.payAccount,
          width: '200px'
        },
        // 合同名称
        {
          prop: 'basicContractName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.contractName,
          width: '200px'
        },
        // 合同编号
        {
          prop: 'basicContractCode',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.contractNum,
          width: '200px'
        },
        // 发票号码
        {
          prop: 'invoiceNo',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.invoiceNum,
          width: '200px'
        },
        // 发票金额
        {
          prop: 'taxExcludingAmount',
          align: 'right',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.invoiceAmount,
          width: '150px',
          format: (row) => { return format.thousandFilter(row.taxExcludingAmount) }
        },
        {
          // 批次日期
          prop: 'factoringApplyTime',
          align: 'center',
          width: '150px',
          label: this.$i18n.messages[this.$i18n.locale].guideSheetManage.factApplicationDate,
          format: (row) => { return format.formatDateTpcModify(row.factoringApplyTime) }
        },
        // 预提单确认状态
        {
          prop: 'planLadingConfirmStatus',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.advanceLadingStatus,
          width: '120px',
          format: (row) => { return format.formatDict(row.planLadingConfirmStatus, 'ZD0102') }
        },
        // 正式提单确认状态
        {
          prop: 'officalLadingConfirmStatus',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].ladingPlanManageList.formalLadingStatus,
          width: '135px',
          format: (row) => { return format.formatDict(row.officalLadingConfirmStatus, 'ZD0103') }
        }
      ]
    }
  },
  computed: {
    api: function () {
      return ladingManageApi.ladingPlanManageList
    }
  },
  methods: {
    showResult (data) {
      this.handleFilter()
      this.item = Object.assign({}, { data: data })
      this.singlePushResultVisible = true
    },
    // 根据ID获取产品类别
    getTypeById () {
      componentsApi.productenterprise.getclassify({ projectId: this.queryParas.projectId }).then(res => {
        let disabled = res.data ? res.data.productType : '2'
        this.$set(this.componentList[1], 'disabled', disabled !== '1')
        this.$set(this.queryParas, 'specialPlanPeriodsId', '')
      })
    },
    selectChanged (obj) {
      if (obj.specialPlanPeriodsIdInfo) {
        this.queryParas.specialPlanPeriods = obj.specialPlanPeriodsIdInfo.specialPlanPeriods
      }
      if (obj.projectNameInfo) {
        this.getTypeById()
      }
      if (Object.keys(obj).some(it => it === 'projectNameInfo')) {
        this.clearInfoList()
      }
      // if (Object.keys(obj).some(it => it === 'coreEnterpriseIdInfo')) {
      //   if (!obj.coreEnterpriseIdInfo || !this.queryParas.coreEnterpriseId || obj.coreEnterpriseIdInfo.enterpriseId !== this.queryParas.coreEnterpriseId) {
      //     this.clearcoreAreaId()
      //   }
      // }
    },
    rowStyle ({ row, rowIndex }) {
      if (row.coreAreaAttache === '0' && row.coreArea === '0') {
        return 'background-color: rgba(255, 237, 235, 1);'
      } else {
        return ''
      }
    },
    cellStyle ({ row, column, rowIndex, columnIndex }) {
      if (row.errorFields instanceof Array) {
        let flag = false
        row.errorFields.forEach(it => {
          if (it === column.property) {
            flag = true
          }
        })
        if (flag) {
          return 'color: red'
        } else {
          return ''
        }
      } else {
        return ''
      }
    },
    clearParam () {
      for (let key in this.queryParas) {
        this.queryParas[key] = ''
      }
      this.queryParas.pageIndex = 1
      this.queryParas.pageSize = 10
    },
    handleFilter () {
      if (!this.UtilJs.isEmpty(this.queryParas.debtor)) {
        this.queryParas.debtor = this.queryParas.debtor.trim()
      }
      if (!this.UtilJs.isEmpty(this.queryParas.projectContractName)) {
        this.queryParas.projectContractName = this.queryParas.projectContractName.trim()
      }
      if (!this.UtilJs.isEmpty(this.queryParas.regionCode)) {
        this.queryParas.regionCode = this.queryParas.regionCode.trim()
      }
      this.loadCount = this.loadCount + 1
    },
    selectionData (value) {
      this.selectedRows = value
    },
    // 编辑
    showEdit (row) {
      this.item = Object.assign({}, row)
      this.ladingManageVisible = true
    },
    // 下载导入文件
    showImportFileHistory () {
      this.item = {}
      this.importFileHistoryVisible = true
    },
    showRecordInfo (row) {
      this.item = Object.assign({}, row)
      this.recordInfoVisible = true
    },
    // 导入
    showImport () {
      let obj = {}
      obj.fileName = ''
      this.item = Object.assign({}, obj)
      this.importVisible = true
    },
    // 批量上传
    showBatchUpload () {
      let obj = {}
      // obj.productId = ''
      // obj.coreEnterpriseId = ''
      // obj.planningManagerId = ''
      // obj.specialPlanPeriods = ''
      obj.batchDate = ''
      // obj.fileName = ''
      // obj.fileList = []
      this.item = Object.assign({}, obj)
      this.batchUploadVisible = true
    },
    // 导出
    exportData () {
      if (this.selectedRows.length > 0) {
        let $this = this
        // let obj = {}
        let arr = []
        this.selectedRows.forEach(it => {
          arr.push(it.keyId)
        })
        $this.loading = true
        ladingManageApi.ladingPlanManageList.export({ assetInfoIds: arr, type: '2' }).then(res => {
          if (res.success) {
            fileApi.file.download({ keyId: res.data }).then(res => {
              downFile(res)
              $this.loading = false
            }).catch(() => {
              $this.loading = false
            })
          } else {
            $this.loading = false
            $this.error(this.$i18n.messages[this.$i18n.locale].ladingManageList.exportFaile)
          }
        }).catch(() => {
          $this.loading = false
        })
      } else {
        this.warning(this.$i18n.messages[this.$i18n.locale].ladingManageList.selectData)
      }
    },
    // 单条推送
    showSinglePush (row) {
      let putData = [{
        keyId: row.keyId,
        officalLadingConfirmStatus: row.officalLadingConfirmStatus,
        pushUserId: this.$store.state.user.user.userId,
        pushUserName: this.$store.state.user.user.userName
      }]
      this.item = Object.assign({}, { data: putData })
      this.singlePusheditModel = 'E'
      this.singlePushVisible = true
    },
    // 批量推送
    batchPush () {
      if (this.selectedRows.length > 0) {
        let putData = []
        this.selectedRows.forEach(it => {
          putData.push({
            keyId: it.keyId,
            officalLadingConfirmStatus: it.officalLadingConfirmStatus,
            pushUserId: this.$store.state.user.user.userId,
            pushUserName: this.$store.state.user.user.userName
          })
          this.item = Object.assign({}, { data: putData })
          this.singlePusheditModel = 'A'
          this.singlePushVisible = true
        })
      } else {
        this.warning(this.$i18n.messages[this.$i18n.locale].ladingManageList.selectData)
      }
    },
    // 批量设置c产品信息
    batchSetProductInfo () {
      if (this.selectedRows.length > 0) {
        let obj = {
          data: JSON.parse(JSON.stringify(this.selectedRows)),
          assetcollectAssetInfoId: ''
        }
        this.item = obj
        this.importProductVisible = true
      } else {
        this.warning(this.$i18n.messages[this.$i18n.locale].ladingManageList.selectData)
      }
    },
    uploadSuccess (returnData) {
      let $this = this
      let obj = {}
      obj.assetLadingPaymentConfirmId = returnData.rowData.keyId
      obj.fileId = returnData.fileID
      ladingManageApi.ladingPlanManageList.uploadSuccess(obj).then(res => {
        if (res.success && res.data) {
          $this.success(this.$i18n.messages[this.$i18n.locale].common.uploadSuccess)
          $this.handleFilter()
        } else {
          $this.error(this.$i18n.messages[this.$i18n.locale].common.uploadError)
        }
      })
    },
    replenishDataShow (row) {
      return row.stopStatus !== '1' && row.hasFile && row.hasFile === '1'
    },
    replenishData (returnData) {
      let $this = this
      let obj = {}
      obj.assetLadingPaymentConfirmId = returnData.rowData.keyId
      obj.fileId = returnData.fileID
      ladingManageApi.ladingManageList.replenishData(obj).then(res => {
        if (res.success && res.data) {
          $this.success(this.$i18n.messages[this.$i18n.locale].common.uploadSuccess)
          $this.handleFilter()
        } else {
          $this.error(this.$i18n.messages[this.$i18n.locale].common.uploadError)
        }
      })
    },
    clearInfoList () {
      this.$set(this.componentList[1], 'disabled', false)
      delete this.queryParas.coreEnterpriseId
      delete this.queryParas.planningManagerId
      delete this.queryParas.initialOwnersId
      delete this.queryParas.assetServiceId
      delete this.queryParas.coreArea
      delete this.queryParas.specialPlanPeriodsId
      delete this.queryParas.specialPlanPeriods
      if (!this.queryParas.projectId) {
        delete this.queryParas.projectId
      }
    },
    clearcoreAreaId () {
      delete this.queryParas.coreArea
      if (!this.queryParas.coreEnterpriseId) {
        delete this.queryParas.coreEnterpriseId
      }
    }
  },
  watch: {
    'queryParas.coreEnterpriseId' (n, o) {
      this.clearcoreAreaId()
    }
  }
}
</script>

<style lang="scss" scoped>
  @import '~@/styles/shouji/ladingManage/ladingPlanManageList.scss';
</style>
