hrSituation.jsx 33 KB

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