innovationAbility.jsx 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. import React from 'react';
  2. import './ablt.less';
  3. import ajax from 'jquery/src/ajax/xhr.js'
  4. import $ from 'jquery/src/ajax';
  5. import { Switch, Input, Button, Spin, message } from 'antd';
  6. import { getProportion, saveProportion } from '../../../../tools.js';
  7. const Base = React.createClass({
  8. getInitialState() {
  9. return {
  10. loading: false,
  11. };
  12. },
  13. loadData() {
  14. this.setState({
  15. loading: true
  16. });
  17. $.ajax({
  18. method: "post",
  19. dataType: "json",
  20. url: globalConfig.context + "/api/admin/able",
  21. data: {
  22. uid: this.props.data.uid
  23. },
  24. success: function (data) {
  25. if (data.data) {
  26. this.setState({
  27. id: data.data.id,
  28. intellectRight: data.data.intellectRight,
  29. scienceAchievement: data.data.scienceAchievement,
  30. researchInnovation: data.data.researchInnovation,
  31. personnel: data.data.personnel
  32. });
  33. } else if (data.error && data.error.length) {
  34. message.warning(data.error[0].message);
  35. };
  36. }.bind(this),
  37. }).always(function () {
  38. this.setState({
  39. loading: false
  40. });
  41. }.bind(this));
  42. let _me = this;
  43. getProportion(this.props.data.uid, function (data) { _me.setState({ proportion: data }); });
  44. },
  45. componentWillMount() {
  46. this.loadData()
  47. },
  48. submit() {
  49. this.setState({
  50. loading: true
  51. })
  52. $.ajax({
  53. method: "POST",
  54. dataType: "json",
  55. crossDomain: false,
  56. url: globalConfig.context + "/api/admin/disposeAble",
  57. data: {
  58. uid: this.props.data.uid,
  59. id: this.state.id,
  60. intellectRight: this.state.intellectRight,
  61. scienceAchievement: this.state.scienceAchievement,
  62. researchInnovation: this.state.researchInnovation,
  63. personnel: this.state.personnel
  64. }
  65. }).done(function (data) {
  66. if (!data.error.length) {
  67. message.success('保存成功!');
  68. this.loadData();
  69. } else {
  70. message.warning(data.error[0].message);
  71. }
  72. }.bind(this)).always(function () {
  73. this.setState({
  74. loading: false
  75. })
  76. }.bind(this));
  77. },
  78. render() {
  79. return (
  80. <Spin spinning={this.state.loading} className='spin-box'>
  81. <div className="set-ablt">
  82. <div className="acc-detail clearfix">
  83. <p className="acc-title">
  84. <span>能力标签</span>
  85. <span className="proportion"> 是否已完成:</span>
  86. <Switch
  87. checked={this.state.proportion && this.state.proportion.ability == 1 ? true : false}
  88. checkedChildren={'已完成'}
  89. unCheckedChildren={'未完成'}
  90. onChange={(e) => {
  91. e ? this.state.proportion.ability = 1 : this.state.proportion.ability = 0;
  92. saveProportion(this.state.proportion.id, this.props.data.uid, 'ability', this.state.proportion.ability);
  93. this.setState({ proportion: this.state.proportion });
  94. }} />
  95. </p>
  96. <div className="acc-area">
  97. <p>知识产权对企业竞争力的作用 (限400字) </p>
  98. <Input type="textarea" rows={6}
  99. value={this.state.intellectRight}
  100. onChange={(e) => {
  101. if (e.target.value.length > 400) {
  102. message.warning("长度超过400字!");
  103. return;
  104. };
  105. this.setState({ intellectRight: e.target.value });
  106. }} />
  107. </div>
  108. <div className="acc-area">
  109. <p>科技成果转化情况 (限400字) </p>
  110. <Input type="textarea" rows={6}
  111. value={this.state.scienceAchievement}
  112. onChange={(e) => {
  113. if (e.target.value.length > 400) {
  114. message.warning("长度超过400字!");
  115. return;
  116. };
  117. this.setState({ scienceAchievement: e.target.value })
  118. }} />
  119. </div>
  120. <div className="acc-area">
  121. <p>研究开发与技术创新组织管理情况 (限400字) </p>
  122. <Input type="textarea" rows={6}
  123. value={this.state.researchInnovation}
  124. onChange={(e) => {
  125. if (e.target.value.length > 400) {
  126. message.warning("长度超过400字!");
  127. return;
  128. };
  129. this.setState({ researchInnovation: e.target.value })
  130. }} />
  131. </div>
  132. <div className="acc-area">
  133. <p>管理与科技人员情况 (限400字) </p>
  134. <Input type="textarea" rows={6}
  135. value={this.state.personnel}
  136. onChange={(e) => {
  137. if (e.target.value.length > 400) {
  138. message.warning("长度超过400字!");
  139. return;
  140. };
  141. this.setState({ personnel: e.target.value })
  142. }} />
  143. </div>
  144. </div>
  145. <Button className="set-submit" type="primary" onClick={this.submit}>保存</Button>
  146. </div>
  147. </Spin>
  148. )
  149. }
  150. });
  151. export default Base;