innovationAbility.jsx 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. } else {
  69. message.warning(data.error[0].message);
  70. }
  71. }.bind(this)).always(function () {
  72. this.setState({
  73. loading: false
  74. })
  75. }.bind(this));
  76. },
  77. render() {
  78. return (
  79. <Spin spinning={this.state.loading} className='spin-box'>
  80. <div className="set-ablt">
  81. <div className="acc-detail clearfix">
  82. <p className="acc-title">
  83. <span>能力标签</span>
  84. <span className="proportion"> 是否已完成:</span>
  85. <Switch
  86. checked={this.state.proportion && this.state.proportion.ability == 1 ? true : false}
  87. checkedChildren={'已完成'}
  88. unCheckedChildren={'未完成'}
  89. onChange={(e) => {
  90. e ? this.state.proportion.ability = 1 : this.state.proportion.ability = 0;
  91. saveProportion(this.state.proportion.id, this.props.data.uid, 'ability', this.state.proportion.ability);
  92. this.setState({ proportion: this.state.proportion });
  93. }} />
  94. </p>
  95. <div className="acc-area">
  96. <p>知识产权对企业竞争力的作用 (限400字) </p>
  97. <Input type="textarea" rows={6}
  98. value={this.state.intellectRight}
  99. onChange={(e) => {
  100. if (e.target.value.length > 400) {
  101. message.warning("长度超过400字!");
  102. return;
  103. };
  104. this.setState({ intellectRight: e.target.value });
  105. }} />
  106. </div>
  107. <div className="acc-area">
  108. <p>科技成果转化情况 (限400字) </p>
  109. <Input type="textarea" rows={6}
  110. value={this.state.scienceAchievement}
  111. onChange={(e) => {
  112. if (e.target.value.length > 400) {
  113. message.warning("长度超过400字!");
  114. return;
  115. };
  116. this.setState({ scienceAchievement: e.target.value })
  117. }} />
  118. </div>
  119. <div className="acc-area">
  120. <p>研究开发与技术创新组织管理情况 (限400字) </p>
  121. <Input type="textarea" rows={6}
  122. value={this.state.researchInnovation}
  123. onChange={(e) => {
  124. if (e.target.value.length > 400) {
  125. message.warning("长度超过400字!");
  126. return;
  127. };
  128. this.setState({ researchInnovation: e.target.value })
  129. }} />
  130. </div>
  131. <div className="acc-area">
  132. <p>管理与科技人员情况 (限400字) </p>
  133. <Input type="textarea" rows={6}
  134. value={this.state.personnel}
  135. onChange={(e) => {
  136. if (e.target.value.length > 400) {
  137. message.warning("长度超过400字!");
  138. return;
  139. };
  140. this.setState({ personnel: e.target.value })
  141. }} />
  142. </div>
  143. </div>
  144. <Button className="set-submit" type="primary" onClick={this.submit}>保存</Button>
  145. </div>
  146. </Spin>
  147. )
  148. }
  149. });
  150. export default Base;