hrSituation.jsx 35 KB

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