innovationAbility.jsx 6.6 KB

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