highTechApply.jsx 52 KB

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