hrSituation.jsx 34 KB

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