<!-- 项目公司信息管理--企业概况 -->
<template>
  <div>
    <dialog-edit :visible.sync="dialogVisible" :editModel="editModel" :form="form" :api="api" width="1480px"
                 :title="$t('enterpriseInfoManage.supplierInfoManage.profileHead')">
      <div class="header-title">
        <el-collapse v-model="activeNames">
          <!-- 企业基本信息 -->
          <el-collapse-item :title="$t('enterpriseInfoManage.projCompanyInfoManage.enterpriseBasicInfo')" name="1">
            <vertical-table :columns="basicColumns" :tableData="basicTableData"></vertical-table>
          </el-collapse-item>
          <!-- 业务操作信息 -->
          <el-collapse-item :title="$t('enterpriseInfoManage.projCompanyInfoManage.businessOperateInfo')" name="2">
            <vertical-table :columns='operateColumns' :tableData="operateTableData"></vertical-table>
          </el-collapse-item>
          <!-- 特殊事项 -->
          <el-collapse-item :title="$t('enterpriseInfoManage.projCompanyInfoManage.specialIssue')" name="3">
            <data-table :api="api" :operateBtnLayout="operateBtnLayout" :queryParas="queryParas" :sourceData="specialData"
                        :toolMenuFlag="toolMenuFlag" :columns="specialColumns" :showPage="showPage">
            </data-table>
          </el-collapse-item>
          <!-- 区域专员信息 -->
          <el-collapse-item :title="$t('enterpriseInfoManage.projCompanyInfoManage.areaCommissionerInfo')" name="4">
            <data-table :api="api" :operateBtnLayout="operateBtnLayout" :queryParas="queryParas" :sourceData="areaCommissionerData"
                        :toolMenuFlag="toolMenuFlag" :columns="areaCommissionerColumns" :showPage="showPage">
            </data-table>
          </el-collapse-item>
          <!-- 历史业务数据 -->
          <el-collapse-item :title="$t('enterpriseInfoManage.projCompanyInfoManage.historyBusinessData')" name="5">
            <el-row>
              <el-col :span="24">
                <el-checkbox-group v-model="checkList" size="medium" @change="checkChange">
                  <el-checkbox v-for="item in checkListOption" :key="item.dictId" :label="item.dictId">{{item.dictName}}</el-checkbox>
                </el-checkbox-group>
              </el-col>
            </el-row>
            <data-table :api="api" :operateBtnLayout="operateBtnLayout" :queryParas="queryParas" :sourceData="historyBusinessData"
                        :toolMenuFlag="toolMenuFlag" :columns="historyBusinessColumns" :showPage="showPage" :summary-method="getHistorySummaries"
                        :show-summary="showSummary">
            </data-table>
            <div class="graphic-table">
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <td width="10%" class="graphic-td"><span>{{$t('enterpriseInfoManage.projCompanyInfoManage.graphic')}}</span></td>
                <td width="90%"><div id="historyBusinessChart" class="graphic-css"></div></td>
              </table>
            </div>
          </el-collapse-item>
          <!-- 供应商业务数据 -->
          <el-collapse-item :title="$t('enterpriseInfoManage.projCompanyInfoManage.supplierBusinessData')" name="6">
            <data-table :api="api" :operateBtnLayout="operateBtnLayout" :queryParas="queryParas" :sourceData="supplierData"
                        :toolMenuFlag="toolMenuFlag" :columns="supplierColumns" :showPage="showPage" :summary-method="getSupplierSummaries"
                        :show-summary="showSummary">
            </data-table>
            <div class="graphic-table">
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <td width="10%" class="graphic-td"><span>{{$t('enterpriseInfoManage.projCompanyInfoManage.graphic')}}</span></td>
                <td width="90%"><div id="supplierBusinessChart" class="graphic-css"></div></td>
              </table>
            </div>
          </el-collapse-item>
        </el-collapse>
      </div>
    </dialog-edit>
  </div>
</template>

