myClientDesc.jsx 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314
  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. {getFieldDecorator('createTim', {
  888. initialValue: theData.createTime ? moment(theData.createTime) : null
  889. })(
  890. <TimePicker />
  891. )}
  892. </FormItem>
  893. {/* <FormItem className="half-item" style={{marginLeft:'-160px'}}
  894. {...formItemLayout}
  895. label="" >
  896. </FormItem> */}
  897. {/* <FormItem className="half-item"
  898. {...formItemLayout}
  899. label="跟单人" >
  900. {getFieldDecorator('ownerId', {
  901. initialValue: theData.ownerId
  902. })(
  903. <Input />
  904. )}
  905. </FormItem> */}
  906. </div>
  907. <div className="clearfix" style={{marginLeft:'40px',marginBottom:'20px',color:'#000000'}}>公司资料:</div>
  908. <div>
  909. <FormItem className="half-item"
  910. {...formItemLayout}
  911. label="公司名称" >
  912. {getFieldDecorator('companyName', {
  913. rules: [{ required: true, message: '此项为必填项!' }],
  914. initialValue: theData.companyName
  915. })(
  916. <Input />
  917. )}
  918. </FormItem>
  919. <FormItem className="half-item"
  920. {...formItemLayout}
  921. label="公司行业" >
  922. {getFieldDecorator('companyIndustry', {
  923. initialValue: theData.companyIndustry
  924. })(
  925. <Input />
  926. )}
  927. </FormItem>
  928. <FormItem className="half-item"
  929. {...formItemLayout}
  930. label="意向服务" >
  931. {getFieldDecorator('companyIntention', {
  932. rules: [{ required: true, message: '此项为必填项!' }],
  933. initialValue: getCompanyIntention(theData.companyIntention)
  934. })(
  935. <Select placeholder="选择服务类型" >
  936. {
  937. intentionalService.map(function (item) {
  938. return <Select.Option key={item.value} >{item.key}</Select.Option>
  939. })
  940. }
  941. </Select>
  942. )}
  943. </FormItem>
  944. <FormItem className="half-item"
  945. {...formItemLayout}
  946. label="地区" >
  947. {getFieldDecorator('locationProvince', {
  948. initialValue: getcityArr(theData.locationProvince)
  949. })(
  950. <Select placeholder="选择地区" style={{ width: 160 }} >
  951. {
  952. cityArr.map(function (item) {
  953. return <Select.Option key={item.value} >{item.key}</Select.Option>
  954. })
  955. }
  956. </Select>
  957. )}
  958. </FormItem>
  959. <FormItem className="half-item"
  960. {...formItemLayout}
  961. label="最新跟进" >
  962. {getFieldDecorator('followSituation', {
  963. rules: [{ required: true, message: '此项为必填项!' }],
  964. initialValue: getfllowSituation(theData.followSituation)
  965. })(
  966. <Select placeholder="选择跟进进度" style={{ width: 160 }} >
  967. {
  968. newFollow.map(function (item) {
  969. return <Select.Option key={item.value} >{item.key}</Select.Option>
  970. })
  971. }
  972. </Select>
  973. )}
  974. </FormItem>
  975. <FormItem className="half-item"
  976. {...formItemLayout}
  977. label="客户状态" >
  978. {getFieldDecorator('customerStatus', {
  979. rules: [{ required: true, message: '此项为必填项!' }],
  980. initialValue: getcustomerStatue(theData.customerStatus)
  981. })(
  982. <Select placeholder="选择客户状态" style={{ width: 160 }} >
  983. {
  984. customerStatus.map(function (item) {
  985. return <Select.Option key={item.value} >{item.key}</Select.Option>
  986. })
  987. }
  988. </Select>
  989. )}
  990. </FormItem>
  991. <FormItem className="half-item"
  992. {...formItemLayout}
  993. label="详细地址" >
  994. {getFieldDecorator('adress', {
  995. initialValue: theData.adress
  996. })(
  997. <Input />
  998. )}
  999. </FormItem>
  1000. <FormItem className="half-item"
  1001. {...formItemLayout}
  1002. label="标签" >
  1003. {getFieldDecorator('tag', {
  1004. initialValue: theData.tag
  1005. })(
  1006. <Select placeholder="选择客户标签" >
  1007. {
  1008. tag.map(function (item) {
  1009. return <Select.Option key={item.key} >{item.key}</Select.Option>
  1010. })
  1011. }
  1012. </Select>
  1013. )}
  1014. </FormItem>
  1015. <div className="clearfix">
  1016. <FormItem
  1017. labelCol={{ span: 4 }}
  1018. wrapperCol={{ span: 18 }}
  1019. label="备注" >
  1020. {getFieldDecorator('remarks', {
  1021. initialValue: theData.remarks
  1022. })(
  1023. <Input type="textarea" rows={4} />
  1024. )}
  1025. </FormItem>
  1026. </div>
  1027. </div>
  1028. <div className="clearfix" style={{marginLeft:'40px',marginBottom:'20px',color:'#000000'}}>联系资料:</div>
  1029. <div>
  1030. <FormItem className="half-item"
  1031. {...formItemLayout}
  1032. label="姓名" >
  1033. {getFieldDecorator('name', {
  1034. rules: [{ required: true, message: '此项为必填项!' }],
  1035. initialValue: theData.name
  1036. })(
  1037. <Input />
  1038. )}
  1039. </FormItem>
  1040. <FormItem className="half-item"
  1041. {...formItemLayout}
  1042. label="性别" >
  1043. {getFieldDecorator('sex', {
  1044. rules: [{ required: true, message: '此项为必填项!' }],
  1045. initialValue: getsex(theData.sex)
  1046. })(
  1047. <Radio.Group>
  1048. <Radio value="0">男</Radio>
  1049. <Radio value="1">女</Radio>
  1050. </Radio.Group>
  1051. )}
  1052. </FormItem>
  1053. <FormItem className="half-item"
  1054. {...formItemLayout}
  1055. label="手机号码" >
  1056. {getFieldDecorator('telNum', {
  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;