addIntention.jsx 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764
  1. import React from 'react';
  2. import { Modal, message, Spin, Input, Select, Button, Form, Col, Cascader, Tag, Tooltip, AutoComplete, Icon } from 'antd';
  3. import $ from 'jquery/src/ajax';
  4. import { areaSelect } from '@/NewDicProvinceList';
  5. import { socialAttribute, customerSource } from '@/dataDic.js';
  6. import TextArea from "antd/es/input/TextArea";
  7. const confirm = Modal.confirm;
  8. const AchievementDetailForm = Form.create()(React.createClass({
  9. getInitialState() {
  10. return {
  11. loading: false,
  12. data: {},
  13. detailApi: '',
  14. businessScope: [],
  15. inputVisible: false,
  16. cooperationProjects: [],
  17. selectCooperationProjects: []
  18. };
  19. },
  20. handleSubmit(e) {
  21. // if (/.*[\u4e00-\u9fa5]+.*$/.test(this.state.content)) {
  22. // } else {
  23. // message.error("请填写正确的姓名,且至少包含一个汉字");
  24. // return;
  25. // }
  26. e.preventDefault();
  27. this.props.form.validateFields((err, values) => {
  28. let re = new RegExp("^[\u4e00-\u9fa5]");
  29. if (!re.test(values.name)) {
  30. message.warning('公司名称必须以汉字开头!')
  31. return
  32. }
  33. if (!re.test(values.name.charAt(values.name.length - 1))) {
  34. message.warning('公司名称必须以汉字结尾!')
  35. return
  36. }
  37. if (values.name.length > 64) {
  38. message.warning('公司名称字数不超过64个!')
  39. return false;
  40. };
  41. let regu = /[`~!#$%^&*'_[\]+=<>?:"{}|~!#¥%……&*=-@-!{}|/《》?:“”【】、;;‘’,,.。、\s+]/g;
  42. if (regu.test(values.name)) {
  43. message.warning('公司名称不能存在特殊符号或空格!')
  44. return false;
  45. }
  46. if (!/^[A-Z0-9]{15}$|^[A-Z0-9]{17}$|^[A-Z0-9]{18}$|^[A-Z0-9]{20}$/.test(values.orgCode)) {
  47. message.warning('请输入正确的统一社会信用代码!')
  48. return
  49. }
  50. if (/.*[\u4e00-\u9fa5]+.*$/.test(values.content)) {
  51. } else {
  52. message.error("请填写正确的联系人,且至少包含一个汉字");
  53. return false;
  54. };
  55. if (/.*[\u4e00-\u9fa5]+.*$/.test(values.position)) {
  56. } else {
  57. message.error("请填写正确的职位,且至少包含一个汉字");
  58. return false;
  59. };
  60. if (!values.ProvinceCity[1]) {
  61. message.warning('请选择地区');
  62. return false;
  63. };
  64. if (values.content.length > 32) {
  65. message.warning('联系人字数不超过32个')
  66. return false;
  67. };
  68. if (values.length > 13) {
  69. message.warning('电话号码字数不超过13个')
  70. return false;
  71. };
  72. if (this.state.businessScope.length === 0) {
  73. message.warning('请选择主营产品')
  74. return false;
  75. }
  76. if (this.state.selectCooperationProjects.length === 0) {
  77. message.warning('请选择意向合作项目')
  78. return false;
  79. }
  80. let arr = [];
  81. for (let i of this.state.selectCooperationProjects) {
  82. arr.push(i.label)
  83. }
  84. if (!err) {
  85. this.setState({
  86. loading: true
  87. });
  88. $.ajax({
  89. method: "POST",
  90. dataType: "json",
  91. crossDomain: false,
  92. url: globalConfig.context + '/api/admin/customer/addCustomer',
  93. data: {
  94. name: values.name,
  95. orgCode: values.orgCode,
  96. contacts: values.content,
  97. contactMobile: values.telnum,
  98. societyTag: '0', //社会属性默认为 社会企业
  99. //source:values.customerSource,
  100. province: (values.ProvinceCity)[0],//省
  101. city: (values.ProvinceCity)[1],//市
  102. area: (values.ProvinceCity)[2],//区
  103. type: '1',
  104. intendedProject: arr.join(','),
  105. businessScope: this.state.businessScope.join(','),
  106. position: values.position,
  107. }
  108. }).done(function (data) {
  109. this.setState({
  110. loading: false
  111. });
  112. if (!data.error.length) {
  113. message.success('保存成功!');
  114. this.setState({
  115. verification: false
  116. })
  117. this.props.handleOk();
  118. } else {
  119. message.warning(data.error[0].message);
  120. }
  121. }.bind(this));
  122. }
  123. });
  124. },
  125. componentWillMount() {
  126. this.state.name = '';
  127. this.state.content = '';
  128. this.state.position = '';
  129. this.state.telnum = '';
  130. // this.state.societyTagt='0';
  131. this.state.customerSource = '0';
  132. this.state.inputValue = '';
  133. this.state.businessScope = [];
  134. this.state.inputVisible = false;
  135. this.state.cooperationProjects = [];
  136. this.state.selectCooperationProjects = [];
  137. },
  138. componentWillReceiveProps(nextProps) {
  139. if (!this.props.visible && nextProps.visible) {
  140. this.state.name = '';
  141. this.state.content = '';
  142. this.state.position = '';
  143. this.state.telnum = '';
  144. this.state.inputValue = '';
  145. this.state.businessScope = [];
  146. this.state.inputVisible = false;
  147. this.state.cooperationProjects = [];
  148. this.state.selectCooperationProjects = [];
  149. // this.state.societyTagt='0';
  150. this.props.form.resetFields();
  151. };
  152. },
  153. handleClose(removedTag) {
  154. let businessScope = this.state.businessScope.filter(tag => { return tag !== removedTag });
  155. this.setState({ businessScope });
  156. },
  157. handleCloseCooperation(removedTag) {
  158. let selectCooperationProjects = this.state.selectCooperationProjects.filter(tag => { return tag.value !== removedTag.value });
  159. this.setState({ selectCooperationProjects });
  160. },
  161. showInput() {
  162. let str = this.state.businessScope.join('/')
  163. this.setState({
  164. inputVisible: true,
  165. inputValue: str
  166. });
  167. },
  168. handleInputConfirm() {
  169. let inputValue = this.state.inputValue;
  170. let arr = inputValue.split('/');
  171. let lv = true;
  172. for (let i of arr) {
  173. if (!i.replace(/\s+/g, '')) {
  174. message.warning("请填写关键词且不为空");
  175. return;
  176. }
  177. if (i.length > 16) {
  178. message.warning('单个标签字数不能超过16个字符')
  179. lv = false;
  180. return;
  181. }
  182. }
  183. if (lv) {
  184. arr = Array.from(new Set(arr));
  185. arr = arr.filter(v => v);
  186. this.setState({
  187. businessScope: arr,
  188. inputVisible: false,
  189. inputValue: '',
  190. });
  191. }
  192. },
  193. //加载(自动补全)
  194. supervisor(value) {
  195. $.ajax({
  196. method: "get",
  197. dataType: "json",
  198. crossDomain: false,
  199. url: globalConfig.context + '/api/admin/order/getBusinessProjectByName',
  200. data: {
  201. businessName: value
  202. },
  203. success: function (data) {
  204. let thedata = data.data;
  205. if (data.error.length === 0) {
  206. this.setState({
  207. cooperationProjects: thedata,
  208. });
  209. } else {
  210. message.warning(data.error[0].message);
  211. }
  212. }.bind(this),
  213. }).always(
  214. function () {
  215. }.bind(this)
  216. );
  217. },
  218. onSelect(value) {
  219. let arr = this.state.cooperationProjects.filter(v => v.id === value);
  220. let arr1 = this.state.selectCooperationProjects.filter(v => v.value === value);
  221. if (arr.length > 0) {
  222. if (arr1.length > 0) {
  223. message.warning('选项已存在');
  224. } else {
  225. this.state.selectCooperationProjects.push({
  226. label: arr[0].bname,
  227. value: arr[0].id,
  228. })
  229. this.setState({
  230. selectCooperationProjects: this.state.selectCooperationProjects
  231. })
  232. }
  233. }
  234. },
  235. checkUserName() {
  236. this.setState({
  237. verification: false
  238. })
  239. let yzName = this.props.form.getFieldValue('name')
  240. if (!yzName) {
  241. message.warning('请输入公司名称');
  242. return;
  243. }
  244. let re = new RegExp("^[\u4e00-\u9fa5]");
  245. if (!re.test(yzName)) {
  246. message.warning('公司名称必须以汉字开头!')
  247. return
  248. }
  249. if (!re.test(yzName.charAt(yzName.length - 1))) {
  250. message.warning('公司名称必须以汉字结尾!')
  251. return
  252. }
  253. if (yzName.length > 64) {
  254. message.warning('公司名称字数不超过64个!')
  255. return;
  256. };
  257. let regu = /[`~!#$%^&*'_[\]+=<>?:"{}|~!#¥%……&*=-@-!{}|/《》?:“”【】、;;‘’,,.。、\s+]/g;
  258. if (regu.test(yzName)) {
  259. message.warning('公司名称不能存在特殊符号或空格!')
  260. return false;
  261. }
  262. $.ajax({
  263. method: "get",
  264. dataType: "json",
  265. crossDomain: false,
  266. url: globalConfig.context + '/api/admin/customer/checkUserName',
  267. data: {
  268. userName: this.props.form.getFieldValue('name')
  269. },
  270. success: function (data) {
  271. if (data.error.length === 0) {
  272. if (!data.data) {
  273. this.setState({
  274. verification: true
  275. })
  276. } else {
  277. Modal.info({
  278. title: '提醒',
  279. content: (
  280. <div>
  281. <p>企业客户已存在!请在“客户管理-企业客户-企业客户查询”输入企业全称查询所属人信息</p>
  282. </div>
  283. ),
  284. });
  285. this.setState({
  286. verification: false
  287. })
  288. }
  289. } else {
  290. message.warning(data.error[0].message);
  291. }
  292. }.bind(this),
  293. }).always(
  294. function () {
  295. }.bind(this)
  296. );
  297. },
  298. render() {
  299. const theData = this.state.data || {};
  300. const { getFieldDecorator } = this.props.form;
  301. const FormItem = Form.Item
  302. const formItemLayout = {
  303. labelCol: { span: 6 },
  304. wrapperCol: { span: 14 },
  305. };
  306. return (
  307. <div>
  308. <Form layout="horizontal" onSubmit={this.handleSubmit} id="demand-form">
  309. <Spin spinning={this.state.loading}>
  310. <div>
  311. <Col style={{ color: 'red', marginBottom: '10px' }} span={12} offset={6}>注意:请录入真实有效的客户信息</Col>
  312. <div className="clearfix">
  313. <FormItem className="mid-item"
  314. {...formItemLayout}
  315. label="公司名称" >
  316. {getFieldDecorator('name', {
  317. rules: [{ required: true, message: '此项为必填项!' }],
  318. initialValue: this.state.name
  319. })(
  320. <span style={{ display: 'flex', alignItems: 'center', position: 'relative' }}>
  321. <Input placeholder="公司名称" />
  322. {this.state.verification && <Icon type="check-circle" style={{
  323. fontSize: 16,
  324. color: '#30e031',
  325. position: 'absolute',
  326. right: '80px',
  327. }} />}
  328. <Button onClick={this.checkUserName} type="primary" style={{ marginLeft: '10px' }}>验证</Button>
  329. </span>
  330. )}
  331. </FormItem>
  332. </div>
  333. <div className="clearfix">
  334. <FormItem
  335. {...formItemLayout}
  336. label="统一社会信用代码"
  337. >
  338. {getFieldDecorator('orgCode', {
  339. rules: [{ required: true, message: '此项为必填项!' }],
  340. initialValue: this.state.orgCode
  341. })(
  342. <Input placeholder="统一社会信用代码" />
  343. )}
  344. </FormItem>
  345. </div>
  346. <Col style={{ color: 'red', marginBottom: '10px' }} span={12} offset={6}>如,科德集团则填写91430105670766451M</Col>
  347. <div className="clearfix">
  348. <FormItem
  349. {...formItemLayout}
  350. label="省-市-区"
  351. >
  352. {getFieldDecorator('ProvinceCity', {
  353. rules: [{ required: true, message: '此项为必填项!' }],
  354. initialValue: this.state.ProvinceCity
  355. })(
  356. <Cascader options={areaSelect()} placeholder="选择城市" />
  357. )}
  358. </FormItem>
  359. </div>
  360. <div className="clearfix">
  361. <FormItem className="mid-item"
  362. {...formItemLayout}
  363. label="联系人" >
  364. {getFieldDecorator('content', {
  365. rules: [{ required: true, message: '此项为必填项!' }],
  366. initialValue: this.state.content
  367. })(
  368. <Input placeholder="联系人姓名" />
  369. )}
  370. </FormItem>
  371. </div>
  372. <div className="clearfix">
  373. <FormItem className="mid-item"
  374. {...formItemLayout}
  375. label="职位" >
  376. {getFieldDecorator('position', {
  377. rules: [{ required: true, message: '此项为必填项!' }],
  378. initialValue: this.state.position
  379. })(
  380. <Input placeholder="联系人职位" />
  381. )}
  382. </FormItem>
  383. </div>
  384. <div className="clearfix">
  385. <FormItem className="mid-item"
  386. {...formItemLayout}
  387. label="联系电话" >
  388. {getFieldDecorator('telnum', {
  389. rules: [{ required: true, message: '此项为必填项!' }],
  390. initialValue: this.state.telnum
  391. })(
  392. <Input placeholder="请填写手机号,仅填座机号时,请后续补充手机号" />
  393. )}
  394. </FormItem>
  395. </div>
  396. <div className="clearfix">
  397. <FormItem className="mid-item"
  398. {...formItemLayout}
  399. required
  400. label="主营产品" >
  401. <div>
  402. {this.state.businessScope.map((tag, index) => {
  403. const isLongTag = tag.length > 20;
  404. const tagElem = (
  405. <Tag closable key={tag} afterClose={() => this.handleClose(tag)}>
  406. {isLongTag ? `${tag.slice(0, 20)}...` : tag}
  407. </Tag>
  408. );
  409. return isLongTag ? <Tooltip title={tag} key={tag}>{tagElem}</Tooltip> : tagElem;
  410. })}
  411. {
  412. !this.state.inputVisible &&
  413. <Button
  414. size="small"
  415. type="primary"
  416. onClick={this.showInput}>
  417. + 新增主营产品
  418. </Button>
  419. }
  420. </div>
  421. {this.state.inputVisible && (<div>
  422. <TextArea
  423. style={{ width: '300px', height: '100px' }}
  424. value={this.state.inputValue}
  425. onChange={(e) => {
  426. this.setState({
  427. inputValue: e.target.value
  428. })
  429. }} />
  430. <div style={{ color: '#f00' }}>提示:请用 / 符号隔开关键字</div>
  431. <div>
  432. <Button
  433. size="small"
  434. type="primary"
  435. onClick={this.handleInputConfirm}>
  436. 确定
  437. </Button>
  438. <Button
  439. size="small"
  440. style={{ marginLeft: '5px' }}
  441. onClick={() => {
  442. this.setState({
  443. inputVisible: false,
  444. inputValue: ''
  445. })
  446. }}>
  447. 取消
  448. </Button>
  449. </div>
  450. </div>)}
  451. </FormItem>
  452. </div>
  453. <div className="clearfix">
  454. <FormItem
  455. className="mid-item"
  456. {...formItemLayout}
  457. required
  458. label="意向合作项目" >
  459. <div>
  460. <div style={{ paddingBottom: this.state.selectCooperationProjects.length === 0 ? 0 : '10px' }}>
  461. {this.state.selectCooperationProjects.map((tag, index) => {
  462. const isLongTag = tag.label.length > 20;
  463. const tagElem = (
  464. <Tag closable key={tag.label} afterClose={() => this.handleCloseCooperation(tag)}>
  465. {isLongTag ? `${tag.label.slice(0, 20)}...` : tag.label}
  466. </Tag>
  467. );
  468. return isLongTag ? <Tooltip title={tag.label} key={tag.label}>{tagElem}</Tooltip> : tagElem;
  469. })}
  470. </div>
  471. <div>
  472. <AutoComplete
  473. style={{ width: 200 }}
  474. onSearch={this.supervisor}
  475. onSelect={this.onSelect}
  476. placeholder="请输入关键字"
  477. >
  478. {
  479. this.state.cooperationProjects.map(function (item) {
  480. return <Select.Option key={item.id} value={item.id}>{item.bname}</Select.Option>
  481. })
  482. }
  483. </AutoComplete>
  484. </div>
  485. </div>
  486. </FormItem>
  487. </div>
  488. {/*<div className="clearfix">*/}
  489. {/* <FormItem className="mid-item"*/}
  490. {/* {...formItemLayout}*/}
  491. {/* label="社会属性"*/}
  492. {/* >*/}
  493. {/* {getFieldDecorator('societyTagt', {*/}
  494. {/* rules: [{ required: true, message: '此项为必填项!' }],*/}
  495. {/* initialValue: this.state.societyTagt*/}
  496. {/* })(*/}
  497. {/* <Select placeholder="客户社会属性">*/}
  498. {/* {*/}
  499. {/* socialAttribute.map(function (item) {*/}
  500. {/* return <Select.Option key={item.value} >{item.key}</Select.Option>*/}
  501. {/* })*/}
  502. {/* }*/}
  503. {/* </Select>*/}
  504. {/* )}*/}
  505. {/* </FormItem>*/}
  506. {/*</div>*/}
  507. </div>
  508. <FormItem wrapperCol={{ span: 12, offset: 6 }}>
  509. <Button type="primary" htmlType="submit" style={{ marginRight: '50px' }}>保存</Button>
  510. <Button type="ghost" onClick={this.props.closeDesc}>取消</Button>
  511. </FormItem>
  512. </Spin>
  513. </Form >
  514. </div>
  515. )
  516. }
  517. }));
  518. const AddPerson = Form.create()(React.createClass({
  519. getInitialState() {
  520. return {
  521. loading: false,
  522. data: {},
  523. detailApi: ''
  524. };
  525. },
  526. handleSubmit(e) {
  527. e.preventDefault();
  528. this.props.form.validateFields((err, values) => {
  529. if (values.companyNamet.length > 64) {
  530. message.warning('联系人字数不超过64个')
  531. return false;
  532. };
  533. if (!values.ProvinceCity[1]) {
  534. message.warning('请选择地区');
  535. return false;
  536. };
  537. if (values.telnums.length > 13) {
  538. message.warning('电话号码字数不超过13个')
  539. return false;
  540. };
  541. if (!err) {
  542. this.setState({
  543. loading: true
  544. });
  545. $.ajax({
  546. method: "POST",
  547. dataType: "json",
  548. crossDomain: false,
  549. url: globalConfig.context + '/api/admin/customer/addCustomer',
  550. data: {
  551. contacts: values.companyNamet,
  552. societyTag: values.societyTagt,
  553. name: values.companyNamet,
  554. contactMobile: values.telnums,
  555. source: values.customerSource,
  556. province: (values.ProvinceCity)[0],//省
  557. city: (values.ProvinceCity)[1],//市
  558. area: (values.ProvinceCity)[2],//区
  559. type: '0'
  560. }
  561. }).done(function (data) {
  562. this.setState({
  563. loading: false
  564. });
  565. if (!data.error.length) {
  566. message.success('保存成功!');
  567. this.props.handleOk();
  568. } else {
  569. message.warning(data.error[0].message);
  570. }
  571. }.bind(this));
  572. }
  573. });
  574. },
  575. componentWillMount() {
  576. this.state.companyNamet = '';
  577. this.state.telnum = '';
  578. this.state.societyTagt = '0';
  579. this.state.customerSource = '0';
  580. },
  581. componentWillReceiveProps(nextProps) {
  582. if (!this.props.visible && nextProps.visible) {
  583. this.state.companyNamet = '';
  584. this.state.telnum = '';
  585. this.state.societyTagt = '0';
  586. this.state.customerSource = '0';
  587. this.props.form.resetFields();
  588. };
  589. },
  590. render() {
  591. const theData = this.state.data || {};
  592. const { getFieldDecorator } = this.props.form;
  593. const FormItem = Form.Item
  594. const formItemLayout = {
  595. labelCol: { span: 6 },
  596. wrapperCol: { span: 14 },
  597. };
  598. return (
  599. <div>
  600. <Form layout="horizontal" onSubmit={this.handleSubmit} id="demand-form">
  601. <Spin spinning={this.state.loading}>
  602. <Col style={{ color: 'red', marginBottom: '10px' }} span={12} offset={6}>注意:请录入真实有效的客户信息</Col>
  603. <div className="clearfix">
  604. <FormItem className="mid-item"
  605. {...formItemLayout}
  606. label="客户姓名" >
  607. {getFieldDecorator('companyNamet', {
  608. rules: [{ required: true, message: '此项为必填项!' }],
  609. initialValue: this.state.companyNamet
  610. })(
  611. <Input placeholder="客户姓名" />
  612. )}
  613. </FormItem>
  614. </div>
  615. <div className="clearfix">
  616. <FormItem
  617. {...formItemLayout}
  618. label="省-市-区"
  619. >
  620. {getFieldDecorator('ProvinceCity', {
  621. rules: [{ required: true, message: '此项为必填项!' }],
  622. initialValue: this.state.ProvinceCity
  623. })(
  624. <Cascader options={areaSelect()} placeholder="选择城市" />
  625. )}
  626. </FormItem>
  627. </div>
  628. <div className="clearfix">
  629. <FormItem className="mid-item"
  630. {...formItemLayout}
  631. label="联系电话" >
  632. {getFieldDecorator('telnums', {
  633. rules: [{ required: true, message: '此项为必填项!' }],
  634. initialValue: this.state.telnums
  635. })(
  636. <Input placeholder="联系电话" />
  637. )}
  638. </FormItem>
  639. </div>
  640. <div className="clearfix">
  641. <FormItem className="mid-item"
  642. {...formItemLayout}
  643. label="社会属性"
  644. >
  645. {getFieldDecorator('societyTagt', {
  646. rules: [{ required: true, message: '此项为必填项!' }],
  647. initialValue: this.state.societyTagt
  648. })(
  649. <Select placeholder="客户社会属性">
  650. {
  651. socialAttribute.map(function (item) {
  652. return <Select.Option key={item.value} >{item.key}</Select.Option>
  653. })
  654. }
  655. </Select>
  656. )}
  657. </FormItem>
  658. </div>
  659. <div className="clearfix">
  660. <FormItem className="mid-item"
  661. {...formItemLayout}
  662. label="客户来源"
  663. >
  664. {getFieldDecorator('customerSource', {
  665. rules: [{ required: true, message: '此项为必填项!' }],
  666. initialValue: this.state.customerSource
  667. })(
  668. <Select placeholder="客户来源">
  669. {
  670. customerSource.map(function (item) {
  671. return <Select.Option key={item.value} >{item.key}</Select.Option>
  672. })
  673. }
  674. </Select>
  675. )}
  676. </FormItem>
  677. </div>
  678. <FormItem wrapperCol={{ span: 12, offset: 6 }}>
  679. <Button style={{ marginRight: '50px' }} type="primary" htmlType="submit">保存</Button>
  680. <Button type="ghost" onClick={this.props.closeDesc}>取消</Button>
  681. </FormItem>
  682. </Spin>
  683. </Form >
  684. </div>
  685. )
  686. }
  687. }));
  688. const AddIntention = React.createClass({
  689. getInitialState() {
  690. return {
  691. visible: false,
  692. tabsKey: 1,
  693. loading: false,
  694. dataSource: [],
  695. };
  696. },
  697. handleCancel(e) {
  698. this.setState({
  699. visible: false,
  700. });
  701. this.props.closeDesc(false);
  702. },
  703. handleOk(e) {
  704. this.setState({
  705. visible: false,
  706. });
  707. this.props.closeDesc(false, true);
  708. },
  709. componentWillReceiveProps(nextProps) {
  710. if (!this.state.visible && nextProps.showDesc) {
  711. this.state.tabsKey = "1";
  712. };
  713. this.state.visible = nextProps.showDesc;
  714. },
  715. render() {
  716. return (
  717. <div className="patent-desc">
  718. {
  719. this.state.visible &&
  720. <Modal maskClosable={false} visible={this.state.visible}
  721. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  722. width='600px'
  723. title='新建客户'
  724. footer=''
  725. className="admin-desc-content">
  726. <Spin spinning={this.state.loading}>
  727. {this.props.api.indexOf('Personal') < 0 ? <AchievementDetailForm
  728. data={this.props.data}
  729. newmodal={this.props.newmodal}
  730. closeDesc={this.handleCancel}
  731. visible={this.state.visible}
  732. handleOk={this.handleOk} /> : <AddPerson
  733. data={this.props.data}
  734. newmodal={this.props.newmodal}
  735. closeDesc={this.handleCancel}
  736. visible={this.state.visible}
  737. handleOk={this.handleOk}
  738. />}
  739. </Spin>
  740. </Modal>
  741. }
  742. </div>
  743. );
  744. },
  745. });
  746. export default Form.create({})(AddIntention);