highTechApply.jsx 38 KB

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