<script>
import { DialogEdit, DataTable } from 'newepoch-components'
import BaseEdit from '@/pages/baseEditPage'
import * as format from '@/filters/index.js'
import VerticalTable from '@/components/element/cyjg/verticalTable.vue'
import coreEnterpriseInfoManageApi from '@/api/enterpriseInfoManage/coreEnterpriseInfoManageApi'
export default {
  extends: new BaseEdit(),
  name: 'enterpriseProfileEdit',
  components: {
    DialogEdit,
    DataTable,
    VerticalTable
  },
  data () {
    let enterpriseInfoManage = this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage
    return {
      checkList: [],
      // 企业id
      enterpriseId: '',
      activeNames: ['1', '2', '3', '4', '5', '6'],
      // 企业基本信息
      basicColumns: [
        // 企业名称
        { label: enterpriseInfoManage.projCompanyInfoManage.enterpriseName, prop: 'enterpriseName' },
        // 曾用名
        { label: enterpriseInfoManage.projCompanyInfoManage.usedName, prop: 'historyNames' },
        // 变更时间
        {
          label: enterpriseInfoManage.projCompanyInfoManage.changeTime,
          prop: 'changeTime',
          format: (it) => {
            if (!this.UtilJs.isEmpty(it)) {
              return format.formatDate(it)
            } else {
              return ''
            }
          }
        },
        // 企业性质
        { label: enterpriseInfoManage.projCompanyInfoManage.enterpriseProperty,
          prop: 'enterpriseNature',
          format: (it) => { return format.formatDict(it, 'enterprise_nature') }
        },
        // 是否合作方
        {
          label: enterpriseInfoManage.projCompanyInfoManage.partnerOrNot,
          prop: 'isPartners',
          format: (it) => { return format.formatDict(it, 'ZD0003') }
        },
        // 营业执照核准日期
        {
          label: enterpriseInfoManage.projCompanyInfoManage.yyzzApprovedDate,
          prop: 'approvedTime',
          format: (it) => {
            if (!this.UtilJs.isEmpty(it)) {
              return format.formatDate(it)
            } else {
              return ''
            }
          }
        },
        // 核心企业
        { label: enterpriseInfoManage.projCompanyInfoManage.coreEnterprise, prop: 'coreEnterpriseName' },
        // 是否核心企业
        {
          label: enterpriseInfoManage.projCompanyInfoManage.jointVentureOrNot,
          prop: 'isJointVenture',
          format: (it) => { return format.formatDict(it, 'ZD0003') }
        }
      ],
      basicTableData: {},
      // 业务操作信息
      operateColumns: [
        // 盖章方式
        {
          label: enterpriseInfoManage.projCompanyInfoManage.sealWay,
          prop: 'stampWay',
          format: (it) => { return format.formatDict(it, 'sealing_method') }
        },
        // 电子章申请时间
        {
          label: enterpriseInfoManage.projCompanyInfoManage.electronicSealTime,
          prop: 'electronicApplyTime',
          format: (it) => {
            if (!this.UtilJs.isEmpty(it)) {
              return format.formatDate(it)
            } else {
              return ''
            }
          }
        },
        // 资料模板
        // { label: enterpriseInfoManage.projCompanyInfoManage.dataTemplate, prop: 'factoringTemplate' },
        // 盖章流程
        {
          label: enterpriseInfoManage.projCompanyInfoManage.sealFlow,
          prop: 'stampingProcess',
          format: (it) => { return format.formatDict(it, 'stamp_process') }
        },
        // 盖章天数
        { label: enterpriseInfoManage.projCompanyInfoManage.sealDay, prop: 'stampedDays' },
        // 操作难度等级
        {
          label: enterpriseInfoManage.projCompanyInfoManage.difficultLevel,
          prop: 'optDifficultyLevel',
          format: (it) => { return format.formatDict(it, 'opt_difficulty_level') }
        },
        // 是否做业务
        {
          label: enterpriseInfoManage.projCompanyInfoManage.doBusiness,
          prop: 'businessStatus',
          format: (it) => { return format.formatDict(it, 'ZD0003') }
        },
        // 业务开展时间
        {
          label: enterpriseInfoManage.projCompanyInfoManage.busStartTime,
          prop: 'bizStartTime',
          format: (it) => {
            if (!this.UtilJs.isEmpty(it)) {
              return format.formatDate(it)
            } else {
              return ''
            }
          }
        },
        // 最后一次提单时间
        {
          label: enterpriseInfoManage.projCompanyInfoManage.lastLadingTime,
          prop: 'lastLadingTime',
          format: (it) => {
            if (!this.UtilJs.isEmpty(it)) {
              return format.formatDate(it)
            } else {
              return ''
            }
          }
        },
        // 业务类型
        { label: enterpriseInfoManage.projCompanyInfoManage.businessType, prop: 'bizType' },
        // 提单频率
        { label: enterpriseInfoManage.projCompanyInfoManage.billTimes, prop: 'ladingAmount' },
        // 提单次数
        { label: enterpriseInfoManage.projCompanyInfoManage.billNumber, prop: 'ladingFrequency' },
        // 提单总金额
        {
          label: enterpriseInfoManage.projCompanyInfoManage.billTotalLimit,
          prop: 'ladingTotalAmount',
          format: (it) => { return format.thousandFilter(it, 'ZD0003') }
        },
        // 平均提单金额
        {
          label: enterpriseInfoManage.projCompanyInfoManage.averageLadingAmount,
          prop: 'ladingAverageAmount',
          format: (it) => { return format.thousandFilter(it, 'ZD0003') }
        },
        // 联系人数量
        { label: enterpriseInfoManage.projCompanyInfoManage.contactAmount, prop: 'contactsPeopleCount' }
      ],
      operateTableData: {},
      showPage: false,
      showSummary: true,
      toolMenuFlag: false,
      operateBtnLayout: '',
      queryParas: {},
      checkListOption: [],
      // 特殊事项Data
      specialData: [],
      // 区域专员信息Data
      areaCommissionerData: [],
      // 历史业务数据Data
      historyBusinessData: [],
      // 供应商业务数据Data
      supplierData: [],
      // 特殊事项
      specialColumns: [
        // 区域
        {
          prop: 'regionName',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.region,
          width: '150px'
        },
        // 对接人账号
        {
          prop: 'account',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.dockPeopleAccount,
          width: '100px'
        },
        // 对接人
        {
          prop: 'employeeName',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.dockPeople,
          width: '100px'
        },
        // 特殊事项内容
        {
          prop: 'specialMatter',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.specialIssueContent,
          width: '300px'
        }
      ],
      // 区域专员信息
      areaCommissionerColumns: [
        // 序号
        {
          prop: 'orderNum',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.orderNum,
          width: '100px'
        },
        // 区域专员
        {
          prop: 'attacheName',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.areaCommissioner,
          width: '150px'
        },
        // 对接人信息
        {
          prop: 'jointPerson',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.dockPeopleInfo,
          width: '200px'
        },
        // 开始时间
        {
          prop: 'startDate',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.startTime,
          width: '150px',
          format: (row) => { return format.formatCheckDatetime(row.startDate) }
        },
        // 停止时间
        {
          prop: 'endDate',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.stopTime,
          width: '150px',
          format: (row) => { return format.formatCheckDatetime(row.endDate) }
        },
        // 提单次数
        {
          prop: 'num',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.billNumber,
          width: '100px'
        }
      ],
      // 历史业务数据
      historyBusinessColumns: [
        // 序号
        {
          prop: 'orderNumber',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.orderNum,
          width: '100px'
        },
        // 核心企业
        {
          prop: 'coreEnterpriseName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].common.coreEnterprises,
          width: '200px'
        },
        // 产品名称
        {
          prop: 'projectName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].common.productName,
          width: '200px'
        },
        // 期数
        {
          prop: 'specialPlanPeriods',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.periods,
          width: '100px'
        },
        // 供应商数
        {
          prop: 'suppliersCount',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.supplierAmount,
          width: '100px'
        },
        // 笔数
        {
          prop: 'count',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.numAmount,
          width: '100px'
        },
        // 金额
        {
          prop: 'money',
          align: 'right',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.moneyAmount,
          width: '150px',
          format: (row) => { return format.thousandFilter(row.money) }
        },
        // 到期日
        {
          prop: 'dueDate',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.dueDate,
          width: '150px',
          format: (row) => { return format.formatDate(row.dueDate) }
        }
      ],
      // 供应商业务数据
      supplierColumns: [
        // 合同及付款信息
        {
          prop: 'orderNumber',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.contractAndPayInfo,
          width: '150px'
        },
        // 供应商
        {
          prop: 'suppliersName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.supplier,
          width: '200px'
        },
        // 合同名称
        {
          prop: 'basicContractName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.contractName,
          width: '200px'
        },
        // 业务开始-上次提单时间
        {
          prop: 'ladingDate',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.lastTimeLadingTime,
          width: '200px',
          format: (row) => { return format.formatDate(row.ladingDate) }
        },
        // 付款次数
        {
          prop: 'payCount',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.paymentTimes,
          width: '100px'
        },
        // 付款金额合计
        {
          prop: 'payMoney',
          align: 'right',
          label: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.projCompanyInfoManage.totalPaymentAmount,
          width: '100px',
          format: (row) => { return format.thousandFilter(row.payMoney) }
        }
      ]
    }
  },
  mounted () {
  },
  computed: {
    api () {
      return {}
    }
  },
  methods: {
    // 复选框选择时的方法
    checkChange (val) {
      if (val.length !== 0) {
        let $this = this
        coreEnterpriseInfoManageApi.proCompanyEnterpriseProfile.getHistoryBusinessList({ enterpriseId: this.enterpriseId, productType: val }).then(res => {
          if (res.success) {
            $this.historyBusinessData = res.data
          } else {
            $this.error('获取历史业务数据失败')
          }
        })
      } else {
        this.historyBusinessData = []
      }
    },
    // 历史业务数据合计方法
    getHistorySummaries (param) {
      const { columns, data } = param
      const sums = []
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '合计'
          return
        }
        if (column.property === 'coreEnterpriseName' || column.property === 'projectName' || column.property === 'specialPlanPeriods' || column.property === 'dueDate') {
          sums[index] = '—'
          return
        }
        if (column.property === 'suppliersCount') {
          var value1 = data.map(item1 => item1.suppliersCount)
          if (value1.length !== 0) {
            sums[index] = value1.reduce((total, val) => {
              return total + val
            })
          } else {
            sums[index] = []
          }
          return
        }
        if (column.property === 'count') {
          var value2 = data.map(item2 => item2.count)
          if (value2.length !== 0) {
            sums[index] = value2.reduce((total, val) => {
              return total + val
            })
          } else {
            sums[index] = []
          }
          return
        }
        if (column.property === 'money') {
          var value3 = data.map(item3 => item3.money)
          if (value3.length !== 0) {
            sums[index] = format.thousandFilter(value3.reduce((total, val) => {
              return total + val
            }))
          } else {
            sums[index] = []
          }
        }
      })
      return sums
    },
    // 供应商业务数据合计方法
    getSupplierSummaries (param) {
      const { columns, data } = param
      const sums = []
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '合计'
          return
        }
        if (column.property === 'suppliersName' || column.property === 'ladingDate') {
          sums[index] = '—'
          return
        }
        if (column.property === 'basicContractName') {
          sums[index] = data.length + '份合同'
          return
        }
        if (column.property === 'payCount') {
          var value1 = data.map(item1 => item1.payCount)
          if (value1.length !== 0) {
            sums[index] = value1.reduce((total, val) => {
              return total + val
            })
          } else {
            sums[index] = []
          }
          return
        }
        if (column.property === 'payMoney') {
          var value2 = data.map(item2 => item2.payMoney)
          if (value2.length !== 0) {
            sums[index] = format.thousandFilter(value2.reduce((total, val) => {
              return total + val
            }))
          } else {
            sums[index] = []
          }
        }
      })
      return sums
    },
    // 历史业务图示数据生成
    drawHistoryBusiness () {
      // 基于准备好的dom，初始化echarts实例
      let myChart = this.$echarts.init(document.getElementById('historyBusinessChart'))
      var historyOption = {
        title: {
          text: '一年放款数据'
        },
        color: ['#675bba', '#5793f3', '#d14a61'],
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'cross'
          }
        },
        grid: {
          right: '130'
        },
        legend: {
          data: ['金额', '供应商数', '笔数']
        },
        dataZoom: [
          {
            type: 'slider',
            realtime: true,
            height: 20,
            start: 0,
            end: 100,
            bottom: '1%'
          }
        ],
        xAxis: {
          type: 'category',
          axisTick: {
            alignWithLabel: true
          },
          data: []
        },
        yAxis: [
          {
            type: 'value',
            name: '金额',
            position: 'left',
            axisLine: {
              lineStyle: {
                color: '#675bba'
              }
            },
            axisLabel: {
              formatter: '{value} 元'
            }
          },
          {
            type: 'value',
            name: '供应商数',
            position: 'right',
            axisLine: {
              lineStyle: {
                color: '#5793f3'
              }
            },
            axisLabel: {
              formatter: '{value} 个'
            }
          },
          {
            type: 'value',
            name: '笔数',
            position: 'right',
            offset: 70,
            axisLine: {
              lineStyle: {
                color: '#d14a61'
              }
            },
            axisLabel: {
              formatter: '{value}  笔'
            }
          }
        ],
        series: [
          {
            name: '金额',
            type: 'bar',
            data: []
          },
          {
            name: '供应商数',
            type: 'line',
            yAxisIndex: 2,
            data: []
          },
          {
            name: '笔数',
            type: 'line',
            yAxisIndex: 1,
            data: []
          }
        ]
      }
      let $this = this
      coreEnterpriseInfoManageApi.proCompanyEnterpriseProfile.getHistoryBusinessDiagram({ enterpriseId: this.enterpriseId }).then(res => {
        if (res.success) {
          if (res.data.length > 0) {
            historyOption.xAxis.data = res.data.map(it1 => it1.specialPlanPeriods)
            historyOption.series[0].data = res.data.map(it1 => it1.money)
            historyOption.series[1].data = res.data.map(it1 => it1.suppliersAmount)
            historyOption.series[2].data = res.data.map(it1 => it1.amount)
          }
          // 绘制图表
          myChart.setOption(historyOption)
        } else {
          $this.error('获取历史业务图示数据失败')
        }
      })
    },
    // 供应商业务图示数据生成
    drawSupplierBusiness () {
      // 基于准备好的dom，初始化echarts实例
      let myChart = this.$echarts.init(document.getElementById('supplierBusinessChart'))
      var supplierOption = {
        title: {
          text: '一年金额合计前20放款数据'
        },
        color: ['#675bba', '#5793f3'],
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'shadow'
          }
        },
        grid: {
          right: '130'
        },
        legend: {
          data: ['金额']
        },
        dataZoom: [
          {
            type: 'slider',
            realtime: true,
            height: 20,
            start: 0,
            end: 100,
            bottom: '1%'
          }
        ],
        xAxis: {
          type: 'category',
          axisTick: {
            alignWithLabel: true
          },
          data: []
        },
        yAxis: [
          {
            type: 'value',
            name: '金额',
            position: 'left',
            axisLine: {
              lineStyle: {
                color: '#675bba'
              }
            },
            axisLabel: {
              formatter: '{value} 元'
            }
          }
        ],
        series: [
          {
            name: '金额',
            type: 'bar',
            data: []
          },
          {
            name: '笔数',
            type: 'line',
            symbolSize: 0,
            showSymbol: false,
            lineStyle: {
              width: 0,
              color: 'rgba(0, 0, 0, 0)'
            },
            data: []
          }
        ]
      }
      let $this = this
      coreEnterpriseInfoManageApi.proCompanyEnterpriseProfile.getSupplierBusinessDiagram({ enterpriseId: this.enterpriseId }).then(res => {
        if (res.success) {
          if (res.data.length > 0) {
            supplierOption.xAxis.data = res.data.map(it1 => it1.suppliersName)
            supplierOption.series[0].data = res.data.map(it1 => it1.money)
            supplierOption.series[1].data = res.data.map(it1 => it1.amount)
          }
          // 绘制图表
          myChart.setOption(supplierOption)
        } else {
          $this.error('获取供应商业务图示数据失败')
        }
      })
    },
    // 获取企业基本信息
    getEnterpriseList () {
      let $this = this
      coreEnterpriseInfoManageApi.proCompanyEnterpriseProfile.getEnterpriseList({ keyId: this.enterpriseId, tagCode: '150' }).then(res => {
        if (res.success) {
          $this.basicTableData = res.data
        } else {
          $this.error('获取企业基本信息失败')
        }
      })
    },
    // 获取业务操作信息
    getCertificateList () {
      let $this = this
      coreEnterpriseInfoManageApi.proCompanyEnterpriseProfile.getCertificateList({ enterpriseId: this.enterpriseId }).then(res => {
        if (res.success) {
          $this.operateTableData = res.data
        } else {
          $this.error('获取业务操作信息失败')
        }
      })
    },
    // 获取特殊事项列表
    getSpecialList () {
      let $this = this
      coreEnterpriseInfoManageApi.proCompanyEnterpriseProfile.getSpecialList({ keyId: this.enterpriseId, tagCode: '150' }).then(res => {
        if (res.success && res.data) {
          res.data.forEach(it => {
            let quyu = ''
            let len = it.areaRelDtoList.length
            it.areaRelDtoList.forEach((item, index) => {
              if (len > 1) {
                quyu = quyu + item.areaName + ','
              }
              if (len === index + 1) {
                quyu = quyu + item.areaName
              }
            })
            it.regionName = quyu
          })
          $this.specialData = res.data
        } else {
          $this.error('获取特殊事项失败')
        }
      })
    },
    // 获取区域专员列表
    getAreaCommissionerList () {
      let $this = this
      coreEnterpriseInfoManageApi.proCompanyEnterpriseProfile.getAreaCommissionerList({ enterpriseId: this.enterpriseId, tagCode: '150', attacheType: 2 }).then(res => {
        if (res.success) {
          res.data.forEach((it, index) => {
            it.orderNum = index + 1
          })
          $this.areaCommissionerData = res.data
        } else {
          $this.error('获取区域专员失败')
        }
      })
    },
    // 获取历史业务数据
    getHistoryBusinessList () {
      let $this = this
      coreEnterpriseInfoManageApi.proCompanyEnterpriseProfile.getHistoryBusinessList({ enterpriseId: this.enterpriseId, productType: this.checkList }).then(res => {
        if (res.success) {
          $this.historyBusinessData = res.data
        } else {
          $this.error('获取历史业务数据失败')
        }
      })
    },
    // 获取供应商业务数据
    getSupplierBusinessList () {
      let $this = this
      coreEnterpriseInfoManageApi.proCompanyEnterpriseProfile.getSupplierBusinessList({ enterpriseId: this.enterpriseId }).then(res => {
        if (res.success) {
          $this.supplierData = res.data
        } else {
          $this.error('获取供应商业务数据失败')
        }
      })
    }
  },
  watch: {
    visible (val) {
      if (val) {
        this.enterpriseId = this.form.enterpriseId
        this.checkListOption = this.$store.state.sys.dictionarys.filter(function (dict) {
          return dict.dictTypeCode === 'ZD0087'
        })
        this.checkList = ['1']
        let $this = this
        this.$nextTick(function () {
          $this.drawHistoryBusiness()
          $this.drawSupplierBusiness()
        })
        // 获取企业基本信息
        $this.getEnterpriseList()
        // 获取业务操作信息
        $this.getCertificateList()
        // 获取特殊事项列表
        $this.getSpecialList()
        // 获取区域专员列表
        $this.getAreaCommissionerList()
        // 获取历史业务数据
        $this.getHistoryBusinessList()
        // 获取供应商业务数据
        $this.getSupplierBusinessList()
      }
    }
  }
}
</script>

<style scoped lang="scss">
  @import '~@/styles/enterpriseInfoManage/supplierInfoManage/proCompanyEnterpriseProfileEdit.scss';
</style>
