highTechApply.jsx 43 KB

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