activity.jsx 32 KB

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