highTechApply.jsx 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051
  1. import React from 'react';
  2. import { Icon, InputNumber, Form, Button, Input, Radio, Select, Spin, Table, DatePicker, message, Cascader, Modal } from 'antd';
  3. import { provinceArr, cognizanceStateList } from '../../../dataDic.js';
  4. import { techFieldList } from '../../../DicTechFieldList.js';
  5. import { getTime, getCognizanceState, companySearch } from '../../../tools.js';
  6. import ajax from 'jquery/src/ajax/xhr.js';
  7. import $ from 'jquery/src/ajax';
  8. import moment from 'moment';
  9. import './highTechFoster.less';
  10. const CognizanceDescFrom = Form.create()(React.createClass({
  11. loadData(uid, cid, year) {
  12. this.setState({
  13. loading: true
  14. });
  15. $.ajax({
  16. method: "post",
  17. dataType: "json",
  18. crossDomain: false,
  19. url: globalConfig.context + "/api/admin/cognizanceDetail",
  20. data: {
  21. cid: cid || this.props.data.cid,
  22. uid: uid || this.props.data.uid,
  23. year: year || this.props.data.year
  24. },
  25. success: function (data) {
  26. if (data.error.length || !data.data) {
  27. message.warning(data.error[0].message);
  28. return;
  29. };
  30. this.state.data = data.data;
  31. this.state.cid = this.props.data.cid;
  32. this.state.moneyTable = [{
  33. key: 1,
  34. year: '前一年',
  35. netAsset: data.data.netAsset1,
  36. salesRevenue: data.data.salesRevenue1,
  37. grossProfit: data.data.grossProfit1
  38. }, {
  39. key: 2,
  40. year: '前二年',
  41. netAsset: data.data.netAsset2,
  42. salesRevenue: data.data.salesRevenue2,
  43. grossProfit: data.data.grossProfit2
  44. }, {
  45. key: 3,
  46. year: '前三年',
  47. netAsset: data.data.netAsset3,
  48. salesRevenue: data.data.salesRevenue3,
  49. grossProfit: data.data.grossProfit3
  50. }];
  51. if (data.data.netAsset2 == 0) {
  52. this.state.netAssetRate = 0;
  53. } else if (data.data.netAsset3 == 0) {
  54. this.state.netAssetRate = (data.data.netAsset1 / data.data.netAsset2) - 1;
  55. } else {
  56. this.state.netAssetRate = 1 / 2 * (data.data.netAsset2 / data.data.netAsset3 + data.data.netAsset1 / data.data.netAsset2) - 1;
  57. };
  58. if (this.state.netAssetRate < 0 || isNaN(this.state.netAssetRate)) {
  59. this.state.netAssetRate = 0
  60. };
  61. if (data.data.salesRevenue2 == 0) {
  62. this.state.salesRevenueRate = 0;
  63. } else if (data.data.salesRevenue3 == 0) {
  64. this.state.salesRevenueRate = (data.data.salesRevenue1 / data.data.salesRevenue2) - 1;
  65. } else {
  66. this.state.salesRevenueRate = 1 / 2 * (data.data.salesRevenue2 / data.data.salesRevenue3 + data.data.salesRevenue1 / data.data.salesRevenue2) - 1;
  67. };
  68. if (this.state.salesRevenueRate < 0 || isNaN(this.state.salesRevenueRate)) {
  69. this.state.salesRevenueRate = 0
  70. };
  71. }.bind(this),
  72. }).always(function () {
  73. this.setState({
  74. loading: false
  75. });
  76. }.bind(this));
  77. },
  78. getStateData(cid) {
  79. this.setState({
  80. loading: true
  81. });
  82. $.ajax({
  83. method: "post",
  84. dataType: "json",
  85. crossDomain: false,
  86. url: globalConfig.context + "/api/admin/cognizanceLog",
  87. data: {
  88. cid: cid || this.props.data.cid
  89. },
  90. success: function (data) {
  91. if (data.error.length || !data.data) {
  92. message.warning(data.error[0].message);
  93. return;
  94. };
  95. this.state.stateTable = [];
  96. for (let i = 0; i < data.data.length; i++) {
  97. this.state.stateTable.push({
  98. key: i,
  99. recordTimeFormattedDate: data.data[i].recordTimeFormattedDate,
  100. state: data.data[i].state,
  101. principal: data.data[i].principal,
  102. operator: data.data[i].operator,
  103. comment: data.data[i].comment
  104. });
  105. };
  106. }.bind(this),
  107. }).always(function () {
  108. this.setState({
  109. loading: false
  110. });
  111. }.bind(this));
  112. },
  113. getContactsList(uid) {
  114. $.ajax({
  115. method: "get",
  116. dataType: "json",
  117. crossDomain: false,
  118. url: globalConfig.context + "/api/admin/getContacts",
  119. data: {
  120. uid: uid || this.props.data.uid
  121. },
  122. success: function (data) {
  123. let theOption = [];
  124. if (data.error.length || !data.data) {
  125. return;
  126. };
  127. for (let item in data.data) {
  128. let theData = data.data[item];
  129. theOption.push(
  130. <Select.Option value={item} key={theData}>{theData}</Select.Option>
  131. );
  132. };
  133. this.setState({
  134. contactsOption: theOption
  135. });
  136. }.bind(this),
  137. });
  138. },
  139. getOptionList() {
  140. this.setState({
  141. loading: true
  142. });
  143. $.ajax({
  144. method: "get",
  145. dataType: "json",
  146. crossDomain: false,
  147. url: globalConfig.context + "/api/admin/cognizanceStatus",
  148. success: function (data) {
  149. let _me = this;
  150. if (!data.data) {
  151. if (data.error && data.error.length) {
  152. message.warning(data.error[0].message);
  153. return;
  154. };
  155. };
  156. _me.state.stateOption = [];
  157. for (var item in data.data) {
  158. _me.state.stateOption.push(
  159. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  160. )
  161. };
  162. }.bind(this),
  163. }).always(function () {
  164. this.setState({
  165. loading: false
  166. });
  167. }.bind(this));
  168. },
  169. getInitialState() {
  170. return {
  171. loading: false,
  172. stateOption: [],
  173. moneyColumns: [{
  174. title: '',
  175. dataIndex: 'year',
  176. key: 'year',
  177. }, {
  178. title: '净资产',
  179. dataIndex: 'netAsset',
  180. key: 'netAsset',
  181. }, {
  182. title: '销售收入',
  183. dataIndex: 'salesRevenue',
  184. key: 'salesRevenue',
  185. }, {
  186. title: '利润总额',
  187. dataIndex: 'grossProfit',
  188. key: 'grossProfit',
  189. }],
  190. stateColumns: [{
  191. title: '认证状态',
  192. dataIndex: 'state',
  193. key: 'state',
  194. render: (text) => { return getCognizanceState(text) }
  195. }, {
  196. title: '处理时间',
  197. dataIndex: 'recordTimeFormattedDate',
  198. key: 'recordTimeFormattedDate',
  199. }, {
  200. title: '负责人',
  201. dataIndex: 'principal',
  202. key: 'principal',
  203. }, {
  204. title: '操作人',
  205. dataIndex: 'operator',
  206. key: 'operator',
  207. }, {
  208. title: '备注',
  209. dataIndex: 'comment',
  210. key: 'comment',
  211. }]
  212. };
  213. },
  214. componentWillMount() {
  215. this.loadData();
  216. this.getOptionList();
  217. this.getStateData();
  218. this.getContactsList();
  219. },
  220. handleSubmit(e) {
  221. e.preventDefault();
  222. this.props.form.validateFields((err, values) => {
  223. if (values.state || values.principal || values.recordTime || values.comment) {
  224. if (!values.state && !values.principal && !values.recordTime) {
  225. message.warning("请填写完整的状态流转信息!");
  226. return;
  227. };
  228. };
  229. if (!err) {
  230. this.props.spinState(true);
  231. $.ajax({
  232. method: "POST",
  233. dataType: "json",
  234. crossDomain: false,
  235. url: globalConfig.context + "/api/admin/disposeCognizanceDetail",
  236. data: {
  237. id: this.props.data.cid,
  238. uid: this.props.data.uid,
  239. technicalField1: values.technicalField[0],
  240. technicalField2: values.technicalField[1],
  241. technicalField3: values.technicalField[2],
  242. basicResearchCost: values.basicResearchCost,
  243. contacts: values.contacts,
  244. accident: values.accident,
  245. certificateNumber: values.certificateNumber,
  246. recordTimeFormattedDate: values.recordTime ? values.recordTime.format("YYYY-MM-DD HH:mm:ss") : undefined,
  247. state: values.state,
  248. principal: values.principal,
  249. comment: values.comment,
  250. }
  251. }).done(function (data) {
  252. if (!data.error.length) {
  253. message.success('保存成功!');
  254. this.props.clickOk();
  255. this.props.form.resetFields();
  256. this.state.targetKeys = [];
  257. this.state.selectedKeys = [];
  258. this.props.spinState(false);
  259. } else {
  260. message.warning(data.error[0].message);
  261. this.props.spinState(false);
  262. }
  263. }.bind(this));
  264. }
  265. });
  266. },
  267. componentWillReceiveProps(nextProps) {
  268. if (!this.props.visible && nextProps.visible) {
  269. this.getStateData(nextProps.data.cid);
  270. this.loadData(nextProps.data.uid, nextProps.data.cid, nextProps.data.year);
  271. this.getContactsList(nextProps.data.uid);
  272. this.props.form.resetFields();
  273. };
  274. },
  275. render() {
  276. const FormItem = Form.Item;
  277. const { getFieldDecorator } = this.props.form;
  278. const theData = this.state.data;
  279. const formItemLayout = {
  280. labelCol: { span: 6 },
  281. wrapperCol: { span: 12 },
  282. };
  283. const _me = this;
  284. if (this.state.data) {
  285. return (
  286. <Form onSubmit={this.handleSubmit} id="highTechApply-form">
  287. <div className="clearfix">
  288. <div className="half-item">
  289. <span className="item-title">公司名称: </span>
  290. <span>{theData.unitName}</span>
  291. </div>
  292. <div className="half-item">
  293. <span className="item-title">公司组织机构代码: </span>
  294. <span>{theData.orgCode}</span>
  295. </div>
  296. <div className="half-item">
  297. <span className="item-title">公司地址: </span>
  298. <span>{theData.postalAddress}</span>
  299. </div>
  300. <FormItem className="half-item"
  301. labelCol={{ span: 3 }}
  302. wrapperCol={{ span: 14 }}
  303. >
  304. <span className="item-title">联系人: </span>
  305. {getFieldDecorator('contacts', {
  306. rules: [{ required: true, message: '此项为必填项!' }],
  307. initialValue: theData.contacts
  308. })(
  309. <Select
  310. style={{ display: 'inline-block', width: '200px' }}
  311. placeholder='选择一个联系人'>
  312. {this.state.contactsOption}
  313. </Select>
  314. )}
  315. </FormItem>
  316. <FormItem className="half-item"
  317. labelCol={{ span: 3 }}
  318. wrapperCol={{ span: 14 }}
  319. >
  320. <span className="item-title">证书编号: </span>
  321. {getFieldDecorator('certificateNumber', {
  322. initialValue: this.props.data.certificateNumber
  323. })(
  324. <Input style={{ width: '200px' }} placeholder='高企证书编号' />
  325. )}
  326. </FormItem>
  327. </div>
  328. <FormItem style={{ width: '50%' }}
  329. labelCol={{ span: 0 }}
  330. wrapperCol={{ span: 24 }}
  331. label="技术领域"
  332. >
  333. <span className="item-title">技术领域: </span>
  334. {getFieldDecorator('technicalField', {
  335. rules: [{ type: 'array', required: true, message: '此项为必填项!' }],
  336. initialValue: [Number(theData.technicalField1), Number(theData.technicalField2), Number(theData.technicalField3)]
  337. })(
  338. <Cascader options={techFieldList} placeholder="请选择技术领域" />
  339. )}
  340. </FormItem>
  341. <div className="clearfix">
  342. <div>
  343. <span className="form-title">获得知识产权数量(件): </span>
  344. </div>
  345. <div className="half-item">
  346. <span className="item-title">一类: </span>
  347. <span>{theData.firstCatagory}</span>
  348. </div>
  349. <div className="half-item">
  350. <span className="item-title">二类: </span>
  351. <span>{theData.secondCatagory}</span>
  352. </div>
  353. </div>
  354. <div className="clearfix">
  355. <div>
  356. <span className="form-title">人力资源状况(人): </span>
  357. </div>
  358. <div className="half-item">
  359. <span className="item-title">职工总数: </span>
  360. <span>{theData.firmTotal}</span>
  361. </div>
  362. <div className="half-item">
  363. <span className="item-title">科技人员数: </span>
  364. <span>{theData.techTotal}</span>
  365. </div>
  366. </div>
  367. <div className="form-title">近三年经营状况(万元): </div>
  368. <Table pagination={false} dataSource={this.state.moneyTable} columns={this.state.moneyColumns} />
  369. <div className="clearfix">
  370. <div className="half-item">
  371. <span className="item-title">净资产增长率: </span>
  372. <span>{(this.state.netAssetRate * 100).toFixed(2) + '%'}</span>
  373. </div>
  374. <div className="half-item">
  375. <span className="item-title">销售收入增长率: </span>
  376. <span>{(this.state.salesRevenueRate * 100).toFixed(2) + '%'}</span>
  377. </div>
  378. </div>
  379. <div className="clearfix">
  380. <div><span className="form-title">近三年研究开发费用总额(万元): </span></div>
  381. <div className="third-item">
  382. <div className="item-title">近三年研究开发费用总额</div>
  383. <p>{theData.researchCost}</p>
  384. </div>
  385. <div className="third-item">
  386. <div className="item-title">其中: 在中国境内研发费用总和</div>
  387. <p>{theData.territory}</p>
  388. </div>
  389. <div className="third-item">
  390. <div className="item-title">其中: 基础研究投入费用总额</div>
  391. <div>
  392. <FormItem
  393. labelCol={{ span: 0 }}
  394. wrapperCol={{ span: 24 }}
  395. >
  396. {getFieldDecorator('basicResearchCost', {
  397. rules: [{ type: 'number', required: true, message: '此项为必填项!' }],
  398. initialValue: theData.basicResearchCost
  399. })(
  400. <InputNumber />
  401. )}
  402. </FormItem>
  403. </div>
  404. </div>
  405. </div>
  406. <div>
  407. <span className="item-title">近一年企业总收入(万元): </span>
  408. <span>{theData.totalRevenue}</span>
  409. </div>
  410. <div>
  411. <span className="item-title">近一年高新技术产品收入(万元): </span>
  412. <span>{theData.lastYearRevenue}</span>
  413. </div>
  414. <div className="item-title">申请认定前一年内是否发生过重大安全、重大质量或严重环境违法行为</div>
  415. <FormItem
  416. labelCol={{ span: 0 }}
  417. wrapperCol={{ span: 24 }}
  418. >
  419. {getFieldDecorator('accident', {
  420. rules: [{ type: 'number', required: true, message: '此项为必填项!' }],
  421. initialValue: theData.accident
  422. })(
  423. <Radio.Group>
  424. <Radio value={0}>否</Radio>
  425. <Radio value={1}>是</Radio>
  426. </Radio.Group>
  427. )}
  428. </FormItem>
  429. <div className="form-title">状态流转记录: </div>
  430. <Table pagination={false} dataSource={this.state.stateTable} columns={this.state.stateColumns} />
  431. <div className="clearfix">
  432. <FormItem className="third-item"
  433. {...formItemLayout}
  434. label="状态流转"
  435. >
  436. {getFieldDecorator('state')(
  437. <Select placeholder="选择一个状态">{this.state.stateOption}</Select>
  438. )}
  439. </FormItem>
  440. <FormItem className="third-item"
  441. labelCol={{ span: 6 }}
  442. wrapperCol={{ span: 12 }}
  443. label="处理时间"
  444. >
  445. {getFieldDecorator('recordTime')(
  446. <DatePicker />
  447. )}
  448. </FormItem>
  449. <FormItem className="third-item"
  450. {...formItemLayout}
  451. label="负责人"
  452. >
  453. {getFieldDecorator('principal')(
  454. <Select placeholder="选择负责人">{this.props.authorOption}</Select>
  455. )}
  456. </FormItem>
  457. </div>
  458. <FormItem
  459. labelCol={{ span: 2 }}
  460. wrapperCol={{ span: 12 }}
  461. label="备注"
  462. >
  463. {getFieldDecorator('comment')(
  464. <Input />
  465. )}
  466. </FormItem>
  467. <FormItem style={{ marginTop: '20px' }}>
  468. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  469. <Button type="ghost" style={{ marginLeft: '20px' }} onClick={this.props.closeModal}>取消</Button>
  470. </FormItem>
  471. </Form >
  472. );
  473. } else {
  474. return (<div></div>)
  475. };
  476. },
  477. }));
  478. const CognizanceDesc = React.createClass({
  479. getInitialState() {
  480. return {
  481. visible: false,
  482. loading: false
  483. };
  484. },
  485. componentWillReceiveProps(nextProps) {
  486. this.state.visible = nextProps.showDesc
  487. },
  488. showModal() {
  489. this.setState({
  490. visible: true,
  491. });
  492. },
  493. handleOk() {
  494. this.setState({
  495. visible: false,
  496. });
  497. this.props.closeDesc(false, true);
  498. },
  499. handleCancel(e) {
  500. this.setState({
  501. visible: false,
  502. });
  503. this.props.closeDesc(false);
  504. },
  505. spinChange(e) {
  506. this.setState({
  507. loading: e
  508. });
  509. },
  510. render() {
  511. return (
  512. <div className="patent-addNew">
  513. <Spin spinning={this.state.loading} className='spin-box'>
  514. <Modal title="高企管理" visible={this.state.visible}
  515. onOk={this.handleOk} onCancel={this.handleCancel}
  516. width='1000px'
  517. footer=''
  518. >
  519. <CognizanceDescFrom
  520. visible={this.state.visible}
  521. contactsOption={this.props.contactsOption}
  522. authorOption={this.props.authorOption}
  523. data={this.props.data}
  524. spinState={this.spinChange} closeModal={this.handleCancel} clickOk={this.handleOk} />
  525. </Modal>
  526. </Spin>
  527. </div>
  528. );
  529. }
  530. });
  531. const CognizanceAdd = React.createClass({
  532. getInitialState() {
  533. return {
  534. visible: false,
  535. loading: false,
  536. yearOption: []
  537. };
  538. },
  539. getContactsList(theUid) {
  540. $.ajax({
  541. method: "get",
  542. dataType: "json",
  543. crossDomain: false,
  544. url: globalConfig.context + "/api/admin/getContacts",
  545. data: {
  546. uid: theUid
  547. },
  548. success: function (data) {
  549. let theOption = [];
  550. if (data.error.length || !data.data) {
  551. return;
  552. };
  553. for (let item in data.data) {
  554. let theData = data.data[item];
  555. theOption.push(
  556. <Select.Option value={item} key={theData}>{theData}</Select.Option>
  557. );
  558. };
  559. this.setState({
  560. contactsOption: theOption
  561. });
  562. }.bind(this),
  563. });
  564. },
  565. componentWillReceiveProps(nextProps) {
  566. if (!this.props.showAdd && nextProps.showAdd) {
  567. this.state.year = undefined;
  568. this.state.contacts = undefined;
  569. this.state.comment = undefined;
  570. this.state.consultant = undefined;
  571. this.state.uid = undefined;
  572. };
  573. this.state.visible = nextProps.showAdd;
  574. },
  575. componentWillMount() {
  576. let d = new Date();
  577. let _me = this;
  578. d = d.getFullYear() - 1;
  579. this.state.thisYear = d;
  580. for (let i = d; i < d + 20; i++) {
  581. _me.state.yearOption.push(
  582. <Select.Option value={i.toString()} key={i}>{i}</Select.Option>
  583. )
  584. };
  585. },
  586. showModal() {
  587. this.setState({
  588. visible: true,
  589. });
  590. },
  591. handleOk() {
  592. this.setState({
  593. loading: true
  594. });
  595. if (!this.state.year) {
  596. message.warning('请选择年份!');
  597. this.setState({
  598. loading: false
  599. });
  600. return;
  601. };
  602. if (!this.state.contacts) {
  603. message.warning('请选择一个联系人!');
  604. this.setState({
  605. loading: false
  606. });
  607. return;
  608. };
  609. $.ajax({
  610. method: "POST",
  611. dataType: "json",
  612. crossDomain: false,
  613. url: globalConfig.context + "/api/admin/applyCognizance",
  614. data: {
  615. year: this.state.year,
  616. contacts: this.state.contacts,
  617. comment: this.state.comment,
  618. consultant: this.state.consultant,
  619. uid: this.state.uid
  620. }
  621. }).done(function (data) {
  622. if (!data.error.length) {
  623. message.success('保存成功!');
  624. this.setState({
  625. visible: false,
  626. loading: false
  627. });
  628. this.props.closeAdd(false, true);
  629. } else {
  630. message.warning(data.error[0].message);
  631. this.setState({
  632. loading: false
  633. });
  634. }
  635. }.bind(this));
  636. },
  637. handleCancel(e) {
  638. this.setState({
  639. visible: false,
  640. });
  641. this.props.closeAdd(false);
  642. },
  643. spinChange(e) {
  644. this.setState({
  645. loading: e
  646. });
  647. },
  648. render() {
  649. return (
  650. <div className="cognizance-add">
  651. <Modal title="高企申请" visible={this.state.visible}
  652. onOk={this.handleOk} onCancel={this.handleCancel}
  653. width='800px'
  654. footer={[
  655. <Button key="submit" type="primary" loading={this.state.loading} onClick={this.handleOk}>
  656. 提交
  657. </Button>,
  658. <Button key="back" onClick={this.handleCancel}>
  659. 返回
  660. </Button>,
  661. ]}
  662. >
  663. <div className="clearfix" style={{ marginBottom: '10px' }}>
  664. <div className="half-item">
  665. <span>选择公司: </span>
  666. <Select
  667. placeholder="请选择公司"
  668. style={{ width: 200 }}
  669. showSearch
  670. filterOption={companySearch}
  671. value={this.state.uid}
  672. onSelect={(e, n) => { this.setState({ uid: e }); this.getContactsList(e); }}>
  673. {this.props.companyOption}
  674. </Select>
  675. </div>
  676. <div className="half-item">
  677. <span>选择咨询师: </span>
  678. <Select placeholder="请选择咨询师" style={{ width: 200 }}
  679. value={this.state.consultant}
  680. onSelect={(e, n) => { this.setState({ consultant: e }); }}>
  681. {this.props.authorOption}
  682. </Select>
  683. </div>
  684. </div>
  685. <div className="clearfix">
  686. <div className="half-item">
  687. <span>选择申请年份: </span>
  688. <Select placeholder="请选择年份" style={{ width: 200 }}
  689. value={this.state.year}
  690. onSelect={(e, n) => { this.setState({ year: e }); }}>
  691. {this.state.yearOption}
  692. </Select>
  693. </div>
  694. <div className="half-item">
  695. <span>选择联系人: </span>
  696. <Select placeholder="请选择联系人" style={{ width: 200 }}
  697. value={this.state.contacts}
  698. onSelect={(e, n) => { this.setState({ contacts: e }); }}>
  699. {this.state.contactsOption}
  700. </Select>
  701. </div>
  702. </div>
  703. <div>
  704. <div>
  705. <Input type="textarea" rows={6}
  706. value={this.state.comment}
  707. onChange={(e) => { this.setState({ comment: e.target.value }); }} />
  708. </div>
  709. </div>
  710. </Modal>
  711. </div>
  712. );
  713. }
  714. });
  715. const Cognizance = React.createClass({
  716. loadData(pageNo) {
  717. this.state.data = [];
  718. this.setState({
  719. loading: true
  720. });
  721. $.ajax({
  722. method: "post",
  723. dataType: "json",
  724. crossDomain: false,
  725. url: globalConfig.context + "/api/admin/listCognizance",
  726. data: {
  727. pageNo: pageNo || 1,
  728. pageSize: this.state.pagination.pageSize,
  729. locationProvince: this.state.province,
  730. uid: this.state.unitName,
  731. },
  732. success: function (data) {
  733. if (data.error.length || !data.data || !data.data.list) {
  734. message.warning(data.error[0].message);
  735. return;
  736. }
  737. for (let i = 0; i < data.data.list.length; i++) {
  738. let thisdata = data.data.list[i];
  739. this.state.data.push({
  740. key: i,
  741. uid: thisdata.uid,
  742. cid: thisdata.cid,
  743. year: thisdata.year,
  744. serialNumber: thisdata.serialNumber,
  745. locationProvince: thisdata.locationProvince,
  746. unitName: thisdata.unitName,
  747. contacts: [thisdata.contacts, {
  748. '1': thisdata.firstContacts,
  749. '2': thisdata.secondContacts,
  750. '3': thisdata.thirdContacts
  751. }],
  752. createTime: thisdata.createTime,
  753. comment: thisdata.comment,
  754. state: thisdata.state,
  755. certificateNumber: thisdata.certificateNumber,
  756. issuingDate: thisdata.issuingDate,
  757. consultant: thisdata.consultant,
  758. createTimeFormattedDate: thisdata.createTimeFormattedDate,
  759. issuingDateFormattedDate: thisdata.issuingDateFormattedDate
  760. });
  761. };
  762. this.state.pagination.current = data.data.pageNo;
  763. this.state.pagination.total = data.data.totalCount;
  764. this.setState({
  765. dataSource: this.state.data,
  766. pagination: this.state.pagination
  767. });
  768. }.bind(this),
  769. }).always(function () {
  770. this.setState({
  771. loading: false
  772. });
  773. }.bind(this));
  774. },
  775. getAuthorList() {
  776. this.setState({
  777. loading: true
  778. });
  779. $.ajax({
  780. method: "get",
  781. dataType: "json",
  782. crossDomain: false,
  783. url: globalConfig.context + "/api/admin/getPrincipal",
  784. success: function (data) {
  785. if (!data.data) {
  786. if (data.error && data.error.length) {
  787. message.warning(data.error[0].message);
  788. };
  789. return;
  790. };
  791. let _me = this;
  792. for (var item in data.data) {
  793. _me.state.authorOption.push(
  794. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  795. )
  796. };
  797. }.bind(this),
  798. }).always(function () {
  799. this.setState({
  800. loading: false
  801. });
  802. }.bind(this));
  803. },
  804. getCompanyList() {
  805. this.setState({
  806. loading: true
  807. });
  808. $.ajax({
  809. method: "get",
  810. dataType: "json",
  811. crossDomain: false,
  812. url: globalConfig.context + "/api/admin/getUnitNames",
  813. success: function (data) {
  814. if (data.error.length || !data.data) {
  815. return;
  816. };
  817. let _me = this;
  818. for (var item in data.data) {
  819. _me.state.companyOption.push(
  820. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  821. )
  822. };
  823. }.bind(this),
  824. }).always(function () {
  825. this.setState({
  826. loading: false
  827. });
  828. }.bind(this));
  829. },
  830. getInitialState() {
  831. return {
  832. provinceOption: [],
  833. companyOption: [],
  834. authorOption: [],
  835. selectedRowKeys: [],
  836. selectedRows: [],
  837. loading: false,
  838. showAdd: false,
  839. showDesc: false,
  840. pagination: {
  841. defaultCurrent: 1,
  842. defaultPageSize: 10,
  843. showQuickJumper: true,
  844. pageSize: 10,
  845. onChange: function (page) {
  846. this.loadData(page);
  847. }.bind(this),
  848. showTotal: function (total) {
  849. return '共' + total + '条数据';
  850. }
  851. },
  852. columns: [
  853. {
  854. title: '编号',
  855. dataIndex: 'serialNumber',
  856. key: 'serialNumber'
  857. }, {
  858. title: '省份',
  859. dataIndex: 'locationProvince',
  860. key: 'locationProvince'
  861. }, {
  862. title: '公司',
  863. dataIndex: 'unitName',
  864. key: 'unitName'
  865. }, {
  866. title: '联系人',
  867. dataIndex: 'contacts',
  868. key: 'contacts',
  869. render: (text) => {
  870. for (let item in text[1]) {
  871. if (text[0] == item) {
  872. return text[1][item];
  873. };
  874. };
  875. }
  876. }, {
  877. title: '派单日',
  878. dataIndex: 'createTimeFormattedDate',
  879. key: 'createTimeFormattedDate'
  880. }, {
  881. title: '状态',
  882. dataIndex: 'state',
  883. key: 'state',
  884. render: (text) => { return getCognizanceState(text) }
  885. }, {
  886. title: '证书编号',
  887. dataIndex: 'certificateNumber',
  888. key: 'certificateNumber'
  889. }, {
  890. title: '发证日',
  891. dataIndex: 'issuingDateFormattedDate',
  892. key: 'issuingDateFormattedDate'
  893. }, {
  894. title: '到期日',
  895. dataIndex: 'issuingDate',
  896. key: 'issuingDate',
  897. render: (text) => { return getTime(text, 36) }
  898. }, {
  899. title: '咨询师',
  900. dataIndex: 'consultant',
  901. key: 'consultant'
  902. }
  903. ],
  904. dataSource: []
  905. };
  906. },
  907. componentWillMount() {
  908. let _me = this;
  909. provinceArr.map(function (item) {
  910. _me.state.provinceOption.push(
  911. <Select.Option value={item} key={item}>{item}</Select.Option>
  912. )
  913. });
  914. this.loadData();
  915. this.getAuthorList();
  916. this.getCompanyList();
  917. // this.getContactsList();
  918. },
  919. tableRowClick(record, index) {
  920. this.state.RowData = record;
  921. this.setState({
  922. showDesc: true
  923. });
  924. },
  925. addClick() {
  926. this.setState({
  927. showAdd: true
  928. });
  929. },
  930. delectRow() {
  931. let deletedIds = [];
  932. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  933. let rowItem = this.state.selectedRows[idx];
  934. if (rowItem.cid) {
  935. deletedIds.push(rowItem.cid)
  936. }
  937. }
  938. this.setState({
  939. selectedRowKeys: [],
  940. loading: deletedIds.length > 0
  941. });
  942. $.ajax({
  943. method: "POST",
  944. dataType: "json",
  945. crossDomain: false,
  946. url: globalConfig.context + "/api/admin/deleteCognizance",
  947. data: {
  948. ids: deletedIds
  949. }
  950. }).done(function (data) {
  951. if (!data.error.length) {
  952. message.success('保存成功!');
  953. this.setState({
  954. loading: false,
  955. });
  956. } else {
  957. message.warning(data.error[0].message);
  958. };
  959. this.loadData();
  960. }.bind(this));
  961. },
  962. closeDesc(e, s) {
  963. this.state.showDesc = e;
  964. if (s) {
  965. this.loadData();
  966. };
  967. },
  968. closeAdd(e, s) {
  969. this.state.showAdd = e;
  970. if (s) {
  971. this.loadData();
  972. };
  973. },
  974. search() {
  975. this.loadData();
  976. },
  977. reset() {
  978. this.state.province = undefined;
  979. this.state.unitName = undefined;
  980. this.loadData();
  981. },
  982. render() {
  983. const rowSelection = {
  984. selectedRowKeys: this.state.selectedRowKeys,
  985. onChange: (selectedRowKeys, selectedRows) => {
  986. this.setState({
  987. selectedRows: selectedRows,
  988. selectedRowKeys: selectedRowKeys
  989. });
  990. }
  991. };
  992. const hasSelected = this.state.selectedRowKeys.length > 0;
  993. return (
  994. <div className="foster-content" >
  995. <div className="content-title">
  996. <span>高企申请管理</span>
  997. <Button style={{ background: "#ea0862", border: "none", color: "#fff", float: 'right' }}
  998. onClick={this.addClick}>添加新申请<Icon type="plus" /></Button>
  999. </div>
  1000. <div className="foster-query">
  1001. <Select placeholder="选择省份"
  1002. style={{ width: 200 }}
  1003. value={this.state.province}
  1004. showSearch
  1005. filterOption={companySearch}
  1006. onChange={(e) => { this.setState({ province: e }) }}>
  1007. {this.state.provinceOption}
  1008. </Select>
  1009. <Select placeholder="选择公司"
  1010. style={{ width: 200 }}
  1011. value={this.state.unitName}
  1012. showSearch
  1013. filterOption={companySearch}
  1014. onChange={(e) => { this.setState({ unitName: e }) }}>
  1015. {this.state.companyOption}
  1016. </Select>
  1017. <Button type="primary" onClick={this.search}>搜索</Button>
  1018. <Button onClick={this.reset}>重置</Button>
  1019. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  1020. disabled={!hasSelected}
  1021. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  1022. </div>
  1023. <div className="patent-table">
  1024. <Spin spinning={this.state.loading}>
  1025. <Table columns={this.state.columns}
  1026. dataSource={this.state.dataSource}
  1027. pagination={this.state.pagination}
  1028. rowSelection={rowSelection}
  1029. onRowClick={this.tableRowClick} />
  1030. </Spin>
  1031. </div>
  1032. <CognizanceDesc
  1033. data={this.state.RowData}
  1034. authorOption={this.state.authorOption}
  1035. showDesc={this.state.showDesc}
  1036. closeDesc={this.closeDesc} />
  1037. <CognizanceAdd
  1038. authorOption={this.state.authorOption}
  1039. companyOption={this.state.companyOption}
  1040. showAdd={this.state.showAdd}
  1041. closeAdd={this.closeAdd} />
  1042. </div >
  1043. );
  1044. }
  1045. });
  1046. export default Cognizance;