HighTechApply.jsx 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963
  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. this.state.visible = nextProps.showAdd
  490. },
  491. componentWillMount() {
  492. let d = new Date();
  493. let _me = this;
  494. d = d.getFullYear() - 1;
  495. this.state.thisYear = d;
  496. for (let i = d; i < d + 20; i++) {
  497. _me.state.yearOption.push(
  498. <Select.Option value={i.toString()} key={i}>{i}</Select.Option>
  499. )
  500. };
  501. },
  502. showModal() {
  503. this.setState({
  504. visible: true,
  505. });
  506. },
  507. handleOk() {
  508. this.setState({
  509. loading: true
  510. });
  511. if (!this.state.year) {
  512. message.warning('请选择年份!');
  513. this.setState({
  514. loading: false
  515. });
  516. return;
  517. };
  518. if (!this.state.contacts) {
  519. message.warning('请选择一个联系人!');
  520. this.setState({
  521. loading: false
  522. });
  523. return;
  524. };
  525. $.ajax({
  526. method: "POST",
  527. dataType: "json",
  528. crossDomain: false,
  529. url: globalConfig.context + "/api/admin/applyCognizance",
  530. data: {
  531. year: this.state.year,
  532. contacts: this.state.contacts,
  533. comment: this.state.comment,
  534. consultant: this.state.consultant,
  535. uid: this.state.uid,
  536. state: this.state.year == this.state.thisYear ? 0 : 7
  537. }
  538. }).done(function (data) {
  539. if (!data.error.length) {
  540. message.success('保存成功!');
  541. this.setState({
  542. visible: false
  543. });
  544. this.props.closeAdd(false, true);
  545. } else {
  546. message.warning(data.error[0].message);
  547. this.setState({
  548. loading: false
  549. });
  550. }
  551. }.bind(this));
  552. },
  553. handleCancel(e) {
  554. this.setState({
  555. visible: false,
  556. });
  557. this.props.closeAdd(false);
  558. },
  559. spinChange(e) {
  560. this.setState({
  561. loading: e
  562. });
  563. },
  564. render() {
  565. return (
  566. <div className="cognizance-add">
  567. <Modal title="高企申请" visible={this.state.visible}
  568. onOk={this.handleOk} onCancel={this.handleCancel}
  569. width='800px'
  570. footer={[
  571. <Button key="submit" type="primary" loading={this.state.loading} onClick={this.handleOk}>
  572. 提交
  573. </Button>,
  574. <Button key="back" onClick={this.handleCancel}>
  575. 返回
  576. </Button>,
  577. ]}
  578. >
  579. <div className="clearfix" style={{ marginBottom: '10px' }}>
  580. <div className="half-item">
  581. <span>选择公司: </span>
  582. <Select
  583. placeholder="请选择公司"
  584. style={{ width: 200 }}
  585. showSearch
  586. filterOption={companySearch}
  587. onSelect={(e, n) => { this.state.uid = e; this.getContactsList(e); }}>
  588. {this.props.companyOption}
  589. </Select>
  590. </div>
  591. <div className="half-item">
  592. <span>选择咨询师: </span>
  593. <Select placeholder="请选择咨询师" style={{ width: 200 }}
  594. onSelect={(e, n) => { this.state.consultant = e }}>
  595. {this.props.authorOption}
  596. </Select>
  597. </div>
  598. </div>
  599. <div className="clearfix">
  600. <div className="half-item">
  601. <span>选择申请年份: </span>
  602. <Select placeholder="请选择年份" style={{ width: 200 }}
  603. onSelect={(e, n) => { this.state.year = e }}>
  604. {this.state.yearOption}
  605. </Select>
  606. </div>
  607. <div className="half-item">
  608. <span>选择联系人: </span>
  609. <Select placeholder="请选择联系人" style={{ width: 200 }}
  610. onSelect={(e, n) => { this.state.contacts = e }}>
  611. {this.state.contactsOption}
  612. </Select>
  613. </div>
  614. </div>
  615. <div>
  616. <div>
  617. <Input type="textarea" rows={6} onChange={(e) => { this.state.comment = e.target.value; }} />
  618. </div>
  619. </div>
  620. </Modal>
  621. </div>
  622. );
  623. }
  624. });
  625. const Cognizance = React.createClass({
  626. loadData(pageNo) {
  627. this.state.data = [];
  628. this.setState({
  629. loading: true
  630. });
  631. $.ajax({
  632. method: "post",
  633. dataType: "json",
  634. crossDomain: false,
  635. url: globalConfig.context + "/api/admin/listCognizance",
  636. data: {
  637. pageNo: pageNo || 1,
  638. pageSize: this.state.pagination.pageSize,
  639. locationProvince: this.state.province,
  640. uid: this.state.unitName,
  641. },
  642. success: function (data) {
  643. if (data.error.length || !data.data || !data.data.list) {
  644. message.warning(data.error[0].message);
  645. return;
  646. }
  647. for (let i = 0; i < data.data.list.length; i++) {
  648. let thisdata = data.data.list[i];
  649. this.state.data.push({
  650. key: i,
  651. uid: thisdata.uid,
  652. cid: thisdata.cid,
  653. year: thisdata.year,
  654. serialNumber: thisdata.serialNumber,
  655. locationProvince: thisdata.locationProvince,
  656. unitName: thisdata.unitName,
  657. contacts: [thisdata.contacts, {
  658. '1': thisdata.firstContacts,
  659. '2': thisdata.secondContacts,
  660. '3': thisdata.thirdContacts
  661. }],
  662. createTime: thisdata.createTime,
  663. comment: thisdata.comment,
  664. state: thisdata.state,
  665. certificateNumber: thisdata.certificateNumber,
  666. issuingDate: thisdata.issuingDate,
  667. consultant: thisdata.consultant,
  668. createTimeFormattedDate: thisdata.createTimeFormattedDate,
  669. issuingDateFormattedDate: thisdata.issuingDateFormattedDate
  670. });
  671. };
  672. this.state.pagination.current = data.data.pageNo;
  673. this.state.pagination.total = data.data.totalCount;
  674. this.setState({
  675. dataSource: this.state.data,
  676. pagination: this.state.pagination
  677. });
  678. }.bind(this),
  679. }).always(function () {
  680. this.setState({
  681. loading: false
  682. });
  683. }.bind(this));
  684. },
  685. getAuthorList() {
  686. this.setState({
  687. loading: true
  688. });
  689. $.ajax({
  690. method: "get",
  691. dataType: "json",
  692. crossDomain: false,
  693. url: globalConfig.context + "/techservice/patent/getAdmin",
  694. success: function (data) {
  695. if (data.error.length || !data.data) {
  696. return;
  697. };
  698. let _me = this;
  699. for (var item in data.data) {
  700. _me.state.authorOption.push(
  701. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  702. )
  703. };
  704. }.bind(this),
  705. }).always(function () {
  706. this.setState({
  707. loading: false
  708. });
  709. }.bind(this));
  710. },
  711. getCompanyList() {
  712. this.setState({
  713. loading: true
  714. });
  715. $.ajax({
  716. method: "get",
  717. dataType: "json",
  718. crossDomain: false,
  719. url: globalConfig.context + "/techservice/patent/getUnitNames",
  720. success: function (data) {
  721. if (data.error.length || !data.data) {
  722. return;
  723. };
  724. let _me = this;
  725. for (var item in data.data) {
  726. _me.state.companyOption.push(
  727. <Select.Option value={item} key={item}>{data.data[item]}</Select.Option>
  728. )
  729. };
  730. }.bind(this),
  731. }).always(function () {
  732. this.setState({
  733. loading: false
  734. });
  735. }.bind(this));
  736. },
  737. getInitialState() {
  738. return {
  739. provinceOption: [],
  740. companyOption: [],
  741. authorOption: [],
  742. selectedRowKeys: [],
  743. selectedRows: [],
  744. loading: false,
  745. showAdd: false,
  746. showDesc: false,
  747. pagination: {
  748. defaultCurrent: 1,
  749. defaultPageSize: 10,
  750. showQuickJumper: true,
  751. pageSize: 10,
  752. onChange: function (page) {
  753. this.loadData(page);
  754. }.bind(this),
  755. showTotal: function (total) {
  756. return '共' + total + '条数据';
  757. }
  758. },
  759. columns: [
  760. {
  761. title: '编号',
  762. dataIndex: 'serialNumber',
  763. key: 'serialNumber'
  764. }, {
  765. title: '省份',
  766. dataIndex: 'locationProvince',
  767. key: 'locationProvince'
  768. }, {
  769. title: '公司',
  770. dataIndex: 'unitName',
  771. key: 'unitName'
  772. }, {
  773. title: '联系人',
  774. dataIndex: 'contacts',
  775. key: 'contacts',
  776. render: (text) => {
  777. for (let item in text[1]) {
  778. if (text[0] == item) {
  779. return text[1][item];
  780. };
  781. };
  782. }
  783. }, {
  784. title: '派单日',
  785. dataIndex: 'createTimeFormattedDate',
  786. key: 'createTimeFormattedDate'
  787. }, {
  788. title: '状态',
  789. dataIndex: 'state',
  790. key: 'state',
  791. render: (text) => { return getCognizanceState(text) }
  792. }, {
  793. title: '证书编号',
  794. dataIndex: 'certificateNumber',
  795. key: 'certificateNumber'
  796. }, {
  797. title: '发证日',
  798. dataIndex: 'issuingDateFormattedDate',
  799. key: 'issuingDateFormattedDate'
  800. }, {
  801. title: '到期日',
  802. dataIndex: 'issuingDate',
  803. key: 'issuingDate',
  804. render: (text) => { return getTime(text, 36) }
  805. }, {
  806. title: '咨询师',
  807. dataIndex: 'consultant',
  808. key: 'consultant'
  809. }
  810. ],
  811. dataSource: []
  812. };
  813. },
  814. componentWillMount() {
  815. let _me = this;
  816. provinceArr.map(function (item) {
  817. _me.state.provinceOption.push(
  818. <Select.Option value={item} key={item}>{item}</Select.Option>
  819. )
  820. });
  821. this.loadData();
  822. this.getAuthorList();
  823. this.getCompanyList();
  824. // this.getContactsList();
  825. },
  826. tableRowClick(record, index) {
  827. this.state.RowData = record;
  828. this.setState({
  829. showDesc: true
  830. });
  831. },
  832. addClick() {
  833. this.setState({
  834. showAdd: true
  835. });
  836. },
  837. delectRow() {
  838. let deletedIds = [];
  839. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  840. let rowItem = this.state.selectedRows[idx];
  841. if (rowItem.id) {
  842. deletedIds.push(rowItem.id)
  843. }
  844. }
  845. this.setState({
  846. selectedRowKeys: [],
  847. loading: deletedIds.length > 0
  848. });
  849. $.ajax({
  850. method: "POST",
  851. dataType: "json",
  852. crossDomain: false,
  853. url: globalConfig.context + "/techservice/cognizance/deleteCognizance",
  854. data: {
  855. ids: deletedIds
  856. }
  857. }).done(function (data) {
  858. if (!data.error.length) {
  859. message.success('保存成功!');
  860. this.setState({
  861. loading: false,
  862. });
  863. } else {
  864. message.warning(data.error[0].message);
  865. };
  866. this.loadData();
  867. }.bind(this));
  868. },
  869. closeDesc(e, s) {
  870. this.state.showDesc = e;
  871. if (s) {
  872. this.loadData();
  873. };
  874. },
  875. closeAdd(e, s) {
  876. this.state.showAdd = e;
  877. if (s) {
  878. this.loadData();
  879. };
  880. },
  881. search() {
  882. this.loadData();
  883. },
  884. reset() {
  885. this.state.province = undefined;
  886. this.state.unitName = undefined;
  887. this.loadData();
  888. },
  889. render() {
  890. const rowSelection = {
  891. selectedRowKeys: this.state.selectedRowKeys,
  892. onChange: (selectedRowKeys, selectedRows) => {
  893. this.setState({
  894. selectedRows: selectedRows,
  895. selectedRowKeys: selectedRowKeys
  896. });
  897. }
  898. };
  899. const hasSelected = this.state.selectedRowKeys.length > 0;
  900. return (
  901. <div className="foster-content" >
  902. <div className="content-title">
  903. <span>高企申请管理</span>
  904. </div>
  905. <div className="foster-query">
  906. <Select placeholder="选择省份"
  907. style={{ width: 200 }}
  908. value={this.state.province}
  909. showSearch
  910. filterOption={companySearch}
  911. onChange={(e) => { this.setState({ province: e }) }}>
  912. {this.state.provinceOption}
  913. </Select>
  914. <Select placeholder="选择公司"
  915. style={{ width: 200 }}
  916. value={this.state.unitName}
  917. showSearch
  918. filterOption={companySearch}
  919. onChange={(e) => { this.setState({ unitName: e }) }}>
  920. {this.state.companyOption}
  921. </Select>
  922. <Button type="primary" onClick={this.search}>搜索</Button>
  923. <Button onClick={this.reset}>重置</Button>
  924. </div>
  925. <div className="foster-query">
  926. <div>
  927. <Button style={{ background: "#ea0862", border: "none", color: "#fff" }}
  928. onClick={this.addClick}>添加<Icon type="plus" /></Button>
  929. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  930. disabled={!hasSelected}
  931. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  932. </div>
  933. </div>
  934. <div className="patent-table">
  935. <Spin spinning={this.state.loading}>
  936. <Table columns={this.state.columns}
  937. dataSource={this.state.dataSource}
  938. pagination={this.state.pagination}
  939. rowSelection={rowSelection}
  940. onRowClick={this.tableRowClick} />
  941. </Spin>
  942. </div>
  943. <CognizanceDesc
  944. data={this.state.RowData}
  945. authorOption={this.state.authorOption}
  946. showDesc={this.state.showDesc}
  947. closeDesc={this.closeDesc} />
  948. <CognizanceAdd
  949. authorOption={this.state.authorOption}
  950. companyOption={this.state.companyOption}
  951. showAdd={this.state.showAdd}
  952. closeAdd={this.closeAdd} />
  953. </div >
  954. );
  955. }
  956. });
  957. export default Cognizance;