highTechApply.jsx 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274
  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/getContacts",
  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}>{theData}</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. this.setState({
  1135. showDesc: true
  1136. });
  1137. },
  1138. addClick() {
  1139. this.setState({
  1140. showAdd: true
  1141. });
  1142. },
  1143. delectRow() {
  1144. let deletedIds = [];
  1145. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  1146. let rowItem = this.state.selectedRows[idx];
  1147. if (rowItem.cid) {
  1148. deletedIds.push(rowItem.cid)
  1149. }
  1150. }
  1151. this.setState({
  1152. selectedRowKeys: [],
  1153. loading: deletedIds.length > 0
  1154. });
  1155. $.ajax({
  1156. method: "POST",
  1157. dataType: "json",
  1158. crossDomain: false,
  1159. url: globalConfig.context + "/api/admin/deleteCognizance",
  1160. data: {
  1161. ids: deletedIds
  1162. }
  1163. }).done(function (data) {
  1164. if (!data.error.length) {
  1165. message.success('删除成功!');
  1166. this.setState({
  1167. loading: false,
  1168. });
  1169. } else {
  1170. message.warning(data.error[0].message);
  1171. };
  1172. this.loadData();
  1173. }.bind(this));
  1174. },
  1175. closeDesc(e, s) {
  1176. this.state.showDesc = e;
  1177. if (s) {
  1178. this.loadData();
  1179. };
  1180. },
  1181. closeAdd(e, s) {
  1182. this.state.showAdd = e;
  1183. if (s) {
  1184. this.loadData();
  1185. };
  1186. },
  1187. search() {
  1188. this.loadData();
  1189. },
  1190. reset() {
  1191. this.state.province = undefined;
  1192. this.state.unitName = undefined;
  1193. this.state.contractId = undefined;
  1194. this.loadData();
  1195. },
  1196. render() {
  1197. const rowSelection = {
  1198. selectedRowKeys: this.state.selectedRowKeys,
  1199. onChange: (selectedRowKeys, selectedRows) => {
  1200. this.setState({
  1201. selectedRows: selectedRows,
  1202. selectedRowKeys: selectedRowKeys
  1203. });
  1204. }
  1205. };
  1206. const hasSelected = this.state.selectedRowKeys.length > 0;
  1207. return (
  1208. <div className="foster-content" >
  1209. <div className="content-title">
  1210. <span>高企申请管理</span>
  1211. </div>
  1212. <div className="foster-query">
  1213. <Cascader placeholder="选择省份"
  1214. style={{ width: 100, marginTop: "-4px", marginRight: '20px' }}
  1215. value={this.state.province}
  1216. options={provinceSelect()}
  1217. showSearch
  1218. filterOption={companySearch}
  1219. onChange={(e) => { this.setState({ province: e }) }} />
  1220. <Select placeholder="选择公司"
  1221. style={{ width: 200 }}
  1222. value={this.state.unitName}
  1223. showSearch
  1224. filterOption={companySearch}
  1225. onChange={(e) => { this.setState({ unitName: e }) }}>
  1226. {this.state.companyOption}
  1227. </Select>
  1228. <Select placeholder="选择合同编号"
  1229. style={{ width: 120 }}
  1230. value={this.state.contractId}
  1231. showSearch
  1232. filterOption={companySearch}
  1233. onChange={(e) => { this.setState({ contractId: e }) }}>
  1234. {this.state.contractListOption}
  1235. </Select>
  1236. <Button type="primary" onClick={this.search}>搜索</Button>
  1237. <Button onClick={this.reset}>重置</Button>
  1238. <Button style={{ background: "#3fcf9e", border: "none", color: "#fff" }}
  1239. disabled={!hasSelected}
  1240. onClick={this.delectRow}>删除<Icon type="minus" /></Button>
  1241. </div>
  1242. <div className="patent-table">
  1243. <Spin spinning={this.state.loading}>
  1244. <Table columns={this.state.columns}
  1245. dataSource={this.state.dataSource}
  1246. pagination={this.state.pagination}
  1247. rowSelection={rowSelection}
  1248. onRowClick={this.tableRowClick} />
  1249. </Spin>
  1250. </div>
  1251. <CognizanceDesc
  1252. data={this.state.RowData}
  1253. authorOption={this.state.authorOption}
  1254. showDesc={this.state.showDesc}
  1255. closeDesc={this.closeDesc} />
  1256. <CognizanceAdd
  1257. authorOption={this.state.authorOption}
  1258. salesmanOption={this.state.salesmanOption}
  1259. companyOption={this.state.companyOption}
  1260. showAdd={this.state.showAdd}
  1261. closeAdd={this.closeAdd} />
  1262. </div >
  1263. );
  1264. }
  1265. });
  1266. export default Cognizance;
  1267. //<Button style={{ background: "#ea0862", border: "none", color: "#fff", float: 'right' }}
  1268. //onClick={this.addClick}>添加新申请<Icon type="plus" /></Button>