highTechApply.jsx 39 KB

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