statisticalDetails.jsx 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. import React,{Component} from "react";
  2. import {Button, message, Modal, Spin, Table, Tag, Tooltip} from "antd";
  3. import {
  4. getSocialAttribute,
  5. getChannelAllocationStatus
  6. } from "@/tools.js";
  7. import {
  8. channelAllocationStatus
  9. } from "@/dataDic.js";
  10. import $ from "jquery/src/ajax";
  11. import IntentionDetail from "./intentionDetail/intentionDetail";
  12. class StatisticalDetails extends Component{
  13. constructor(props) {
  14. super(props);
  15. this.state={
  16. columns: [
  17. {
  18. title: "客户名称",
  19. dataIndex: "userName",
  20. key: "userName",
  21. width:250,
  22. render: (text,record) => {
  23. return (
  24. <Tooltip title={text}>
  25. <div
  26. // style={{
  27. // maxWidth:'250px',
  28. // overflow:'hidden',
  29. // textOverflow: "ellipsis",
  30. // whiteSpace:'nowrap',
  31. // }}
  32. >
  33. {record.recovery === 1 ? <div style={{
  34. background:'#ef7207',
  35. color:'#FFF',
  36. padding: '1px 7px',
  37. borderRadius:'5px',
  38. fontSize:'12px',
  39. display: 'inline-block',
  40. marginRight:'10px'
  41. }}>
  42. 回收
  43. </div> : null}
  44. {text}
  45. </div>
  46. </Tooltip>
  47. )
  48. },
  49. },
  50. {
  51. title: "地区",
  52. dataIndex: "locationProvince",
  53. key: "locationProvince",
  54. },
  55. {
  56. title: "社会性质",
  57. dataIndex: "societyTag",
  58. key: "societyTag",
  59. render: (text) => {
  60. return getSocialAttribute(text);
  61. },
  62. },
  63. {
  64. title: "外联专员",
  65. dataIndex: "channelName",
  66. key: "channelName",
  67. },
  68. {
  69. title: "客户联系人",
  70. dataIndex: "contacts",
  71. key: "contacts",
  72. },
  73. {
  74. title: "联系电话",
  75. dataIndex: "contactMobile",
  76. key: "contactMobile",
  77. },
  78. {
  79. title: "外联初始时间",
  80. dataIndex: "createTimes",
  81. key: "createTimes",
  82. },
  83. {
  84. title: "分配状态",
  85. dataIndex: "status",
  86. key: "status",
  87. render: (text) => (
  88. getChannelAllocationStatus(text,true)
  89. )
  90. },
  91. {
  92. title: "当前跟进人",
  93. dataIndex: "adminName",
  94. key: "adminName",
  95. render: (text, record) => {
  96. return (
  97. record.status !== 0 ? text : ''
  98. )
  99. }
  100. },
  101. {
  102. title: "跟进操作",
  103. dataIndex: "abc",
  104. key: "abc",
  105. render: (text, record, index) => {
  106. return (
  107. <div style={{
  108. display: 'flex',
  109. flexFlow:'row',
  110. alignItems:'center',
  111. }}>
  112. <Button
  113. onClick={(e) => {
  114. e.stopPropagation();
  115. this.tableRowClick(record);
  116. }}
  117. type="primary"
  118. >
  119. 查看指导
  120. </Button>
  121. </div>
  122. );
  123. },
  124. },
  125. {
  126. title: "备注",
  127. dataIndex: "remarks",
  128. key: "remarks",
  129. render: (text) => {
  130. return (
  131. <Tooltip placement="topLeft" title={text}>
  132. <div style={{
  133. maxWidth:'150px',
  134. overflow:'hidden',
  135. textOverflow: "ellipsis",
  136. whiteSpace:'nowrap',
  137. }}>{text}</div>
  138. </Tooltip>
  139. )
  140. }
  141. }
  142. ],
  143. dataSource:[],
  144. pagination: {
  145. defaultCurrent: 1,
  146. defaultPageSize: 10,
  147. showQuickJumper: true,
  148. pageSize: 10,
  149. onChange: function (page) {
  150. this.loadData(page);
  151. }.bind(this),
  152. showTotal: function (total) {
  153. return "共" + total + "条数据";
  154. },
  155. },
  156. pageNo:1,
  157. listLoading:false,
  158. categoryArr:[],
  159. }
  160. this.tableRowClick = this.tableRowClick.bind(this);
  161. this.category = this.category.bind(this);
  162. this.detailCloseDesc = this.detailCloseDesc.bind(this);
  163. this.loadData = this.loadData.bind(this);
  164. }
  165. tableRowClick(record) {
  166. this.category();
  167. this.setState({
  168. rowData:record,
  169. modalVisible: true,
  170. basicState: true,
  171. contactState: true,
  172. modalName: record.userName
  173. })
  174. }
  175. componentWillReceiveProps (nextProps){
  176. if(nextProps.visible){
  177. this.loadData(1,nextProps);
  178. }
  179. }
  180. loadData(pageNo = 1,nextProps=this.props) {
  181. this.setState({
  182. listLoading: true,
  183. selectedRows: [],
  184. selectedRowKeys: [],
  185. });
  186. $.ajax({
  187. method: "post",
  188. dataType: "json",
  189. crossDomain: false,
  190. url: globalConfig.context + '/api/admin/customer/listChannelCustomer',
  191. data: {
  192. pageNo: pageNo || 1,
  193. pageSize: this.state.pagination.pageSize,
  194. type:nextProps.type, // 0营销员 1外联专员 2营销总监 3营销经理 4释放 5未分配 6已分配 7已签单
  195. aid:nextProps.aid
  196. },
  197. success: function (data) {
  198. let theArr = [];
  199. if (data.error.length > 0) {
  200. message.warning(data.error[0].message);
  201. } else {
  202. if(data.data.list.length === 0 && pageNo !== 1){
  203. this.loadData(pageNo - 1)
  204. }else{
  205. for (let i = 0; i < data.data.list.length; i++) {
  206. let thisdata = data.data.list[i];
  207. let diqu =
  208. (thisdata.province == null ? "" : thisdata.province) +
  209. (thisdata.city == null ? "" : "-" + thisdata.city) +
  210. (thisdata.area == null ? "" : "-" + thisdata.area);
  211. thisdata.key = i;
  212. thisdata.id = thisdata.uid;
  213. thisdata.lastFollowTime = thisdata.lastFollowTime &&
  214. thisdata.lastFollowTime.split(" ")[0];
  215. thisdata.transferTime= thisdata.transferTime && thisdata.transferTime.split(" ")[0];
  216. thisdata.surplusFollowTime = thisdata.surplusFollowTime && thisdata.surplusFollowTime.split(" ")[0];
  217. thisdata.surplusSignTime = thisdata.surplusSignTime && thisdata.surplusSignTime.split(" ")[0];
  218. thisdata.locationProvince = diqu;
  219. theArr.push(thisdata);
  220. }
  221. this.state.pagination.current = data.data.pageNo;
  222. this.state.pagination.total = data.data.totalCount;
  223. this.setState({
  224. pageNo: data.data.pageNo,
  225. dataSource: theArr,
  226. pagination: this.state.pagination,
  227. })
  228. }
  229. }
  230. }.bind(this),
  231. }).always(
  232. function () {
  233. this.setState({
  234. listLoading: false,
  235. });
  236. }.bind(this)
  237. );
  238. }
  239. category() {
  240. $.ajax({
  241. method: "get",
  242. dataType: "json",
  243. crossDomain: false,
  244. url: globalConfig.context + "/api/admin/Varieties/getSuperList",
  245. data: {},
  246. success: function (data) {
  247. let thedata = data.data;
  248. let theArr = [];
  249. if (!thedata) {
  250. if (data.error && data.error.length) {
  251. message.warning(data.error[0].message);
  252. }
  253. thedata = {};
  254. } else {
  255. thedata.map(function (item, index) {
  256. theArr.push({
  257. value: item.id,
  258. key: item.cname,
  259. });
  260. });
  261. }
  262. this.setState({
  263. categoryArr: theArr,
  264. });
  265. }.bind(this),
  266. });
  267. }
  268. detailCloseDesc(){
  269. this.setState({
  270. rowData:'',
  271. modalVisible: false,
  272. basicState: false,
  273. contactState: false,
  274. modalName: '',
  275. },()=>{
  276. this.loadData(this.state.pageNo);
  277. })
  278. }
  279. render() {
  280. return (
  281. <Modal
  282. maskClosable={false}
  283. className="customeDetails"
  284. footer=""
  285. title={
  286. <span>
  287. <span style={{marginRight:'15px'}}>详细列表</span>
  288. <Tag color="#f50">{this.props.aName}</Tag>
  289. <Tag color="#108ee9">
  290. {
  291. this.props.type === 1?
  292. '当前客户总数':
  293. this.props.type === 4?
  294. '释放客数':
  295. this.props.type === 5?
  296. '未分配数':
  297. this.props.type === 6?
  298. '已分配数':
  299. this.props.type === 7?
  300. '已签单数': ''
  301. }
  302. </Tag>
  303. </span>
  304. }
  305. width="1200px"
  306. visible={this.props.visible}
  307. onOk={this.props.onCancel}
  308. onCancel={this.props.onCancel}
  309. >
  310. <Spin spinning={this.state.listLoading}>
  311. <Table
  312. size="middle"
  313. className={'intentionCustomerTable'}
  314. columns={this.state.columns}
  315. dataSource={this.state.dataSource}
  316. pagination={this.state.pagination}
  317. onRowClick={this.tableRowClick}
  318. />
  319. </Spin>
  320. <IntentionDetail
  321. categoryArr={this.state.categoryArr}
  322. detailApi='/api/admin/customer/findOrganizationCustomerDetail'
  323. IntentionData={this.state.rowData}
  324. modalVisible={this.state.modalVisible}
  325. name={this.state.modalName}
  326. closeDesc={this.detailCloseDesc}
  327. basicState={this.state.basicState}
  328. contactState={this.state.contactState}
  329. isGuidanceLv={true}
  330. isEditGuidanceLv={false}
  331. />
  332. </Modal>
  333. );
  334. }
  335. }
  336. export default StatisticalDetails;