myClientDesc.jsx 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313
  1. import React from 'react';
  2. import { Tabs, Table, Icon, Tooltip, Modal, message, AutoComplete, Spin, DatePicker,Upload, Input, InputNumber, Select,TimePicker, Button, Radio, Form, Cascader, Tag, Switch } from 'antd';
  3. import './myClient.less';
  4. import ajax from 'jquery/src/ajax/xhr.js';
  5. import moment from 'moment';
  6. import $ from 'jquery/src/ajax';
  7. import { areaSelect } from '../../NewDicProvinceList';
  8. import { maturityList, innovationList, transferModeList,cityArr ,newFollow,customerStatus,intentionalService,tag} from '../../dataDic';
  9. import { IndustryObject, getIndustryCategory } from '../../DicIndustryList.js';
  10. import { beforeUploadFile, splitUrl, companySearch, getTransferMode, getAchievementCategory, getTechAuditStatus, getDemandType, getMaturity, getInnovation,beforeUpload, getBase64,getsex,getCompanyIntention,getcityArr,getfllowSituation,getcustomerStatue} from '../../tools.js';
  11. import throttle from '../../throttle.js';
  12. const KeyWordTagGroup = React.createClass({
  13. getInitialState() {
  14. return {
  15. tags: [],
  16. inputVisible: false,
  17. inputValue: ''
  18. };
  19. },
  20. handleClose(removedTag) {
  21. const tags = this.state.tags.filter(tag => tag !== removedTag);
  22. this.props.tagsArr(tags);
  23. this.setState({ tags });
  24. },
  25. showInput() {
  26. this.setState({ inputVisible: true }, () => this.input.focus());
  27. },
  28. handleInputChange(e) {
  29. this.setState({ inputValue: e.target.value });
  30. },
  31. handleInputConfirm() {
  32. const state = this.state;
  33. const inputValue = state.inputValue;
  34. let tags = state.tags;
  35. if (inputValue && tags.indexOf(inputValue) === -1 && inputValue.replace(/(^\s*)|(\s*$)/g, "").length != 0) {
  36. tags = [...tags, inputValue.replace(/(^\s*)|(\s*$)/g, "")];
  37. };
  38. this.props.tagsArr(tags);
  39. this.setState({
  40. tags,
  41. inputVisible: false,
  42. inputValue: '',
  43. });
  44. },
  45. componentWillMount() {
  46. this.state.tags = this.props.keyWordArr;
  47. },
  48. componentWillReceiveProps(nextProps) {
  49. if (this.props.keyWordArr != nextProps.keyWordArr) {
  50. this.state.tags = nextProps.keyWordArr;
  51. };
  52. },
  53. render() {
  54. const { tags, inputVisible, inputValue } = this.state;
  55. return (
  56. <div className="keyWord-tips">
  57. {tags.map((tag, index) => {
  58. const isLongTag = tag.length > 10;
  59. const tagElem = (
  60. <Tag key={tag} closable={index !== -1} afterClose={() => this.handleClose(tag)}>
  61. {isLongTag ? `${tag.slice(0, 10)}...` : tag}
  62. </Tag>
  63. );
  64. return isLongTag ? <Tooltip key={tag} title={tag}>{tagElem}</Tooltip> : tagElem;
  65. })}
  66. {inputVisible && (
  67. <Input
  68. ref={input => this.input = input}
  69. type="text"
  70. style={{ width: 78 }}
  71. value={inputValue}
  72. onChange={this.handleInputChange}
  73. onBlur={this.handleInputConfirm}
  74. onPressEnter={this.handleInputConfirm}
  75. />
  76. )}
  77. {!inputVisible && <Button className="addtips" type="dashed" disabled={tags.length > 9 ? true : false} onClick={this.showInput}>+ 新关键词</Button>}
  78. </div>
  79. );
  80. }
  81. });
  82. const PicturesWall = React.createClass({
  83. getInitialState() {
  84. return {
  85. previewVisible: false,
  86. previewImage: '',
  87. fileList: [],
  88. }
  89. },
  90. handleCancel() {
  91. this.setState({ previewVisible: false })
  92. },
  93. handlePreview(file) {
  94. this.setState({
  95. previewImage: file.url || file.thumbUrl,
  96. previewVisible: true,
  97. });
  98. },
  99. handleChange(info) {
  100. let fileList = info.fileList;
  101. this.setState({ fileList });
  102. this.props.fileList(fileList);
  103. },
  104. serviceChange(value) {
  105. console.log(`selected ${value}`);
  106. },
  107. componentWillReceiveProps(nextProps) {
  108. this.state.fileList = nextProps.pictureUrl;
  109. },
  110. render() {
  111. const { previewVisible, previewImage, fileList } = this.state;
  112. const uploadButton = (
  113. <div>
  114. <Icon type="plus" />
  115. <div className="ant-upload-text">点击上传</div>
  116. </div>
  117. );
  118. return (
  119. <div className="clearfix">
  120. <Upload
  121. action={globalConfig.context + "/api/admin/achievement/uploadPicture"}
  122. data={{ 'sign': this.props.pictureSign }}
  123. listType="picture-card"
  124. fileList={fileList}
  125. onPreview={this.handlePreview}
  126. onChange={this.handleChange} >
  127. {fileList.length >= 5 ? null : uploadButton}
  128. </Upload>
  129. <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
  130. <img alt="example" style={{ width: '100%' }} src={previewImage} />
  131. </Modal>
  132. </div>
  133. );
  134. }
  135. });
  136. const AchievementDetailShow = Form.create()(React.createClass({
  137. getInitialState() {
  138. return {
  139. loading: false,
  140. buttonLoading: false,
  141. contactsObj: {},
  142. data: {},
  143. tags: [],
  144. technicalPictureUrl: [],
  145. coverImg: [],
  146. maturityPictureUrl: [],
  147. textFileList: [],
  148. techPlanFileList: [],
  149. businessPlanFileList: []
  150. };
  151. },
  152. //鼠标点击整行的时候的函数
  153. loadData(id, detailApiUrl) {
  154. this.setState({
  155. loading: true
  156. });
  157. $.ajax({
  158. method: "post",
  159. dataType: "json",
  160. crossDomain: false,
  161. url: globalConfig.context + detailApiUrl,
  162. data: {
  163. id: id
  164. },
  165. success: function (data) {
  166. let thisData = data.data;
  167. if (!thisData) {
  168. if (data.error && data.error.length) {
  169. message.warning(data.error[0].message);
  170. };
  171. thisData = {};
  172. };
  173. this.setState({
  174. data: thisData,
  175. orgDisplay: thisData.ownerType,
  176. switchValue: Boolean(!thisData.ownerId),
  177. radios:thisData.hot==='1'?true:false,
  178. tags: thisData.keyword ? (thisData.keyword.replace(/(,|、)/g, ",")).split(',') : [],
  179. technicalPictureUrl: thisData.technicalPictureUrl ? splitUrl(thisData.technicalPictureUrl, ',', globalConfig.avatarHost + '/upload') : [],
  180. coverImg: thisData.coverImg ? splitUrl(thisData.coverImg, ',', globalConfig.avatarHost + '/upload') : [],
  181. maturityPictureUrl: thisData.maturityPictureUrl ? splitUrl(thisData.maturityPictureUrl, ',', globalConfig.avatarHost + '/upload') : [],
  182. });
  183. if (thisData.ownerId) {
  184. this.getContactsList(thisData.ownerId);
  185. };
  186. console.log(thisData);
  187. }.bind(this),
  188. }).always(function () {
  189. this.setState({
  190. loading: false
  191. });
  192. }.bind(this));
  193. },
  194. offShelf() {
  195. this.setState({
  196. loading: true
  197. });
  198. $.ajax({
  199. method: "post",
  200. dataType: "json",
  201. crossDomain: false,
  202. url: globalConfig.context + "/api/admin/achievement/offShelf",
  203. data: { "id": this.props.data.id }
  204. }).done(function (data) {
  205. if (!data.error.length) {
  206. message.success('撤销成功!');
  207. this.setState({
  208. visible: false,
  209. releaseSubmitVisible: false
  210. });
  211. this.props.handleOk();
  212. } else {
  213. message.warning(data.error[0].message);
  214. }
  215. }.bind(this));
  216. },
  217. modifyBroker() {
  218. this.props.form.validateFields((err, values) => {
  219. if (!err) {
  220. this.setState({
  221. loading: true
  222. });
  223. $.ajax({
  224. method: "POST",
  225. dataType: "json",
  226. crossDomain: false,
  227. url: globalConfig.context + '/api/admin/audit/modifyAchievementTechBroker',
  228. data: {
  229. id: this.props.data.id,
  230. techBrokerId: values.modifyTechBrokerId
  231. }
  232. }).done(function (data) {
  233. this.state.auditStatus = 0;
  234. this.setState({
  235. loading: false
  236. });
  237. if (data.error && data.error.length) {
  238. message.warning(data.error[0].message);
  239. } else {
  240. message.success('保存成功!');
  241. this.props.handleOk();
  242. };
  243. }.bind(this));
  244. }
  245. });
  246. },
  247. formSubmit() {
  248. this.props.form.validateFields((err, values) => {
  249. if (!err) {
  250. this.setState({
  251. loading: true
  252. });
  253. $.ajax({
  254. method: "POST",
  255. dataType: "json",
  256. crossDomain: false,
  257. url: globalConfig.context + '/api/admin/audit/achievement',
  258. data: {
  259. id: this.props.data.id,
  260. techBroderId: values.techBrokerId,
  261. auditStatus: values.auditStatus
  262. }
  263. }).done(function (data) {
  264. this.state.auditStatus = 0;
  265. this.setState({
  266. loading: false
  267. });
  268. if (!data.error.length) {
  269. message.success('保存成功!');
  270. this.setState({
  271. formSubmitVisible: false
  272. });
  273. this.props.handleOk();
  274. } else {
  275. message.warning(data.error[0].message);
  276. };
  277. }.bind(this));
  278. }
  279. });
  280. },
  281. handleSubmit(e) {
  282. e.preventDefault();
  283. this.props.form.validateFields((err, values) => {
  284. if (values.auditStatus == 4) {
  285. this.setState({
  286. formSubmitVisible: true
  287. });
  288. } else {
  289. this.formSubmit();
  290. };
  291. });
  292. },
  293. buildMatchList() {
  294. this.setState({
  295. buttonLoading: true
  296. });
  297. $.ajax({
  298. method: "POST",
  299. dataType: "json",
  300. crossDomain: false,
  301. url: globalConfig.context + '/api/admin/achievement/matchDemand',
  302. data: {
  303. id: this.props.data.id,
  304. }
  305. }).done(function (data) {
  306. this.setState({
  307. buttonLoading: false
  308. });
  309. if (!data.error.length) {
  310. message.success('匹配完成!匹配到' + data.data + '条记录');
  311. } else {
  312. message.warning(data.error[0].message);
  313. };
  314. }.bind(this));
  315. },
  316. getContactsList(theUid) {
  317. $.ajax({
  318. method: "get",
  319. dataType: "json",
  320. crossDomain: false,
  321. url: globalConfig.context + "/api/admin/findCustomer",
  322. data: {
  323. id: theUid
  324. },
  325. success: function (data) {
  326. if (!data.data) {
  327. if (data.error && data.error.length) {
  328. message.warning(data.error[0].message);
  329. return;
  330. };
  331. } else {
  332. this.setState({
  333. contactsObj: data.data || {}
  334. });
  335. };
  336. }.bind(this),
  337. });
  338. },
  339. componentWillMount() {
  340. this.loadData(this.props.data.id, this.props.detailApiUrl);
  341. },
  342. componentWillReceiveProps(nextProps) {
  343. if (!this.props.visible && nextProps.visible) {
  344. this.loadData(nextProps.data.id, nextProps.detailApiUrl);
  345. this.state.textFileList = [];
  346. this.state.techPlanFileList = [];
  347. this.state.businessPlanFileList = [];
  348. this.props.form.resetFields();
  349. };
  350. },
  351. render() {
  352. const theData = this.state.data || {};
  353. const { getFieldDecorator } = this.props.form;
  354. const FormItem = Form.Item
  355. const formItemLayout = {
  356. labelCol: { span: 8 },
  357. wrapperCol: { span: 14 },
  358. };
  359. //意向服务多选
  360. // const selectOption=[];
  361. // intentionalService.map(function (item) {
  362. // selectOption.push(
  363. // <Select.Option key={item.id}>{item.name}</Select.Option>
  364. // )
  365. // });
  366. return (
  367. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  368. <Spin spinning={this.state.loading}>
  369. <div className="clearfix">
  370. <FormItem className="half-item"
  371. {...formItemLayout}
  372. label="客户类型" >
  373. <span>{theData._shareType}</span>
  374. </FormItem>
  375. <div className="clearfix" style={{marginLeft:'40px',marginBottom:'20px',color:'#000000'}}>基本资料:</div>
  376. </div>
  377. {/* <FormItem className="half-item"
  378. {...formItemLayout}
  379. label="录入时间" >
  380. {getFieldDecorator('createTime', {
  381. initialValue: theData.createTime ? moment(theData.createTime) : null
  382. })(
  383. <DatePicker />
  384. )}
  385. </FormItem> */}
  386. <FormItem className="half-item"
  387. {...formItemLayout}
  388. label="跟单人" >
  389. <span>{theData.adminName}</span>
  390. </FormItem>
  391. <div className="clearfix" style={{marginLeft:'40px',marginBottom:'20px',color:'#000000'}}>公司资料:</div>
  392. <div>
  393. <FormItem className="half-item"
  394. {...formItemLayout}
  395. label="公司名称" >
  396. {getFieldDecorator('companyName', {
  397. rules: [{ required: true, message: '此项为必填项!' }],
  398. initialValue: theData.companyName
  399. })(
  400. <Input />
  401. )}
  402. </FormItem>
  403. <FormItem className="half-item"
  404. {...formItemLayout}
  405. label="公司行业" >
  406. {getFieldDecorator('companyIndustry', {
  407. initialValue: theData.companyIndustry
  408. })(
  409. <Input />
  410. )}
  411. </FormItem>
  412. <FormItem className="half-item"
  413. {...formItemLayout}
  414. label="意向服务" >
  415. {getFieldDecorator('companyIntention', {
  416. initialValue: theData.companyIntention
  417. })(
  418. <Select placeholder="选择意向服务" style={{ width: 160 }} >
  419. {
  420. intentionalService.map(function (item) {
  421. return <Select.Option key={item.value} >{item.key}</Select.Option>
  422. })
  423. }
  424. </Select>
  425. )}
  426. </FormItem>
  427. <FormItem className="half-item"
  428. {...formItemLayout}
  429. label="地区" >
  430. {getFieldDecorator('locationProvince', {
  431. initialValue: theData.locationProvince
  432. })(
  433. <Select placeholder="选择地区" style={{ width: 160 }} >
  434. {
  435. cityArr.map(function (item) {
  436. return <Select.Option key={item.value} >{item.key}</Select.Option>
  437. })
  438. }
  439. </Select>
  440. )}
  441. </FormItem>
  442. <FormItem className="half-item"
  443. {...formItemLayout}
  444. label="最新跟进" >
  445. {getFieldDecorator('followSituation', {
  446. rules: [{ required: true, message: '此项为必填项!' }],
  447. initialValue: getfllowSituation(theData.followSituation)
  448. })(
  449. <Select placeholder="选择跟进进度" style={{ width: 160 }} >
  450. {
  451. newFollow.map(function (item) {
  452. return <Select.Option key={item.value} >{item.key}</Select.Option>
  453. })
  454. }
  455. </Select>
  456. )}
  457. </FormItem>
  458. <FormItem className="half-item"
  459. {...formItemLayout}
  460. label="客户状态" >
  461. {getFieldDecorator('customerStatus', {
  462. rules: [{ required: true, message: '此项为必填项!' }],
  463. initialValue: getcustomerStatue(theData.customerStatus)
  464. })(
  465. <Select placeholder="选择客户状态" style={{ width: 160 }} >
  466. {
  467. customerStatus.map(function (item) {
  468. return <Select.Option key={item.value} >{item.key}</Select.Option>
  469. })
  470. }
  471. </Select>
  472. )}
  473. </FormItem>
  474. <FormItem className="half-item"
  475. {...formItemLayout}
  476. label="详细地址" >
  477. {getFieldDecorator('adress', {
  478. initialValue: theData.adress
  479. })(
  480. <Input type="text" rows={1}/>
  481. )}
  482. </FormItem>
  483. <div className="clearfix">
  484. <FormItem
  485. labelCol={{ span: 4 }}
  486. wrapperCol={{ span: 18 }}
  487. label="备注" >
  488. {getFieldDecorator('remarks', {
  489. initialValue: theData.remarks
  490. })(
  491. <Input type="textarea" rows={4} />
  492. )}
  493. </FormItem>
  494. </div>
  495. </div>
  496. <div className="clearfix" style={{marginLeft:'40px',marginBottom:'20px',color:'#000000'}}>联系资料:</div>
  497. <div>
  498. <FormItem className="half-item"
  499. {...formItemLayout}
  500. label="姓名" >
  501. {getFieldDecorator('contactName', {
  502. rules: [{ required: true, message: '此项为必填项!' }],
  503. initialValue: theData.contactName
  504. })(
  505. <Input type="text" rows={1}/>
  506. )}
  507. </FormItem>
  508. <FormItem className="half-item"
  509. {...formItemLayout}
  510. label="性别" >
  511. {getFieldDecorator('sex', {
  512. rules: [{ required: true, message: '此项为必填项!' }],
  513. initialValue:theData.sex
  514. })(
  515. <Radio.Group onChange={(e) => { this.setState({ radios: e.target.value }); }}>
  516. <Radio value="0">男</Radio>
  517. <Radio value="1">女</Radio>
  518. </Radio.Group>
  519. )}
  520. </FormItem>
  521. <FormItem className="half-item"
  522. {...formItemLayout}
  523. label="手机号码" >
  524. {getFieldDecorator('telNum', {
  525. rules: [{ required: true, message: '此项为必填项!' }],
  526. initialValue: theData.telNum
  527. })(
  528. <Input type="text" rows={1}/>
  529. )}
  530. </FormItem>
  531. <FormItem className="half-item"
  532. {...formItemLayout}
  533. label="座机号" >
  534. {getFieldDecorator('mobile', {
  535. initialValue: theData.mobile
  536. })(
  537. <Input type="text" rows={1}/>
  538. )}
  539. </FormItem>
  540. <FormItem className="half-item"
  541. {...formItemLayout}
  542. label="QQ号码" >
  543. {getFieldDecorator('qq', {
  544. initialValue: theData.qq
  545. })(
  546. <Input type="text" rows={1}/>
  547. )}
  548. </FormItem>
  549. <FormItem className="half-item"
  550. {...formItemLayout}
  551. label="邮箱号" >
  552. {getFieldDecorator('email', {
  553. initialValue: theData.email
  554. })(
  555. <Input type="text" rows={1}/>
  556. )}
  557. </FormItem>
  558. <FormItem className="half-item"
  559. {...formItemLayout}
  560. label="微信" >
  561. {getFieldDecorator('wechat', {
  562. initialValue: theData.wechat
  563. })(
  564. <Input type="text" rows={1}/>
  565. )}
  566. </FormItem>
  567. <FormItem className="half-item"
  568. {...formItemLayout}
  569. label="部门" >
  570. {getFieldDecorator('depatrment', {
  571. initialValue: theData.depatrment
  572. })(
  573. <Input type="text" rows={1}/>
  574. )}
  575. </FormItem>
  576. <FormItem className="half-item"
  577. {...formItemLayout}
  578. label="职位" >
  579. {getFieldDecorator('customerPosition', {
  580. initialValue: theData.customerPosition
  581. })(
  582. <Input type="text" rows={1}/>
  583. )}
  584. </FormItem>
  585. </div>
  586. <div className="clearfix" style={{paddingLeft:"200px",marginBottom:"20px"}}>
  587. <Button className="set-submit" type="primary" htmlType="submit" id="change_keep" style={{marginTop:"20px"}}>保存</Button>
  588. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc} id='change_rem' style={{marginTop:"20px"}}>取消</Button>
  589. </div>
  590. </Spin>
  591. </Form >
  592. )
  593. }
  594. }));
  595. const AchievementDetailForm = Form.create()(React.createClass({
  596. getInitialState() {
  597. return {
  598. loading: false,
  599. auditStatus: 0,
  600. selectOption: [],
  601. textFileList: [],
  602. switchValue: false,
  603. radios: false,
  604. techPlanFileList: [],
  605. data: {},
  606. tags: [],
  607. technicalPictureUrl: [],
  608. coverImg: [],
  609. maturityPictureUrl: [],
  610. businessPlanFileList: [],
  611. dataSource: [],
  612. };
  613. },
  614. loadData(id, detailApiUrl) {
  615. this.setState({
  616. loading: true
  617. });
  618. $.ajax({
  619. method: "get",
  620. dataType: "json",
  621. crossDomain: false,
  622. url: globalConfig.context + detailApiUrl,
  623. data: {
  624. id: id
  625. },
  626. success: function (data) {
  627. let thisData = data.data;
  628. if (!thisData) {
  629. if (data.error && data.error.length) {
  630. message.warning(data.error[0].message);
  631. };
  632. thisData = {};
  633. };
  634. this.setState({
  635. data: thisData,
  636. orgDisplay: thisData.ownerType,
  637. switchValue: Boolean(!thisData.ownerId),
  638. radios: thisData.hot == '1' ? true : false,
  639. transferPriceDis: thisData.transferMode == 1 ? true : false,
  640. tags: thisData.keyword ? (thisData.keyword.replace(/(,|、)/g, ",")).split(',') : [],
  641. technicalPictureUrl: thisData.technicalPictureUrl ? splitUrl(thisData.technicalPictureUrl, ',', globalConfig.avatarHost + '/upload') : [],
  642. coverImg: thisData.coverImg ? splitUrl(thisData.coverImg, ',', globalConfig.avatarHost + '/upload') : [],
  643. maturityPictureUrl: thisData.maturityPictureUrl ? splitUrl(thisData.maturityPictureUrl, ',', globalConfig.avatarHost + '/upload') : [],
  644. });
  645. if (thisData.ownerType == "1" && thisData.ownerId) {
  646. this.getContactsList(thisData.ownerId);
  647. };
  648. }.bind(this),
  649. }).always(function () {
  650. this.setState({
  651. loading: false
  652. });
  653. }.bind(this));
  654. },
  655. getContactsList(theUid) {
  656. $.ajax({
  657. method: "get",
  658. dataType: "json",
  659. crossDomain: false,
  660. url: globalConfig.context + "/api/admin/getContacts",
  661. data: {
  662. uid: theUid
  663. },
  664. success: function (data) {
  665. let theOption = [];
  666. if (!data.data) {
  667. if (data.error && data.error.length) {
  668. message.warning(data.error[0].message);
  669. return;
  670. };
  671. };
  672. for (let item in data.data) {
  673. let theData = data.data[item];
  674. theOption.push(
  675. <Select.Option value={item} key={theData}>{theData}</Select.Option>
  676. );
  677. };
  678. this.setState({
  679. contactsOption: theOption
  680. });
  681. }.bind(this),
  682. });
  683. },
  684. getTagsArr(e) {
  685. this.setState({ tags: e });
  686. },
  687. getMaturityPictureUrl(e) {
  688. this.setState({ maturityPictureUrl: e });
  689. },
  690. getTechnicalPictureUrl(e) {
  691. this.setState({ technicalPictureUrl: e });
  692. },
  693. getcoverImg(e) {
  694. this.setState({coverImg: e });
  695. },
  696. handleSearch(e) {
  697. if (this.props.detailApiUrl.indexOf('org') != -1) {
  698. $.ajax({
  699. method: "get",
  700. dataType: "json",
  701. crossDomain: false,
  702. url: globalConfig.context + "/api/admin/achievement/orgOwner",
  703. data: { name: e },
  704. success: function (data) {
  705. let theArr = [];
  706. let theObj = {};
  707. if (!data.data) {
  708. if (data.error && data.error.length) {
  709. message.warning(data.error[0].message);
  710. };
  711. } else if (!$.isEmptyObject(data.data)) {
  712. data.data.map(function (item) {
  713. theArr.push(item.unitName);
  714. theObj[item.unitName] = item.uid;
  715. });
  716. };
  717. this.setState({
  718. dataSource: theArr,
  719. dataSourceObj: theObj
  720. });
  721. }.bind(this),
  722. });
  723. } else {
  724. $.ajax({
  725. method: "get",
  726. dataType: "json",
  727. crossDomain: false,
  728. url: globalConfig.context + "/api/admin/achievement/userOwner",
  729. data: { name: e },
  730. success: function (data) {
  731. let theArr = [];
  732. let theObj = {};
  733. if (!data.data) {
  734. if (data.error && data.error.length) {
  735. message.warning(data.error[0].message);
  736. };
  737. } else if (!$.isEmptyObject(data.data)) {
  738. for (let item in data.data) {
  739. theArr.push(data.data[item]);
  740. theObj[data.data[item]] = item;
  741. };
  742. };
  743. this.setState({
  744. dataSource: theArr,
  745. dataSourceObj: theObj
  746. });
  747. }.bind(this),
  748. });
  749. };
  750. },
  751. handleSubmit(e) {
  752. e.preventDefault();
  753. this.props.form.validateFields((err, values) => {
  754. //url转化
  755. let theTechnicalPictureUrl = [];
  756. if (this.state.technicalPictureUrl.length) {
  757. let picArr = [];
  758. this.state.technicalPictureUrl.map(function (item) {
  759. picArr.push(item.response.data);
  760. });
  761. theTechnicalPictureUrl = picArr.join(",");
  762. };
  763. let thecoverImg = [];
  764. if (this.state.coverImg.length) {
  765. let picArr = [];
  766. this.state.coverImg.map(function (item) {
  767. picArr.push(item.response.data);
  768. });
  769. thecoverImg = picArr.join(",");
  770. };
  771. let theMaturityPictureUrl = [];
  772. if (this.state.maturityPictureUrl.length) {
  773. let picArr = [];
  774. this.state.maturityPictureUrl.map(function (item) {
  775. picArr.push(item.response.data);
  776. });
  777. theMaturityPictureUrl = picArr.join(",");
  778. };
  779. //意向服务多选
  780. // let companyMore = [];
  781. // if (values.companyIntention.length) {
  782. // let companyList = [];
  783. // values.companyIntention.map(function (item) {
  784. // companyList.push(item);
  785. // });
  786. // companyMore = companyList.join(",");
  787. // };
  788. console.log(values.companyIntention)
  789. if (!err) {
  790. this.setState({
  791. loading: true
  792. });
  793. $.ajax({
  794. method: "POST",
  795. dataType: "json",
  796. crossDomain: false,
  797. url: this.props.data.id ? globalConfig.context + '/api/admin/customer/updCustomer' : globalConfig.context + '/api/admin/customer/addCustomer',
  798. data: {
  799. id: this.props.data.id, //编号
  800. customerType:values.customerTyp ,//客户信息 1
  801. // createTime: values.createTime ? values.createTime.format('YYYY-MM-DD') : undefined,//时间 1\
  802. companyName: values.companyName,//公司名称 1
  803. companyIndustry: values.companyIndustry,//公司行业
  804. companyIntention: values.companyIntention,//公司意向1
  805. tag: values.tag,
  806. locationProvince: values.locationProvince,//省份1
  807. adress: values.adress,//详细地址1
  808. remarks: values.remarks,//备注1
  809. followSituation: values.followSituation,//最新跟进1
  810. customerStatus: values.customerStatus,//客户状态1
  811. name: values.name,//客户姓名1
  812. mobile: values.mobile,//座机1
  813. telNum: values.telNum,//手机号码1
  814. sex: values.sex,//性别1
  815. customerPosition: values.customerPosition,//职位1
  816. wechat: values.wechat,//微信号1
  817. qq: values.qq,//qq 1
  818. depatrment: values.depatrment,//部门 1
  819. email: values.email,//邮箱 1
  820. shareType:0,
  821. followDates:values.createTime ? values.createTime.format('YYYY-MM-DD'):undefined,//+" "+(values.createTim ? values.createTim.format('YYYY:MM:DD'):undefined),//时间,
  822. primaryFlg:0,
  823. }
  824. }).done(function (data) {
  825. this.state.auditStatus = 0;
  826. this.setState({
  827. loading: false
  828. });
  829. if (!data.error.length) {
  830. message.success('保存成功!');
  831. this.props.handleOk();
  832. } else {
  833. message.warning(data.error[0].message);
  834. }
  835. }.bind(this));
  836. }
  837. });
  838. },
  839. componentWillMount() {
  840. this.state.therottleSearch = throttle(this.handleSearch, 1000, { leading: false }).bind(this);
  841. if (this.props.data && this.props.data.id) {
  842. this.loadData(this.props.data.id, this.props.detailApiUrl);
  843. };
  844. },
  845. componentWillReceiveProps(nextProps) {
  846. if (!this.props.visible && nextProps.visible) {
  847. if (nextProps.data && nextProps.data.id) {
  848. this.loadData(nextProps.data.id, nextProps.detailApiUrl);
  849. };
  850. this.state.data = {};
  851. this.state.tags = [];
  852. this.state.switchValue = false;
  853. this.state.radios = false;
  854. this.state.technicalPictureUrl = [];
  855. this.state.coverImg = [];
  856. this.state.maturityPictureUrl = [];
  857. this.state.textFileList = [];
  858. this.state.techPlanFileList = [];
  859. this.state.businessPlanFileList = [];
  860. this.props.form.resetFields();
  861. };
  862. },
  863. render() {
  864. const theData = this.state.data || {};
  865. const { getFieldDecorator } = this.props.form;
  866. const FormItem = Form.Item
  867. const formItemLayout = {
  868. labelCol: { span: 8 },
  869. wrapperCol: { span: 14 },
  870. };
  871. const { RangePicker } = DatePicker;
  872. return (
  873. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  874. <Spin spinning={this.state.loading}>
  875. <div className="clearfix">
  876. <FormItem className="half-item"
  877. {...formItemLayout}
  878. label="客户类型" >
  879. {getFieldDecorator('customerTyp', {
  880. rules: [{ required: true, message: '此项为必填项!' }],
  881. initialValue: theData.customerTyp
  882. })(
  883. <Select placeholder="选择客户类型" style={{ width: 160 }} >
  884. <Select.Option value="0" >个人客户</Select.Option>
  885. <Select.Option value="1" >机构单位</Select.Option>
  886. <Select.Option value="2" >团体单位</Select.Option>
  887. </Select>
  888. )}
  889. </FormItem>
  890. <div className="clearfix" style={{marginLeft:'40px',marginBottom:'20px',color:'#000000'}}>基本资料:</div>
  891. <div>
  892. <FormItem className="half-item"
  893. {...formItemLayout}
  894. label="录入时间" >
  895. {getFieldDecorator('createTime', {
  896. rules: [{ required: true, message: '此项为必填项!' }],
  897. initialValue: theData.createTime ? moment(theData.createTime) : null
  898. })(
  899. <DatePicker />
  900. )}
  901. </FormItem>
  902. </div>
  903. <div className="clearfix" style={{marginLeft:'40px',marginBottom:'20px',color:'#000000'}}>公司资料:</div>
  904. <div>
  905. <FormItem className="half-item"
  906. {...formItemLayout}
  907. label="公司名称" >
  908. {getFieldDecorator('companyName', {
  909. rules: [{ required: true, message: '此项为必填项!' }],
  910. initialValue: theData.companyName
  911. })(
  912. <Input />
  913. )}
  914. </FormItem>
  915. <FormItem className="half-item"
  916. {...formItemLayout}
  917. label="公司行业" >
  918. {getFieldDecorator('companyIndustry', {
  919. initialValue: theData.companyIndustry
  920. })(
  921. <Input />
  922. )}
  923. </FormItem>
  924. <FormItem className="half-item"
  925. {...formItemLayout}
  926. label="地区" >
  927. {getFieldDecorator('locationProvince', {
  928. initialValue: getcityArr(theData.locationProvince)
  929. })(
  930. <Select placeholder="选择地区" style={{ width: 160 }} >
  931. {
  932. cityArr.map(function (item) {
  933. return <Select.Option key={item.value} >{item.key}</Select.Option>
  934. })
  935. }
  936. </Select>
  937. )}
  938. </FormItem>
  939. <FormItem className="half-item"
  940. {...formItemLayout}
  941. label="最新跟进" >
  942. {getFieldDecorator('followSituation', {
  943. rules: [{ required: true, message: '此项为必填项!' }],
  944. initialValue: getfllowSituation(theData.followSituation)
  945. })(
  946. <Select placeholder="选择跟进进度" style={{ width: 160 }} >
  947. {
  948. newFollow.map(function (item) {
  949. return <Select.Option key={item.value} >{item.key}</Select.Option>
  950. })
  951. }
  952. </Select>
  953. )}
  954. </FormItem>
  955. <FormItem className="half-item"
  956. {...formItemLayout}
  957. label="客户状态" >
  958. {getFieldDecorator('customerStatus', {
  959. rules: [{ required: true, message: '此项为必填项!' }],
  960. initialValue: getcustomerStatue(theData.customerStatus)
  961. })(
  962. <Select placeholder="选择客户状态" style={{ width: 160 }} >
  963. {
  964. customerStatus.map(function (item) {
  965. return <Select.Option key={item.value} >{item.key}</Select.Option>
  966. })
  967. }
  968. </Select>
  969. )}
  970. </FormItem>
  971. <FormItem className="half-item"
  972. {...formItemLayout}
  973. label="详细地址" >
  974. {getFieldDecorator('adress', {
  975. initialValue: theData.adress
  976. })(
  977. <Input />
  978. )}
  979. </FormItem>
  980. <FormItem className="half-item"
  981. {...formItemLayout}
  982. label="标签" >
  983. {getFieldDecorator('tag', {
  984. initialValue: theData.tag
  985. })(
  986. <Select placeholder="选择客户标签" >
  987. {
  988. tag.map(function (item) {
  989. return <Select.Option key={item.key} >{item.key}</Select.Option>
  990. })
  991. }
  992. </Select>
  993. )}
  994. </FormItem>
  995. <div className="clearfix" >
  996. <FormItem className="half-item" style={{marginLeft:'80px'}}
  997. labelCol={{ span: 4 }}
  998. wrapperCol={{ span: 18 }}
  999. label="意向服务" >
  1000. {getFieldDecorator('companyIntention', {
  1001. rules: [{ required: true, message: '此项为必填项!' }],
  1002. initialValue: theData.companyIntention
  1003. })(
  1004. <Select placeholder="选择意向服务" style={{ width: 160 }} >
  1005. {
  1006. intentionalService.map(function (item) {
  1007. return <Select.Option key={item.value} >{item.key}</Select.Option>
  1008. })
  1009. }
  1010. </Select>
  1011. )}
  1012. </FormItem>
  1013. </div>
  1014. <div className="clearfix">
  1015. <FormItem
  1016. labelCol={{ span: 4 }}
  1017. wrapperCol={{ span: 18 }}
  1018. label="备注" >
  1019. {getFieldDecorator('remarks', {
  1020. initialValue: theData.remarks
  1021. })(
  1022. <Input type="textarea" rows={4} />
  1023. )}
  1024. </FormItem>
  1025. </div>
  1026. </div>
  1027. <div className="clearfix" style={{marginLeft:'40px',marginBottom:'20px',color:'#000000'}}>联系资料:</div>
  1028. <div>
  1029. <FormItem className="half-item"
  1030. {...formItemLayout}
  1031. label="姓名" >
  1032. {getFieldDecorator('name', {
  1033. rules: [{ required: true, message: '此项为必填项!' }],
  1034. initialValue: theData.name
  1035. })(
  1036. <Input />
  1037. )}
  1038. </FormItem>
  1039. <FormItem className="half-item"
  1040. {...formItemLayout}
  1041. label="性别" >
  1042. {getFieldDecorator('sex', {
  1043. rules: [{ required: true, message: '此项为必填项!' }],
  1044. initialValue: getsex(theData.sex)
  1045. })(
  1046. <Radio.Group>
  1047. <Radio value="0">男</Radio>
  1048. <Radio value="1">女</Radio>
  1049. </Radio.Group>
  1050. )}
  1051. </FormItem>
  1052. <FormItem className="half-item"
  1053. {...formItemLayout}
  1054. label="手机号码" >
  1055. {getFieldDecorator('telNum', {
  1056. rules: [{ required: true, message: '此项为必填项!' }],
  1057. initialValue: theData.telNum
  1058. })(
  1059. <Input />
  1060. )}
  1061. </FormItem>
  1062. <FormItem className="half-item"
  1063. {...formItemLayout}
  1064. label="座机号" >
  1065. {getFieldDecorator('mobile', {
  1066. initialValue: theData.mobile
  1067. })(
  1068. <Input />
  1069. )}
  1070. </FormItem>
  1071. <FormItem className="half-item"
  1072. {...formItemLayout}
  1073. label="QQ号码" >
  1074. {getFieldDecorator('qq', {
  1075. initialValue: theData.qq
  1076. })(
  1077. <Input />
  1078. )}
  1079. </FormItem>
  1080. <FormItem className="half-item"
  1081. {...formItemLayout}
  1082. label="邮箱号" >
  1083. {getFieldDecorator('email', {
  1084. initialValue: theData.email
  1085. })(
  1086. <Input />
  1087. )}
  1088. </FormItem>
  1089. <FormItem className="half-item"
  1090. {...formItemLayout}
  1091. label="微信" >
  1092. {getFieldDecorator('wechat', {
  1093. initialValue: theData.wechat
  1094. })(
  1095. <Input />
  1096. )}
  1097. </FormItem>
  1098. <FormItem className="half-item"
  1099. {...formItemLayout}
  1100. label="部门" >
  1101. {getFieldDecorator('depatrment', {
  1102. initialValue: theData.depatrment
  1103. })(
  1104. <Input />
  1105. )}
  1106. </FormItem>
  1107. <FormItem className="half-item"
  1108. {...formItemLayout}
  1109. label="职位" >
  1110. {getFieldDecorator('customerPosition', {
  1111. initialValue: theData.customerPosition
  1112. })(
  1113. <Input />
  1114. )}
  1115. </FormItem>
  1116. </div>
  1117. </div>
  1118. <FormItem wrapperCol={{ span: 12, offset: 4 }}>
  1119. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  1120. {/*<Button className="set-submit" type="ghost" onClick={(e) => { this.state.auditStatus = 1; }} htmlType="submit">发布</Button>*/}
  1121. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  1122. </FormItem>
  1123. </Spin>
  1124. </Form >
  1125. )
  1126. }
  1127. }));
  1128. const AchievementDetail = React.createClass({
  1129. getInitialState() {
  1130. return {
  1131. visible: false,
  1132. tabsKey: 1,
  1133. loading: false,
  1134. columns: [
  1135. {
  1136. title: '客户信息',
  1137. dataIndex: 'id',
  1138. key: 'id',
  1139. render: text => {
  1140. switch (text) {
  1141. case "0":
  1142. return <span>个人客户</span>;
  1143. case "1":
  1144. return <span>公司客户</span>;
  1145. }
  1146. }
  1147. }, {
  1148. title: '名称',
  1149. dataIndex: 'companyNmae',
  1150. key: 'companyNmae',
  1151. }, {
  1152. title: '关键字',
  1153. dataIndex: 'keyword',
  1154. key: 'keyword',
  1155. }, {
  1156. title: '类型',
  1157. dataIndex: 'demandType',
  1158. key: 'demandType',
  1159. render: text => { return getDemandType(text); }
  1160. }, {
  1161. title: '所有人名称',
  1162. dataIndex: 'theName',
  1163. key: 'theName',
  1164. }, {
  1165. title: '发布时间',
  1166. dataIndex: 'releaseDateFormattedDate',
  1167. key: 'releaseDateFormattedDate',
  1168. }, {
  1169. title: '有效期限',
  1170. dataIndex: 'validityPeriodFormattedDate',
  1171. key: 'validityPeriodFormattedDate',
  1172. },
  1173. ],
  1174. dataSource: [],
  1175. };
  1176. },
  1177. getTableList() {
  1178. this.setState({
  1179. loading: true
  1180. });
  1181. $.ajax({
  1182. method: "get",
  1183. dataType: "json",
  1184. crossDomain: false,
  1185. url: globalConfig.context + "/api/admin/achievement/achievementDemand",
  1186. data: { id: this.props.data.id },
  1187. success: function (data) {
  1188. let theArr = [];
  1189. if (!data.data) {
  1190. if (data.error && data.error.length) {
  1191. message.warning(data.error[0].message);
  1192. };
  1193. } else if (data.data.length) {
  1194. for (let i = 0; i < data.data.length; i++) {
  1195. let thisdata = data.data[i];
  1196. theArr.push({
  1197. key: i,
  1198. id: thisdata.id,
  1199. serialNumber: thisdata.serialNumber,
  1200. createTime: thisdata.createTime,
  1201. name: thisdata.name,
  1202. keyword: thisdata.keyword,
  1203. demandType: thisdata.demandType,
  1204. theName: thisdata.username || thisdata.unitName,
  1205. releaseDateFormattedDate: thisdata.releaseDateFormattedDate,
  1206. validityPeriodFormattedDate: thisdata.validityPeriodFormattedDate,
  1207. coverImg: thisdata.coverImg,
  1208. hot: thisdata.hot,
  1209. });
  1210. };
  1211. };
  1212. this.setState({
  1213. dataSource: theArr,
  1214. });
  1215. }.bind(this),
  1216. }).always(function () {
  1217. this.setState({
  1218. loading: false
  1219. });
  1220. }.bind(this));
  1221. },
  1222. tableRowClick(record, index) {
  1223. window.open(globalConfig.context + '/portal/detail/demandDetail.html?id=' + record.id + '&type=' + record.dataCategory);
  1224. },
  1225. handleCancel(e) {
  1226. this.setState({
  1227. visible: false,
  1228. });
  1229. this.props.closeDesc(false);
  1230. },
  1231. handleOk(e) {
  1232. this.setState({
  1233. visible: false,
  1234. });
  1235. this.props.closeDesc(false, true);
  1236. },
  1237. componentWillReceiveProps(nextProps) {
  1238. if (!this.state.visible && nextProps.showDesc) {
  1239. this.state.tabsKey = "1";
  1240. };
  1241. this.state.visible = nextProps.showDesc;
  1242. },
  1243. render() {
  1244. if (this.props.data) {
  1245. return (
  1246. <div className="patent-desc">
  1247. <Modal maskClosable={false} visible={this.state.visible}
  1248. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  1249. width='1000px'
  1250. footer=''
  1251. className="admin-desc-content">
  1252. <Spin spinning={this.state.loading}>
  1253. <Tabs activeKey={this.state.tabsKey}
  1254. onChange={(e) => {
  1255. this.setState({ tabsKey: e });
  1256. if (e == "2") {
  1257. this.getTableList();
  1258. };
  1259. }} >
  1260. <Tabs.TabPane tab="客户详情" key="1">
  1261. {(() => {
  1262. if (this.props.data.id && this.props.data.auditStatus != "0" && this.props.data.auditStatus != "4") {
  1263. return <AchievementDetailShow
  1264. data={this.props.data}
  1265. detailApiUrl={this.props.detailApiUrl}
  1266. techBrodersOption={this.state.techBrodersOption}
  1267. techBrodersObj={this.state.techBrodersObj}
  1268. closeDesc={this.handleCancel}
  1269. visible={this.state.visible}
  1270. handleOk={this.handleOk} />
  1271. } else {
  1272. return <AchievementDetailForm
  1273. data={this.props.data}
  1274. detailApiUrl={this.props.detailApiUrl}
  1275. achievementCategoryOption={this.props.achievementCategoryOption}
  1276. techBrodersObj={this.state.techBrodersObj}
  1277. closeDesc={this.handleCancel}
  1278. visible={this.state.visible}
  1279. handleOk={this.handleOk} />
  1280. };
  1281. })()}
  1282. </Tabs.TabPane>
  1283. </Tabs>
  1284. </Spin>
  1285. </Modal>
  1286. </div>
  1287. );
  1288. } else {
  1289. return <div></div>
  1290. }
  1291. },
  1292. });
  1293. export default AchievementDetail;