HighTechApply.jsx 34 KB

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