highTechApply.jsx 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279
  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. style={{
  1251. cursor: 'pointer',
  1252. }}
  1253. onRowClick={this.tableRowClick} />
  1254. </Spin>
  1255. </div>
  1256. <CognizanceDesc
  1257. data={this.state.RowData}
  1258. authorOption={this.state.authorOption}
  1259. showDesc={this.state.showDesc}
  1260. closeDesc={this.closeDesc} />
  1261. <CognizanceAdd
  1262. authorOption={this.state.authorOption}
  1263. salesmanOption={this.state.salesmanOption}
  1264. companyOption={this.state.companyOption}
  1265. showAdd={this.state.showAdd}
  1266. closeAdd={this.closeAdd} />
  1267. </div >
  1268. );
  1269. }
  1270. });
  1271. export default Cognizance;
  1272. //<Button style={{ background: "#ea0862", border: "none", color: "#fff", float: 'right' }}
  1273. //onClick={this.addClick}>添加新申请<Icon type="plus" /></Button>