hrSituation.jsx 32 KB

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