highTechApply.jsx 40 KB

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