hrSituation.jsx 37 KB

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