queryCutomer.jsx 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251
  1. import React from 'react';
  2. import {
  3. Button, Cascader, Modal, Input, Select, Tag,
  4. Spin, Table, Tabs, Form, Col, message, Tooltip, AutoComplete
  5. } from 'antd';
  6. import $ from 'jquery/src/ajax';
  7. import { ShowModal } from '../../../../tools.js'
  8. import { areaSelect, citySelect, provinceList } from '@/NewDicProvinceList';
  9. import ShowModalDiv from "@/showModal.jsx";
  10. import ZhuanjiaoDetail from "@/zhuanjiaoDetail.jsx";
  11. import Detaile from './detail.jsx';
  12. import { ChooseList } from "../../../order/orderNew/chooseList";
  13. import EnterpriseNameChange from "../../../../common/enterpriseNameChange";
  14. import TextArea from "antd/es/input/TextArea";
  15. import ImgList from '../../../../common/imgList/index.js';
  16. const confirm = Modal.confirm;
  17. const { TabPane } = Tabs
  18. const QueryCustomer = React.createClass({
  19. //
  20. loadData(pageNo, apiUrl) {
  21. if (!this.state.nameSearch) {
  22. return
  23. }
  24. // 新需求 除湖南和内蒙古外 不让其他省操作
  25. if (adminData.province != "21" && adminData.province != "11") {
  26. return
  27. }
  28. this.setState({
  29. visitModul: false,
  30. loading: true,
  31. modalVisible: false,
  32. });
  33. let api = apiUrl ? apiUrl : this.props.ApiUrl;
  34. $.ajax({
  35. method: "post",
  36. dataType: "json",
  37. crossDomain: false,
  38. url: globalConfig.context + api,
  39. data: {
  40. pageNo: pageNo || 1,
  41. pageSize: this.state.pagination.pageSize,
  42. name: this.state.nameSearch,
  43. departmentId: this.state.departmenttSearch,
  44. aid: this.state.theTypes,
  45. },
  46. success: function (data) {
  47. ShowModal(this);
  48. let theArr = [];
  49. if (data.error.length || data.data.list == "") {
  50. if (data.error && data.error.length) {
  51. message.warning(data.error[0].message);
  52. }
  53. } else {
  54. for (let i = 0; i < data.data.list.length; i++) {
  55. let thisdata = data.data.list[i];
  56. let diqu =
  57. (thisdata.province == null ? "" : thisdata.province) +
  58. (thisdata.city == null ? "" : "-" + thisdata.city) +
  59. (thisdata.area == null ? "" : "-" + thisdata.area);
  60. thisdata.key = i;
  61. thisdata.id = thisdata.uid;
  62. thisdata.signBills = thisdata.signBills;
  63. thisdata.createTime = thisdata.createTime && thisdata.createTime.split(" ")[0];
  64. thisdata.locationProvince = diqu;
  65. thisdata.myUser = thisdata.myUser;
  66. theArr.push(thisdata);
  67. }
  68. this.state.pagination.current = data.data.pageNo;
  69. this.state.pagination.total = data.data.totalCount;
  70. }
  71. if (data.data && data.data.list && !data.data.list.length) {
  72. this.state.pagination.current = 0;
  73. this.state.pagination.total = 0;
  74. }
  75. this.setState({
  76. dataSource: theArr,
  77. pagination: this.state.pagination,
  78. selectedRowKeys: [],
  79. ispage: data.data.pageNo,
  80. });
  81. }.bind(this),
  82. }).always(
  83. function () {
  84. this.setState({
  85. loading: false,
  86. });
  87. }.bind(this)
  88. );
  89. },
  90. //部门
  91. departmentList() {
  92. this.setState({
  93. loading: true,
  94. });
  95. $.ajax({
  96. method: "get",
  97. dataType: "json",
  98. crossDomain: false,
  99. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  100. data: {},
  101. success: function (data) {
  102. let thedata = data.data;
  103. let theArr = [];
  104. if (!thedata) {
  105. if (data.error && data.error.length) {
  106. message.warning(data.error[0].message);
  107. }
  108. thedata = {};
  109. } else {
  110. thedata.map(function (item, index) {
  111. theArr.push({
  112. key: index,
  113. name: item.name,
  114. id: item.id,
  115. });
  116. });
  117. }
  118. this.setState({
  119. departmentArr: theArr,
  120. });
  121. }.bind(this),
  122. }).always(
  123. function () {
  124. this.setState({
  125. loading: false,
  126. });
  127. }.bind(this)
  128. );
  129. },
  130. //
  131. getInitialState() {
  132. return {
  133. verification: false,
  134. businessScope: [],
  135. cooperationProjects: [],
  136. selectCooperationProjects: [],
  137. addressSearch: [],
  138. dataSource: [],
  139. zhuanjiaoVisible: false,
  140. zhuanjiaoData: [],
  141. loading: false,
  142. departmentArr: [],
  143. selectedRowKeys: [],
  144. selectedRowKey: [],
  145. selectedRows: [],
  146. pagination: {
  147. defaultCurrent: 1,
  148. defaultPageSize: 10,
  149. showQuickJumper: true,
  150. pageSize: 10,
  151. onChange: function (page) {
  152. this.loadData(page);
  153. }.bind(this),
  154. showTotal: function (total) {
  155. return "共" + total + "条数据";
  156. },
  157. },
  158. columns: [
  159. {
  160. title: "客户名称",
  161. dataIndex: "name",
  162. key: "name",
  163. render: (text, record) => {
  164. return (
  165. <span style={{ display: 'flex', alignItems: 'flex-start' }}>
  166. {record.channel === 1 ? <div style={{
  167. whiteSpace: 'nowrap',
  168. background: '#ef7207',
  169. color: '#FFF',
  170. padding: '1px 7px',
  171. borderRadius: '5px',
  172. fontSize: '12px',
  173. display: 'inline-block',
  174. marginRight: '10px'
  175. }}>
  176. 外联
  177. </div> : null}
  178. <Tooltip title={text}>
  179. <div>{text}</div>
  180. </Tooltip>
  181. </span>
  182. )
  183. }
  184. },
  185. {
  186. title: "统一社会信用代码",
  187. dataIndex: "orgCode",
  188. key: "orgCode",
  189. },
  190. {
  191. title: "共享类型",
  192. dataIndex: "shareType",
  193. key: "shareType",
  194. //0-私有 1-公共 2 签单
  195. render: (text, record) => {
  196. return (
  197. <span>
  198. {
  199. text === '0' ? '私有' :
  200. text === '1' ? '公共' :
  201. text === '2' ? '签单' :
  202. text === '3' ? '外联' :
  203. text === '4' ? '渠道' :
  204. text === '5' ? '线索' : ''
  205. }
  206. {/* {
  207. record.newChannel == "1"
  208. ? "渠道" : ""
  209. } */}
  210. </span>
  211. )
  212. }
  213. },
  214. {
  215. title: "地区",
  216. dataIndex: "locationProvince",
  217. key: "locationProvince",
  218. },
  219. {
  220. title: "创建时间",
  221. dataIndex: "createTime",
  222. key: "createTime",
  223. width: 80,
  224. },
  225. {
  226. title: "客户所属人",
  227. dataIndex: "adminName",
  228. key: "adminName",
  229. },
  230. {
  231. title: "资料所属人",
  232. dataIndex: "informationMaintainer",
  233. key: "informationMaintainer",
  234. },
  235. {
  236. title: "操作",
  237. dataIndex: "abc",
  238. key: "abc",
  239. render: (text, record) => {
  240. return (
  241. <div>
  242. <Button
  243. disabled={record.signBills === 0}
  244. onClick={(e) => {
  245. e.stopPropagation(), this.seeDetail(record);
  246. }}
  247. // type="primary"
  248. style={{ border: 0, marginRight: 10, color: "#fff", background: record.signBills === 0 ? "#58A3FF" : "green" }}
  249. >
  250. {record.signBills === 0 ? '暂未签单' : '已签,查看详细'}
  251. </Button>
  252. <Button
  253. onClick={(e) => {
  254. e.stopPropagation(), this.zhuanjiaoLog(record);
  255. }}
  256. type="primary"
  257. >
  258. 查看转交记录
  259. </Button>
  260. <EnterpriseNameChange
  261. type='journal'
  262. style={{ marginLeft: 10 }}
  263. data={record}
  264. enterpriseId={record.uid} />
  265. {record.shareType === '1' &&
  266. <Button style={{ marginLeft: 10 }} onClick={(e) => {
  267. e.stopPropagation();
  268. this.receive(record)
  269. // let _this = this;
  270. // confirm({
  271. // title: '提醒!',
  272. // content: '确定要领取此客户吗?',
  273. // onOk() {
  274. // _this.receive(record);
  275. // },
  276. // onCancel() { },
  277. // });
  278. }} type="primary">领取</Button>
  279. }
  280. </div>
  281. );
  282. },
  283. },
  284. ],
  285. natureOptions: [{
  286. value: 1,
  287. label: "政府机构"
  288. }, {
  289. value: 2,
  290. label: "科研院所"
  291. }, {
  292. value: 3,
  293. label: "高等院校"
  294. }, {
  295. value: 4,
  296. label: "社会团体"
  297. }, {
  298. value: 5,
  299. label: "企业",
  300. children: [{
  301. value: 1,
  302. label: "国企",
  303. children: [{
  304. value: 1,
  305. label: "上市公司",
  306. }, {
  307. value: 0,
  308. label: "非上市公司",
  309. }]
  310. }, {
  311. value: 2,
  312. label: "央企",
  313. children: [{
  314. value: 1,
  315. label: "上市公司",
  316. }, {
  317. value: 0,
  318. label: "非上市公司",
  319. }]
  320. }, {
  321. value: 3,
  322. label: "私企",
  323. children: [{
  324. value: 1,
  325. label: "上市公司",
  326. }, {
  327. value: 0,
  328. label: "非上市公司",
  329. }]
  330. }, {
  331. value: 4,
  332. label: "合资企业(含港澳台)",
  333. children: [{
  334. value: 1,
  335. label: "上市公司",
  336. }, {
  337. value: 0,
  338. label: "非上市公司",
  339. }]
  340. }, {
  341. value: 5,
  342. label: "外资控股",
  343. children: [{
  344. value: 1,
  345. label: "上市公司",
  346. }, {
  347. value: 0,
  348. label: "非上市公司",
  349. }]
  350. }]
  351. }, {
  352. value: 0,
  353. label: "其他组织"
  354. }],
  355. fileList: []
  356. };
  357. },
  358. handleClose(removedTag) {
  359. let businessScope = this.state.businessScope.filter(tag => { return tag !== removedTag });
  360. this.setState({ businessScope });
  361. },
  362. handleCloseCooperation(removedTag) {
  363. let selectCooperationProjects = this.state.selectCooperationProjects.filter(tag => { return tag.value !== removedTag.value });
  364. this.setState({ selectCooperationProjects });
  365. },
  366. showInput() {
  367. let str = this.state.businessScope.join('/')
  368. this.setState({
  369. inputVisible: true,
  370. inputValue: str
  371. });
  372. },
  373. handleInputConfirm() {
  374. let inputValue = this.state.inputValue;
  375. let arr = inputValue.split('/');
  376. let lv = true;
  377. for (let i of arr) {
  378. if (!i.replace(/\s+/g, '')) {
  379. message.warning("请填写关键词且不为空");
  380. return;
  381. }
  382. if (i.length > 16) {
  383. message.warning('单个标签字数不能超过16个字符')
  384. lv = false;
  385. return;
  386. }
  387. }
  388. if (lv) {
  389. arr = Array.from(new Set(arr));
  390. arr = arr.filter(v => v);
  391. this.setState({
  392. businessScope: arr,
  393. inputVisible: false,
  394. inputValue: '',
  395. });
  396. }
  397. },
  398. //加载(自动补全)
  399. // supervisor(value) {
  400. // console.log(value)
  401. // $.ajax({
  402. // method: "get",
  403. // dataType: "json",
  404. // crossDomain: false,
  405. // url: globalConfig.context + '/api/admin/order/getBusinessProjectByName',
  406. // data: {
  407. // businessName: value
  408. // },
  409. // success: function (data) {
  410. // let thedata = data.data;
  411. // console.log(data)
  412. // if (data.error.length === 0) {
  413. // this.setState({
  414. // cooperationProjects: thedata,
  415. // });
  416. // } else {
  417. // message.warning(data.error[0].message);
  418. // }
  419. // }.bind(this),
  420. // }).always(
  421. // function () {
  422. // }.bind(this)
  423. // );
  424. // },
  425. onSelect(value) {
  426. let arr = this.state.cooperationProjects.filter(v => v.id === value);
  427. let arr1 = this.state.selectCooperationProjects.filter(v => v.value === value);
  428. if (arr.length > 0) {
  429. if (arr1.length > 0) {
  430. message.warning('选项已存在');
  431. } else {
  432. this.state.selectCooperationProjects.push({
  433. label: arr[0].bname,
  434. value: arr[0].id,
  435. })
  436. this.setState({
  437. selectCooperationProjects: this.state.selectCooperationProjects
  438. })
  439. }
  440. }
  441. },
  442. // 查询客户补充完整
  443. receive(e) {
  444. this.setState({
  445. loading: true,
  446. selectedRowKeys: [],
  447. });
  448. $.ajax({
  449. method: "get",
  450. dataType: "json",
  451. crossDomain: false,
  452. url: globalConfig.context + "/api/admin/customer/checkUser",
  453. data: {
  454. id: e.id || e.uid,
  455. }
  456. }).done(function (data) {
  457. if (!data.error.length) {
  458. let obj = data.data
  459. let selectCooperationProjects = !!obj.intendedProject ? obj.intendedProject.split(',') : []
  460. if (selectCooperationProjects.length > 0) {
  461. selectCooperationProjects = selectCooperationProjects.map((item) => {
  462. return { label: item }
  463. })
  464. }
  465. let nature = [];
  466. if (!!obj.nature) {
  467. nature.push(obj.nature);
  468. }
  469. if (!!obj.enterpriseNature) {
  470. nature.push(obj.enterpriseNature);
  471. }
  472. if (!!obj.listedNature) {
  473. nature.push(obj.listedNature);
  474. }
  475. this.setState({
  476. loading: false,
  477. verification: true,
  478. verificationMyUser: e.myUser,
  479. id: obj.id,
  480. name: obj.name,
  481. orgCode: obj.orgCode,
  482. ProvinceCity: [obj.province, obj.city, obj.area],
  483. // content: e.myUser == 1 ? obj.contacts : '',
  484. position: obj.position,
  485. // telnum: e.myUser == 1 ? obj.contactMobile : '',
  486. businessScope: !!obj.businessScope ? obj.businessScope.split(',') : [],
  487. selectCooperationProjects: selectCooperationProjects,
  488. level: obj.level,
  489. nature,
  490. natureOther: obj.natureOther,
  491. fileList: []
  492. });
  493. } else {
  494. message.warning(data.error[0].message);
  495. };
  496. }.bind(this));
  497. },
  498. // 补充客户并领取
  499. handleSubmit(e) {
  500. e.preventDefault();
  501. this.props.form.validateFields((err, values) => {
  502. let re = new RegExp("^[\u4e00-\u9fa5]");
  503. // if (!re.test(values.name)) {
  504. // message.warning('公司名称必须以汉字开头!')
  505. // return
  506. // }
  507. // if (!re.test(values.name.charAt(values.name.length - 1))) {
  508. // message.warning('公司名称必须以汉字结尾!')
  509. // return
  510. // }
  511. if (values.name.length > 64) {
  512. message.warning('公司名称字数不超过64个!')
  513. return false;
  514. };
  515. let regu = /[`~!#$%^&*'_[\]+=<>?:"{}|~!#¥%……&*=-@-!{}|/《》?:“”【】、;;‘’,,.。、\s+]/g;
  516. if (regu.test(values.name)) {
  517. message.warning('公司名称不能存在特殊符号或空格!')
  518. return false;
  519. }
  520. if (!/^[A-Z0-9]{15}$|^[A-Z0-9]{17}$|^[A-Z0-9]{18}$|^[A-Z0-9]{20}$/.test(values.orgCode)) {
  521. message.warning('请输入正确的统一社会信用代码!')
  522. return
  523. }
  524. if (!!values.content && !/.*[\u4e00-\u9fa5]+.*$/.test(values.content)) {
  525. message.error("请填写正确的联系人,且至少包含一个汉字");
  526. return false;
  527. }
  528. if (!!values.position && !/.*[\u4e00-\u9fa5]+.*$/.test(values.position)) {
  529. message.error("请填写正确的职位,且至少包含一个汉字");
  530. return false;
  531. }
  532. if (!values.ProvinceCity[1]) {
  533. message.warning('请选择地区');
  534. return false;
  535. };
  536. if (!!values.content && values.content.length > 32) {
  537. message.warning('联系人字数不超过32个')
  538. return false;
  539. };
  540. if (!!values.telnum && values.telnum.length > 13) {
  541. message.warning('电话号码字数不超过13个')
  542. return false;
  543. };
  544. if (this.state.businessScope.length === 0) {
  545. message.warning('请选择主营产品')
  546. return false;
  547. }
  548. if (this.state.selectCooperationProjects.length === 0) {
  549. message.warning('请选择意向合作项目')
  550. return false;
  551. }
  552. if (!this.state.level && this.state.level != 0) {
  553. message.warning('请选择客户类型')
  554. return false;
  555. }
  556. if (!this.state.nature && this.state.nature != 0) {
  557. message.warning('请选择客户性质')
  558. return false;
  559. }
  560. if (this.state.nature == 0 && !this.state.natureOther) {
  561. message.warning('其他说明不能为空')
  562. return false;
  563. }
  564. if (!this.state.verificationMyUser && !this.state.fileList.length) {
  565. message.warning('请上传佐证资料')
  566. return false;
  567. }
  568. let arr = [];
  569. for (let i of this.state.selectCooperationProjects) {
  570. arr.push(i.label)
  571. }
  572. if (!err) {
  573. this.setState({
  574. loading: true
  575. });
  576. let enterpriseNature = undefined; // 企业性质 0=其他,1=国企,2=央企,3=私企,4=合资企业(含港澳台),5=外资控股
  577. let listedNature = undefined; // 上市 0=否,1=是
  578. if (this.state.nature.length >= 2) {
  579. enterpriseNature = this.state.nature[1];
  580. }
  581. if (this.state.nature.length >= 3) {
  582. listedNature = this.state.nature[2];
  583. }
  584. let fileSuccList = this.state.fileList.filter(item => item.response.data && !item.response.error.length);
  585. let materialUrlList = fileSuccList.map(item => {
  586. return item.response.data;
  587. });
  588. $.ajax({
  589. method: "POST",
  590. dataType: "json",
  591. crossDomain: false,
  592. url: globalConfig.context + '/api/admin/customer/updateAndReceiveCustomer',
  593. data: {
  594. id: this.state.id,
  595. orgCode: values.orgCode,
  596. contacts: values.content,
  597. contactMobile: values.telnum,
  598. societyTag: '0', //社会属性默认为 社会企业
  599. //source:values.customerSource,
  600. province: (values.ProvinceCity)[0],//省
  601. city: (values.ProvinceCity)[1],//市
  602. area: (values.ProvinceCity)[2],//区
  603. type: '1',
  604. intendedProject: arr.join(','),
  605. businessScope: this.state.businessScope.join(','),
  606. position: values.position,
  607. level: this.state.level,
  608. nature: this.state.nature[0],
  609. natureOther: this.state.natureOther,
  610. enterpriseNature,
  611. listedNature,
  612. materialUrl: materialUrlList.join(",")
  613. }
  614. }).done(function (data) {
  615. this.setState({
  616. loading: false
  617. });
  618. if (!data.error.length) {
  619. message.success('领取成功!');
  620. this.loadData(this.state.ispage);
  621. this.handleModalClose();
  622. } else {
  623. message.warning(data.error[0].message);
  624. }
  625. }.bind(this));
  626. }
  627. });
  628. },
  629. handleModalClose() {
  630. this.setState({
  631. verification: false,
  632. id: undefined,
  633. name: undefined,
  634. orgCode: undefined,
  635. ProvinceCity: [],
  636. content: undefined,
  637. position: undefined,
  638. telnum: undefined,
  639. businessScope: [],
  640. selectCooperationProjects: [],
  641. level: undefined,
  642. nature: undefined,
  643. natureOther: undefined,
  644. })
  645. this.props.form.resetFields();
  646. },
  647. receives(e) {
  648. this.setState({
  649. loading: true,
  650. });
  651. $.ajax({
  652. method: "get",
  653. dataType: "json",
  654. crossDomain: false,
  655. url: globalConfig.context + "/api/admin/customer/receiveCustomer",
  656. data: {
  657. uid: e.id,
  658. }
  659. }).done(function (data) {
  660. this.setState({
  661. loading: false,
  662. });
  663. if (data.error.length === 0) {
  664. message.success(e.signBills == 1 ? '领取成功,请在【私有客户列表】中查询!' : '领取成功,请在【签单客户列表】中查询!');
  665. this.loadData(this.state.ispage);
  666. } else {
  667. message.warning(data.error[0].message);
  668. };
  669. }.bind(this));
  670. },
  671. //
  672. zhuanjiaoDetailCancel() {
  673. this.setState({
  674. zhuanjiaoVisible: false,
  675. });
  676. },
  677. //
  678. zhuanjiaoLog(record) {
  679. this.setState({
  680. zhuanjiaoVisible: true,
  681. zhuanjiaoId: record.id,
  682. });
  683. },
  684. //
  685. seeDetail(record) {
  686. this.setState({
  687. data: record,
  688. visitModul: true,
  689. });
  690. },
  691. //
  692. closeDesc(e) {
  693. this.state.visitModul = e;
  694. },
  695. //
  696. search() {
  697. this.loadData();
  698. },
  699. //
  700. reset() {
  701. this.setState({
  702. nameSearch: undefined,
  703. departmenttSearch: undefined,
  704. theTypes: undefined,
  705. auto: undefined,
  706. provinceSearch: undefined,
  707. addressSearch: [],
  708. dataSource: []
  709. })
  710. // this.loadData();
  711. },
  712. componentWillReceiveProps(nextProps) {
  713. if (nextProps.ApiUrl != this.props.ApiUrl) {
  714. this.state.nameSearch = "";
  715. this.state.provinceSearch = undefined;
  716. this.state.addressSearch = [];
  717. this.loadData(null, nextProps.ApiUrl);
  718. }
  719. },
  720. componentWillMount() {
  721. // this.departmentList();
  722. //城市
  723. let Province = [];
  724. provinceList.map(function (item) {
  725. var id = String(item.id);
  726. Province.push(
  727. <Select.Option value={id} key={item.name}>
  728. {item.name}
  729. </Select.Option>
  730. );
  731. });
  732. this.state.Provinces = Province;
  733. this.loadData();
  734. },
  735. //指定转交人自动补全
  736. supervisor(e) {
  737. $.ajax({
  738. method: "get",
  739. dataType: "json",
  740. crossDomain: false,
  741. url: globalConfig.context + "/api/admin/order/getBusinessProjectByName",
  742. data: {
  743. businessName: e,
  744. },
  745. }).done((data) => {
  746. console.log(data)
  747. let thedata = data.data || [];
  748. if (!thedata) {
  749. if (data.error && data.error.length) {
  750. message.warning(data.error[0].message);
  751. }
  752. thedata = {};
  753. }
  754. this.setState({
  755. cooperationProjects: thedata,
  756. });
  757. }).always(
  758. function () {
  759. this.setState({
  760. loading: false,
  761. });
  762. }.bind(this)
  763. );
  764. },
  765. //输入转交人输入框失去焦点是判断客户是否存在
  766. selectAuto(value, options) {
  767. this.setState({
  768. auto: value,
  769. });
  770. },
  771. blurChange(e) {
  772. let theType = "";
  773. let contactLists = this.state.customerArr || [];
  774. if (e) {
  775. contactLists.map(function (item) {
  776. if (item.name == e.toString()) {
  777. theType = item.id;
  778. }
  779. });
  780. }
  781. this.setState({
  782. theTypes: theType,
  783. });
  784. },
  785. //值改变时请求客户名称
  786. httpChange(e) {
  787. if (e.length >= 1) {
  788. this.supervisor(e);
  789. }
  790. this.setState({
  791. auto: e,
  792. });
  793. },
  794. changeList(arr) {
  795. const newArr = [];
  796. this.state.columns.forEach(item => {
  797. arr.forEach(val => {
  798. if (val === item.title) {
  799. newArr.push(item);
  800. }
  801. });
  802. });
  803. this.setState({
  804. changeList: newArr
  805. });
  806. },
  807. handleFileChange(info) {
  808. let fileList = info.fileList;
  809. this.setState({ fileList });
  810. },
  811. render() {
  812. let departmentArr = this.state.departmentArr || [];
  813. const intentionState = this.props.intentionState;
  814. const { getFieldDecorator } = this.props.form;
  815. const formItemLayout = {
  816. labelCol: { span: 6 },
  817. wrapperCol: { span: 14 },
  818. };
  819. const FormItem = Form.Item;
  820. const rowSelection = {
  821. selectedRowKeys: this.state.selectedRowKeys,
  822. onChange: (selectedRowKeys, selectedRows) => {
  823. this.setState({
  824. modalVisible: false,
  825. selectedRows: selectedRows.slice(-1),
  826. selectedRowKeys: selectedRowKeys.slice(-1),
  827. });
  828. },
  829. onSelect: (recordt, selected, selectedRows) => {
  830. this.setState({
  831. modalVisible: false,
  832. recordt: recordt.id,
  833. });
  834. },
  835. };
  836. const dataSources = this.state.customerArr || [];
  837. const options = dataSources.map((group) => (
  838. <Select.Option key={group.id} value={group.name}>
  839. {group.name}
  840. </Select.Option>
  841. ));
  842. const hasSelected = this.state.selectedRowKeys.length > 0;
  843. return (
  844. <div className="user-content">
  845. <ShowModalDiv ShowModal={this.state.showModal} onClose={() => { this.setState({ showModal: false }) }} />
  846. <div className="content-title" style={{ marginBottom: 10 }}>
  847. <span style={{ fontWeight: 900, fontSize: 16 }}>{!intentionState ? "单位客户查询" : "个人客户查询"}</span>
  848. </div>
  849. <Tabs defaultActiveKey="1" onChange={this.callback} className="test">
  850. <TabPane tab="搜索" key="1">
  851. <div className="user-search">
  852. <Input
  853. style={{ width: 240 }}
  854. placeholder="请输入精确客户全称或统一社会信用代码"
  855. value={this.state.nameSearch}
  856. onChange={(e) => {
  857. this.setState({ nameSearch: e.target.value });
  858. }}
  859. />
  860. {/* <Select placeholder="选择部门"
  861. style={{ width: 150, marginRight: '10px', marginLeft: '10px' }}
  862. value={this.state.departmenttSearch}
  863. onChange={(e) => { this.setState({ departmenttSearch: e }) }}>
  864. {
  865. departmentArr.map(function (item) {
  866. return <Select.Option key={item.id} >{item.name}</Select.Option>
  867. })
  868. }
  869. </Select> */}
  870. {/* <AutoComplete
  871. className="certain-category-search"
  872. dropdownClassName="certain-category-search-dropdown"
  873. dropdownMatchSelectWidth={false}
  874. dropdownStyle={{ width: 120 }}
  875. style={{ width: '120px' }}
  876. dataSource={options}
  877. placeholder="客户所有人姓名"
  878. value={this.state.auto}
  879. onChange={this.httpChange}
  880. filterOption={true}
  881. onBlur={this.blurChange}
  882. onSelect={this.selectAuto}
  883. >
  884. <Input />
  885. </AutoComplete> */}
  886. <Button type="primary" onClick={this.search}>搜索</Button>
  887. <Button onClick={this.reset}>重置</Button>
  888. </div>
  889. </TabPane>
  890. <TabPane tab="更改表格显示数据" key="2">
  891. <div style={{ marginLeft: 10 }}>
  892. <ChooseList
  893. columns={this.state.columns}
  894. changeFn={this.changeList}
  895. changeList={this.state.changeList}
  896. top={55}
  897. margin={11}
  898. />
  899. </div>
  900. </TabPane>
  901. </Tabs>
  902. <div className="patent-table">
  903. <Spin spinning={this.state.loading}>
  904. <Table
  905. size="middle"
  906. columns={
  907. this.state.changeList
  908. ? this.state.changeList
  909. : this.state.columns
  910. }
  911. dataSource={this.state.dataSource}
  912. rowSelection={rowSelection}
  913. pagination={this.state.pagination}
  914. />
  915. </Spin>
  916. </div>
  917. <Detaile
  918. visitModul={this.state.visitModul}
  919. data={this.state.data}
  920. detailApi={this.props.detailApi}
  921. closeDesc={this.closeDesc}
  922. />
  923. {this.state.zhuanjiaoVisible ? (
  924. <ZhuanjiaoDetail
  925. cancel={this.zhuanjiaoDetailCancel}
  926. visible={this.state.zhuanjiaoVisible}
  927. id={this.state.zhuanjiaoId}
  928. />
  929. ) : (
  930. ""
  931. )}
  932. <Modal maskClosable={false}
  933. visible={this.state.verification}
  934. onCancel={this.handleModalClose}
  935. width='600px'
  936. title='客户信息'
  937. footer={null}
  938. className="admin-desc-content">
  939. <Spin spinning={this.state.loading}>
  940. <div>
  941. <Form layout="horizontal" onSubmit={this.handleSubmit} id="demand-form">
  942. <Spin spinning={this.state.loading}>
  943. <div>
  944. <Col style={{ color: 'red', marginBottom: '10px' }} span={12} offset={6}>注意:请录入真实有效的客户信息</Col>
  945. <div className="clearfix">
  946. <FormItem className="mid-item"
  947. {...formItemLayout}
  948. label="公司名称" >
  949. {getFieldDecorator('name', {
  950. rules: [{ required: true, message: '此项为必填项!' }],
  951. initialValue: this.state.name
  952. })(
  953. <Input placeholder="公司名称" disabled />
  954. // <span style={{ display: 'flex', alignItems: 'center', position: 'relative' }}>
  955. // <Input placeholder="公司名称" value={this.state.name} />
  956. // {this.state.verification && <Icon type="check-circle" style={{
  957. // fontSize: 16,
  958. // color: '#30e031',
  959. // position: 'absolute',
  960. // right: '80px',
  961. // }} />}
  962. // <Button onClick={this.checkUserName} type="primary" style={{ marginLeft: '10px' }}>验证</Button>
  963. // </span>
  964. )}
  965. </FormItem>
  966. </div>
  967. <div className="clearfix">
  968. <FormItem
  969. {...formItemLayout}
  970. label="统一社会信用代码"
  971. >
  972. {getFieldDecorator('orgCode', {
  973. rules: [{ required: true, message: '此项为必填项!' }],
  974. initialValue: this.state.orgCode
  975. })(
  976. <Input placeholder="统一社会信用代码" />
  977. )}
  978. </FormItem>
  979. </div>
  980. <Col style={{ color: 'red', marginBottom: '10px' }} span={12} offset={6}>如,科德集团则填写91430105670766451M</Col>
  981. <div className="clearfix">
  982. <FormItem
  983. {...formItemLayout}
  984. label="省-市-区"
  985. >
  986. {getFieldDecorator('ProvinceCity', {
  987. rules: [{ required: true, message: '此项为必填项!' }],
  988. initialValue: this.state.ProvinceCity
  989. })(
  990. <Cascader options={areaSelect()} placeholder="选择城市" />
  991. )}
  992. </FormItem>
  993. </div>
  994. <div className="clearfix">
  995. <FormItem className="mid-item"
  996. {...formItemLayout}
  997. label="联系人" >
  998. {getFieldDecorator('content', {
  999. rules: [{ required: this.state.verificationMyUser != 1, message: '此项为必填项!' }],
  1000. initialValue: this.state.content
  1001. })(
  1002. <Input placeholder="联系人姓名" />
  1003. )}
  1004. </FormItem>
  1005. </div>
  1006. <div className="clearfix">
  1007. <FormItem className="mid-item"
  1008. {...formItemLayout}
  1009. label="职位" >
  1010. {getFieldDecorator('position', {
  1011. rules: [{ required: this.state.verificationMyUser != 1, message: '此项为必填项!' }],
  1012. initialValue: this.state.position
  1013. })(
  1014. <Input placeholder="联系人职位" />
  1015. )}
  1016. </FormItem>
  1017. </div>
  1018. <div className="clearfix">
  1019. <FormItem className="mid-item"
  1020. {...formItemLayout}
  1021. label="联系电话" >
  1022. {getFieldDecorator('telnum', {
  1023. rules: [{ required: this.state.verificationMyUser != 1, message: '此项为必填项!' }],
  1024. initialValue: this.state.telnum
  1025. })(
  1026. <Input placeholder="请填写手机号,仅填座机号时,请后续补充手机号" />
  1027. )}
  1028. </FormItem>
  1029. </div>
  1030. <div className="clearfix">
  1031. <FormItem className="mid-item"
  1032. {...formItemLayout}
  1033. required
  1034. label="主营产品" >
  1035. <div>
  1036. {this.state.businessScope.map((tag, index) => {
  1037. const isLongTag = tag.length > 20;
  1038. const tagElem = (
  1039. <Tag closable key={tag} afterClose={() => this.handleClose(tag)}>
  1040. {isLongTag ? `${tag.slice(0, 20)}...` : tag}
  1041. </Tag>
  1042. );
  1043. return isLongTag ? <Tooltip title={tag} key={tag}>{tagElem}</Tooltip> : tagElem;
  1044. })}
  1045. {
  1046. !this.state.inputVisible &&
  1047. <Button
  1048. size="small"
  1049. type="primary"
  1050. onClick={this.showInput}>
  1051. + 新增主营产品
  1052. </Button>
  1053. }
  1054. </div>
  1055. {this.state.inputVisible && (<div>
  1056. <TextArea
  1057. style={{ width: '300px', height: '100px' }}
  1058. value={this.state.inputValue}
  1059. onChange={(e) => {
  1060. this.setState({
  1061. inputValue: e.target.value
  1062. })
  1063. }} />
  1064. <div style={{ color: '#f00' }}>提示:请用 / 符号隔开关键字</div>
  1065. <div>
  1066. <Button
  1067. size="small"
  1068. type="primary"
  1069. onClick={this.handleInputConfirm}>
  1070. 确定
  1071. </Button>
  1072. <Button
  1073. size="small"
  1074. style={{ marginLeft: '5px' }}
  1075. onClick={() => {
  1076. this.setState({
  1077. inputVisible: false,
  1078. inputValue: ''
  1079. })
  1080. }}>
  1081. 取消
  1082. </Button>
  1083. </div>
  1084. </div>)}
  1085. </FormItem>
  1086. </div>
  1087. <div className="clearfix">
  1088. <FormItem
  1089. className="mid-item"
  1090. {...formItemLayout}
  1091. required
  1092. label="意向合作项目" >
  1093. <div>
  1094. <div style={{ paddingBottom: this.state.selectCooperationProjects.length === 0 ? 0 : '10px' }}>
  1095. {this.state.selectCooperationProjects.map((tag, index) => {
  1096. console.log(tag)
  1097. const isLongTag = tag.label.length > 20;
  1098. const tagElem = (
  1099. <Tag closable key={tag.label} afterClose={() => this.handleCloseCooperation(tag)}>
  1100. {isLongTag ? `${tag.label.slice(0, 20)}...` : tag.label}
  1101. </Tag>
  1102. );
  1103. return isLongTag ? <Tooltip title={tag.label} key={tag.label}>{tagElem}</Tooltip> : tagElem;
  1104. })}
  1105. </div>
  1106. <div>
  1107. <AutoComplete
  1108. style={{ width: 200 }}
  1109. onSearch={this.supervisor}
  1110. onSelect={this.onSelect}
  1111. placeholder="请输入关键字"
  1112. >
  1113. {
  1114. this.state.cooperationProjects.map(function (item) {
  1115. return <Select.Option key={item.id} value={item.id}>{item.bname}</Select.Option>
  1116. })
  1117. }
  1118. </AutoComplete>
  1119. </div>
  1120. </div>
  1121. </FormItem>
  1122. </div>
  1123. <div className="clearfix">
  1124. <FormItem
  1125. className="mid-item"
  1126. {...formItemLayout}
  1127. required
  1128. label="客户类型" >
  1129. <Select
  1130. placeholder="请选择客户类型"
  1131. value={this.state.level}
  1132. onChange={(e) => {
  1133. this.setState({ level: e });
  1134. }}
  1135. >
  1136. <Option value={0}>一般客户(一年以上预签)</Option>
  1137. <Option value={1}>意向客户(半年内预签)</Option>
  1138. <Option value={2}>重点客户(一个月内预签)</Option>
  1139. </Select>
  1140. </FormItem>
  1141. </div>
  1142. <div className="clearfix">
  1143. <FormItem
  1144. className="mid-item"
  1145. {...formItemLayout}
  1146. required
  1147. label="客户性质" >
  1148. {/* <Select
  1149. placeholder="请选择客户性质"
  1150. value={this.state.nature}
  1151. onChange={(e) => {
  1152. this.setState({ nature: e });
  1153. }}
  1154. >
  1155. <Option value={1}>政府机构</Option>
  1156. <Option value={2}>科研院所</Option>
  1157. <Option value={3}>高等院校</Option>
  1158. <Option value={4}>国有企业</Option>
  1159. <Option value={5}>民营企业</Option>
  1160. <Option value={6}>社会团体</Option>
  1161. <Option value={0}>其他(请注明)</Option>
  1162. </Select> */}
  1163. <Cascader
  1164. options={this.state.natureOptions}
  1165. placeholder="请选择客户性质"
  1166. value={this.state.nature}
  1167. onChange={e => { this.setState({ nature: e }) }}
  1168. />
  1169. </FormItem>
  1170. </div>
  1171. {
  1172. this.state.nature && this.state.nature.length && this.state.nature[0] === 0 ?
  1173. <div className="clearfix">
  1174. <FormItem
  1175. className="mid-item"
  1176. {...formItemLayout}
  1177. required
  1178. label="其他说明" >
  1179. <Input
  1180. placeholder="其他说明"
  1181. value={this.state.natureOther}
  1182. onChange={e => {
  1183. this.setState({
  1184. natureOther: e.target.value
  1185. })
  1186. }}
  1187. />
  1188. </FormItem>
  1189. </div> : null
  1190. }
  1191. { !this.state.verificationMyUser && (
  1192. <FormItem
  1193. {...formItemLayout}
  1194. required
  1195. help="帮助文档"
  1196. label="佐证资料" >
  1197. <div className="clearfix">
  1198. <ImgList
  1199. uploadConfig={{
  1200. action: globalConfig.context + "/api/user/achievement/uploadTextFile",
  1201. data: { 'sign': 'achievement_maturity_text_file' },
  1202. multiple: true,
  1203. listType: "picture-card",
  1204. }}
  1205. onChange={(infor) => {
  1206. this.handleFileChange(infor)
  1207. }}
  1208. fileList={this.state.fileList}
  1209. />
  1210. </div>
  1211. </FormItem>
  1212. ) }
  1213. { !this.state.verificationMyUser && <Col style={{ color: 'red', marginBottom: '10px' }} span={12} offset={6}>
  1214. 注:请上传客户信息截图、电话记录等录入凭证图片
  1215. </Col> }
  1216. </div>
  1217. <FormItem wrapperCol={{ span: 12, offset: 6 }}>
  1218. <Button type="primary" htmlType="submit" style={{}}>领取客户</Button>
  1219. </FormItem>
  1220. </Spin>
  1221. </Form >
  1222. </div>
  1223. </Spin>
  1224. </Modal>
  1225. </div>
  1226. );
  1227. },
  1228. });
  1229. export default Form.create({})(QueryCustomer);