hrSituation.jsx 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
  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. newEmployment: values.newEmployment,
  81. graduateNumber: values.graduateNumber
  82. }
  83. }).done(function (data) {
  84. if (!data.error.length) {
  85. message.success('保存成功!');
  86. this.props.clickOk();
  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('newEmployment', {
  416. initialValue: this.props.data.newEmployment || 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. if (!info.file.response.error.length) {
  445. message.success(`${info.file.name} 文件上传成功!`);
  446. } else {
  447. message.warning(info.file.response.error[0].message);
  448. return;
  449. };
  450. this.state.socialSecurityUrl = info.file.response.data;
  451. } else if (info.file.status === 'error') {
  452. message.error(`${info.file.name} 文件上传失败。`);
  453. }
  454. }}
  455. >
  456. <Button><Icon type="upload" /> 上传社保文件 </Button>
  457. </Upload>
  458. </div>
  459. <div className="hrSituation-roster">
  460. <Upload
  461. name="roster"
  462. action={globalConfig.context + "/techservice/cognizance/upload"}
  463. data={{ 'sign': this.props.year + 'roster' }}
  464. beforeUpload={beforeUpload}
  465. onChange={(info) => {
  466. if (info.file.status !== 'uploading') {
  467. console.log(info.file, info.fileList);
  468. }
  469. if (info.file.status === 'done') {
  470. if (!info.file.response.error.length) {
  471. message.success(`${info.file.name} 文件上传成功!`);
  472. } else {
  473. message.warning(info.file.response.error[0].message);
  474. return;
  475. };
  476. this.state.rosterUrl = info.file.response.data;
  477. } else if (info.file.status === 'error') {
  478. message.error(`${info.file.name} 文件上传失败。`);
  479. }
  480. }}
  481. >
  482. <Button><Icon type="upload" /> 上传花名册文件 </Button>
  483. </Upload>
  484. </div>
  485. <div>
  486. <span style={{ color: "red" }}>提示</span>
  487. <p>1、总体情况的在职人员数、兼职人员数、临时聘用人员数相加小于等于企业职工总数。</p>
  488. <p>2、科技人员数小于等于企业职工总数。</p>
  489. <p>3、科技人员各项人数小于等于企业职工各项人数。</p>
  490. <p>4、全体人员结构中学历一栏人数总和小于等于职工人数。</p>
  491. <p>5、全体人员结构中年龄一栏人数总和小于等于职工人数。</p>
  492. <Button style={{ marginTop: "20px" }} className="set-submit" type="primary" htmlType="submit">保存</Button>
  493. </div>
  494. </Form >
  495. );
  496. },
  497. }));
  498. const HrSituationDesc = React.createClass({
  499. getInitialState() {
  500. return {
  501. visible: false,
  502. loading: false
  503. };
  504. },
  505. componentWillReceiveProps(nextProps) {
  506. this.state.visible = nextProps.showDesc
  507. },
  508. showModal() {
  509. this.setState({
  510. visible: true,
  511. });
  512. },
  513. handleOk() {
  514. this.setState({
  515. visible: false,
  516. });
  517. this.props.closeDesc(false, true);
  518. },
  519. handleCancel(e) {
  520. this.setState({
  521. visible: false,
  522. });
  523. this.props.closeDesc(false);
  524. },
  525. spinChange(e) {
  526. this.setState({
  527. loading: e
  528. });
  529. },
  530. render() {
  531. return (
  532. <div className="patent-addNew">
  533. <Spin spinning={this.state.loading} className='spin-box'>
  534. <Modal title="人力资源状况" visible={this.state.visible}
  535. onOk={this.handleOk} onCancel={this.handleCancel}
  536. width='1200px'
  537. footer=''
  538. >
  539. <HrSituationDescFrom
  540. uid={this.props.uid}
  541. data={this.props.data}
  542. spinState={this.spinChange} closeModal={this.handleCancel} clickOk={this.handleOk} />
  543. </Modal>
  544. </Spin>
  545. </div>
  546. );
  547. },
  548. });
  549. const HrSituation = React.createClass({
  550. loadData(pageNo) {
  551. this.state.data = [];
  552. this.setState({
  553. loading: true
  554. });
  555. $.ajax({
  556. method: "post",
  557. dataType: "json",
  558. crossDomain: false,
  559. url: globalConfig.context + "/api/admin/orgHumanResource",
  560. data: {
  561. pageNo: pageNo || 1,
  562. pageSize: this.state.pagination.pageSize,
  563. uid: this.props.data.uid
  564. }
  565. }).done((data) => {
  566. if (data.error.length || !data.data || !data.data.list) {
  567. message.warning(data.error[0].message);
  568. return;
  569. };
  570. for (let i = 0; i < data.data.list.length; i++) {
  571. let thisdata = data.data.list[i];
  572. this.state.data.push({
  573. key: i,
  574. id: thisdata.id,
  575. uid: thisdata.uid,
  576. year: thisdata.year,
  577. aboveFifty: thisdata.aboveFifty,
  578. belowThirty: thisdata.belowThirty,
  579. college: thisdata.college,
  580. doctor: thisdata.doctor,
  581. firmAbroad: thisdata.firmAbroad,
  582. firmCore: thisdata.firmCore,
  583. firmForeign: thisdata.firmForeign,
  584. firmInService: thisdata.firmInService,
  585. firmPartTime: thisdata.firmPartTime,
  586. firmTemporary: thisdata.firmTemporary,
  587. firmTotal: thisdata.firmTotal,
  588. fortyoneToFifty: thisdata.fortyoneToFifty,
  589. intermediateTitle: thisdata.intermediateTitle,
  590. juniorTitle: thisdata.juniorTitle,
  591. master: thisdata.master,
  592. seniorMechanic: thisdata.seniorMechanic,
  593. seniorTitle: thisdata.seniorTitle,
  594. techAbroad: thisdata.techAbroad,
  595. techCore: thisdata.techCore,
  596. techForeign: thisdata.techForeign,
  597. techInService: thisdata.techInService,
  598. techPartTime: thisdata.techPartTime,
  599. techTemporary: thisdata.techTemporary,
  600. techTotal: thisdata.techTotal,
  601. thirtyoneToThirtyfour: thisdata.thirtyoneToThirtyfour,
  602. undergraduate: thisdata.undergraduate,
  603. attachment: [thisdata.rosterDownloadFileName, thisdata.socialSecurityDownloadFileName],
  604. newEmployment: thisdata.newEmployment,
  605. graduateNumber: thisdata.graduateNumber
  606. });
  607. };
  608. this.state.pagination.current = data.data.pageNo;
  609. this.state.pagination.total = data.data.totalCount;
  610. this.setState({
  611. dataSource: this.state.data,
  612. pagination: this.state.pagination
  613. });
  614. }).always(function () {
  615. this.setState({
  616. loading: false
  617. });
  618. }.bind(this));
  619. },
  620. getInitialState() {
  621. return {
  622. selectedRowKeys: [],
  623. selectedRows: [],
  624. loading: false,
  625. pagination: {
  626. defaultCurrent: 1,
  627. defaultPageSize: 10,
  628. showQuickJumper: true,
  629. pageSize: 10,
  630. onChange: function (page) {
  631. this.loadData(page);
  632. }.bind(this),
  633. showTotal: function (total) {
  634. return '共' + total + '条数据';
  635. }
  636. },
  637. columns: [
  638. {
  639. title: '年份',
  640. dataIndex: 'year',
  641. key: 'year'
  642. }, {
  643. title: '总人数',
  644. dataIndex: 'firmTotal',
  645. key: 'firmTotal'
  646. }, {
  647. title: '科技人员',
  648. dataIndex: 'techTotal',
  649. key: 'techTotal'
  650. }, {
  651. title: '博士人数',
  652. dataIndex: 'doctor',
  653. key: 'doctor',
  654. }, {
  655. title: '高级职称人数',
  656. dataIndex: 'seniorTitle',
  657. key: 'seniorTitle',
  658. }, {
  659. title: '30岁以下人数',
  660. dataIndex: 'belowThirty',
  661. key: 'belowThirty',
  662. }, {
  663. title: '相关附件',
  664. dataIndex: 'attachment',
  665. key: 'attachment',
  666. render: (text) => {
  667. <a href="" onClick={() => {
  668. window.open(globalConfig.context + "/techservice/patent/downloadFile?path=" + text + "&sign=" + "type")
  669. }}></a>
  670. }
  671. }
  672. ],
  673. dataSource: []
  674. };
  675. },
  676. componentWillMount() {
  677. this.loadData();
  678. },
  679. tableRowClick(record, index) {
  680. this.state.RowData = record;
  681. this.setState({
  682. showDesc: true
  683. });
  684. },
  685. delectRow() {
  686. let deletedIds = [];
  687. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  688. let rowItem = this.state.selectedRows[idx];
  689. if (rowItem.id) {
  690. deletedIds.push(rowItem.id)
  691. }
  692. }
  693. this.setState({
  694. selectedRowKeys: [],
  695. loading: deletedIds.length > 0
  696. });
  697. $.ajax({
  698. method: "POST",
  699. dataType: "json",
  700. crossDomain: false,
  701. url: globalConfig.context + "/techservice/cognizance/deleteFinance",
  702. data: {
  703. ids: deletedIds
  704. }
  705. }).done(function (data) {
  706. if (!data.error.length) {
  707. message.success('保存成功!');
  708. this.setState({
  709. loading: false,
  710. });
  711. } else {
  712. message.warning(data.error[0].message);
  713. };
  714. this.loadData();
  715. }.bind(this));
  716. },
  717. closeDesc(e, s) {
  718. this.state.showDesc = e;
  719. if (s) {
  720. this.loadData();
  721. };
  722. },
  723. render() {
  724. const rowSelection = {
  725. selectedRowKeys: this.state.selectedRowKeys,
  726. onChange: (selectedRowKeys, selectedRows) => {
  727. this.setState({
  728. selectedRows: selectedRows,
  729. selectedRowKeys: selectedRowKeys
  730. });
  731. }
  732. };
  733. const hasSelected = this.state.selectedRowKeys.length > 0;
  734. return (
  735. <div className="user-content" >
  736. <div className="content-title">
  737. <span>人力资源状况</span>
  738. </div>
  739. <div className="user-search">
  740. <p>
  741. <Button style={{ background: "#ea0862", border: "none", color: "#fff" }}
  742. onClick={this.tableRowClick}>添加<Icon type="plus" /></Button>
  743. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  744. disabled={!hasSelected}
  745. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  746. </p>
  747. </div>
  748. <div className="patent-table">
  749. <Spin spinning={this.state.loading}>
  750. <Table columns={this.state.columns}
  751. dataSource={this.state.dataSource}
  752. pagination={this.state.pagination}
  753. rowSelection={rowSelection}
  754. onRowClick={this.tableRowClick} />
  755. </Spin>
  756. </div>
  757. <HrSituationDesc
  758. uid={this.props.data.uid}
  759. data={this.state.RowData}
  760. showDesc={this.state.showDesc} closeDesc={this.closeDesc} />
  761. </div >
  762. );
  763. }
  764. });
  765. export default HrSituation;