activity.jsx 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. import React from 'react';
  2. import { Icon, Button, Upload, Input, Table, message, Select, Modal, DatePicker, Cascader, Transfer, InputNumber, Switch, Form } from 'antd';
  3. import { technicalSourceList } from '../../dataDic.js';
  4. import { techFieldList, getTechField } from '../../DicTechFieldList.js';
  5. import { getTechnicalSource, beforeUploadFile, newDownloadFile } from '../../tools.js';
  6. import './activity.less';
  7. import moment from 'moment';
  8. import ajax from 'jquery/src/ajax/xhr.js';
  9. import $ from 'jquery/src/ajax';
  10. import SpinContainer from "../../SpinContainer";
  11. if (!Array.prototype.includes) {
  12. Object.defineProperty(Array.prototype, 'includes', {
  13. value: function (searchElement, fromIndex) {
  14. // 1. Let O be ? ToObject(this value).
  15. if (this == null) {
  16. throw new TypeError('"this" is null or not defined');
  17. }
  18. var o = Object(this);
  19. // 2. Let len be ? ToLength(? Get(O, "length")).
  20. var len = o.length >>> 0;
  21. // 3. If len is 0, return false.
  22. if (len === 0) {
  23. return false;
  24. }
  25. // 4. Let n be ? ToInteger(fromIndex).
  26. // (If fromIndex is undefined, this step produces the value 0.)
  27. var n = fromIndex | 0;
  28. // 5. If n ≥ 0, then
  29. // a. Let k be n.
  30. // 6. Else n < 0,
  31. // a. Let k be len + n.
  32. // b. If k < 0, let k be 0.
  33. var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
  34. // 7. Repeat, while k < len
  35. while (k < len) {
  36. // a. Let elementK be the result of ? Get(O, ! ToString(k)).
  37. // b. If SameValueZero(searchElement, elementK) is true, return true.
  38. // c. Increase k by 1.
  39. // NOTE: === provides the correct "SameValueZero" comparison needed here.
  40. if (o[k] === searchElement) {
  41. return true;
  42. }
  43. k++;
  44. }
  45. // 8. Return false
  46. return false;
  47. }
  48. });
  49. }
  50. const ActivityForm = Form.create()(React.createClass({
  51. getInitialState() {
  52. return {
  53. loading: false,
  54. targetKeys: [],
  55. selectedKeys: []
  56. };
  57. },
  58. loadData(id) {
  59. this.setState({ loading: true });
  60. $.ajax({
  61. method: "get",
  62. dataType: "json",
  63. crossDomain: false,
  64. url: globalConfig.context + "/api/user/cognizance/activityDetail",
  65. data: {
  66. id: id || this.props.data.id
  67. }
  68. }).done(function (data) {
  69. if (!data.data) {
  70. if (data.error && data.error.length) {
  71. message.warning(data.error[0].message);
  72. };
  73. } else {
  74. this.setState({
  75. data: data.data,
  76. targetKeys: data.data.intellectualPropertyNumber ? data.data.intellectualPropertyNumber.split(",") : [],
  77. techField: [data.data.technicalField1, data.data.technicalField2, data.data.technicalField3]
  78. });
  79. };
  80. }.bind(this)).always(function (data) {
  81. this.setState({ loading: false });
  82. }.bind(this));
  83. },
  84. handleSubmit(e) {
  85. e.preventDefault();
  86. this.props.form.validateFields((err, values) => {
  87. if (!err) {
  88. this.setState({ loading: true });
  89. $.ajax({
  90. method: "POST",
  91. dataType: "json",
  92. crossDomain: false,
  93. url: globalConfig.context + "/api/user/cognizance/activity",
  94. data: {
  95. id: this.props.data.id,
  96. uid: this.props.uid,
  97. activityName: values.activityName,
  98. activityNumber: values.activityNumber,
  99. projectMode: values.projectMode,
  100. startDateFormattedDate: values.startDate ? values.startDate.format("YYYY-MM-DD") : null,
  101. endDateFormattedDate: values.endDate ? values.endDate.format("YYYY-MM-DD") : null,
  102. technicalField1: values.techField[0],
  103. technicalField2: values.techField[1],
  104. technicalField3: values.techField[2],
  105. technicalSource: values.technicalSource,
  106. intellectualPropertyNumber: this.state.targetKeys.join(","),
  107. budget: values.budget,
  108. implement: values.implement,
  109. technologyInnovation: values.technologyInnovation,
  110. achievement: values.achievement,
  111. proofUrl: this.state.proofUrl
  112. }
  113. }).done(function (data) {
  114. if (!data.error.length) {
  115. message.success('保存成功!');
  116. this.props.closeModal(true);
  117. } else {
  118. message.warning(data.error[0].message);
  119. };
  120. this.setState({ loading: false });
  121. }.bind(this));
  122. }
  123. });
  124. },
  125. componentWillMount() {
  126. if (this.props.data.id) {
  127. this.loadData();
  128. } else {
  129. this.state.data = {};
  130. this.state.targetKeys = [];
  131. this.state.techField = undefined;
  132. };
  133. },
  134. componentWillReceiveProps(nextProps) {
  135. if (!this.props.visible && nextProps.visible) {
  136. this.state.mockData = nextProps.data.mockData;
  137. this.props.form.resetFields();
  138. this.state.proofUrl = undefined;
  139. this.state.fileList = [];
  140. if (nextProps.data.id) {
  141. this.loadData(nextProps.data.id);
  142. } else {
  143. this.state.data = {};
  144. this.state.targetKeys = [];
  145. this.state.techField = undefined;
  146. };
  147. };
  148. },
  149. intellectualChange(nextTargetKeys, direction, moveKeys) {
  150. this.setState({ targetKeys: nextTargetKeys });
  151. },
  152. intellectualSelectChange(sourceSelectedKeys, targetSelectedKeys) {
  153. this.setState({ selectedKeys: [...sourceSelectedKeys, ...targetSelectedKeys] });
  154. },
  155. render() {
  156. const FormItem = Form.Item;
  157. const { getFieldDecorator } = this.props.form;
  158. const theData = this.state.data;
  159. const formItemLayout = {
  160. labelCol: { span: 6 },
  161. wrapperCol: { span: 12 },
  162. };
  163. if (theData) {
  164. return (
  165. <SpinContainer spinning={this.state.loading} className='spin-box'>
  166. <Form onSubmit={this.handleSubmit} id="admin-desc-content">
  167. <div className="clearfix">
  168. <FormItem className="half-item"
  169. {...formItemLayout}
  170. label="研发活动编号"
  171. >
  172. {getFieldDecorator('activityNumber', {
  173. initialValue: theData.activityNumber
  174. })(
  175. <Input />
  176. )}
  177. </FormItem>
  178. <FormItem className="half-item"
  179. {...formItemLayout}
  180. label="研发活动名称"
  181. >
  182. {getFieldDecorator('activityName', {
  183. initialValue: theData.activityName
  184. })(
  185. <Input />
  186. )}
  187. </FormItem>
  188. <FormItem className="half-item"
  189. {...formItemLayout}
  190. label="开始日期"
  191. >
  192. {getFieldDecorator('startDate', {
  193. initialValue: theData.startDateFormattedDate ? moment(theData.startDateFormattedDate) : null
  194. })(
  195. <DatePicker />
  196. )}
  197. </FormItem>
  198. <FormItem className="half-item"
  199. {...formItemLayout}
  200. label="结束日期"
  201. >
  202. {getFieldDecorator('endDate', {
  203. initialValue: theData.endDateFormattedDate ? moment(theData.endDateFormattedDate) : null
  204. })(
  205. <DatePicker />
  206. )}
  207. </FormItem>
  208. </div>
  209. <div className="clearfix">
  210. <FormItem className="half-item"
  211. {...formItemLayout}
  212. label="技术领域"
  213. >
  214. {getFieldDecorator('techField', {
  215. initialValue: this.state.techField || []
  216. })(
  217. <Cascader
  218. style={{ width: 500 }}
  219. options={techFieldList}
  220. placeholder="选择技术领域"
  221. showSearch
  222. />
  223. )}
  224. </FormItem>
  225. </div>
  226. <div className="clearfix">
  227. <FormItem className="half-item"
  228. {...formItemLayout}
  229. label="技术来源"
  230. >
  231. {getFieldDecorator('technicalSource', {
  232. initialValue: theData.technicalSource ? String(theData.technicalSource) : undefined,
  233. })(
  234. <Select placeholder="选择技术来源" style={{ width: 230 }}>
  235. {
  236. technicalSourceList.map(function (item, i) {
  237. return <Select.Option key={1000 + i} value={item.value} >{item.key}</Select.Option>
  238. })
  239. }
  240. </Select>
  241. )}
  242. </FormItem>
  243. <FormItem className="half-item"
  244. {...formItemLayout}
  245. label="立项类型"
  246. >
  247. {getFieldDecorator('projectMode', {
  248. initialValue: theData.projectMode
  249. })(
  250. <Select style={{ width: 120 }}>
  251. <Select.Option value='0'>内部立项</Select.Option>
  252. <Select.Option value='1'>外部立项</Select.Option>
  253. </Select>
  254. )}
  255. </FormItem>
  256. </div>
  257. <div style={{ marginBottom: '20px' }}>
  258. <p>知识产权编号:</p>
  259. <Transfer
  260. dataSource={this.props.mockData}
  261. listStyle={{
  262. width: 300,
  263. height: 300,
  264. }}
  265. titles={['未选择', '已选择']}
  266. targetKeys={this.state.targetKeys}
  267. selectedKeys={this.state.selectedKeys}
  268. onChange={this.intellectualChange}
  269. onSelectChange={this.intellectualSelectChange}
  270. render={item => `${item.name}-${item.number}`}
  271. />
  272. </div>
  273. <FormItem className="half-div"
  274. labelCol={{ span: 8 }}
  275. wrapperCol={{ span: 12 }}
  276. label="研发经费总预算"
  277. >
  278. {getFieldDecorator('budget', {
  279. initialValue: theData.budget
  280. })(
  281. <InputNumber min={0} max={999999} step={0.01} />
  282. )}
  283. <span>万元</span>
  284. </FormItem>
  285. <div className="clearfix" >
  286. <p>研发经费近三年总支出:</p>
  287. <FormItem className="half-item"
  288. labelCol={{ span: 8 }}
  289. wrapperCol={{ span: 12 }}
  290. label="总计"
  291. >
  292. <span>{
  293. (theData.firstYearExpenditure || 0) +
  294. (theData.secondYearExpenditure || 0) +
  295. (theData.thirdYearExpenditure || 0)
  296. }</span>
  297. <span>万元</span>
  298. </FormItem>
  299. <FormItem className="half-item"
  300. labelCol={{ span: 8 }}
  301. wrapperCol={{ span: 12 }}
  302. label="其中(前一年)"
  303. >
  304. <span>{theData.firstYearExpenditure}</span>
  305. <span>万元</span>
  306. </FormItem>
  307. <FormItem className="half-item"
  308. labelCol={{ span: 8 }}
  309. wrapperCol={{ span: 12 }}
  310. label="其中(前二年)"
  311. >
  312. <span>{theData.secondYearExpenditure}</span>
  313. <span>万元</span>
  314. </FormItem>
  315. <FormItem className="half-item"
  316. labelCol={{ span: 8 }}
  317. wrapperCol={{ span: 12 }}
  318. label="其中(前三年)"
  319. >
  320. <span>{theData.thirdYearExpenditure}</span>
  321. <span>万元</span>
  322. </FormItem>
  323. </div>
  324. <div className="clearfix">
  325. <div className="half-div">
  326. <p>目的及组织实施方式(限400字):</p>
  327. {getFieldDecorator('implement', {
  328. initialValue: theData.implement
  329. })(
  330. <Input type="textarea" rows={6} />
  331. )}
  332. </div>
  333. <div className="half-div">
  334. <p>核心技术及创新点(限400字):</p>
  335. {getFieldDecorator('technologyInnovation', {
  336. initialValue: theData.technologyInnovation
  337. })(
  338. <Input type="textarea" rows={6} />
  339. )}
  340. </div>
  341. <div className="half-div">
  342. <p>取得的阶段性成果(限400字):</p>
  343. {getFieldDecorator('achievement', {
  344. initialValue: theData.achievement
  345. })(
  346. <Input type="textarea" rows={6} />
  347. )}
  348. </div>
  349. </div>
  350. <div style={{ width: '50%' }}>
  351. <Upload
  352. name="ratepay"
  353. action={globalConfig.context + "/api/user/cognizance/uploadProof"}
  354. data={{ 'sign': 'proof', 'uid': this.props.uid }}
  355. beforeUpload={beforeUploadFile}
  356. fileList={this.state.fileList}
  357. onChange={(info) => {
  358. if (info.file.status !== 'uploading') {
  359. console.log(info.file, info.fileList);
  360. }
  361. if (info.file.status === 'done') {
  362. if (!info.file.response.error.length) {
  363. message.success(`${info.file.name} 文件上传成功!`);
  364. } else {
  365. message.warning(info.file.response.error[0].message);
  366. return;
  367. };
  368. this.state.proofUrl = info.file.response.data;
  369. } else if (info.file.status === 'error') {
  370. message.error(`${info.file.name} 文件上传失败。`);
  371. };
  372. this.setState({ fileList: info.fileList.slice(-1) });
  373. }}
  374. >
  375. <Button><Icon type="upload" /> 上传立项证明材料 </Button>
  376. </Upload>
  377. <p>{theData.proofUrl ? <a onClick={newDownloadFile.bind(null, theData.id, 'proof', '/api/user/cognizance/downloadProof')}>{theData.proofDownloadFileName}</a> : <span><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传!</span>}</p>
  378. </div>
  379. <FormItem style={{ marginTop: '20px' }}>
  380. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  381. <Button type="ghost" style={{ marginLeft: '20px' }} onClick={this.props.closeModal}>取消</Button>
  382. </FormItem>
  383. </Form >
  384. </SpinContainer >
  385. )
  386. } else {
  387. return (<div></div>)
  388. };
  389. }
  390. }));
  391. const ActivityDesc = React.createClass({
  392. getInitialState() {
  393. return {
  394. visible: false,
  395. loading: false
  396. };
  397. },
  398. handleCancel(e) {
  399. this.setState({
  400. visible: false,
  401. });
  402. this.props.closeDesc(false);
  403. if (e) {
  404. this.props.closeDesc(false, true);
  405. };
  406. },
  407. componentWillReceiveProps(nextProps) {
  408. this.state.visible = nextProps.showDesc;
  409. },
  410. render() {
  411. return (
  412. <div className="admin-desc">
  413. <Modal maskClosable={false} title="企业研究开发活动情况详情"
  414. visible={this.state.visible}
  415. onCancel={this.handleCancel}
  416. width='800px'
  417. footer=''
  418. className="admin-desc-content">
  419. <ActivityForm
  420. visible={this.state.visible}
  421. data={this.props.data}
  422. uid={this.props.uid}
  423. mockData={this.props.mockData}
  424. spinState={this.spinChange}
  425. closeModal={this.handleCancel} />
  426. </Modal>
  427. </div>
  428. );
  429. },
  430. });
  431. const Activity = React.createClass({
  432. loadData(pageNo) {
  433. this.state.data = [];
  434. this.setState({
  435. loading: true
  436. });
  437. $.when($.ajax({
  438. method: "post",
  439. dataType: "json",
  440. crossDomain: false,
  441. url: globalConfig.context + "/api/user/cognizance/activityList",
  442. data: {
  443. pageNo: pageNo || 1,
  444. pageSize: this.state.pagination.pageSize,
  445. activityNumber: this.state.activityNumber,
  446. activityName: this.state.activityName
  447. }
  448. }), $.ajax({
  449. method: "get",
  450. dataType: "json",
  451. crossDomain: false,
  452. url: globalConfig.context + "/api/user/cognizance/intellectualList",
  453. data: {
  454. pageNo: pageNo || 1,
  455. pageSize: 99,
  456. }
  457. })).done((data1, data2) => {
  458. let data = data1[0];
  459. let intellectualList = data2[0];
  460. let theArr = [], theObj = {};
  461. if (data.error.length || !data.data || !data.data.list) {
  462. message.warning(data.error[0].message);
  463. } else {
  464. for (let i = 0; i < data.data.list.length; i++) {
  465. let thisdata = data.data.list[i];
  466. this.state.data.push({
  467. key: i,
  468. id: thisdata.id,
  469. uid: thisdata.uid,
  470. activityNumber: thisdata.activityNumber,
  471. activityName: thisdata.activityName,
  472. startDate: thisdata.startDate,
  473. endDate: thisdata.endDate,
  474. mockData: this.state.mockData,
  475. techField: [thisdata.technicalField1, thisdata.technicalField2, thisdata.technicalField3],
  476. technicalField: getTechField(thisdata.technicalField1, thisdata.technicalField2, thisdata.technicalField3),
  477. technicalField1: thisdata.technicalField1,
  478. technicalField2: thisdata.technicalField2,
  479. technicalField3: thisdata.technicalField3,
  480. technicalSource: thisdata.technicalSource ? String(thisdata.technicalSource) : undefined,
  481. intellectualPropertyNumber: thisdata.intellectualPropertyNumber ? thisdata.intellectualPropertyNumber.split(",") : [],
  482. intellectualPropertyNumberText: thisdata.intellectualPropertyNumber,
  483. budget: thisdata.budget,
  484. firstYearExpenditure: thisdata.firstYearExpenditure,
  485. secondYearExpenditure: thisdata.secondYearExpenditure,
  486. thirdYearExpenditure: thisdata.thirdYearExpenditure,
  487. implement: thisdata.implement,
  488. technologyInnovation: thisdata.technologyInnovation,
  489. achievement: thisdata.achievement,
  490. internalLaborCost: thisdata.internalLaborCost,
  491. internalDirectCost: thisdata.internalDirectCost,
  492. internalDepreciationCost: thisdata.internalDepreciationCost,
  493. internalAmortizationCost: thisdata.internalAmortizationCost,
  494. internalDesignCost: thisdata.internalDesignCost,
  495. internalEquipmentCost: thisdata.internalEquipmentCost,
  496. internalOtherCost: thisdata.internalOtherCost,
  497. externalTotalCost: thisdata.externalTotalCost,
  498. externalAbroadCost: thisdata.externalAbroadCost,
  499. enterpriseFiller: thisdata.enterpriseFiller,
  500. signDate: thisdata.signDate,
  501. sortNumber: thisdata.sortNumber,
  502. startDateFormattedDate: thisdata.startDateFormattedDate,
  503. endDateFormattedDate: thisdata.endDateFormattedDate,
  504. projectMode: thisdata.projectMode,
  505. proofUrl: thisdata.proofUrl,
  506. proofDownloadFileName: thisdata.proofDownloadFileName
  507. });
  508. };
  509. this.state.pagination.current = data.data.pageNo;
  510. this.state.pagination.total = data.data.totalCount;
  511. };
  512. if (intellectualList.error.length || !intellectualList.data || !intellectualList.data.list) {
  513. message.warning(intellectualList.error[0].message);
  514. } else {
  515. for (let i = 0; i < intellectualList.data.list.length; i++) {
  516. theArr.push({
  517. key: intellectualList.data.list[i].id,
  518. number: intellectualList.data.list[i].intellectualPropertyNumber,
  519. name: intellectualList.data.list[i].intellectualPropertyName
  520. });
  521. theObj[intellectualList.data.list[i].id] = intellectualList.data.list[i].intellectualPropertyNumber;
  522. };
  523. };
  524. this.setState({
  525. dataSource: this.state.data,
  526. pagination: this.state.pagination,
  527. mockData: theArr,
  528. mockDataObj: theObj
  529. });
  530. }).always(function () {
  531. this.setState({
  532. loading: false
  533. });
  534. }.bind(this));
  535. },
  536. getInitialState() {
  537. return {
  538. mockData: [],
  539. mockDataObj: {},
  540. selectedRowKeys: [],
  541. selectedRows: [],
  542. loading: false,
  543. pagination: {
  544. defaultCurrent: 1,
  545. defaultPageSize: 10,
  546. showQuickJumper: true,
  547. pageSize: 10,
  548. onChange: function (page) {
  549. this.loadData(page);
  550. }.bind(this),
  551. showTotal: function (total) {
  552. return '共' + total + '条数据';
  553. }
  554. },
  555. columns: [
  556. {
  557. title: '研发活动编号',
  558. dataIndex: 'activityNumber',
  559. key: 'activityNumber'
  560. }, {
  561. title: '研发活动名称',
  562. dataIndex: 'activityName',
  563. key: 'activityName'
  564. }, {
  565. title: '技术领域',
  566. dataIndex: 'technicalField',
  567. key: 'technicalField'
  568. }, {
  569. title: '技术来源',
  570. dataIndex: 'technicalSource',
  571. key: 'technicalSource',
  572. render: (text) => { return getTechnicalSource(text) }
  573. }, {
  574. title: '知识产权编号',
  575. dataIndex: 'intellectualPropertyNumberText',
  576. key: 'intellectualPropertyNumberText',
  577. render: (text) => {
  578. let arr = [], _me = this;
  579. if (text && text.split(',').length) {
  580. text.split(',').map((item) => {
  581. arr.push(_me.state.mockDataObj[item]);
  582. });
  583. };
  584. return arr.join(',');
  585. }
  586. }, {
  587. title: '开始时间',
  588. dataIndex: 'startDateFormattedDate',
  589. key: 'startDateFormattedDate'
  590. }, {
  591. title: '结束时间',
  592. dataIndex: 'endDateFormattedDate',
  593. key: 'endDateFormattedDate'
  594. }
  595. ],
  596. dataSource: []
  597. };
  598. },
  599. componentWillMount() {
  600. this.loadData();
  601. },
  602. tableRowClick(record, index) {
  603. this.state.RowData = record;
  604. this.setState({
  605. showDesc: true
  606. });
  607. },
  608. delectRow() {
  609. let deletedIds = [];
  610. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  611. let rowItem = this.state.selectedRows[idx];
  612. if (rowItem.id) {
  613. deletedIds.push(rowItem.id)
  614. }
  615. }
  616. this.setState({
  617. selectedRowKeys: [],
  618. loading: deletedIds.length > 0
  619. });
  620. $.ajax({
  621. method: "POST",
  622. dataType: "json",
  623. crossDomain: false,
  624. url: globalConfig.context + "/api/user/cognizance/deleteActivity",
  625. data: {
  626. ids: deletedIds
  627. }
  628. }).done(function (data) {
  629. if (!data.error.length) {
  630. message.success('删除成功!');
  631. this.setState({
  632. loading: false,
  633. });
  634. } else {
  635. message.warning(data.error[0].message);
  636. };
  637. this.loadData();
  638. }.bind(this));
  639. },
  640. closeDesc(e, s) {
  641. this.state.showDesc = e;
  642. if (s) {
  643. this.loadData();
  644. };
  645. },
  646. search() {
  647. this.loadData();
  648. },
  649. reset() {
  650. this.state.activityName = undefined;
  651. this.state.activityNumber = undefined;
  652. this.loadData();
  653. },
  654. render() {
  655. const rowSelection = {
  656. selectedRowKeys: this.state.selectedRowKeys,
  657. onChange: (selectedRowKeys, selectedRows) => {
  658. this.setState({
  659. selectedRows: selectedRows,
  660. selectedRowKeys: selectedRowKeys
  661. });
  662. }
  663. };
  664. const hasSelected = this.state.selectedRowKeys.length > 0;
  665. return (
  666. <div className="user-content" >
  667. <div className="content-title">
  668. <span>企业研究开发活动情况表</span>
  669. </div>
  670. <div className="user-search">
  671. <Input placeholder="研发活动名称" value={this.state.activityName}
  672. onChange={(e) => { this.setState({ activityName: e.target.value }); }} />
  673. <Input placeholder="研发活动编号" value={this.state.activityNumber}
  674. onChange={(e) => { this.setState({ activityNumber: e.target.value }); }} />
  675. <Button type="primary" onClick={this.search}>搜索</Button>
  676. <Button onClick={this.reset}>重置</Button>
  677. <p>
  678. <Button style={{ background: "#ea0862", border: "none", color: "#fff" }}
  679. onClick={this.tableRowClick}>添加<Icon type="plus" /></Button>
  680. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  681. disabled={!hasSelected}
  682. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  683. </p>
  684. </div>
  685. <div className="patent-table">
  686. <SpinContainer spinning={this.state.loading}>
  687. <Table columns={this.state.columns}
  688. dataSource={this.state.dataSource}
  689. pagination={this.state.pagination}
  690. rowSelection={rowSelection}
  691. onRowClick={this.tableRowClick} />
  692. </SpinContainer>
  693. </div>
  694. <ActivityDesc data={this.state.RowData}
  695. mockData={this.state.mockData}
  696. showDesc={this.state.showDesc} closeDesc={this.closeDesc} />
  697. </div >
  698. );
  699. }
  700. });
  701. export default Activity;