import React from 'react';
import { Button, Spin, message, Table, Row, Col, Icon } from 'antd';
import ajax from 'jquery/src/ajax/xhr.js';
import $ from 'jquery/src/ajax';
import money from '../../../money.js';
import dict from './steps/dict.js';
import ReactEcharts from 'echarts-for-react/lib/core';
import echarts from 'echarts/lib/echarts';
import 'echarts/lib/chart/bar';
import 'echarts/lib/chart/line';
import 'echarts/lib/component/legend';
import 'echarts/lib/component/title';
import 'echarts/lib/component/tooltip';
import jspdf from 'jspdf';
import html2canvas from 'html2canvas';

import './info.less';

const getDateValue = (val) => {
  return val < 10 ? '0' + val : val + '';
}
const tableProps = {
  showHeader: false,
  pagination: false,
  size: 'middle'
}

const NUMBERS = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十']
const SCORES = [100, 80, 60, 40, 20, 0];
const RISK_RATE = ['1%', '2%', '3%', '4%', '5%'];

const growthRate = (a, b) => {
  if (a == 0 || b == 0) {
    return '--';
  }
  return (Math.round((b / a - 1) * 1000)) / 10
}

const evaluateInfo = React.createClass({
  getInitialState() {
    return {
      loading: true,
      data: null,
      exporting: false
    };
  },
  //基础资料
  loadInfoData(id) {
    $.ajax({
      url: globalConfig.context + "/api/user/evaluate/report/" + id
    }).done(function (res) {
      if (res && res.error && res.error.length) {
        message.error(res.error[0].message);
      } else if (res && res.data) {
        this.setState({
          loading: false,
          loaded: true,
          data: res.data
        });
      }
    }.bind(this)).always(function () {
      this.setState({
        loading: false
      });
    }.bind(this));
  },
  componentWillMount() {
    if (window.location.search) {
      let paramsStr = window.location.search.replace('?', '');
      let params = {};
      paramsStr.split('&').forEach(it => {
        let arr = it.split('=');
        if (arr[0]) {
          params[arr[0]] = arr[1] || '';
        }
      });
      if (params.id) {
        this.loadInfoData(params.id);
      }
    };
    let dictMap = {};
    for (let key in dict) {
      if (dict.hasOwnProperty(key) && key != 'toMap') {
        dictMap[key] = dict.toMap(dict[key]);
      }
    }
    this.state.dictMap = dictMap;
  },
  part2Table(data, benchDate) {
    let step = data.log[0] || {};
    let { transferTypes, leftTimes } = this.state.dictMap;
    return {
      col: [{ dataIndex: 'key', key: 'key', width: '40%' }, { dataIndex: 'text', key: 'text', width: '60%' }],
      data: [
        { key: "评估对象名称：", text: data.name },
        { key: "评估基准日：", text: benchDate.join('/') },
        { key: "评估目的：", text: transferTypes[String(step.transferType)] },
        { key: "经济寿命／转让年限：", text: leftTimes[String(data.timeLeft)] },
        { key: "评估目标使用区域：", text: data.transferArea },
        { key: "评估目标应用行业：", text: data.industry + ' - ' + data.subIndustries },
        { key: "评估币种：", text: step.currencyType }
      ]
    }
  },
  part3Table(data, limit) {
    let cols = [{ dataIndex: 'key', key: 'key' }], datas = [{ key: "年份：" }, { key: "预测收入：" }, { key: "年增长率：" }],
      footerTxt = [], values = [], rates = [undefined], years = [], k = '';
    for (let i = 0; i < limit; i++) {
      k = String(i)
      cols.push({ dataIndex: k, key: k });
      datas[0][k] = '第' + NUMBERS[i] + '年';
      years.push(datas[0][k]);
      datas[1][k] = money(data[i] || 0) + '元';
      if (i > 0) {
        rates.push(growthRate(data[i - 1], data[i]));
        datas[2][k] = rates[i] + '%';
        footerTxt.push(datas[2][k]);
      } else {
        datas[2][k] = '';
      }
    }
    return {
      col: cols,
      data: datas,
      footer: () => '上述年收入增长率分别为' + footerTxt.join('、'),
      values: data.slice(0, limit),
      rates: rates,
      years: years
    }
  },
  getBarChartOption(uf, sf, mf) {
    return {
      title: {
        x: 'center',
        text: '未来' + NUMBERS[uf.years.length - 1] + '年收入/增长率预测',
        top: 3,
        textStyle: {
          fontSize: 16
        }
      },
      grid: [
        { left: '18%', width: '73%', zlevel: 0 },
        { left: '18%', width: '73%', zlevel: 1 }
      ],
      legend: {
        data: ['客户预测值', '系统预测值', '调整值'],
        top: 23
      },
      xAxis: [
        {
          type: 'category',
          data: uf.years,
          axisTick: { show: false }
        },
        {
          type: 'category',
          data: uf.years,
          nameLocation: 'start',
          offset: 100,
          gridIndex: 1,
          axisLabel: { show: false },
          axisTick: { show: false }
        }
      ],
      yAxis: [
        {
          type: 'value',
          name: '',
          axisTick: {
            show: false
          }
        }, {
          type: 'value',
          name: '',
          position: 'right',
          gridIndex: 1,
          axisLabel: {
            formatter: '{value}%'
          },
          axisTick: {
            show: false
          },
          splitLine: {
            show: false
          }
        }
      ],
      tooltip: {
        formatter: params => {
          let html = ''
          if (params) {
            html = params.name + params.seriesName + '</br>'
            if (params.seriesIndex > 2) {
              html += '增长率：' + params.value + '%';
            } else {
              html += '收入：' + money(params.value) + '元';
            }
          }
          return html
        }
      },
      series: [
        {
          name: '客户预测值',
          type: 'bar',
          data: uf.values
        },
        {
          name: '系统预测值',
          type: 'bar',
          data: sf.values
        }, {
          name: '调整值',
          type: 'bar',
          data: mf.values
        }, {
          name: '客户预测值',
          type: 'line',
          symbolSize: 5,
          yAxisIndex: 1,
          xAxisIndex: 1,
          data: uf.rates
        },
        {
          name: '系统预测值',
          type: 'line',
          symbolSize: 5,
          yAxisIndex: 1,
          xAxisIndex: 1,
          data: sf.rates
        }, {
          name: '调整值',
          type: 'line',
          symbolSize: 5,
          yAxisIndex: 1,
          xAxisIndex: 1,
          data: mf.rates
        }
      ]
    }
  },
  getResultChartOption(mf, pl) {
    return {
      grid: [
        { left: '18%', width: '73%', zlevel: 0 }
      ],
      legend: {
        data: ['销售收入', '收入分成额'],
        top: 23
      },
      xAxis: [
        {
          type: 'category',
          data: NUMBERS.slice(0, mf.length).map(it => '第' + it + '年'),
          axisTick: { show: false }
        }
      ],
      yAxis: [
        {
          type: 'value',
          name: '',
          axisTick: {
            show: false
          }
        }
      ],
      tooltip: {
        formatter: params => {
          let html = ''
          if (params) {
            html = params.name + params.seriesName + '</br>' + money(params.value) + '元'
          }
          return html
        }
      },
      series: [
        {
          name: '销售收入',
          type: 'bar',
          data: mf
        },
        {
          name: '收入分成额',
          type: 'bar',
          data: pl
        }
      ]
    }
  },
  export() {
    if (this.state.exporting) {
      return;
    }
    window.scrollTo(0, 0)
    this.setState({
      exporting: true
    });
    let width = 595, height = 842;
    html2canvas(document.getElementsByClassName('report-pages'), {
      background: '#fff',
      onrendered: function (canvas) {
        let contentWidth = canvas.width,
          contentHeight = canvas.height,
          pageHeight = contentWidth / width * height,
          leftHeight = contentHeight,
          position = 0,
          imgWidth = width,
          imgHeight = width / contentWidth * contentHeight,
          pageData = canvas.toDataURL('image/jpeg', 1.0),
          pdf = new jspdf('', 'pt', [width, height]);
        while (leftHeight > 0) {
          pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
          leftHeight -= pageHeight;
          position -= height;
          if (leftHeight > 0) {
            pdf.addPage();
          }
        }
        pdf.save('EvaluationReport.pdf');
        this.setState({
          exporting: false
        });
      }.bind(this)
    });
  },
  renderData(data) {
    let now = new Date(),
      nowStr = now.getFullYear() + '年' + getDateValue(now.getMonth() + 1) + '月' + getDateValue(now.getDate()) + '日',
      benchDate = data.benchmarkDate.split('-'),
      limit = new Date(Number(benchDate[0]), Number(benchDate[1]) + 2, Number(benchDate[2])),
      part2Table = this.part2Table(data, benchDate),
      part3Table = this.part3Table(data.userForecast, 3),
      part3Table2 = this.part3Table(data.sysForecast, 3),
      part3Table3 = this.part3Table(data.measuredForecast, 3),
      { dictMap } = this.state, step2 = data.log[1],
      step3 = data.log[2],
      step7 = data.log[6];
    return <div className="report-pages">
      <div className="report-page">
        <div className="report-title">&nbsp;</div>
        <div className="report-title">&nbsp;</div>
        <div className="report-title">{data.name}</div>
        <div className="report-title">
          无形资产在线评估
        </div>
        <div className="report-title">
          简式评估报告
        </div>
        <div className="report-info">
          <Row><Col span="8">客户（委托方）：</Col><Col span="16">{data.customer || ''}</Col></Row>
          <Row><Col span="8">报告使用者：</Col><Col span="16">{data.customer || ''}</Col></Row>
          <Row><Col span="8">评估对象名称：</Col><Col span="16">{data.name}</Col></Row>
          <Row><Col span="8">评估目的：</Col><Col span="16">为交易或策略管理提供价值参考</Col></Row>
          <Row><Col span="8">价值标准：</Col><Col span="16">投资价值</Col></Row>
          <Row><Col span="8">评估方法：</Col><Col span="16">收益法</Col></Row>
          <Row><Col span="8">评估基准日：</Col><Col span="16">{benchDate[0] + '年' + benchDate[1] + '月' + benchDate[2] + '日'}</Col></Row>
          <Row><Col span="8">评估报告日：</Col><Col span="16">{nowStr}</Col></Row>
          <Row><Col span="8">报告类型：</Col><Col span="16">简式评估报告</Col></Row>
          <Row><Col span="8">评估值：</Col><Col span="16">{money((data.value / 100 | 0) / 100, 2)}万元</Col></Row>
        </div>
        <div className="report-announce">
          本报告出自<a href="http://www.jishutao.com">http://www.jishutao.com/</a>，相关限制详见<a href="http://www.jishutao.com">知识产权评估系统声明书</a>
        </div>
        <div className="report-pageno">- 1 -</div>
      </div>
      <div className="report-page">
        <div className="report-subtitle">第一部分   声明</div>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;一、本系统在进行无形资产价值评估过程中，采用了通行的经济理论及通用的评估方法，评估流程参考了《资产评估准则-无形资产》，但本评估报告并非《中国资产评估法》及《资产评估准则-评估报告》所规定和约束的评估报告，而是本在线系统出具的简式评估报告。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;二、本系统测算所依据的财务及技术资料均由客户填写，系统仅引用该数据进行目标价值之评估，对其填写内容的合法性、真实性、完整性、合理性我们未进行核实，也不承担任何责任。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;三、本系统认为系统采用的公共信息、购买的非公开信息及行业统计信息都来自可靠的信息来源。但是因为本系统并未对这些信息做进一步的验证，无法保证这些信息的准确性或完整性。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;四、本评估结果仅作为指定目的下的价值参考，不应当被认为是对评估对象可实现价格的保证。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;五、本评估报告只能用于本报告载明的评估目的和用途，不供其他目的和用途使用。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;六、本评估报告内容系属机密，只能由评估报告载明的评估报告使用者使用。任何第三人也不因得到本评估报告而成为本报告的使用者。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;七、本评估报告之有效期限为评估基准日起三个月内。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;八、本评估报告之结论基于以下假设条件得出：</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1、国家现行的有关法律法规及政策、国家宏观经济形势无重大变化，评估对象所处地区的政治、经济和社会环境无重大变化，无其他人力不可抗拒因素及不可预见因素造成的重大不利影响；</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2、区域经济政策和产业政策、财政和货币政策以及所执行的利率、汇率、赋税基准及税率、政策性征收费用等不发生重大变化；</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3、假设委托方填列的信息和内容真实、合法、准确、完整；</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4、没有考虑评估对象过去或将来可能承担的抵押、质押、担保等事宜的影响；没有考虑特殊的交易方或交易方式可能追加付出的价格等对评估价值的影响；没有考虑评估基准日后遇有自然力和其他不可抗力对资产价值的影响；没有考虑交易费用和税项等可能影响其价值净额的相关方面。</p>
        <div className="report-announce">
          技淘网知识产权评估系统 阿凡提信息科技（湖南）股份有限公司 {nowStr}
        </div>
        <div className="report-pageno">- 2 -</div>
      </div>
      <div className="report-page">
        <div className="report-subtitle">第二部分   评估对象</div>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;一、基本信息</p>
        <Table {...tableProps} columns={part2Table.col} dataSource={part2Table.data}></Table>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;二、价值类型</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;一般常用的价值类型有市场价值、在用价值、清算价值、残余价值等，本系统采用价值类型为投资价值。投资价值是指评估对象对于具有明确投资目标的特定投资者或者某一类投资者所具有的价值估计数额。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;三、系统数据来源说明</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1、本系统用户提供信息</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2、中国统计年鉴</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3、中国国家统计局各年度数据</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4、WIND资讯</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5、开元资产评估有限公司数据库</p>
        <div className="report-pageno">- 3 -</div>
      </div>
      <div className="report-page">
        <div className="report-subtitle">第三部分   重要参数及评估过程说明</div>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;一、评估方法</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;技术类无形资产类似的可比交易案例非常少，难以取得足够有效的案例，故不适合采用市场法。同时，通常而言无形资产的获利能力与其成本呈弱对应性，如果采用成本法来评估，很可能无法准确揭示该无形资产的获利能力。无形资产的价值是由其所带来的未来收益所决定的，故采用收益法对无形资产进行评估，具体采用收益法中的许可费节省法（提成法/ 分成法）进行评估。许可费节省法是通过估算一个假设的无形资产受让人如果拥有该无形资产，就可以节省许可费支出，将该无形资产经济寿命期内每年节省的许可费支出通过适当的折现率折现，并以此作为该无形资产评估价值的一种评估方法。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;二、未来产品收入预测</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1、未来三年收入预测</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;委托方（客户）自行预估未来三年应用{data.name}的产品销售收入如下表所示：</p>
        <Table {...tableProps} columns={part3Table.col} dataSource={part3Table.data} footer={part3Table.footer}></Table>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;经查询WIND资讯终端，该行业平均收入增长率约为{data.industryAverageRate}%，若以该增长率进行预测，则系统推荐预测收入及年增长率如下表所示：</p>
        <Table {...tableProps} columns={part3Table2.col} dataSource={part3Table2.data}></Table>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;针对客户自行预估数据与系统推荐数据，为避免产生过度乐观或过度悲观的偏差，本系统分析后对两者进行调整：</p>
        <div className="report-pageno">- 4 -</div>
      </div>
      <div className="report-page">
        <Table {...tableProps} columns={part3Table3.col} dataSource={part3Table3.data}></Table>
        <ReactEcharts option={this.getBarChartOption(part3Table, part3Table2, part3Table3)} echarts={echarts} />
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2、剩余期限收入预测</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;委托方预估无形资产剩余经济寿命为{data.timeLeft}年，根据评估理论及实务常用经验法则，一般前五年为发展期，五年以后进入稳定期，稳定期的营收增长率将逐渐趋近于行业长期平均成长、多年总体经济成长。</p>
        <ReactEcharts option={this.getBarChartOption(this.part3Table(data.userForecast, data.timeLeft), this.part3Table(data.sysForecast, data.timeLeft), this.part3Table(data.measuredForecast, data.timeLeft))} echarts={echarts} />
        <div className="report-pageno">- 5 -</div>
      </div>
      <div className="report-page">
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;三、分成率</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;利用分成率测算技术分成额，即以技术产品产生的收入为基础，按一定比例分成确定技术的收益。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A、确定待估技术分成率的取值范围</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;根据联合国贸易发展组织对各国技术贸易合同的提成率作的调查统计，认为技术提成率一般在产品销价的0.5％-10％之间，该技术属{data.industry}行业，分成率的范围为{data.minRate}%-{data.maxRate}%。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;B、确定待估技术分成率的调整系数</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;根据本次评估对象特点，评估人员首先对分成率及它的各种影响因素进行了系统分析，认为待估技术价值主要受到法律因素、技术因素、经济因素等的影响，透过强度评估量化表量化转换而得，量化指标由弱至强分布于 0~100 的区间。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1、法律因素</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（1）法律状态</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{dictMap.legalStatus[step2.legalStatus]}，取{SCORES[step2.legalStatus - 1]}分。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（2）保密性</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{dictMap.confidentialities[step2.confidentiality]}，取{SCORES[step2.confidentiality - 1]}分。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（3）侵权判定</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{dictMap.decidabilities[step2.decidability]}，取{SCORES[step2.decidability - 1]}分。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2、技术因素</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（1）技术领域发展前景</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{dictMap.prospect[step3.prospect]}，取{SCORES[step3.prospect - 1]}分。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（2）先进性</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{dictMap.progressiveness[step3.progressiveness]}，取{SCORES[step3.progressiveness - 1]}分。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（3）创新性</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{dictMap.innovativeness[step3.innovativeness]}，取{SCORES[step3.innovativeness - 1]}分。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（4）成熟度</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{dictMap.ripeness[step3.ripeness]}，取{SCORES[step3.ripeness - 1]}分。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（5）替代性</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{dictMap.alternatives[step3.alternatives]}，取{SCORES[step3.alternatives - 1]}分。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（6）技术防御力</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{dictMap.defensive[step3.defensive]}，取{SCORES[step3.defensive - 1]}分。</p>
        <div className="report-pageno">- 6 -</div>
      </div>
      <div className="report-page">
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（7）技术产品应用范围</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{dictMap.rangeOfApplication[step3.rangeOfApplication]}，取{SCORES[step3.rangeOfApplication - 1]}分。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3、经济因素</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（1）供求关系</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{dictMap.supplyAndDemand[step3.supplyAndDemand]}，取{SCORES[step3.supplyAndDemand - 1]}分。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（2）独立获利能力</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{dictMap.profitability[step3.profitability]}，取{SCORES[step3.profitability - 1]}分。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;依循上量化述指标结果，系统配合数据库数据进行运算，得出分成率为{data.profitRate * 100}%</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;四、折现率</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;折现率是将未来的收益折算为现值的系数，它体现了资金的时间价值。此次评估采用国际通用的风险累加法来估测评估中适用的折现率。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1、无风险报酬率</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;考虑到技术转让多属中长期投资，本系统采用中华人民共和国5年期贷款利率{data.governmentLoanRoR}%为无风险报酬率。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2、风险报酬率</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;影响风险报酬率的因素包括政策风险、技术风险、市场风险、资金风险和管理风险。根据目前评估惯例，5个风险系数各取值范围在0%—5%之间。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（1）政策风险</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{dictMap.political[step7.political]}，取风险系数为{RISK_RATE[step7.political - 1]}。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（2）技术风险</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{dictMap.technical[step7.technical]}，取风险系数为{RISK_RATE[step7.technical - 1]}。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（3）市场风险</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{dictMap.market[step7.market]}，取风险系数为{RISK_RATE[step7.market - 1]}。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（4）资金风险</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{dictMap.capital[step7.capital]}，取风险系数为{RISK_RATE[step7.capital - 1]}。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（5）管理风险</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{dictMap.management[step7.management]}，取风险系数为{RISK_RATE[step7.management - 1]}。</p>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;根据上述量化指标结果，系统以风险累加法配合数据库数据进行运算和调整，折现率估计值为{data.discountRate * 100}%。</p>
        <div className="report-pageno">- 7 -</div>
      </div>
      <div className="report-page">
        <div className="report-subtitle">第四部分   评估值计算</div>
        <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;根据前述收入预测情况，以及分成率、折现率计算数据，以{data.profitRate * 100}%作为分成率、{data.discountRate * 100}%为折现率，对未来{data.timeLeft}年收入进行分成折现后，得出评估值为{money((data.value / 100 | 0) / 100, 2)}万元</p>
        <ReactEcharts option={this.getResultChartOption(data.measuredForecast, data.profitList)} echarts={echarts} />
        <div className="report-pageno">- 8 -</div>
      </div>
    </div>
  },
  render() {
    let { loading, data } = this.state;
    return (
      <Spin spinning={loading}>
        <div className="report-container">
          {data ? <Button icon="file-pdf" className="export" onClick={this.export} loading={this.state.exporting}>导出PDF</Button> : ''}
          {
            data ?
              this.renderData(data) :
              <div className="report-page">
                <div className="report-title">无形资产在线评估</div>
                <div className="report-title">简式评估报告</div>
              </div>
          }
        </div>
      </Spin>
    );
  }
});

export default evaluateInfo;