albertshaw 7 years ago
parent
commit
9dc35c180d

+ 1 - 2
js/component/account/services/evaluate/create.jsx

@@ -18,7 +18,6 @@ const CreateEvaluate = React.createClass({
   componentWillMount() {
     if (this.props.id) {
       this.state.id = this.props.id;
-      this.state.title = this.props.name;
     } else {
       this.setState({
         loading: true
@@ -77,7 +76,7 @@ const CreateEvaluate = React.createClass({
   },
   renderBody() {
     if (this.state.id) {
-      return <Steps id={this.state.id} step={Number(this.props.step)} title={this.titleChanged} />
+      return <Steps id={this.state.id} title={this.titleChanged} />
     } else {
       return <div>
         <div className="announce-head">

+ 3 - 3
js/component/account/services/evaluate/index.jsx

@@ -67,7 +67,7 @@ const Evaluate = React.createClass({
   },
   tableRowClick(it) {
     if (this.props.handlekey) {
-      this.props.handlekey('createEvaluate?id=' + it.id + '&name=' + (it.name || '') + '&step=' + it.step);
+      this.props.handlekey('createEvaluate?id=' + it.id);
     }
   },
   remove() {
@@ -101,7 +101,7 @@ const Evaluate = React.createClass({
   preview(e, it) {
     e.stopPropagation();
     e.preventDefault();
-    alert(it.id);
+    message.success('3级用户才能查看评估报告!');
   },
   render() {
     const rowSelection = {
@@ -132,7 +132,7 @@ const Evaluate = React.createClass({
         dataIndex: 'preview',
         key: 'preview',
         render: (text, record) => {
-          return record.step == 7 ?
+          return record.value ?
             <Icon type="eye-o" style={{ fontSize: 18 }} onClick={(e) => {
               this.preview(e, record)
             }}></Icon> : <div />

+ 36 - 9
js/component/account/services/evaluate/steps.jsx

@@ -44,10 +44,18 @@ const EvaluateSteps = React.createClass({
     return {
       current: 0,
       loading: true,
-      steps: {}
+      steps: null,
+      value: 0,
+      step: 0
     };
   },
   next(values) {
+    if (this.state.current == 7) {
+      this.state.value = values;
+      return;
+    } else {
+      this.state.value = 0;
+    }
     const current = this.state.current + 1;
     this.state.steps[this.state.current] = values;
     if (this.state.current === 0 && this.props.title) {
@@ -66,10 +74,18 @@ const EvaluateSteps = React.createClass({
     $.ajax({
       url: globalConfig.context + '/api/user/evaluate/info/' + this.props.id
     }).done(function (res) {
-      this.setState({
-        steps: res || {},
-        loading: false
-      })
+      if (res && res.data) {
+        this.setState({
+          steps: res.data.steps || {},
+          current: res.data.step || 0,
+          step: res.data.step || 0,
+          value: res.data.value || 0,
+          loading: false
+        })
+        if (this.props.title) {
+          this.props.title(res.data.name || '');
+        }
+      }
     }.bind(this)).fail(function () {
       this.setState({
         loading: false
@@ -79,19 +95,30 @@ const EvaluateSteps = React.createClass({
       current: this.props.step || 0
     })
   },
+  progressDot(dot, { index }) {
+    return <span style={{ cursor: 'pointer' }} onClick={() => {
+      if (index == this.state.step || !!this.state.steps[index]) {
+        this.setState({
+          current: index
+        })
+      }
+    }}>{dot}</span>
+  },
   render() {
     this.state.StepContent = steps[this.state.current].content;
+    let loadContent = !!this.state.steps
     return (
-      <Spin spinning={this.state.loading}>
+      <Spin spinning={this.state.loading} >
         <div style={{ marginTop: 10 }}>
-          <Steps current={this.state.current} progressDot>
+          <Steps current={this.state.current} progressDot={this.progressDot} value={this.state.value}>
             {steps.map(item => <Step key={item.title} title={item.title} />)}
           </Steps>
           <div className="steps-content">{
-            <this.state.StepContent next={this.next} prev={this.prev} id={this.props.id} data={this.state.steps[this.state.current]} record={this.state.steps}/>
+            loadContent ? <this.state.StepContent next={this.next} prev={this.prev} id={this.props.id} data={this.state.steps[this.state.current]} record={this.state.steps} value={this.state.value} />
+              : <div />
           }</div>
         </div>
-      </Spin>
+      </Spin >
     )
   },
 });

+ 34 - 13
js/component/account/services/evaluate/steps.less

@@ -1,23 +1,44 @@
 .steps-content {
-  margin-top: 16px;
-  min-height: 360px;
-  text-align: left;
-  padding: 6px 24px;
+    margin-top: 16px;
+    min-height: 360px;
+    text-align: left;
+    padding: 6px 24px;
 }
 
-.steps-action {
-  padding: 6px 0;
+.steps-name {
+    margin: 16px 0 0;
+    font-size: 16px;
+    font-weight: bold;
 }
 
+.steps-action {
+    padding: 6px 0;
+}
+.steps-result {
+    min-height: 300px;
+    margin-bottom: 20px;
+    .steps-value {
+        font-size: 24px;
+        font-weight: bold;
+        color: #ff0036;
+    }
+}
 .steps-form {
     min-height: 300px;
     .ant-form-item {
-      border-radius: 3px;
-      background: #fafafa;
-      padding: 10px 24px;
-      margin-bottom: 12px;
-      .ant-form-item-label {
-        text-align: left;
-      }
+        border-radius: 3px;
+        background: #fafafa;
+        padding: 10px 24px;
+        margin-bottom: 12px;
+        .ant-form-item-label {
+            text-align: left;
+        }
+    }
+    .ant-input-number {
+        width: 160px;
     }
+}
+
+.steps-cell-key {
+    font-weight: bold;
 }

+ 172 - 0
js/component/account/services/evaluate/steps/dict.js

@@ -0,0 +1,172 @@
+
+module.exports = {
+  toMap(arr) {
+    let map = {};
+    arr.forEach((it) => {
+      map[it.id] = it.text;
+    });
+    return map;
+  },
+  transferTypes: [
+    { id: "1", text: "所有权转让" },
+    { id: "2", text: "独占许可" },
+    { id: "3", text: "普通许可" }
+  ],
+  leftTimes: [
+    { id: "3", text: "3年" },
+    { id: "4", text: "4年" },
+    { id: "5", text: "5年" },
+    { id: "6", text: "6年" },
+    { id: "7", text: "7年" },
+    { id: "8", text: "8年" },
+    { id: "9", text: "9年" },
+    { id: "10", text: "10年" },
+    { id: "11", text: "11年" },
+    { id: "12", text: "12年" },
+    { id: "13", text: "13年" },
+    { id: "14", text: "14年" },
+    { id: "15", text: "15年" },
+    { id: "16", text: "16年" },
+    { id: "17", text: "17年" },
+    { id: "18", text: "18年" },
+    { id: "19", text: "19年" },
+    { id: "20", text: "20年以上" }
+  ],
+  accessMethods: [
+    { id: "1", text: "自主研发" },
+    { id: "2", text: "外购取得" },
+    { id: "3", text: "许可取得" },
+  ],
+  legalStatus: [
+    { id: "1", text: "已获专利证书-发明专利,受法律保护" },
+    { id: "2", text: "已获专利证书-实用新型专利,受法律保护" },
+    { id: "3", text: "已获专利证书-外观技术专利,受法律保护" },
+    { id: "4", text: "已申请尚未获得证书,一定程度上受法律保护" },
+    { id: "5", text: "专有技术,未申请法律保护" },
+  ],
+  maintenanceStatus: [
+    { id: "1", text: "专利按时缴纳年费" },
+    { id: "2", text: "专利已过期或未按时缴纳年费" },
+  ],
+  confidentialities: [
+    { id: "1", text: "他人无法获知,保密性强" },
+    { id: "2", text: "他人较少可能获知,保密性较强" },
+    { id: "3", text: "他人可能获知,保密性一般" },
+    { id: "4", text: "他人很有可能获知,保密性较差" },
+    { id: "5", text: "无法保密" },
+  ],
+  decidabilities: [
+    { id: "1", text: "易发现且易判定" },
+    { id: "2", text: "易发现但不易判定" },
+    { id: "3", text: "难以发现他人是否侵权" },
+    { id: "4", text: "非专利技术,无法判定他人侵权" },
+  ],
+  rightLimitations: [
+    { id: "1", text: "否" },
+    { id: "2", text: "是" },
+  ],
+  progressiveness: [
+    { id: "1", text: "填补了世界空白" },
+    { id: "2", text: "填补了国内空白" },
+    { id: "3", text: "国家级领先技术" },
+    { id: "4", text: "省域级领先技术" },
+    { id: "5", text: "市域级领先技术" },
+    { id: "6", text: "先进性方面与类似技术相差不大" },
+  ],
+  innovativeness: [
+    { id: "1", text: "具有突破性创新" },
+    { id: "2", text: "非突破性创新,但功效有显著提升" },
+    { id: "3", text: "非突破性创新,但功效有一定提升" },
+    { id: "4", text: "有类似技术且功效差不多" },
+    { id: "5", text: "功效差于现行类似技术" },
+    { id: "6", text: "功效无法判定" },
+  ],
+  ripeness: [
+    { id: "1", text: "技术成熟并已产业化多年" },
+    { id: "2", text: "技术成熟,已产业化一年以下" },
+    { id: "3", text: "技术成熟,已成功进行试生产,即将产业化" },
+    { id: "4", text: "技术已研发完成,尚未投入生产" },
+    { id: "5", text: "技术处于中试阶段" },
+    { id: "6", text: "仅为概念或早期阶段、小试阶段" },
+  ],
+  alternatives: [
+    { id: "1", text: "具有不可替代性" },
+    { id: "2", text: "与其他类似技术相比具有优势,较难被替代" },
+    { id: "3", text: "有其他相同的替代技术" },
+    { id: "4", text: "有其他更好的替代技术" },
+  ],
+  defensive: [
+    { id: "1", text: "技术复杂程度高,所需资金量大" },
+    { id: "2", text: "技术复杂程度较高,所需资金量较大" },
+    { id: "3", text: "技术复杂程度较高,但所需资金量不大" },
+    { id: "4", text: "技术复杂程度不高,所需资金量较大" },
+    { id: "5", text: "技术复杂程度不高,所需资金量不大" },
+    { id: "6", text: "技术简单,所需资金量小" },
+  ],
+  prospect: [
+    { id: "1", text: "技术产品所属领域发展前景好" },
+    { id: "2", text: "技术产品所属领域发展前景较好" },
+    { id: "3", text: "技术产品所属领域发展前景一般" },
+    { id: "4", text: "技术产品所属领域发展前景较差" },
+    { id: "5", text: "技术产品所属领域发展前景差" },
+  ],
+  supplyAndDemand: [
+    { id: "1", text: "解决了行业的必需技术问题,为广大厂商所需要,具有一定垄断性" },
+    { id: "2", text: "解决了行业的重要技术问题,供不应求" },
+    { id: "3", text: "解决了行业一般技术问题,形成一定需求" },
+    { id: "4", text: "解决了行业非重要技术问题,形成少量需求" },
+    { id: "5", text: "解决了生产中某一附加技术问题或改进了某一技术环节,对于整体生产环节的改进有一定作用,形成一定潜在需求" },
+    { id: "6", text: "解决了生产中某一附加技术问题或改进了某一技术环节,对于整体生产环节的改进并未产生作用" },
+  ],
+  rangeOfApplication: [
+    { id: "1", text: "技术产品应用于全国" },
+    { id: "2", text: "技术产品应用于省域或省级区域" },
+    { id: "3", text: "技术产品应用范围较小" },
+    { id: "4", text: "技术产品应用范围非常小" },
+  ],
+  imitable: [
+    { id: "1", text: "较低" },
+    { id: "2", text: "中等" },
+    { id: "3", text: "高" },
+  ],
+  profitability: [
+    { id: "1", text: "可以单独应用于产品,发挥技术作用" },
+    { id: "2", text: "需要与其他相关技术或专利一起应用于产品,共同发挥作用,且占主要作用" },
+    { id: "3", text: "需要与其他相关技术或专利一起应用于产品,共同发挥作用,只起次要作用" },
+  ],
+  political: [
+    { id: "1", text: "政府大力支持,出台了支持行业发展的政策,政策风险低" },
+    { id: "2", text: "政府鼓励发展的行业或项目,政策风险较低" },
+    { id: "3", text: "政府既未鼓励、也未限制的行业,政策风险一般" },
+    { id: "4", text: "政府限制发展的行业或项目,政策风险较高" },
+    { id: "5", text: "政府限制或禁止的行业或项目,出台了相关限制或禁止政策,风险高" },
+  ],
+  technical: [
+    { id: "1", text: "技术先进,创新性好,技术成熟,防御力高" },
+    { id: "2", text: "技术较先进,创新性较好,防御力较高,技术较成熟" },
+    { id: "3", text: "技术先进度一般,创新性较好,防御力一般,技术较成熟" },
+    { id: "4", text: "技术先进度一般,创新性一般,防御力一般,技术尚未产业化" },
+    { id: "5", text: "技术先进度一般,创新性一般,防御力一般,技术处于研发或试验阶段" },
+  ],
+  market: [
+    { id: "1", text: "产品市场容量大,产品供不应求,具有一定垄断地位" },
+    { id: "2", text: "产品市场容量较大,产品供不应求,具有先发优势" },
+    { id: "3", text: "产品市场容量不大,产品供需大致平衡" },
+    { id: "4", text: "产品市场容量小,但能够在竞争中取得一定市场份额" },
+    { id: "5", text: "产品市场容量小,供大于求,竞争激烈" },
+  ],
+  capital: [
+    { id: "1", text: "所需资金量小,融资渠道宽" },
+    { id: "2", text: "所需资金量较小,融资渠道较宽" },
+    { id: "3", text: "所需资金量较大,融资渠道较宽" },
+    { id: "4", text: "所需资金量较大,融资渠道较窄" },
+    { id: "5", text: "所需资金量大,且融资渠道窄" },
+  ],
+  management: [
+    { id: "1", text: "拟实施该技术的企业管理内部规范,内控健全有效,管理层团队稳定" },
+    { id: "2", text: "拟实施该技术的企业管理内部较规范,管理层团队较稳定,内控体系较健全" },
+    { id: "3", text: "拟实施该技术的企业管理内部较规范,管理层团队较稳定,内控体系较存在缺陷" },
+    { id: "4", text: "拟实施该技术的企业管理内部不够规范,内控体系存在缺陷,管理层团队较稳定" },
+    { id: "5", text: "拟实施该技术的企业管理内部不规范,内控体系存在较大缺陷,管理层团队不稳定" },
+  ]
+}

+ 7 - 22
js/component/account/services/evaluate/steps/step1.jsx

@@ -1,9 +1,9 @@
 import React from 'react';
 import { Form, Select, Input, Cascader, Spin, message, Button, DatePicker } from 'antd';
-import './step1.less';
 import ajax from 'jquery/src/ajax/xhr.js'
 import $ from 'jquery/src/ajax';
 import moment from 'moment';
+import { transferTypes, leftTimes } from './dict.js';
 
 const FormItem = Form.Item;
 const Option = Select.Option;
@@ -226,9 +226,9 @@ const EvaluateStep1 = Form.create({})(React.createClass({
               initialValue: this.stringify(initialData.transferType)
             })(
               <Select placeholder="请选择技术转让方式">
-                <Option value="1">所有权转让</Option>
-                <Option value="2">普通许可</Option>
-                <Option value="3">普通许可</Option>
+                {transferTypes.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
               </Select>
               )}
           </FormItem>
@@ -238,24 +238,9 @@ const EvaluateStep1 = Form.create({})(React.createClass({
               initialValue: this.stringify(initialData.timeLeft)
             })(
               <Select placeholder="请选择技术剩余寿命">
-                <Option value="3">3年</Option>
-                <Option value="4">4年</Option>
-                <Option value="5">5年</Option>
-                <Option value="6">6年</Option>
-                <Option value="7">7年</Option>
-                <Option value="8">8年</Option>
-                <Option value="9">9年</Option>
-                <Option value="10">10年</Option>
-                <Option value="11">11年</Option>
-                <Option value="12">12年</Option>
-                <Option value="13">13年</Option>
-                <Option value="14">14年</Option>
-                <Option value="15">15年</Option>
-                <Option value="16">16年</Option>
-                <Option value="17">17年</Option>
-                <Option value="18">18年</Option>
-                <Option value="19">19年</Option>
-                <Option value="20">20年以上</Option>
+                {leftTimes.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
               </Select>
               )}
           </FormItem>

+ 0 - 0
js/component/account/services/evaluate/steps/step1.less


+ 19 - 22
js/component/account/services/evaluate/steps/step2.jsx

@@ -1,8 +1,8 @@
 import React from 'react';
 import { Spin, Form, Button, Select, message } from 'antd';
-import './step2.less';
 import ajax from 'jquery/src/ajax/xhr.js'
 import $ from 'jquery/src/ajax';
+import { accessMethods, legalStatus, maintenanceStatus, confidentialities, decidabilities, rightLimitations } from './dict.js';
 
 const FormItem = Form.Item;
 const Option = Select.Option;
@@ -72,9 +72,9 @@ const EvaluateStep2 = Form.create({})(React.createClass({
               initialValue: this.stringify(initialData.accessMethod)
             })(
               <Select placeholder="请选择技术取得的方式">
-                <Option value="1">自主研发</Option>
-                <Option value="2">外购取得</Option>
-                <Option value="3">许可取得</Option>
+                {accessMethods.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
               </Select>
               )}
           </FormItem>
@@ -84,11 +84,9 @@ const EvaluateStep2 = Form.create({})(React.createClass({
               initialValue: this.stringify(initialData.legalStatus)
             })(
               <Select placeholder="请选择法律保护状态">
-                <Option value="1">已获专利证书-发明专利,受法律保护</Option>
-                <Option value="2">已获专利证书-实用新型专利,受法律保护</Option>
-                <Option value="3">已获专利证书-外观技术专利,受法律保护</Option>
-                <Option value="4">已申请尚未获得证书,一定程度上受法律保护</Option>
-                <Option value="5">专有技术,未申请法律保护</Option>
+                {legalStatus.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
               </Select>
               )}
           </FormItem>
@@ -98,8 +96,9 @@ const EvaluateStep2 = Form.create({})(React.createClass({
               initialValue: this.stringify(initialData.patentMaintenance)
             })(
               <Select placeholder="请选择专利维护状态">
-                <Option value="1">专利按时缴纳年费</Option>
-                <Option value="2">专利已过期或未按时缴纳年费</Option>
+                {maintenanceStatus.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
               </Select>
               )}
           </FormItem>
@@ -109,11 +108,9 @@ const EvaluateStep2 = Form.create({})(React.createClass({
               initialValue: this.stringify(initialData.confidentiality)
             })(
               <Select placeholder="请选择保密性">
-                <Option value="1">他人无法获知,保密性强</Option>
-                <Option value="2">他人较少可能获知,保密性较强</Option>
-                <Option value="3">他人可能获知,保密性一般</Option>
-                <Option value="4">他人很有可能获知,保密性较差</Option>
-                <Option value="5">无法保密</Option>
+                {confidentialities.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
               </Select>
               )}
           </FormItem>
@@ -123,10 +120,9 @@ const EvaluateStep2 = Form.create({})(React.createClass({
               initialValue: this.stringify(initialData.decidability)
             })(
               <Select placeholder="请选择他人侵权的易判定性">
-                <Option value="1">易发现且易判定</Option>
-                <Option value="2">易发现但不易判定</Option>
-                <Option value="3">难以发现他人是否侵权</Option>
-                <Option value="4">非专利技术,无法判定他人侵权</Option>
+                {decidabilities.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
               </Select>
               )}
           </FormItem>
@@ -136,8 +132,9 @@ const EvaluateStep2 = Form.create({})(React.createClass({
               initialValue: this.stringify(initialData.hasRightLimitation)
             })(
               <Select placeholder="请选择是否涉及质押、担保、诉讼等权利限制">
-                <Option value="1">否</Option>
-                <Option value="2">是</Option>
+                {rightLimitations.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
               </Select>
               )}
           </FormItem>

+ 0 - 0
js/component/account/services/evaluate/steps/step2.less


+ 31 - 50
js/component/account/services/evaluate/steps/step3.jsx

@@ -1,8 +1,8 @@
 import React from 'react';
 import { Spin, Form, Button, Select, message } from 'antd';
-import './step3.less';
 import ajax from 'jquery/src/ajax/xhr.js'
 import $ from 'jquery/src/ajax';
+import { progressiveness, innovativeness, ripeness, alternatives, defensive, prospect, supplyAndDemand, rangeOfApplication, imitable, profitability } from './dict.js';
 
 const FormItem = Form.Item;
 const Option = Select.Option;
@@ -72,12 +72,9 @@ const EvaluateStep3 = Form.create({})(React.createClass({
               initialValue: this.stringify(initialData.progressiveness)
             })(
               <Select placeholder="请选择技术的先进性">
-                <Option value="1">填补了世界空白</Option>
-                <Option value="2">填补了国内空白</Option>
-                <Option value="3">国家级领先技术</Option>
-                <Option value="4">省域级领先技术</Option>
-                <Option value="5">市域级领先技术</Option>
-                <Option value="6">先进性方面与类似技术相差不大</Option>
+                {progressiveness.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
               </Select>
               )}
           </FormItem>
@@ -87,12 +84,9 @@ const EvaluateStep3 = Form.create({})(React.createClass({
               initialValue: this.stringify(initialData.innovativeness)
             })(
               <Select placeholder="请选择技术的创新性">
-                <Option value="1">具有突破性创新</Option>
-                <Option value="2">非突破性创新,但功效有显著提升</Option>
-                <Option value="3">非突破性创新,但功效有一定提升</Option>
-                <Option value="4">有类似技术且功效差不多</Option>
-                <Option value="5">功效差于现行类似技术</Option>
-                <Option value="6">功效无法判定</Option>
+                {innovativeness.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
               </Select>
               )}
           </FormItem>
@@ -102,12 +96,9 @@ const EvaluateStep3 = Form.create({})(React.createClass({
               initialValue: this.stringify(initialData.ripeness)
             })(
               <Select placeholder="请选择技术的成熟度">
-                <Option value="1">技术成熟并已产业化多年</Option>
-                <Option value="2">技术成熟,已产业化一年以下</Option>
-                <Option value="3">技术成熟,已成功进行试生产,即将产业化</Option>
-                <Option value="4">技术已研发完成,尚未投入生产</Option>
-                <Option value="5">技术处于中试阶段</Option>
-                <Option value="6">仅为概念或早期阶段、小试阶段</Option>
+                {ripeness.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
               </Select>
               )}
           </FormItem>
@@ -117,10 +108,9 @@ const EvaluateStep3 = Form.create({})(React.createClass({
               initialValue: this.stringify(initialData.alternatives)
             })(
               <Select placeholder="请选择技术的替代性">
-                <Option value="1">具有不可替代性</Option>
-                <Option value="2">与其他类似技术相比具有优势,较难被替代</Option>
-                <Option value="3">有其他相同的替代技术</Option>
-                <Option value="4">有其他更好的替代技术</Option>
+                {alternatives.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
               </Select>
               )}
           </FormItem>
@@ -130,12 +120,9 @@ const EvaluateStep3 = Form.create({})(React.createClass({
               initialValue: this.stringify(initialData.defensive)
             })(
               <Select placeholder="请选择技术的防御力">
-                <Option value="1">技术复杂程度高,所需资金量大</Option>
-                <Option value="2">技术复杂程度较高,所需资金量较大</Option>
-                <Option value="3">技术复杂程度较高,但所需资金量不大</Option>
-                <Option value="4">技术复杂程度不高,所需资金量较大</Option>
-                <Option value="5">技术复杂程度不高,所需资金量不大</Option>
-                <Option value="6">技术简单,所需资金量小</Option>
+                {defensive.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
               </Select>
               )}
           </FormItem>
@@ -145,11 +132,9 @@ const EvaluateStep3 = Form.create({})(React.createClass({
               initialValue: this.stringify(initialData.prospect)
             })(
               <Select placeholder="请选择技术领域发展前景">
-                <Option value="1">技术产品所属领域发展前景好</Option>
-                <Option value="2">技术产品所属领域发展前景较好</Option>
-                <Option value="3">技术产品所属领域发展前景一般</Option>
-                <Option value="4">技术产品所属领域发展前景较差</Option>
-                <Option value="5">技术产品所属领域发展前景差</Option>
+                {prospect.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
               </Select>
               )}
           </FormItem>
@@ -159,12 +144,9 @@ const EvaluateStep3 = Form.create({})(React.createClass({
               initialValue: this.stringify(initialData.supplyAndDemand)
             })(
               <Select placeholder="请选择技术的供求关系">
-                <Option value="1">解决了行业的必需技术问题,为广大厂商所需要,具有一定垄断性</Option>
-                <Option value="2">解决了行业的重要技术问题,供不应求</Option>
-                <Option value="3">解决了行业一般技术问题,形成一定需求</Option>
-                <Option value="4">解决了行业非重要技术问题,形成少量需求</Option>
-                <Option value="5">解决了生产中某一附加技术问题或改进了某一技术环节,对于整体生产环节的改进有一定作用,形成一定潜在需求</Option>
-                <Option value="6">解决了生产中某一附加技术问题或改进了某一技术环节,对于整体生产环节的改进并未产生作用</Option>
+                {supplyAndDemand.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
               </Select>
               )}
           </FormItem>
@@ -174,10 +156,9 @@ const EvaluateStep3 = Form.create({})(React.createClass({
               initialValue: this.stringify(initialData.rangeOfApplication)
             })(
               <Select placeholder="请选择技术的应用范围">
-                <Option value="1">技术产品应用于全国</Option>
-                <Option value="2">技术产品应用于省域或省级区域</Option>
-                <Option value="3">技术产品应用范围较小</Option>
-                <Option value="4">技术产品应用范围非常小</Option>
+                {rangeOfApplication.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
               </Select>
               )}
           </FormItem>
@@ -187,9 +168,9 @@ const EvaluateStep3 = Form.create({})(React.createClass({
               initialValue: this.stringify(initialData.imitable)
             })(
               <Select placeholder="请选择技术的模仿可能性">
-                <Option value="1">较低</Option>
-                <Option value="2">中等</Option>
-                <Option value="3">高</Option>
+                {imitable.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
               </Select>
               )}
           </FormItem>
@@ -199,9 +180,9 @@ const EvaluateStep3 = Form.create({})(React.createClass({
               initialValue: this.stringify(initialData.profitability)
             })(
               <Select placeholder="请选择技术的独立获利能力">
-                <Option value="1">可以单独应用于产品,发挥技术作用</Option>
-                <Option value="2">需要与其他相关技术或专利一起应用于产品,共同发挥作用,且占主要作用</Option>
-                <Option value="3">需要与其他相关技术或专利一起应用于产品,共同发挥作用,只起次要作用</Option>
+                {profitability.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
               </Select>
               )}
           </FormItem>

+ 0 - 0
js/component/account/services/evaluate/steps/step3.less


+ 42 - 14
js/component/account/services/evaluate/steps/step4.jsx

@@ -1,6 +1,5 @@
 import React from 'react';
 import { Spin, Form, Button, message, Radio, Table, InputNumber } from 'antd';
-import './step4.less';
 import ajax from 'jquery/src/ajax/xhr.js'
 import $ from 'jquery/src/ajax';
 
@@ -29,8 +28,8 @@ const EvaluateStep4 = Form.create({})(React.createClass({
     if (initialData.incomes) {
       dataSource = initialData.incomes;
     } else {
-      let step1 = this.props.record && this.props.record[0];
-      let year = Number(step1.benchmarkDate.split('-')[0]) || now.getFullYear();
+      let step1 = this.props.record && this.props.record[0] || {};
+      let year = now.getFullYear();//Number(step1.benchmarkDate && step1.benchmarkDate.split('-')[0]) || now.getFullYear();
       for (let i = 1; i < 4; i++) {
         dataSource.push({
           year: year - i,
@@ -55,6 +54,8 @@ const EvaluateStep4 = Form.create({})(React.createClass({
         let data = {
           id: this.props.id,
           hasIncome: values.hasIncome
+        }, val = {
+          hasIncome: values.hasIncome
         }
         if (data.hasIncome == 2) {
           let incomes = [], year = 0;
@@ -62,11 +63,12 @@ const EvaluateStep4 = Form.create({})(React.createClass({
             year = this.state.dataSource[i].year;
             incomes.push({
               year: year,
-              income: values['income' + year],
-              profit: values['profit' + year]
+              income: values['income' + year] || 0,
+              profit: values['profit' + year] || 0
             })
           }
           data.incomes = JSON.stringify(incomes);
+          val.incomes = incomes;
         }
         $.ajax({
           url: globalConfig.context + '/api/user/evaluate/step4',
@@ -77,7 +79,7 @@ const EvaluateStep4 = Form.create({})(React.createClass({
             message.error(res.error[0].message)
           } else {
             if (this.props.next) {
-              this.props.next(values);
+              this.props.next(val);
             }
           }
         }.bind(this)).fail(function () {
@@ -120,22 +122,48 @@ const EvaluateStep4 = Form.create({})(React.createClass({
         title: '营收(元)',
         dataIndex: 'income',
         key: 'income',
-        render: (text, it) => {
+        render: (text, it, index) => {
+          let rules = [];
+          if (index === 0) {
+            rules.push({ required: index === 0, message: '请输入' + it.year + '营收情况!' })
+            rules.push({
+              validator: (rule, value, callback) => {
+                if (!Number(value)) {
+                  callback('请输入' + it.year + '营收情况!' );
+                } else {
+                  callback();
+                }
+              },
+            })
+          }
           return getFieldDecorator('income' + it.year, {
-            initialValue: text,
-            rules: [{ required: true, message: '请输入' + it.year + '营收情况!' }]
-          })(<InputNumber placeholder="请输入营收情况" />);
+            initialValue: text || 0,
+            rules: rules
+          })(<InputNumber min={0} placeholder="请输入营收情况" />);
         }
       },
       {
         title: '利润率(%)',
         dataIndex: 'profit',
         key: 'profit',
-        render: (text, it) => {
+        render: (text, it, index) => {
+          let rules = [];
+          if (index === 0) {
+            rules.push({ required: index === 0, message: '请输入' + it.year + '利润率!' })
+            rules.push({
+              validator: (rule, value, callback) => {
+                if (!Number(value)) {
+                  callback('请输入' + it.year + '利润率!' );
+                } else {
+                  callback();
+                }
+              },
+            })
+          }
           return getFieldDecorator('profit' + it.year, {
-            initialValue: text,
-            rules: [{ required: true, message: '请输入' + it.year + '利润率!' }]
-          })(<InputNumber placeholder="请输入利润率" />);
+            initialValue: text || 0,
+            rules: rules
+          })(<InputNumber min={0} placeholder="请输入利润率" />);
         }
       },
     ]

+ 0 - 3
js/component/account/services/evaluate/steps/step4.less

@@ -1,3 +0,0 @@
-.ant-input-number {
-  width: 160px;
-}

+ 308 - 7
js/component/account/services/evaluate/steps/step5.jsx

@@ -1,36 +1,337 @@
 import React from 'react';
-import { Spin, Form, Button } from 'antd';
-import './step5.less';
+import { Spin, Form, Button, message, Radio, Table, InputNumber } from 'antd';
+import ajax from 'jquery/src/ajax/xhr.js'
+import $ from 'jquery/src/ajax';
+import money from '../../../../money.js';
+
+const RadioButton = Radio.Button;
+const RadioGroup = Radio.Group;
 const FormItem = Form.Item;
 
 const formItemLayout = {
   labelCol: { span: 4 },
   wrapperCol: { span: 10 },
 };
+const NUMBERS = {
+  1: '第一年',
+  2: '第二年',
+  3: '第三年',
+  4: '第四年',
+  5: '第五年',
+}
 
 const EvaluateStep5 = Form.create({})(React.createClass({
   getInitialState() {
     return {
-      loading: false
+      loading: false,
+      initialData: {},
+      hasIncome: '1',
+      type: '1',
+      dataSource: []
     };
   },
   componentWillMount() {
+    let initialData = this.props.data || {}, dataSource = initialData.forecastIncomes || [];
+    let step4 = this.props.record && this.props.record[3] || {};
+    let type = initialData.type || '1';
+    if (step4.hasIncome == 2) {
+      $.ajax({
+        url: globalConfig.context + '/api/user/evaluate/step5/' + this.props.id
+      }).done(function (res) {
+        if (res.error && res.error.length) {
+          message.error(res.error[0].message)
+        } else if (res.data && res.data.length === 3) {
+          for (let i = 0; i < 3; i++) {
+            dataSource[i] = Object.assign({
+              key: i,
+              income: 0,
+              unitPrice: 0,
+              saleCount: 0,
+              marketScale: 0,
+              marketRate: 0,
+              recommend: res.data[i] || 0
+            }, dataSource[i]);
+          }
+          this.setState({
+            loading: false,
+            dataSource: dataSource
+          })
+        }
+      }.bind(this)).fail(function () {
+        this.setState({
+          loading: false
+        })
+      }.bind(this));
+    } else {
+      for (let i = 0; i < 3; i++) {
+        dataSource[i] = Object.assign({
+          key: i,
+          income: 0,
+          unitPrice: 0,
+          saleCount: 0,
+          marketScale: 0,
+          marketRate: 0
+        }, dataSource[i] || {});
+      }
+      this.state.dataSource = dataSource;
+    }
+    this.state.initialData = initialData;
+    this.state.type = type;
+    this.state.hasIncome = String(step4.hasIncome) || '1'
   },
   next() {
-    if (this.props.next) {
-      this.props.next();
+    if (this.state.loading) {
+      return;
     }
+    this.props.form.validateFields((err, values) => {
+      if (!err) {
+        this.setState({
+          loading: true
+        })
+
+        let incomes = [];
+        for (let i = 0; i < 3; i++) {
+          incomes.push({
+            unitPrice: values['unitPrice' + i] || 0,
+            saleCount: values['saleCount' + i] || 0,
+            marketScale: values['marketScale' + i] || 0,
+            marketRate: values['marketRate' + i] || 0,
+            income: values['income' + i] || 0
+          })
+        }
+
+        $.ajax({
+          url: globalConfig.context + '/api/user/evaluate/step5',
+          method: 'post',
+          data: {
+            id: this.props.id,
+            type: values.type,
+            forecastIncomes: JSON.stringify(incomes)
+          }
+        }).done(function (res) {
+          if (res.error && res.error.length) {
+            message.error(res.error[0].message)
+          } else {
+            if (this.props.next) {
+              this.props.next({
+                type: values.type,
+                forecastIncomes: incomes
+              });
+            }
+          }
+        }.bind(this)).fail(function () {
+          this.setState({
+            loading: false
+          })
+        }.bind(this));
+      } else {
+        for (let field in err) {
+          if (err.hasOwnProperty(field)) {
+            message.error(err[field].errors[0].message)
+            break;
+          }
+        }
+      }
+    });
   },
   prev() {
     if (this.props.prev) {
       this.props.prev();
     }
   },
+  onRadioChange(e) {
+    this.props.form.resetFields();
+    this.setState({
+      type: e.target.value,
+    });
+  },
+  tableCols() {
+    const { getFieldDecorator, getFieldValue, setFieldsValue } = this.props.form;
+    const { type } = this.state;
+    let cols = [{
+      title: '年份',
+      dataIndex: 'key',
+      key: 'key',
+      render: (text, it, idx) => {
+        return <div>{NUMBERS[idx + 1]}</div>
+      }
+    }];
+    switch (type) {
+      case "2":
+        function calc(rate, scale, key) {
+          let fv = {};
+          fv['income' + key] = (scale * rate / 100) | 0
+          setFieldsValue(fv);
+        }
+        cols.push({
+          title: '市场规模(元)',
+          dataIndex: 'marketScale',
+          key: 'marketScale',
+          render: (text, it, idx) => {
+            return getFieldDecorator('marketScale' + it.key, {
+              initialValue: text || 0,
+              rules: [{
+                validator: (rule, value, callback) => {
+                  if (!Number(value)) {
+                    callback('请输入' + NUMBERS[idx + 1] + '市场规模!');
+                  } else {
+                    callback();
+                  }
+                },
+              }]
+            })(<InputNumber min={0} placeholder="请输入市场规模" onChange={value => {
+              calc(Number(getFieldValue('marketRate' + it.key)) || 0, Number(value) || 0, it.key);
+            }} />);
+          }
+        });
+        cols.push({
+          title: '技术覆盖率/市场份额(%)',
+          dataIndex: 'marketRate',
+          key: 'marketRate',
+          render: (text, it, idx) => {
+            return getFieldDecorator('marketRate' + it.key, {
+              initialValue: text || 0,
+              rules: [{
+                validator: (rule, value, callback) => {
+                  if (!Number(value)) {
+                    callback('请输入' + NUMBERS[idx + 1] + '市场份额!');
+                  } else {
+                    callback();
+                  }
+                },
+              }]
+            })(<InputNumber min={0} placeholder="请输入市场份额" onChange={value => {
+              calc(Number(value) || 0, getFieldValue('marketScale' + it.key) || 0, it.key);
+            }} />);
+          }
+        });
+        cols.push({
+          title: '营业收入(元)',
+          dataIndex: 'income',
+          key: 'income',
+          render: (text, it, idx) => {
+            return getFieldDecorator('income' + it.key, {
+              initialValue: text || 0
+            })(<InputNumber min={0} disabled={true} />);
+          }
+        });
+        break;
+      case "3":
+        function calc(rate, scale, key) {
+          let fv = {};
+          fv['income' + key] = (scale * rate) | 0
+          setFieldsValue(fv);
+        }
+        cols.push({
+          title: '单价(元)',
+          dataIndex: 'unitPrice',
+          key: 'unitPrice',
+          render: (text, it, idx) => {
+            return getFieldDecorator('unitPrice' + it.key, {
+              initialValue: text || 0,
+              rules: [{
+                validator: (rule, value, callback) => {
+                  if (!Number(value)) {
+                    callback('请输入' + NUMBERS[idx + 1] + '单价!');
+                  } else {
+                    callback();
+                  }
+                },
+              }]
+            })(<InputNumber min={0} placeholder="请输入单价" onChange={value => {
+              calc(Number(getFieldValue('saleCount' + it.key)) || 0, Number(value) || 0, it.key);
+            }} />);
+          }
+        });
+        cols.push({
+          title: '销量',
+          dataIndex: 'saleCount',
+          key: 'saleCount',
+          render: (text, it, idx) => {
+            return getFieldDecorator('saleCount' + it.key, {
+              initialValue: text || 0,
+              rules: [{
+                validator: (rule, value, callback) => {
+                  if (!Number(value)) {
+                    callback('请输入' + NUMBERS[idx + 1] + '销量!');
+                  } else {
+                    callback();
+                  }
+                },
+              }]
+            })(<InputNumber min={0} placeholder="请输入销量" onChange={value => {
+              calc(Number(value) || 0, getFieldValue('unitPrice' + it.key) || 0, it.key);
+            }} />);
+          }
+        });
+        cols.push({
+          title: '营业收入(元)',
+          dataIndex: 'income',
+          key: 'income',
+          render: (text, it, idx) => {
+            return getFieldDecorator('income' + it.key, {
+              initialValue: text || 0
+            })(<InputNumber min={0} disabled={true} />);
+          }
+        });
+        break;
+      default:
+        cols.push({
+          title: '营业收入(元)',
+          dataIndex: 'income',
+          key: 'income',
+          render: (text, it, idx) => {
+            return getFieldDecorator('income' + it.key, {
+              initialValue: text || 0,
+              rules: [{
+                validator: (rule, value, callback) => {
+                  if (!Number(value)) {
+                    callback('请输入' + NUMBERS[idx + 1] + '预估营业收入!');
+                  } else {
+                    callback();
+                  }
+                },
+              }]
+            })(<InputNumber min={0} placeholder="请输入预估营业收入" />);
+          }
+        })
+        break;
+    }
+    if (this.state.hasIncome == '2') {
+      cols.push({
+        title: '参考值(元)',
+        dataIndex: 'recommend',
+        key: 'recommend',
+        render: (text) => {
+          return money(text)
+        }
+      })
+    }
+    return cols
+  },
+  stringify(val) {
+    return val && String(val)
+  },
   render() {
-    let {loading} = this.state;
+    let { loading, dataSource, type } = this.state;
+    const { getFieldDecorator, getFieldValue, setFieldsValue } = this.props.form;
     return (
       <Spin spinning={loading}>
-        <div>Step 5</div>
+        <div style={{ marginBottom: 10 }}>根据市场等,预测该技术应用于生产活动并产生收入情况。(选择以下三种方式中的一种预估方法)</div>
+        <Form className="steps-form">
+          <FormItem label="请选择预测方法" {...formItemLayout}>
+            {getFieldDecorator('type', {
+              initialValue: this.stringify(type)
+            })(
+              <RadioGroup size="large" onChange={this.onRadioChange}>
+                <RadioButton value="1">直接输入预测值法</RadioButton>
+                <RadioButton value="2">市场份额法</RadioButton>
+                <RadioButton value="3">数量单价法</RadioButton>
+              </RadioGroup>
+              )}
+          </FormItem>
+          <Table pagination={false} columns={this.tableCols()} dataSource={dataSource} />
+        </Form>
         <div className="steps-action">
           <Button type="primary" onClick={() => this.next()}>保存,下一步</Button>
           <Button style={{ marginLeft: 8 }} onClick={() => this.prev()}>上一步</Button>

+ 0 - 0
js/component/account/services/evaluate/steps/step5.less


+ 61 - 8
js/component/account/services/evaluate/steps/step6.jsx

@@ -1,36 +1,89 @@
 import React from 'react';
-import { Spin, Form, Button } from 'antd';
-import './step6.less';
+import { Spin, Form, Button, InputNumber, message } from 'antd';
+import ajax from 'jquery/src/ajax/xhr.js'
+import $ from 'jquery/src/ajax';
+
 const FormItem = Form.Item;
 
 const formItemLayout = {
-  labelCol: { span: 4 },
+  labelCol: { span: 6 },
   wrapperCol: { span: 10 },
 };
 
 const EvaluateStep6 = Form.create({})(React.createClass({
   getInitialState() {
     return {
-      loading: false
+      loading: false,
+      initialData: {}
     };
   },
   componentWillMount() {
+    this.state.initialData = this.props.data || {};
   },
   next() {
-    if (this.props.next) {
-      this.props.next();
+    if (this.state.loading) {
+      return;
     }
+    this.props.form.validateFields((err, values) => {
+      if (!err) {
+        this.setState({
+          loading: true
+        })
+        $.ajax({
+          url: globalConfig.context + '/api/user/evaluate/step6',
+          method: 'post',
+          data: {
+            id: this.props.id,
+            taxRate: values.taxRate
+          }
+        }).done(function (res) {
+          if (res.error && res.error.length) {
+            message.error(res.error[0].message)
+          } else {
+            if (this.props.next) {
+              this.props.next(values);
+            }
+          }
+        }.bind(this)).fail(function () {
+          this.setState({
+            loading: false
+          })
+        }.bind(this));
+      }
+    });
   },
   prev() {
     if (this.props.prev) {
       this.props.prev();
     }
   },
+  stringify(val) {
+    return val && String(val)
+  },
   render() {
-    let {loading} = this.state;
+    let { loading, initialData } = this.state;
+    const { getFieldDecorator } = this.props.form;
     return (
       <Spin spinning={loading}>
-        <div>Step 6</div>
+        <div style={{ marginBottom: 10 }}>提示:一般企业所得税率为25%,如果应用该项技术的公司有所得税优惠政策,按照优惠政策填列。如为高新技术企业请填15%</div>
+        <Form className="steps-form">
+          <FormItem label="预估企业所得税率(%)" {...formItemLayout}>
+            {getFieldDecorator('taxRate', {
+              initialValue: this.stringify(initialData.taxRate),
+              rules: [{ required: true, message: '请输入预估企业所得税率!' }, {
+                validator: (rule, value, callback) => {
+                  if (!Number(value)) {
+                    callback('请输入预估企业所得税率!');
+                  } else {
+                    callback();
+                  }
+                },
+              }]
+            })(
+              <InputNumber min={0} placeholder="请输入预估企业所得税率" />
+              )}
+          </FormItem>
+        </Form>
         <div className="steps-action">
           <Button type="primary" onClick={() => this.next()}>保存,下一步</Button>
           <Button style={{ marginLeft: 8 }} onClick={() => this.prev()}>上一步</Button>

+ 0 - 0
js/component/account/services/evaluate/steps/step6.less


+ 104 - 7
js/component/account/services/evaluate/steps/step7.jsx

@@ -1,7 +1,11 @@
 import React from 'react';
-import { Spin, Form, Button } from 'antd';
-import './step7.less';
+import { Spin, Form, Button, Select } from 'antd';
+import ajax from 'jquery/src/ajax/xhr.js'
+import $ from 'jquery/src/ajax';
+import { political, technical, market, capital, management } from './dict.js';
+
 const FormItem = Form.Item;
+const Option = Select.Option;
 
 const formItemLayout = {
   labelCol: { span: 4 },
@@ -11,26 +15,119 @@ const formItemLayout = {
 const EvaluateStep7 = Form.create({})(React.createClass({
   getInitialState() {
     return {
-      loading: false
+      loading: false,
+      initialData: {}
     };
   },
   componentWillMount() {
+    this.state.initialData = this.props.data || {};
   },
   next() {
-    if (this.props.next) {
-      this.props.next();
+    if (this.state.loading) {
+      return;
     }
+    this.props.form.validateFields((err, values) => {
+      if (!err) {
+        this.setState({
+          loading: true
+        })
+        values.id = this.props.id;
+        $.ajax({
+          url: globalConfig.context + '/api/user/evaluate/step7',
+          method: 'post',
+          data: values
+        }).done(function (res) {
+          if (res.error && res.error.length) {
+            message.error(res.error[0].message)
+          } else {
+            if (this.props.next) {
+              this.props.next(values);
+            }
+          }
+        }.bind(this)).fail(function () {
+          this.setState({
+            loading: false
+          })
+        }.bind(this));
+      }
+    });
   },
   prev() {
     if (this.props.prev) {
       this.props.prev();
     }
   },
+  stringify(val) {
+    return val && String(val)
+  },
   render() {
-    let {loading} = this.state;
+    let { loading, initialData } = this.state;
+    const { getFieldDecorator } = this.props.form;
     return (
       <Spin spinning={loading}>
-        <div>Step 7</div>
+        <div style={{ marginBottom: 10 }}>项目整体获利情况受政策、技术、市场、资金、管理等影响。</div>
+        <Form className="steps-form">
+          <FormItem label="政策风险" {...formItemLayout}>
+            {getFieldDecorator('political', {
+              rules: [{ required: true, message: '请选择政策风险!' }],
+              initialValue: this.stringify(initialData.political)
+            })(
+              <Select placeholder="请选择政策风险">
+                {political.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
+              </Select>
+              )}
+          </FormItem>
+          <FormItem label="技术风险" {...formItemLayout}>
+            {getFieldDecorator('technical', {
+              rules: [{ required: true, message: '请选择技术风险!' }],
+              initialValue: this.stringify(initialData.technical)
+            })(
+              <Select placeholder="请选择技术风险">
+                {technical.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
+              </Select>
+              )}
+          </FormItem>
+          <FormItem label="市场风险" {...formItemLayout}>
+            {getFieldDecorator('market', {
+              rules: [{ required: true, message: '请选择市场风险!' }],
+              initialValue: this.stringify(initialData.market)
+            })(
+              <Select placeholder="请选择市场风险">
+                {market.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
+              </Select>
+              )}
+          </FormItem>
+          <FormItem label="资金风险" {...formItemLayout}>
+            {getFieldDecorator('capital', {
+              rules: [{ required: true, message: '请选择资金风险!' }],
+              initialValue: this.stringify(initialData.capital)
+            })(
+              <Select placeholder="请选择资金风险">
+                {capital.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
+              </Select>
+              )}
+          </FormItem>
+          <FormItem label="管理风险" {...formItemLayout}>
+            {getFieldDecorator('management', {
+              rules: [{ required: true, message: '请选择管理风险!' }],
+              initialValue: this.stringify(initialData.management)
+            })(
+              <Select placeholder="请选择管理风险">
+                {management.map((it) => {
+                  return <Option key={it.id} value={it.id}>{it.text}</Option>
+                })}
+              </Select>
+              )}
+          </FormItem>
+        </Form>
         <div className="steps-action">
           <Button type="primary" onClick={() => this.next()}>保存,下一步</Button>
           <Button style={{ marginLeft: 8 }} onClick={() => this.prev()}>上一步</Button>

+ 0 - 0
js/component/account/services/evaluate/steps/step7.less


+ 319 - 6
js/component/account/services/evaluate/steps/step8.jsx

@@ -1,6 +1,10 @@
 import React from 'react';
-import { Spin, Form, Button, message } from 'antd';
-import './step8.less';
+import { Spin, Form, Button, message, Table } from 'antd';
+import ajax from 'jquery/src/ajax/xhr.js'
+import $ from 'jquery/src/ajax';
+import dict from './dict.js';
+import money from '../../../../money.js';
+
 const FormItem = Form.Item;
 
 const formItemLayout = {
@@ -8,13 +12,91 @@ const formItemLayout = {
   wrapperCol: { span: 10 },
 };
 
+const NUMBERS = {
+  1: '第一年',
+  2: '第二年',
+  3: '第三年',
+  4: '第四年',
+  5: '第五年',
+}
+
+const getText = (map, key, field) => {
+  if (field) {
+    return map[key] ? (map[key][field || 'text'] || '') : key;
+  }
+  return map[key] ? (map[key] || '') : key;
+}
+
 const EvaluateStep8 = Form.create({})(React.createClass({
   getInitialState() {
     return {
-      loading: false
+      loading: true,
+      record: {},
+      industries: {},
+      subIndustries: {},
+      districts: {},
+      value: 0,
+      recommends: []
     };
   },
   componentWillMount() {
+    let record = this.props.record || {}, dictMap = {};
+    if (record[0] && record[0].industry) {
+      this.loadData(record[0].industry);
+    } else {
+      this.state.loading = false;
+    }
+    this.state.record = record;
+    this.state.value = this.props.value || 0;
+    for (let key in dict) {
+      if (dict.hasOwnProperty(key) && key != 'toMap') {
+        dictMap[key] = dict.toMap(dict[key]);
+      }
+    }
+    this.state.dictMap = dictMap;
+  },
+  loadData(pid) {
+    $.when($.ajax({
+      url: globalConfig.context + '/open/findIndustryCategory'
+    }), $.ajax({
+      url: globalConfig.context + '/open/findIndustryCategory',
+      data: { id: pid }
+    }), $.ajax({
+      url: globalConfig.context + '/open/findDistrict'
+    }), $.ajax({
+      url: globalConfig.context + '/api/user/evaluate/step5/' + this.props.id
+    })).done(function (industryRes, subIndustryRes, districtRes, recommendRes) {
+      let i = {}, si = {}, d = { 0: "全国" }, r = [];
+      if (industryRes[0] && industryRes[0].data) {
+        industryRes[0].data.forEach(it => {
+          i[String(it.id)] = it;
+        })
+      }
+      if (subIndustryRes[0] && subIndustryRes[0].data) {
+        subIndustryRes[0].data.forEach(it => {
+          si[String(it.id)] = it;
+        })
+      }
+      if (districtRes[0] && districtRes[0].data) {
+        districtRes[0].data.forEach(it => {
+          d[String(it.id)] = it.name;
+        })
+      }
+      if (recommendRes[0] && recommendRes[0].data) {
+        r = recommendRes[0].data;
+      }
+      this.setState({
+        loading: false,
+        industries: i,
+        subIndustries: si,
+        districts: d,
+        recommends: r
+      })
+    }.bind(this)).fail(function () {
+      this.setState({
+        loading: false
+      })
+    }.bind(this));
   },
   next() {
     if (this.props.next) {
@@ -26,13 +108,244 @@ const EvaluateStep8 = Form.create({})(React.createClass({
       this.props.prev();
     }
   },
+  step1Col() {
+    return [{ dataIndex: 'key', key: 'key', width: '40%', className: 'steps-cell-key' }, { dataIndex: 'text', key: 'text', width: '60%' }]
+  },
+  step4Col() {
+    return [{
+      title: '年份', dataIndex: 'year', key: 'year'
+    }, {
+      title: '营收', dataIndex: 'income', key: 'income', render: (text) => { return money(text || 0) + '元' }
+    }, {
+      title: '利润率', dataIndex: 'profit', key: 'profit', render: (text) => { return (text || 0) + '%' }
+    }]
+  },
+  step5Col() {
+    const step = this.state.record[4];
+    let cols = [{
+      title: '年份', dataIndex: 'key', key: 'key', render: (text) => { return NUMBERS[text + 1] }
+    }]
+    switch (step.type) {
+      case "2":
+        cols.push({ title: '市场规模', dataIndex: 'marketScale', key: 'marketScale', render: (text) => { return money(text || 0) + '元' } });
+        cols.push({ title: '技术覆盖率/市场份额', dataIndex: 'marketRate', key: 'marketRate', render: (text) => { return (text || 0) + '%' } });
+        break;
+      case "3":
+        cols.push({ title: '单价', dataIndex: 'unitPrice', key: 'unitPrice', render: (text) => { return money(text || 0) + '元' } });
+        cols.push({ title: '销量', dataIndex: 'saleCount', key: 'saleCount' });
+        break;
+    }
+    cols.push({ title: '营业收入', dataIndex: 'income', key: 'income', render: (text) => { return money(text || 0) + '元' } });
+    cols.push({ title: '建议值', dataIndex: 'recommend', key: 'recommend', render: (text) => { return money(text || 0) + '元' } });
+    return cols;
+  },
+  step1Data() {
+    const step = this.state.record[0], { industries, subIndustries, districts } = this.state;
+    const { transferTypes, leftTimes } = this.state.dictMap;
+    return step ? [{
+      key: "技术名称",
+      text: step.name
+    }, {
+      key: "所属主行业",
+      text: getText(industries, String(step.industry), 'name')
+    }, {
+      key: "所属子行业",
+      text: step.subIndustry.split(',').map(it => {
+        return getText(subIndustries, it, 'name');
+      }).join(',')
+    }, {
+      key: "转让方式",
+      text: getText(transferTypes, String(step.transferType))
+    }, {
+      key: "预估技术剩余寿命",
+      text: getText(leftTimes, String(step.timeLeft))
+    }, {
+      key: "转让区域",
+      text: step.transferArea.split(',').map(it => {
+        return districts[it] || it;
+      }).join(',')
+    }, {
+      key: "评估基准日",
+      text: step.benchmarkDate
+    }, {
+      key: "评估币种",
+      text: step.currencyType
+    }] : []
+  },
+  step2Data() {
+    const step = this.state.record[1];
+    const { accessMethods, legalStatus, maintenanceStatus, confidentialities, decidabilities, rightLimitations } = this.state.dictMap;
+    return step ? [{
+      key: "取得方式",
+      text: getText(accessMethods, String(step.accessMethod))
+    }, {
+      key: "法律状态",
+      text: getText(legalStatus, String(step.legalStatus))
+    }, {
+      key: "专利维护",
+      text: getText(maintenanceStatus, String(step.patentMaintenance))
+    }, {
+      key: "保密性",
+      text: getText(confidentialities, String(step.confidentiality))
+    }, {
+      key: "他人侵权的易判定性",
+      text: getText(decidabilities, String(step.decidability))
+    }, {
+      key: "是否涉及质押、担保、诉讼等权利限制",
+      text: getText(rightLimitations, String(step.hasRightLimitation))
+    }] : []
+  },
+  step3Data() {
+    const step = this.state.record[2];
+    const { progressiveness, innovativeness, ripeness, alternatives,
+      defensive, prospect, supplyAndDemand, rangeOfApplication, imitable, profitability } = this.state.dictMap;
+    return step ? [{
+      key: "先进性",
+      text: getText(progressiveness, String(step.progressiveness))
+    }, {
+      key: "创新性",
+      text: getText(innovativeness, String(step.innovativeness))
+    }, {
+      key: "成熟度",
+      text: getText(ripeness, String(step.ripeness))
+    }, {
+      key: "替代性",
+      text: getText(alternatives, String(step.alternatives))
+    }, {
+      key: "技术防御力",
+      text: getText(defensive, String(step.defensive))
+    }, {
+      key: "技术领域发展前景",
+      text: getText(prospect, String(step.prospect))
+    }, {
+      key: "供求关系",
+      text: getText(supplyAndDemand, String(step.supplyAndDemand))
+    }, {
+      key: "产品应用范围",
+      text: getText(rangeOfApplication, String(step.rangeOfApplication))
+    }, {
+      key: "遭他人模仿可能性",
+      text: getText(imitable, String(step.imitable))
+    }, {
+      key: "独立获利能力",
+      text: getText(profitability, String(step.profitability))
+    }] : []
+  },
+  step4Data() {
+    const step = this.state.record[3];
+    return step.hasIncome == 2 && step.incomes || []
+  },
+  step5Data() {
+    const step = this.state.record[4], { recommends } = this.state;
+    let res = [];
+    if (step.forecastIncomes) {
+      step.forecastIncomes.forEach((it, idx) => {
+        res.push(Object.assign({}, it, {
+          key: idx,
+          recommend: recommends[idx]
+        }))
+      })
+    }
+    return res
+  },
+  step6Data() {
+    const step = this.state.record[5];
+    return step ? [{
+      key: "企业所得税率预估",
+      text: step.taxRate + '%'
+    }] : []
+  },
+  step7Data() {
+    const step = this.state.record[6];
+    const { political, technical, market, capital, management } = this.state.dictMap;
+    return step ? [{
+      key: "政策风险",
+      text: getText(political, String(step.political))
+    }, {
+      key: "技术风险",
+      text: getText(technical, String(step.technical))
+    }, {
+      key: "市场风险",
+      text: getText(market, String(step.market))
+    }, {
+      key: "资金风险",
+      text: getText(capital, String(step.capital))
+    }, {
+      key: "管理风险",
+      text: getText(management, String(step.management))
+    }] : []
+  },
+  step5Title() {
+    const step = this.state.record[4];
+    let title = "收入直接预估"
+    switch (step.type) {
+      case "2":
+        title = "市场占比预估"
+        break;
+      case "3":
+        title = "产品开发预估"
+        break;
+    }
+    return title;
+  },
+  calc() {
+    if(this.state.loading) {
+      return;
+    }
+    this.setState({
+      loading: true
+    })
+    $.ajax({
+      url: globalConfig.context + '/api/user/evaluate/calc/' + this.props.id
+    }).done(function (res) {
+      let val = res && res.data || 0;
+      this.setState({
+        value: val,
+        loading: false
+      })
+      if (this.props.next) {
+        this.props.next(val)
+      }
+    }.bind(this)).fail(function () {
+      this.setState({
+        loading: false
+      })
+    }.bind(this));
+  },
   render() {
-    let {loading} = this.state;
+    let { loading, record, value } = this.state;
+    const tableProps = {
+      showHeader: false,
+      pagination: false,
+      size: 'middle'
+    }
     return (
       <Spin spinning={loading}>
-        <div>Step 8</div>
+        <div className="steps-result">
+          <div className="steps-name">基本信息</div>
+          <Table {...tableProps} columns={this.step1Col()} dataSource={this.step1Data()}></Table>
+          <div className="steps-name">法律状况评估</div>
+          <Table {...tableProps} columns={this.step1Col()} dataSource={this.step2Data()}></Table>
+          <div className="steps-name">技术状况评估</div>
+          <Table {...tableProps} columns={this.step1Col()} dataSource={this.step3Data()}></Table>
+          <div className="steps-name">历史收入</div>
+          <Table columns={this.step4Col()} dataSource={this.step4Data()} locale={{ emptyText: "无历史收入" }} rowKey="year" pagination={false} size="middle"></Table>
+          <div className="steps-name">收入预估</div>
+          <Table columns={this.step5Col()} dataSource={this.step5Data()} pagination={false} size="middle" showHeader={true} title={this.step5Title}></Table>
+          <div className="steps-name">所得税预估</div>
+          <Table {...tableProps} columns={this.step1Col()} dataSource={this.step6Data()}></Table>
+          <div className="steps-name">风险预估</div>
+          <Table {...tableProps} columns={this.step1Col()} dataSource={this.step7Data()}></Table>
+          {
+            value ? <div><div className="steps-name">价值评估结果:</div>
+              <div className="steps-value">{money(value)}元</div></div> : <div />
+          }
+        </div>
         <div className="steps-action">
-          <Button type="primary" onClick={() => message.success('评估完成!')}>查看评估报告</Button>
+          {
+            value ? <Button type="primary" onClick={() => message.success('3级用户才能查看评估报告!')}>查看评估报告</Button>
+              : <Button type="primary" onClick={this.calc}>确认表单,开始估值</Button>
+          }
           <Button style={{ marginLeft: 8 }} onClick={() => this.prev()}>上一步</Button>
         </div>
       </Spin>

+ 0 - 0
js/component/account/services/evaluate/steps/step8.less


+ 15 - 0
js/component/money.js

@@ -0,0 +1,15 @@
+function money(s, n) {
+  n = n || 0;
+  n = n >= 0 && n <= 5 ? n : 2;
+  s = parseFloat((s + '').replace(/[^\d\.-]/g, '')).toFixed(n) + '';
+  s = s.split('.');
+  let l = s[0].split('').reverse(),
+    r = s[1] || '',
+    t = '';
+  for (let i = 0; i < l.length; i++) {
+    t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? ',' : '');
+  }
+  return t.split('').reverse().join('') + (r ? ('.' + r) : r);
+}
+
+module.exports = money;