highTechApply.jsx 40 KB

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