highTechApply.jsx 41 KB

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