HighTechApply.jsx 37 KB

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