highTechApply.jsx 44 KB

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