HighTechApply.jsx 35 KB

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