myClientDesc.jsx 59 KB

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