highTechApply.jsx 38 KB

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