hrSituation.jsx 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. import React from 'react';
  2. import { Input, InputNumber, Button, Form, Icon, Spin, message, Table, Modal, Upload } from 'antd';
  3. import { beforeUpload } from '../../tools.js';
  4. import './hrSituation.less'
  5. import ajax from 'jquery/src/ajax/xhr.js'
  6. import $ from 'jquery/src/ajax';
  7. const HrSituationDescFrom = Form.create()(React.createClass({
  8. getInitialState() {
  9. return {
  10. loading: false
  11. };
  12. },
  13. handleSubmit(e) {
  14. e.preventDefault();
  15. this.props.form.validateFields((err, values) => {
  16. if (values.firmTotal < values.firmInService + values.firmPartTime + values.firmTemporary) {
  17. message.warning("总体情况的在职人员数、兼职人员数、临时聘用人员数相加小于等于企业职工总数!");
  18. return;
  19. };
  20. if (values.firmTotal < values.techTotal) {
  21. message.warning("科技人员数小于等于企业职工总数!");
  22. return;
  23. };
  24. if (values.firmInService < values.techInService || values.firmPartTime < values.techPartTime || values.firmTemporary < values.techTemporary ||
  25. values.firmForeign < values.techForeign || values.firmAbroad < values.techAbroad || values.firmCore < values.techCore) {
  26. message.warning("科技人员各项人数小于等于企业职工各项人数!");
  27. return;
  28. };
  29. if (values.firmTotal < values.doctor + values.master + values.undergraduate + values.college) {
  30. message.warning("全体人员结构中学历一栏人数总和小于等于职工人数!");
  31. return;
  32. };
  33. if (values.firmTotal < values.belowThirty + values.thirtyoneToThirtyfour + values.fortyoneToFifty + values.aboveFifty) {
  34. message.warning("全体人员结构中年龄一栏人数总和小于等于职工人数!");
  35. return;
  36. };
  37. if (values.year) {
  38. message.warning("请输入年份!");
  39. return;
  40. }
  41. if (!err) {
  42. this.props.spinState(true);
  43. $.ajax({
  44. method: "POST",
  45. dataType: "json",
  46. crossDomain: false,
  47. url: globalConfig.context + "/techservice/cognizance/updateOrgHumanResource",
  48. data: {
  49. id: this.props.data.id,
  50. year: values.data.year,
  51. aboveFifty: values.aboveFifty,
  52. belowThirty: values.belowThirty,
  53. college: values.college,
  54. doctor: values.doctor,
  55. firmAbroad: values.firmAbroad,
  56. firmCore: values.firmCore,
  57. firmForeign: values.firmForeign,
  58. firmInService: values.firmInService,
  59. firmPartTime: values.firmPartTime,
  60. firmTemporary: values.firmTemporary,
  61. firmTotal: values.firmTotal,
  62. fortyoneToFifty: values.fortyoneToFifty,
  63. intermediateTitle: values.intermediateTitle,
  64. juniorTitle: values.juniorTitle,
  65. master: values.master,
  66. seniorMechanic: values.seniorMechanic,
  67. seniorTitle: values.seniorTitle,
  68. techAbroad: values.techAbroad,
  69. techCore: values.techCore,
  70. techForeign: values.techForeign,
  71. techInService: values.techInService,
  72. techPartTime: values.techPartTime,
  73. techTemporary: values.techTemporary,
  74. techTotal: values.techTotal,
  75. thirtyoneToThirtyfour: values.thirtyoneToThirtyfour,
  76. undergraduate: values.undergraduate,
  77. rosterUrl: this.state.rosterUrl,
  78. socialSecurityUrl: this.state.socialSecurityUrl,
  79. neweEmployment: values.neweEmployment,
  80. graduateNumber: values.graduateNumber
  81. }
  82. }).done(function (data) {
  83. if (!data.error.length) {
  84. message.success('保存成功!');
  85. this.props.closeModal();
  86. this.props.spinState(false);
  87. this.props.form.resetFields();
  88. } else {
  89. message.warning(data.error[0].message);
  90. this.props.spinState(false);
  91. }
  92. }.bind(this));
  93. }
  94. });
  95. },
  96. render() {
  97. const { getFieldDecorator } = this.props.form;
  98. const formItemLayout = {
  99. labelCol: { span: 8 },
  100. wrapperCol: { span: 16 },
  101. };
  102. const FormItem = Form.Item;
  103. return (
  104. <Form onSubmit={this.handleSubmit} className="hrSituation-form">
  105. <div className="clearfix">
  106. <FormItem className="half-item"
  107. {...formItemLayout}
  108. label="年份"
  109. >
  110. {getFieldDecorator('year', {
  111. initialValue: this.props.data.year || null
  112. })(
  113. <InputNumber />
  114. )}
  115. </FormItem>
  116. </div>
  117. <p className="hrSituation-title">总体情况</p>
  118. <div className="clearfix">
  119. <span className="hrSituation-span">总数(人)</span>
  120. <FormItem className="half-item"
  121. {...formItemLayout}
  122. label="企业职工"
  123. >
  124. {getFieldDecorator('firmTotal', {
  125. initialValue: this.props.data.firmTotal || null
  126. })(
  127. <InputNumber />
  128. )}
  129. </FormItem>
  130. <FormItem className="half-item"
  131. {...formItemLayout}
  132. label="科技人员"
  133. >
  134. {getFieldDecorator('techTotal', {
  135. initialValue: this.props.data.techTotal || null
  136. })(
  137. <InputNumber />
  138. )}
  139. </FormItem>
  140. <FormItem className="half-item" style={{ width: '50%' }}>
  141. <span>其中科技人员占比
  142. {(() => {
  143. if (!this.props.form.getFieldValue('techTotal') || !this.props.form.getFieldValue('firmTotal')) {
  144. return 0
  145. }
  146. return (this.props.form.getFieldValue('techTotal') / this.props.form.getFieldValue('firmTotal') * 100).toFixed(2)
  147. })()}
  148. %</span>
  149. </FormItem>
  150. <span className="hrSituation-span">在职人员(人)</span>
  151. <FormItem className="half-item"
  152. {...formItemLayout}
  153. label="企业职工"
  154. >
  155. {getFieldDecorator('firmInService', {
  156. initialValue: this.props.data.firmInService || null
  157. })(
  158. <InputNumber />
  159. )}
  160. </FormItem>
  161. <FormItem className="half-item"
  162. {...formItemLayout}
  163. label="科技人员"
  164. >
  165. {getFieldDecorator('techInService', {
  166. initialValue: this.props.data.techInService || null
  167. })(
  168. <InputNumber />
  169. )}
  170. </FormItem>
  171. <span className="hrSituation-span">兼职人员(人)</span>
  172. <FormItem className="half-item"
  173. {...formItemLayout}
  174. label="企业职工"
  175. >
  176. {getFieldDecorator('firmPartTime', {
  177. initialValue: this.props.data.firmPartTime || null
  178. })(
  179. <InputNumber />
  180. )}
  181. </FormItem>
  182. <FormItem className="half-item"
  183. {...formItemLayout}
  184. label="科技人员"
  185. >
  186. {getFieldDecorator('techPartTime', {
  187. initialValue: this.props.data.techPartTime || null
  188. })(
  189. <InputNumber />
  190. )}
  191. </FormItem>
  192. <span className="hrSituation-span">临时聘用人员(人)</span>
  193. <FormItem className="half-item"
  194. {...formItemLayout}
  195. label="企业职工"
  196. >
  197. {getFieldDecorator('firmTemporary', {
  198. initialValue: this.props.data.firmTemporary || null
  199. })(
  200. <InputNumber />
  201. )}
  202. </FormItem>
  203. <FormItem className="half-item"
  204. {...formItemLayout}
  205. label="科技人员"
  206. >
  207. {getFieldDecorator('techTemporary', {
  208. initialValue: this.props.data.techTemporary || null
  209. })(
  210. <InputNumber />
  211. )}
  212. </FormItem>
  213. <span className="hrSituation-span">外籍人员(人)</span>
  214. <FormItem className="half-item"
  215. {...formItemLayout}
  216. label="企业职工"
  217. >
  218. {getFieldDecorator('firmForeign', {
  219. initialValue: this.props.data.firmForeign || null
  220. })(
  221. <InputNumber />
  222. )}
  223. </FormItem>
  224. <FormItem className="half-item"
  225. {...formItemLayout}
  226. label="科技人员"
  227. >
  228. {getFieldDecorator('techForeign', {
  229. initialValue: this.props.data.techForeign || null
  230. })(
  231. <InputNumber />
  232. )}
  233. </FormItem>
  234. <span className="hrSituation-span">留学归国人员(人)</span>
  235. <FormItem className="half-item"
  236. {...formItemLayout}
  237. label="企业职工"
  238. >
  239. {getFieldDecorator('firmAbroad', {
  240. initialValue: this.props.data.firmAbroad || null
  241. })(
  242. <InputNumber />
  243. )}
  244. </FormItem>
  245. <FormItem className="half-item"
  246. {...formItemLayout}
  247. label="科技人员"
  248. >
  249. {getFieldDecorator('techAbroad', {
  250. initialValue: this.props.data.techAbroad || null
  251. })(
  252. <InputNumber />
  253. )}
  254. </FormItem>
  255. <span className="hrSituation-span">干人计划人员(人)</span>
  256. <FormItem className="half-item"
  257. {...formItemLayout}
  258. label="企业职工"
  259. >
  260. {getFieldDecorator('firmCore', {
  261. initialValue: this.props.data.firmCore || null
  262. })(
  263. <InputNumber />
  264. )}
  265. </FormItem>
  266. <FormItem className="half-item"
  267. {...formItemLayout}
  268. label="科技人员"
  269. >
  270. {getFieldDecorator('techCore', {
  271. initialValue: this.props.data.techCore || null
  272. })(
  273. <InputNumber />
  274. )}
  275. </FormItem>
  276. </div>
  277. <p className="hrSituation-title">全体人员结构</p>
  278. <div className="clearfix">
  279. <span className="hrSituation-span">学历人数</span>
  280. <FormItem className="half-item"
  281. {...formItemLayout}
  282. label="博士"
  283. >
  284. {getFieldDecorator('doctor', {
  285. initialValue: this.props.data.doctor || null
  286. })(
  287. <InputNumber />
  288. )}
  289. </FormItem>
  290. <FormItem className="half-item"
  291. {...formItemLayout}
  292. label="硕士"
  293. >
  294. {getFieldDecorator('master', {
  295. initialValue: this.props.data.master || null
  296. })(
  297. <InputNumber />
  298. )}
  299. </FormItem>
  300. <FormItem className="half-item"
  301. {...formItemLayout}
  302. label="本科"
  303. >
  304. {getFieldDecorator('undergraduate', {
  305. initialValue: this.props.data.undergraduate || null
  306. })(
  307. <InputNumber />
  308. )}
  309. </FormItem>
  310. <FormItem className="half-item"
  311. {...formItemLayout}
  312. label="大专及以下"
  313. >
  314. {getFieldDecorator('college', {
  315. initialValue: this.props.data.college || null
  316. })(
  317. <InputNumber />
  318. )}
  319. </FormItem>
  320. </div>
  321. <div className="clearfix">
  322. <span className="hrSituation-span">职称人数</span>
  323. <FormItem className="half-item"
  324. {...formItemLayout}
  325. label="高级职称"
  326. >
  327. {getFieldDecorator('seniorTitle', {
  328. initialValue: this.props.data.seniorTitle || null
  329. })(
  330. <InputNumber />
  331. )}
  332. </FormItem>
  333. <FormItem className="half-item"
  334. {...formItemLayout}
  335. label="中级职称"
  336. >
  337. {getFieldDecorator('intermediateTitle', {
  338. initialValue: this.props.data.intermediateTitle || null
  339. })(
  340. <InputNumber />
  341. )}
  342. </FormItem>
  343. <FormItem className="half-item"
  344. {...formItemLayout}
  345. label="初级职称"
  346. >
  347. {getFieldDecorator('juniorTitle', {
  348. initialValue: this.props.data.juniorTitle || null
  349. })(
  350. <InputNumber />
  351. )}
  352. </FormItem>
  353. <FormItem className="half-item"
  354. {...formItemLayout}
  355. label="高级技工"
  356. >
  357. {getFieldDecorator('seniorMechanic', {
  358. initialValue: this.props.data.seniorMechanic || null
  359. })(
  360. <InputNumber />
  361. )}
  362. </FormItem>
  363. </div>
  364. <div className="clearfix">
  365. <span className="hrSituation-span">年龄人数</span>
  366. <FormItem className="half-item"
  367. {...formItemLayout}
  368. label="30及以下"
  369. >
  370. {getFieldDecorator('belowThirty', {
  371. initialValue: this.props.data.belowThirty || null
  372. })(
  373. <InputNumber />
  374. )}
  375. </FormItem>
  376. <FormItem className="half-item"
  377. {...formItemLayout}
  378. label="31-34"
  379. >
  380. {getFieldDecorator('thirtyoneToThirtyfour', {
  381. initialValue: this.props.data.thirtyoneToThirtyfour || null
  382. })(
  383. <InputNumber />
  384. )}
  385. </FormItem>
  386. <FormItem className="half-item"
  387. {...formItemLayout}
  388. label="41-50"
  389. >
  390. {getFieldDecorator('fortyoneToFifty', {
  391. initialValue: this.props.data.fortyoneToFifty || null
  392. })(
  393. <InputNumber />
  394. )}
  395. </FormItem>
  396. <FormItem className="half-item"
  397. {...formItemLayout}
  398. label="50以上"
  399. >
  400. {getFieldDecorator('aboveFifty', {
  401. initialValue: this.props.data.aboveFifty || null
  402. })(
  403. <InputNumber />
  404. )}
  405. </FormItem>
  406. </div>
  407. <p className="hrSituation-title">每年新增员工数</p>
  408. <div className="clearfix">
  409. <FormItem
  410. labelCol={{ span: 16 }}
  411. wrapperCol={{ span: 8 }}
  412. label="新增就业人数"
  413. >
  414. {getFieldDecorator('neweEmployment', {
  415. initialValue: this.props.data.neweEmployment || null
  416. })(
  417. <InputNumber />
  418. )}
  419. </FormItem>
  420. <FormItem
  421. labelCol={{ span: 16 }}
  422. wrapperCol={{ span: 8 }}
  423. label="高校应届毕业生人数"
  424. >
  425. {getFieldDecorator('graduateNumber', {
  426. initialValue: this.props.data.graduateNumber || null
  427. })(
  428. <InputNumber />
  429. )}
  430. </FormItem>
  431. </div>
  432. <div className="hrSituation-roster">
  433. <Upload
  434. name="socialSecurity"
  435. action={globalConfig.context + "/techservice/cognizance/upload"}
  436. data={{ 'sign': this.props.year + 'socialSecurity' }}
  437. beforeUpload={beforeUpload}
  438. onChange={(info) => {
  439. if (info.file.status !== 'uploading') {
  440. console.log(info.file, info.fileList);
  441. }
  442. if (info.file.status === 'done') {
  443. message.success(`${info.file.name} 文件上传成功!`);
  444. this.state.socialSecurityUrl = info.file.response.data;
  445. } else if (info.file.status === 'error') {
  446. message.error(`${info.file.name} 文件上传失败。`);
  447. }
  448. }}
  449. >
  450. <Button><Icon type="upload" /> 上传社保文件 </Button>
  451. </Upload>
  452. </div>
  453. <div className="hrSituation-roster">
  454. <Upload
  455. name="roster"
  456. action={globalConfig.context + "/techservice/cognizance/upload"}
  457. data={{ 'sign': this.props.year + 'roster' }}
  458. beforeUpload={beforeUpload}
  459. onChange={(info) => {
  460. if (info.file.status !== 'uploading') {
  461. console.log(info.file, info.fileList);
  462. }
  463. if (info.file.status === 'done') {
  464. message.success(`${info.file.name} 文件上传成功!`);
  465. this.state.rosterUrl = info.file.response.data;
  466. } else if (info.file.status === 'error') {
  467. message.error(`${info.file.name} 文件上传失败。`);
  468. }
  469. }}
  470. >
  471. <Button><Icon type="upload" /> 上传花名册文件 </Button>
  472. </Upload>
  473. </div>
  474. <div>
  475. <span style={{ color: "red" }}>提示</span>
  476. <p>1、总体情况的在职人员数、兼职人员数、临时聘用人员数相加小于等于企业职工总数。</p>
  477. <p>2、科技人员数小于等于企业职工总数。</p>
  478. <p>3、科技人员各项人数小于等于企业职工各项人数。</p>
  479. <p>4、全体人员结构中学历一栏人数总和小于等于职工人数。</p>
  480. <p>5、全体人员结构中年龄一栏人数总和小于等于职工人数。</p>
  481. <Button style={{ marginTop: "20px" }} className="set-submit" type="primary" htmlType="submit">保存</Button>
  482. </div>
  483. </Form >
  484. );
  485. },
  486. }));
  487. const HrSituationDesc = React.createClass({
  488. getInitialState() {
  489. return {
  490. visible: false,
  491. loading: false
  492. };
  493. },
  494. componentWillReceiveProps(nextProps) {
  495. this.state.visible = nextProps.showDesc
  496. },
  497. showModal() {
  498. this.setState({
  499. visible: true,
  500. });
  501. },
  502. handleOk() {
  503. this.setState({
  504. visible: false,
  505. });
  506. this.props.closeDesc(false);
  507. },
  508. handleCancel(e) {
  509. this.setState({
  510. visible: false,
  511. });
  512. this.props.closeDesc(false);
  513. },
  514. spinChange(e) {
  515. this.setState({
  516. loading: e
  517. });
  518. },
  519. render() {
  520. return (
  521. <div className="patent-addNew">
  522. <Spin spinning={this.state.loading} className='spin-box'>
  523. <Modal title="人力资源状况" visible={this.state.visible}
  524. onOk={this.handleOk} onCancel={this.handleCancel}
  525. width='1200px'
  526. footer=''
  527. >
  528. <HrSituationDescFrom data={this.props.data}
  529. spinState={this.spinChange} closeModal={this.handleCancel} />
  530. </Modal>
  531. </Spin>
  532. </div>
  533. );
  534. },
  535. });
  536. const HrSituation = React.createClass({
  537. loadData(pageNo) {
  538. this.state.data = [];
  539. this.setState({
  540. loading: true
  541. });
  542. $.ajax({
  543. method: "post",
  544. dataType: "json",
  545. crossDomain: false,
  546. url: globalConfig.context + "/techservice/cognizance/orgHumanResource",
  547. data: {
  548. pageNo: pageNo || 1,
  549. pageSize: this.state.pagination.pageSize,
  550. uid: this.props.data.uid
  551. }
  552. }).done((data) => {
  553. if (data.error.length || !data.data || !data.data.list) {
  554. message.warning(data.error[0].message);
  555. return;
  556. };
  557. for (let i = 0; i < data.data.list.length; i++) {
  558. let thisdata = data.data.list[i];
  559. this.state.data.push({
  560. key: i,
  561. id: thisdata.id,
  562. uid: thisdata.uid,
  563. year: thisdata.year,
  564. aboveFifty: thisdata.aboveFifty,
  565. belowThirty: thisdata.belowThirty,
  566. college: thisdata.college,
  567. doctor: thisdata.doctor,
  568. firmAbroad: thisdata.firmAbroad,
  569. firmCore: thisdata.firmCore,
  570. firmForeign: thisdata.firmForeign,
  571. firmInService: thisdata.firmInService,
  572. firmPartTime: thisdata.firmPartTime,
  573. firmTemporary: thisdata.firmTemporary,
  574. firmTotal: thisdata.firmTotal,
  575. fortyoneToFifty: thisdata.fortyoneToFifty,
  576. intermediateTitle: thisdata.intermediateTitle,
  577. juniorTitle: thisdata.juniorTitle,
  578. master: thisdata.master,
  579. seniorMechanic: thisdata.seniorMechanic,
  580. seniorTitle: thisdata.seniorTitle,
  581. techAbroad: thisdata.techAbroad,
  582. techCore: thisdata.techCore,
  583. techForeign: thisdata.techForeign,
  584. techInService: thisdata.techInService,
  585. techPartTime: thisdata.techPartTime,
  586. techTemporary: thisdata.techTemporary,
  587. techTotal: thisdata.techTotal,
  588. thirtyoneToThirtyfour: thisdata.thirtyoneToThirtyfour,
  589. undergraduate: thisdata.undergraduate,
  590. attachment: [thisdata.rosterDownloadFileName, thisdata.socialSecurityDownloadFileName],
  591. neweEmployment: thisdata.neweEmployment,
  592. graduateNumber: this.graduateNumber
  593. });
  594. };
  595. this.state.pagination.current = data.data.pageNo;
  596. this.state.pagination.total = data.data.totalCount;
  597. this.setState({
  598. dataSource: this.state.data,
  599. pagination: this.state.pagination
  600. });
  601. }).always(function () {
  602. this.setState({
  603. loading: false
  604. });
  605. }.bind(this));
  606. },
  607. getInitialState() {
  608. return {
  609. selectedRowKeys: [],
  610. selectedRows: [],
  611. loading: false,
  612. pagination: {
  613. defaultCurrent: 1,
  614. defaultPageSize: 10,
  615. showQuickJumper: true,
  616. pageSize: 10,
  617. onChange: function (page) {
  618. this.loadData(page);
  619. }.bind(this),
  620. showTotal: function (total) {
  621. return '共' + total + '条数据';
  622. }
  623. },
  624. columns: [
  625. {
  626. title: '年份',
  627. dataIndex: 'year',
  628. key: 'year'
  629. }, {
  630. title: '总人数',
  631. dataIndex: 'firmTotal',
  632. key: 'firmTotal'
  633. }, {
  634. title: '科技人员',
  635. dataIndex: 'techTotal',
  636. key: 'techTotal'
  637. }, {
  638. title: '博士人数',
  639. dataIndex: 'doctor',
  640. key: 'doctor',
  641. }, {
  642. title: '高级职称人数',
  643. dataIndex: 'seniorTitle',
  644. key: 'seniorTitle',
  645. }, {
  646. title: '30岁以下人数',
  647. dataIndex: 'belowThirty',
  648. key: 'belowThirty',
  649. }, {
  650. title: '相关附件',
  651. dataIndex: 'attachment',
  652. key: 'attachment',
  653. render: (text) => {
  654. <a href="" onClick={() => {
  655. window.open(globalConfig.context + "/techservice/patent/downloadFile?path=" + text + "&sign=" + "type")
  656. }}></a>
  657. }
  658. }
  659. ],
  660. dataSource: []
  661. };
  662. },
  663. componentWillMount() {
  664. this.loadData();
  665. },
  666. tableRowClick(record, index) {
  667. this.state.RowData = record;
  668. this.setState({
  669. showDesc: true
  670. });
  671. },
  672. delectRow() {
  673. let deletedIds = [];
  674. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  675. let rowItem = this.state.selectedRows[idx];
  676. if (rowItem.id) {
  677. deletedIds.push(rowItem.id)
  678. }
  679. }
  680. this.setState({
  681. selectedRowKeys: [],
  682. loading: deletedIds.length > 0
  683. });
  684. $.ajax({
  685. method: "POST",
  686. dataType: "json",
  687. crossDomain: false,
  688. url: globalConfig.context + "/techservice/cognizance/deleteFinance",
  689. data: {
  690. ids: deletedIds
  691. }
  692. }).done(function (data) {
  693. if (!data.error.length) {
  694. message.success('保存成功!');
  695. this.setState({
  696. loading: false,
  697. });
  698. } else {
  699. message.warning(data.error[0].message);
  700. };
  701. this.loadData();
  702. }.bind(this));
  703. },
  704. closeDesc(e) {
  705. this.state.showDesc = e;
  706. this.loadData();
  707. },
  708. render() {
  709. const rowSelection = {
  710. selectedRowKeys: this.state.selectedRowKeys,
  711. onChange: (selectedRowKeys, selectedRows) => {
  712. this.setState({
  713. selectedRows: selectedRows,
  714. selectedRowKeys: selectedRowKeys
  715. });
  716. }
  717. };
  718. const hasSelected = this.state.selectedRowKeys.length > 0;
  719. return (
  720. <div className="user-content" >
  721. <div className="content-title">
  722. <span>人力资源状况</span>
  723. </div>
  724. <div className="user-search">
  725. <p>
  726. <Button style={{ background: "#ea0862", border: "none", color: "#fff" }}
  727. onClick={this.tableRowClick}>添加<Icon type="plus" /></Button>
  728. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  729. disabled={!hasSelected}
  730. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  731. </p>
  732. </div>
  733. <div className="patent-table">
  734. <Spin spinning={this.state.loading}>
  735. <Table columns={this.state.columns}
  736. dataSource={this.state.dataSource}
  737. pagination={this.state.pagination}
  738. rowSelection={rowSelection}
  739. onRowClick={this.tableRowClick} />
  740. </Spin>
  741. </div>
  742. <HrSituationDesc data={this.state.RowData}
  743. showDesc={this.state.showDesc} closeDesc={this.closeDesc} />
  744. </div >
  745. );
  746. }
  747. });
  748. export default HrSituation;