myClientDesc.jsx 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347
  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. customerTyp :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. shareTyp:0,
  809. }
  810. }).done(function (data) {
  811. this.state.auditStatus = 0;
  812. this.setState({
  813. loading: false
  814. });
  815. if (!data.error.length) {
  816. message.success('保存成功!');
  817. this.props.handleOk();
  818. } else {
  819. message.warning(data.error[0].message);
  820. }
  821. }.bind(this));
  822. }
  823. });
  824. },
  825. componentWillMount() {
  826. this.state.therottleSearch = throttle(this.handleSearch, 1000, { leading: false }).bind(this);
  827. if (this.props.data && this.props.data.id) {
  828. this.loadData(this.props.data.id, this.props.detailApiUrl);
  829. };
  830. },
  831. componentWillReceiveProps(nextProps) {
  832. if (!this.props.visible && nextProps.visible) {
  833. if (nextProps.data && nextProps.data.id) {
  834. this.loadData(nextProps.data.id, nextProps.detailApiUrl);
  835. };
  836. this.state.data = {};
  837. this.state.tags = [];
  838. this.state.switchValue = false;
  839. this.state.radios = false;
  840. this.state.technicalPictureUrl = [];
  841. this.state.coverImg = [];
  842. this.state.maturityPictureUrl = [];
  843. this.state.textFileList = [];
  844. this.state.techPlanFileList = [];
  845. this.state.businessPlanFileList = [];
  846. this.props.form.resetFields();
  847. };
  848. },
  849. render() {
  850. const theData = this.state.data || {};
  851. const { getFieldDecorator } = this.props.form;
  852. const FormItem = Form.Item
  853. const formItemLayout = {
  854. labelCol: { span: 8 },
  855. wrapperCol: { span: 14 },
  856. };
  857. return (
  858. <Form horizontal onSubmit={this.handleSubmit} id="demand-form">
  859. <Spin spinning={this.state.loading}>
  860. <div className="clearfix">
  861. <FormItem className="half-item"
  862. {...formItemLayout}
  863. label="客户类型" >
  864. {getFieldDecorator('customerTyp', {
  865. rules: [{ required: true, message: '此项为必填项!' }],
  866. initialValue: theData.customerTyp
  867. })(
  868. <Select placeholder="选择客户类型" style={{ width: 160 }} >
  869. <Select.Option value="0" >个人客户</Select.Option>
  870. <Select.Option value="1" >公司客户</Select.Option>
  871. </Select>
  872. )}
  873. </FormItem>
  874. <div className="clearfix" style={{marginLeft:'40px',marginBottom:'20px',color:'#000000'}}>基本资料:</div>
  875. <div>
  876. {/* <FormItem className="half-item"
  877. {...formItemLayout}
  878. label="录入时间" >
  879. {getFieldDecorator('createTime', {
  880. initialValue: theData.createTime ? moment(theData.createTime) : null
  881. })(
  882. <DatePicker />
  883. )}
  884. </FormItem> */}
  885. {/* <FormItem className="half-item" style={{marginLeft:'-160px'}}
  886. {...formItemLayout}
  887. label="" >
  888. {getFieldDecorator('createTim', {
  889. initialValue: theData.createTime ? moment(theData.createTime) : null
  890. })(
  891. <TimePicker />
  892. )}
  893. </FormItem> */}
  894. <FormItem className="half-item"
  895. {...formItemLayout}
  896. label="跟单人" >
  897. {getFieldDecorator('ownerId', {
  898. initialValue: theData.ownerId
  899. })(
  900. <Input />
  901. )}
  902. </FormItem>
  903. </div>
  904. <div className="clearfix" style={{marginLeft:'40px',marginBottom:'20px',color:'#000000'}}>公司资料:</div>
  905. <div>
  906. <FormItem className="half-item"
  907. {...formItemLayout}
  908. label="公司名称" >
  909. {getFieldDecorator('companyName', {
  910. rules: [{ required: true, message: '此项为必填项!' }],
  911. initialValue: theData.companyName
  912. })(
  913. <Input />
  914. )}
  915. </FormItem>
  916. <FormItem className="half-item"
  917. {...formItemLayout}
  918. label="公司行业" >
  919. {getFieldDecorator('companyIndustry', {
  920. initialValue: theData.companyIndustry
  921. })(
  922. <Input />
  923. )}
  924. </FormItem>
  925. <FormItem className="half-item"
  926. {...formItemLayout}
  927. label="意向服务" >
  928. {getFieldDecorator('companyIntention', {
  929. rules: [{ required: true, message: '此项为必填项!' }],
  930. initialValue: getCompanyIntention(theData.companyIntention)
  931. })(
  932. <Select placeholder="选择服务类型" >
  933. {
  934. intentionalService.map(function (item) {
  935. return <Select.Option key={item.value} >{item.key}</Select.Option>
  936. })
  937. }
  938. </Select>
  939. )}
  940. </FormItem>
  941. <FormItem className="half-item"
  942. {...formItemLayout}
  943. label="地区" >
  944. {getFieldDecorator('locationProvince', {
  945. initialValue: getcityArr(theData.locationProvince)
  946. })(
  947. <Select placeholder="选择地区" style={{ width: 160 }} >
  948. {
  949. cityArr.map(function (item) {
  950. return <Select.Option key={item.value} >{item.key}</Select.Option>
  951. })
  952. }
  953. </Select>
  954. )}
  955. </FormItem>
  956. <FormItem className="half-item"
  957. {...formItemLayout}
  958. label="最新跟进" >
  959. {getFieldDecorator('followSituation', {
  960. rules: [{ required: true, message: '此项为必填项!' }],
  961. initialValue: getfllowSituation(theData.followSituation)
  962. })(
  963. <Select placeholder="选择跟进进度" style={{ width: 160 }} >
  964. {
  965. newFollow.map(function (item) {
  966. return <Select.Option key={item.value} >{item.key}</Select.Option>
  967. })
  968. }
  969. </Select>
  970. )}
  971. </FormItem>
  972. <FormItem className="half-item"
  973. {...formItemLayout}
  974. label="客户状态" >
  975. {getFieldDecorator('customerStatus', {
  976. rules: [{ required: true, message: '此项为必填项!' }],
  977. initialValue: getcustomerStatue(theData.customerStatus)
  978. })(
  979. <Select placeholder="选择客户状态" style={{ width: 160 }} >
  980. {
  981. customerStatus.map(function (item) {
  982. return <Select.Option key={item.value} >{item.key}</Select.Option>
  983. })
  984. }
  985. </Select>
  986. )}
  987. </FormItem>
  988. <FormItem className="half-item"
  989. {...formItemLayout}
  990. label="详细地址" >
  991. {getFieldDecorator('adress', {
  992. initialValue: theData.adress
  993. })(
  994. <Input />
  995. )}
  996. </FormItem>
  997. <FormItem className="half-item"
  998. {...formItemLayout}
  999. label="标签" >
  1000. {getFieldDecorator('tag', {
  1001. initialValue: theData.tag
  1002. })(
  1003. <Select placeholder="选择客户标签" >
  1004. {
  1005. tag.map(function (item) {
  1006. return <Select.Option key={item.key} >{item.key}</Select.Option>
  1007. })
  1008. }
  1009. </Select>
  1010. )}
  1011. </FormItem>
  1012. <div className="clearfix">
  1013. <FormItem
  1014. labelCol={{ span: 4 }}
  1015. wrapperCol={{ span: 18 }}
  1016. label="备注" >
  1017. {getFieldDecorator('remarks', {
  1018. initialValue: theData.remarks
  1019. })(
  1020. <Input type="textarea" rows={4} />
  1021. )}
  1022. </FormItem>
  1023. </div>
  1024. </div>
  1025. <div className="clearfix" style={{marginLeft:'40px',marginBottom:'20px',color:'#000000'}}>联系资料:</div>
  1026. <div>
  1027. <FormItem className="half-item"
  1028. {...formItemLayout}
  1029. label="姓名" >
  1030. {getFieldDecorator('name', {
  1031. rules: [{ required: true, message: '此项为必填项!' }],
  1032. initialValue: theData.name
  1033. })(
  1034. <Input />
  1035. )}
  1036. </FormItem>
  1037. <FormItem className="half-item"
  1038. {...formItemLayout}
  1039. label="性别" >
  1040. {getFieldDecorator('sex', {
  1041. rules: [{ required: true, message: '此项为必填项!' }],
  1042. initialValue: getsex(theData.sex)
  1043. })(
  1044. <Radio.Group>
  1045. <Radio value="0">男</Radio>
  1046. <Radio value="1">女</Radio>
  1047. </Radio.Group>
  1048. )}
  1049. </FormItem>
  1050. <FormItem className="half-item"
  1051. {...formItemLayout}
  1052. label="手机号码" >
  1053. {getFieldDecorator('telNum', {
  1054. initialValue: theData.telNum
  1055. })(
  1056. <Input />
  1057. )}
  1058. </FormItem>
  1059. <FormItem className="half-item"
  1060. {...formItemLayout}
  1061. label="座机号" >
  1062. {getFieldDecorator('mobile', {
  1063. initialValue: theData.mobile
  1064. })(
  1065. <Input />
  1066. )}
  1067. </FormItem>
  1068. <FormItem className="half-item"
  1069. {...formItemLayout}
  1070. label="QQ号码" >
  1071. {getFieldDecorator('qq', {
  1072. initialValue: theData.qq
  1073. })(
  1074. <Input />
  1075. )}
  1076. </FormItem>
  1077. <FormItem className="half-item"
  1078. {...formItemLayout}
  1079. label="邮箱号" >
  1080. {getFieldDecorator('email', {
  1081. initialValue: theData.email
  1082. })(
  1083. <Input />
  1084. )}
  1085. </FormItem>
  1086. <FormItem className="half-item"
  1087. {...formItemLayout}
  1088. label="微信" >
  1089. {getFieldDecorator('wechat', {
  1090. initialValue: theData.wechat
  1091. })(
  1092. <Input />
  1093. )}
  1094. </FormItem>
  1095. <FormItem className="half-item"
  1096. {...formItemLayout}
  1097. label="部门" >
  1098. {getFieldDecorator('depatrment', {
  1099. initialValue: theData.depatrment
  1100. })(
  1101. <Input />
  1102. )}
  1103. </FormItem>
  1104. <FormItem className="half-item"
  1105. {...formItemLayout}
  1106. label="职位" >
  1107. {getFieldDecorator('customerPosition', {
  1108. initialValue: theData.customerPosition
  1109. })(
  1110. <Input />
  1111. )}
  1112. </FormItem>
  1113. </div>
  1114. </div>
  1115. <FormItem wrapperCol={{ span: 12, offset: 4 }}>
  1116. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  1117. {/*<Button className="set-submit" type="ghost" onClick={(e) => { this.state.auditStatus = 1; }} htmlType="submit">发布</Button>*/}
  1118. <Button className="set-submit" type="ghost" onClick={this.props.closeDesc}>取消</Button>
  1119. </FormItem>
  1120. </Spin>
  1121. </Form >
  1122. )
  1123. }
  1124. }));
  1125. const AchievementDetail = React.createClass({
  1126. getInitialState() {
  1127. return {
  1128. visible: false,
  1129. tabsKey: 1,
  1130. loading: false,
  1131. columns: [
  1132. {
  1133. title: '客户信息',
  1134. dataIndex: 'id',
  1135. key: 'id',
  1136. render: text => {
  1137. switch (text) {
  1138. case "0":
  1139. return <span>个人客户</span>;
  1140. case "1":
  1141. return <span>公司客户</span>;
  1142. }
  1143. }
  1144. }, {
  1145. title: '名称',
  1146. dataIndex: 'companyNmae',
  1147. key: 'companyNmae',
  1148. }, {
  1149. title: '关键字',
  1150. dataIndex: 'keyword',
  1151. key: 'keyword',
  1152. }, {
  1153. title: '类型',
  1154. dataIndex: 'demandType',
  1155. key: 'demandType',
  1156. render: text => { return getDemandType(text); }
  1157. }, {
  1158. title: '所有人名称',
  1159. dataIndex: 'theName',
  1160. key: 'theName',
  1161. }, {
  1162. title: '发布时间',
  1163. dataIndex: 'releaseDateFormattedDate',
  1164. key: 'releaseDateFormattedDate',
  1165. }, {
  1166. title: '有效期限',
  1167. dataIndex: 'validityPeriodFormattedDate',
  1168. key: 'validityPeriodFormattedDate',
  1169. },
  1170. ],
  1171. dataSource: [],
  1172. };
  1173. },
  1174. getTechBrodersList() {
  1175. this.setState({
  1176. loading: true
  1177. });
  1178. $.ajax({
  1179. method: "get",
  1180. dataType: "json",
  1181. crossDomain: false,
  1182. url: globalConfig.context + "/api/admin/audit/techBroders",
  1183. success: function (data) {
  1184. if (!data.data) {
  1185. if (data.error && data.error.length) {
  1186. message.warning(data.error[0].message);
  1187. }
  1188. return;
  1189. };
  1190. let _me = this, theArr = [];
  1191. for (var item in data.data) {
  1192. theArr.push(
  1193. <Select.Option key={item}>{data.data[item]}</Select.Option>
  1194. )
  1195. };
  1196. this.setState({
  1197. techBrodersOption: theArr,
  1198. techBrodersObj: data.data
  1199. });
  1200. }.bind(this),
  1201. }).always(function () {
  1202. this.setState({
  1203. loading: false
  1204. });
  1205. }.bind(this));
  1206. },
  1207. getTableList() {
  1208. this.setState({
  1209. loading: true
  1210. });
  1211. $.ajax({
  1212. method: "get",
  1213. dataType: "json",
  1214. crossDomain: false,
  1215. url: globalConfig.context + "/api/admin/achievement/achievementDemand",
  1216. data: { id: this.props.data.id },
  1217. success: function (data) {
  1218. let theArr = [];
  1219. if (!data.data) {
  1220. if (data.error && data.error.length) {
  1221. message.warning(data.error[0].message);
  1222. };
  1223. } else if (data.data.length) {
  1224. for (let i = 0; i < data.data.length; i++) {
  1225. let thisdata = data.data[i];
  1226. theArr.push({
  1227. key: i,
  1228. id: thisdata.id,
  1229. serialNumber: thisdata.serialNumber,
  1230. createTime: thisdata.createTime,
  1231. name: thisdata.name,
  1232. keyword: thisdata.keyword,
  1233. demandType: thisdata.demandType,
  1234. theName: thisdata.username || thisdata.unitName,
  1235. releaseDateFormattedDate: thisdata.releaseDateFormattedDate,
  1236. validityPeriodFormattedDate: thisdata.validityPeriodFormattedDate,
  1237. coverImg: thisdata.coverImg,
  1238. hot: thisdata.hot,
  1239. });
  1240. };
  1241. };
  1242. this.setState({
  1243. dataSource: theArr,
  1244. });
  1245. }.bind(this),
  1246. }).always(function () {
  1247. this.setState({
  1248. loading: false
  1249. });
  1250. }.bind(this));
  1251. },
  1252. tableRowClick(record, index) {
  1253. window.open(globalConfig.context + '/portal/detail/demandDetail.html?id=' + record.id + '&type=' + record.dataCategory);
  1254. },
  1255. handleCancel(e) {
  1256. this.setState({
  1257. visible: false,
  1258. });
  1259. this.props.closeDesc(false);
  1260. },
  1261. handleOk(e) {
  1262. this.setState({
  1263. visible: false,
  1264. });
  1265. this.props.closeDesc(false, true);
  1266. },
  1267. componentWillMount() {
  1268. this.getTechBrodersList();
  1269. },
  1270. componentWillReceiveProps(nextProps) {
  1271. if (!this.state.visible && nextProps.showDesc) {
  1272. this.state.tabsKey = "1";
  1273. };
  1274. this.state.visible = nextProps.showDesc;
  1275. },
  1276. render() {
  1277. if (this.props.data) {
  1278. return (
  1279. <div className="patent-desc">
  1280. <Modal maskClosable={false} visible={this.state.visible}
  1281. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  1282. width='1000px'
  1283. footer=''
  1284. className="admin-desc-content">
  1285. <Spin spinning={this.state.loading}>
  1286. <Tabs activeKey={this.state.tabsKey}
  1287. onChange={(e) => {
  1288. this.setState({ tabsKey: e });
  1289. if (e == "2") {
  1290. this.getTableList();
  1291. };
  1292. }} >
  1293. <Tabs.TabPane tab="客户详情" key="1">
  1294. {(() => {
  1295. if (this.props.data.id && this.props.data.auditStatus != "0" && this.props.data.auditStatus != "4") {
  1296. return <AchievementDetailShow
  1297. data={this.props.data}
  1298. detailApiUrl={this.props.detailApiUrl}
  1299. techBrodersOption={this.state.techBrodersOption}
  1300. techBrodersObj={this.state.techBrodersObj}
  1301. closeDesc={this.handleCancel}
  1302. visible={this.state.visible}
  1303. handleOk={this.handleOk} />
  1304. } else {
  1305. return <AchievementDetailForm
  1306. data={this.props.data}
  1307. detailApiUrl={this.props.detailApiUrl}
  1308. achievementCategoryOption={this.props.achievementCategoryOption}
  1309. techBrodersObj={this.state.techBrodersObj}
  1310. closeDesc={this.handleCancel}
  1311. visible={this.state.visible}
  1312. handleOk={this.handleOk} />
  1313. };
  1314. })()}
  1315. </Tabs.TabPane>
  1316. </Tabs>
  1317. </Spin>
  1318. </Modal>
  1319. </div>
  1320. );
  1321. } else {
  1322. return <div></div>
  1323. }
  1324. },
  1325. });
  1326. export default AchievementDetail;