myClientDesc.jsx 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311
  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. rules: [{ required: true, message: '此项为必填项!' }],
  884. initialValue: theData.createTime ? moment(theData.createTime) : null
  885. })(
  886. <DatePicker />
  887. )}
  888. </FormItem>
  889. {/* <FormItem className="half-item" style={{marginLeft:'-160px'}}
  890. {...formItemLayout}
  891. label="" >
  892. </FormItem> */}
  893. {/* <FormItem className="half-item"
  894. {...formItemLayout}
  895. label="跟单人" >
  896. {getFieldDecorator('ownerId', {
  897. initialValue: theData.ownerId
  898. })(
  899. <Input />
  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('companyIntention', {
  928. rules: [{ required: true, message: '此项为必填项!' }],
  929. initialValue: getCompanyIntention(theData.companyIntention)
  930. })(
  931. <Select placeholder="选择服务类型" >
  932. {
  933. intentionalService.map(function (item) {
  934. return <Select.Option key={item.value} >{item.key}</Select.Option>
  935. })
  936. }
  937. </Select>
  938. )}
  939. </FormItem>
  940. <FormItem className="half-item"
  941. {...formItemLayout}
  942. label="地区" >
  943. {getFieldDecorator('locationProvince', {
  944. initialValue: getcityArr(theData.locationProvince)
  945. })(
  946. <Select placeholder="选择地区" style={{ width: 160 }} >
  947. {
  948. cityArr.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('followSituation', {
  959. rules: [{ required: true, message: '此项为必填项!' }],
  960. initialValue: getfllowSituation(theData.followSituation)
  961. })(
  962. <Select placeholder="选择跟进进度" style={{ width: 160 }} >
  963. {
  964. newFollow.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('customerStatus', {
  975. rules: [{ required: true, message: '此项为必填项!' }],
  976. initialValue: getcustomerStatue(theData.customerStatus)
  977. })(
  978. <Select placeholder="选择客户状态" style={{ width: 160 }} >
  979. {
  980. customerStatus.map(function (item) {
  981. return <Select.Option key={item.value} >{item.key}</Select.Option>
  982. })
  983. }
  984. </Select>
  985. )}
  986. </FormItem>
  987. <FormItem className="half-item"
  988. {...formItemLayout}
  989. label="详细地址" >
  990. {getFieldDecorator('adress', {
  991. initialValue: theData.adress
  992. })(
  993. <Input />
  994. )}
  995. </FormItem>
  996. <FormItem className="half-item"
  997. {...formItemLayout}
  998. label="标签" >
  999. {getFieldDecorator('tag', {
  1000. initialValue: theData.tag
  1001. })(
  1002. <Select placeholder="选择客户标签" >
  1003. {
  1004. tag.map(function (item) {
  1005. return <Select.Option key={item.key} >{item.key}</Select.Option>
  1006. })
  1007. }
  1008. </Select>
  1009. )}
  1010. </FormItem>
  1011. <div className="clearfix">
  1012. <FormItem
  1013. labelCol={{ span: 4 }}
  1014. wrapperCol={{ span: 18 }}
  1015. label="备注" >
  1016. {getFieldDecorator('remarks', {
  1017. initialValue: theData.remarks
  1018. })(
  1019. <Input type="textarea" rows={4} />
  1020. )}
  1021. </FormItem>
  1022. </div>
  1023. </div>
  1024. <div className="clearfix" style={{marginLeft:'40px',marginBottom:'20px',color:'#000000'}}>联系资料:</div>
  1025. <div>
  1026. <FormItem className="half-item"
  1027. {...formItemLayout}
  1028. label="姓名" >
  1029. {getFieldDecorator('name', {
  1030. rules: [{ required: true, message: '此项为必填项!' }],
  1031. initialValue: theData.name
  1032. })(
  1033. <Input />
  1034. )}
  1035. </FormItem>
  1036. <FormItem className="half-item"
  1037. {...formItemLayout}
  1038. label="性别" >
  1039. {getFieldDecorator('sex', {
  1040. rules: [{ required: true, message: '此项为必填项!' }],
  1041. initialValue: getsex(theData.sex)
  1042. })(
  1043. <Radio.Group>
  1044. <Radio value="0">男</Radio>
  1045. <Radio value="1">女</Radio>
  1046. </Radio.Group>
  1047. )}
  1048. </FormItem>
  1049. <FormItem className="half-item"
  1050. {...formItemLayout}
  1051. label="手机号码" >
  1052. {getFieldDecorator('telNum', {
  1053. initialValue: theData.telNum
  1054. })(
  1055. <Input />
  1056. )}
  1057. </FormItem>
  1058. <FormItem className="half-item"
  1059. {...formItemLayout}
  1060. label="座机号" >
  1061. {getFieldDecorator('mobile', {
  1062. initialValue: theData.mobile
  1063. })(
  1064. <Input />
  1065. )}
  1066. </FormItem>
  1067. <FormItem className="half-item"
  1068. {...formItemLayout}
  1069. label="QQ号码" >
  1070. {getFieldDecorator('qq', {
  1071. initialValue: theData.qq
  1072. })(
  1073. <Input />
  1074. )}
  1075. </FormItem>
  1076. <FormItem className="half-item"
  1077. {...formItemLayout}
  1078. label="邮箱号" >
  1079. {getFieldDecorator('email', {
  1080. initialValue: theData.email
  1081. })(
  1082. <Input />
  1083. )}
  1084. </FormItem>
  1085. <FormItem className="half-item"
  1086. {...formItemLayout}
  1087. label="微信" >
  1088. {getFieldDecorator('wechat', {
  1089. initialValue: theData.wechat
  1090. })(
  1091. <Input />
  1092. )}
  1093. </FormItem>
  1094. <FormItem className="half-item"
  1095. {...formItemLayout}
  1096. label="部门" >
  1097. {getFieldDecorator('depatrment', {
  1098. initialValue: theData.depatrment
  1099. })(
  1100. <Input />
  1101. )}
  1102. </FormItem>
  1103. <FormItem className="half-item"
  1104. {...formItemLayout}
  1105. label="职位" >
  1106. {getFieldDecorator('customerPosition', {
  1107. initialValue: theData.customerPosition
  1108. })(
  1109. <Input />
  1110. )}
  1111. </FormItem>
  1112. </div>
  1113. </div>
  1114. <FormItem wrapperCol={{ span: 12, offset: 4 }}>
  1115. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  1116. {/*<Button className="set-submit" type="ghost" onClick={(e) => { this.state.auditStatus = 1; }} htmlType="submit">发布</Button>*/}
  1117. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  1118. </FormItem>
  1119. </Spin>
  1120. </Form >
  1121. )
  1122. }
  1123. }));
  1124. const AchievementDetail = React.createClass({
  1125. getInitialState() {
  1126. return {
  1127. visible: false,
  1128. tabsKey: 1,
  1129. loading: false,
  1130. columns: [
  1131. {
  1132. title: '客户信息',
  1133. dataIndex: 'id',
  1134. key: 'id',
  1135. render: text => {
  1136. switch (text) {
  1137. case "0":
  1138. return <span>个人客户</span>;
  1139. case "1":
  1140. return <span>公司客户</span>;
  1141. }
  1142. }
  1143. }, {
  1144. title: '名称',
  1145. dataIndex: 'companyNmae',
  1146. key: 'companyNmae',
  1147. }, {
  1148. title: '关键字',
  1149. dataIndex: 'keyword',
  1150. key: 'keyword',
  1151. }, {
  1152. title: '类型',
  1153. dataIndex: 'demandType',
  1154. key: 'demandType',
  1155. render: text => { return getDemandType(text); }
  1156. }, {
  1157. title: '所有人名称',
  1158. dataIndex: 'theName',
  1159. key: 'theName',
  1160. }, {
  1161. title: '发布时间',
  1162. dataIndex: 'releaseDateFormattedDate',
  1163. key: 'releaseDateFormattedDate',
  1164. }, {
  1165. title: '有效期限',
  1166. dataIndex: 'validityPeriodFormattedDate',
  1167. key: 'validityPeriodFormattedDate',
  1168. },
  1169. ],
  1170. dataSource: [],
  1171. };
  1172. },
  1173. getTableList() {
  1174. this.setState({
  1175. loading: true
  1176. });
  1177. $.ajax({
  1178. method: "get",
  1179. dataType: "json",
  1180. crossDomain: false,
  1181. url: globalConfig.context + "/api/admin/achievement/achievementDemand",
  1182. data: { id: this.props.data.id },
  1183. success: function (data) {
  1184. let theArr = [];
  1185. if (!data.data) {
  1186. if (data.error && data.error.length) {
  1187. message.warning(data.error[0].message);
  1188. };
  1189. } else if (data.data.length) {
  1190. for (let i = 0; i < data.data.length; i++) {
  1191. let thisdata = data.data[i];
  1192. theArr.push({
  1193. key: i,
  1194. id: thisdata.id,
  1195. serialNumber: thisdata.serialNumber,
  1196. createTime: thisdata.createTime,
  1197. name: thisdata.name,
  1198. keyword: thisdata.keyword,
  1199. demandType: thisdata.demandType,
  1200. theName: thisdata.username || thisdata.unitName,
  1201. releaseDateFormattedDate: thisdata.releaseDateFormattedDate,
  1202. validityPeriodFormattedDate: thisdata.validityPeriodFormattedDate,
  1203. coverImg: thisdata.coverImg,
  1204. hot: thisdata.hot,
  1205. });
  1206. };
  1207. };
  1208. this.setState({
  1209. dataSource: theArr,
  1210. });
  1211. }.bind(this),
  1212. }).always(function () {
  1213. this.setState({
  1214. loading: false
  1215. });
  1216. }.bind(this));
  1217. },
  1218. tableRowClick(record, index) {
  1219. window.open(globalConfig.context + '/portal/detail/demandDetail.html?id=' + record.id + '&type=' + record.dataCategory);
  1220. },
  1221. handleCancel(e) {
  1222. this.setState({
  1223. visible: false,
  1224. });
  1225. this.props.closeDesc(false);
  1226. },
  1227. handleOk(e) {
  1228. this.setState({
  1229. visible: false,
  1230. });
  1231. this.props.closeDesc(false, true);
  1232. },
  1233. componentWillReceiveProps(nextProps) {
  1234. if (!this.state.visible && nextProps.showDesc) {
  1235. this.state.tabsKey = "1";
  1236. };
  1237. this.state.visible = nextProps.showDesc;
  1238. },
  1239. render() {
  1240. if (this.props.data) {
  1241. return (
  1242. <div className="patent-desc">
  1243. <Modal maskClosable={false} visible={this.state.visible}
  1244. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  1245. width='1000px'
  1246. footer=''
  1247. className="admin-desc-content">
  1248. <Spin spinning={this.state.loading}>
  1249. <Tabs activeKey={this.state.tabsKey}
  1250. onChange={(e) => {
  1251. this.setState({ tabsKey: e });
  1252. if (e == "2") {
  1253. this.getTableList();
  1254. };
  1255. }} >
  1256. <Tabs.TabPane tab="客户详情" key="1">
  1257. {(() => {
  1258. if (this.props.data.id && this.props.data.auditStatus != "0" && this.props.data.auditStatus != "4") {
  1259. return <AchievementDetailShow
  1260. data={this.props.data}
  1261. detailApiUrl={this.props.detailApiUrl}
  1262. techBrodersOption={this.state.techBrodersOption}
  1263. techBrodersObj={this.state.techBrodersObj}
  1264. closeDesc={this.handleCancel}
  1265. visible={this.state.visible}
  1266. handleOk={this.handleOk} />
  1267. } else {
  1268. return <AchievementDetailForm
  1269. data={this.props.data}
  1270. detailApiUrl={this.props.detailApiUrl}
  1271. achievementCategoryOption={this.props.achievementCategoryOption}
  1272. techBrodersObj={this.state.techBrodersObj}
  1273. closeDesc={this.handleCancel}
  1274. visible={this.state.visible}
  1275. handleOk={this.handleOk} />
  1276. };
  1277. })()}
  1278. </Tabs.TabPane>
  1279. </Tabs>
  1280. </Spin>
  1281. </Modal>
  1282. </div>
  1283. );
  1284. } else {
  1285. return <div></div>
  1286. }
  1287. },
  1288. });
  1289. export default AchievementDetail;