index.jsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. import React,{Component} from 'react';
  2. import {
  3. AutoComplete,
  4. Button,
  5. Cascader,
  6. DatePicker, Form,
  7. Icon,
  8. Input,
  9. message,
  10. Modal,
  11. Select,
  12. Spin,
  13. Table,
  14. Tabs,
  15. Tag
  16. } from "antd";
  17. import { citySelect, provinceList } from '@/NewDicProvinceList';
  18. import {getSocialAttribute, beforeUploadFile, getLevel, ShowModal} from "@/tools.js";
  19. import moment from "moment";
  20. import $ from "jquery/src/ajax";
  21. import IntentionDetail from "../../NEW/intentionCustomer/intentionDetail/intentionDetail";
  22. const {TabPane} = Tabs;
  23. const { RangePicker } = DatePicker;
  24. class DepartmentStatistics extends Component{
  25. constructor(props) {
  26. super(props);
  27. this.state={
  28. releaseDate: [],
  29. superId:'',
  30. nameSearch: '',
  31. columns: [
  32. {
  33. title: "部门",
  34. dataIndex: "name",
  35. key: "name",
  36. width: '40%',
  37. },
  38. {
  39. title: "客户总数",
  40. dataIndex: "userCount",
  41. key: "userCount",
  42. render: (text, record) => {
  43. return (
  44. <div style={{cursor:"pointer"}} onClick={(e)=>{
  45. e.stopPropagation();
  46. }}>
  47. {text}
  48. </div>
  49. );
  50. },
  51. },
  52. {
  53. title: "成交客户总数",
  54. dataIndex: "completeCount",
  55. key: "completeCount",
  56. render: (text, record) => {
  57. return (
  58. <div style={{cursor:"pointer"}} onClick={(e)=>{
  59. e.stopPropagation();
  60. }}>
  61. {text}
  62. </div>
  63. );
  64. },
  65. },
  66. {
  67. title: "新增客户数",
  68. dataIndex: "inputCount",
  69. key: "inputCount",
  70. render: (text, record) => {
  71. return (
  72. <div style={{cursor:"pointer"}} onClick={(e)=>{
  73. e.stopPropagation();
  74. }}>
  75. {text}
  76. </div>
  77. );
  78. },
  79. },
  80. {
  81. title: "新增面谈数",
  82. dataIndex: "interviewCount",
  83. key: "interviewCount",
  84. render: (text, record) => {
  85. return (
  86. <div style={{cursor:"pointer"}} onClick={(e)=>{
  87. e.stopPropagation();
  88. }}>
  89. {text}
  90. </div>
  91. );
  92. },
  93. },
  94. {
  95. title: "新增领取客户数",
  96. dataIndex: "receiveCount",
  97. key: "receiveCount",
  98. render: (text, record) => {
  99. return (
  100. <div
  101. className={'receiveCount'}
  102. style={{cursor:record.aid ? "pointer" : "default"}}
  103. onClick={(e)=>{
  104. if(record.aid){
  105. e.stopPropagation();
  106. }
  107. }}>
  108. {text}
  109. </div>
  110. );
  111. },
  112. },
  113. ],
  114. contactsOption:null,
  115. loading: false,
  116. ispage: 1,
  117. };
  118. this.loadData = this.loadData.bind(this);
  119. this.reset = this.reset.bind(this);
  120. this.selectSuperId = this.selectSuperId.bind(this);
  121. }
  122. componentDidMount() {
  123. this.loadData();
  124. this.selectSuperId();
  125. }
  126. loadData(pageNo) {
  127. this.setState({
  128. loading: true,
  129. });
  130. let api = '/api/admin/customer/selectAllUser';
  131. $.ajax({
  132. method: "get",
  133. dataType: "json",
  134. crossDomain: false,
  135. url: globalConfig.context + api,
  136. data: {},
  137. success: function (data) {
  138. let theArr = [];
  139. if (data.error.length !== 0) {
  140. if (data.error && data.error.length) {
  141. message.warning(data.error[0].message);
  142. }
  143. } else {
  144. data.data.children = data.data.list;
  145. theArr.push(data.data);
  146. theArr = this.handleTabsInfor(theArr.concat(data.data.aList));
  147. console.log(theArr,'表格数据')
  148. this.setState({
  149. ispage: data.data.pageNo,
  150. dataSource: theArr,
  151. });
  152. }
  153. }.bind(this),
  154. }).always(
  155. function () {
  156. this.setState({
  157. loading: false,
  158. });
  159. }.bind(this)
  160. );
  161. };
  162. //表格数据处理
  163. handleTabsInfor(infor){
  164. for(let i=0;i<infor.length;i++){
  165. if(!infor[i].key){
  166. infor[i].key = infor[i].id ? infor[i].id : (infor[i].aid ? infor[i].aid : i)
  167. }
  168. if(infor[i].children){
  169. for(let c=0;c<infor[i].children.length;c++){
  170. infor[i].children[c].key = infor[i].children[c].id;
  171. infor[i].children[c].children = infor[i].children[c].list;
  172. if(infor[i].children[c].aList && Array.isArray(infor[i].children[c].aList) && infor[i].children[c].aList.length){
  173. if(infor[i].children[c].children && Array.isArray(infor[i].children[c].children)){
  174. for(let t of infor[i].children[c].aList){
  175. t.key = t.aid;
  176. t.name = t.aName;
  177. }
  178. infor[i].children[c].children = infor[i].children[c].children.concat(infor[i].children[c].aList);
  179. }
  180. }
  181. this.handleTabsInfor(infor[i].children);
  182. }
  183. }
  184. }
  185. return infor;
  186. }
  187. reset(){
  188. this.setState({
  189. releaseDate: [],
  190. superId:'',
  191. nameSearch: '',
  192. },()=>{
  193. this.loadData();
  194. });
  195. };
  196. //获取上级组织
  197. selectSuperId() {
  198. this.state.data = []
  199. $.ajax({
  200. method: "get",
  201. dataType: "json",
  202. crossDomain: false,
  203. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  204. data:{},
  205. success: function (data) {
  206. let theArr = [];
  207. let theId=[];//用于保存上级组织的ID和名称
  208. let thedata=data.data;
  209. if (!thedata) {
  210. if (data.error && data.error.length) {
  211. message.warning(data.error[0].message);
  212. };
  213. thedata = {};
  214. };
  215. for(var i=0;i<data.data.length;i++){
  216. let theData = data.data[i];
  217. theArr.push(
  218. <Select.Option value={theData.id} key={theData.id}>{theData.name}</Select.Option>
  219. );
  220. theId.push(
  221. [theData.id,theData.name]
  222. );
  223. };
  224. this.setState({
  225. SuperArr:thedata,
  226. contactsOption: theArr,
  227. theId: theId,
  228. orderStatusOptions:data.data,
  229. });
  230. }.bind(this),
  231. }).always(function () {
  232. this.setState({
  233. loading: false
  234. });
  235. }.bind(this));
  236. }
  237. render() {
  238. return(
  239. <div className="user-content">
  240. <div className="content-title">
  241. <span>指导意见</span>
  242. </div>
  243. <div className="user-search" style={{display:'flex',alignItems:'center'}}>
  244. <RangePicker
  245. style={{
  246. marginTop: '10px',
  247. }}
  248. value={[
  249. this.state.releaseDate[0]
  250. ? moment(this.state.releaseDate[0])
  251. : null,
  252. this.state.releaseDate[1]
  253. ? moment(this.state.releaseDate[1])
  254. : null,
  255. ]}
  256. onChange={(data, dataString) => {
  257. this.setState({ releaseDate: dataString });
  258. }}
  259. />
  260. <div>
  261. <Select placeholder="请选择部门"
  262. style={{ width:200,marginLeft:10}}
  263. value={this.state.superId}
  264. onChange={(e) => { this.setState({ superId: e }) }} notFoundContent="未获取到上级组织列表">
  265. {this.state.contactsOption}
  266. </Select>
  267. </div>
  268. <Input
  269. placeholder="客户名称"
  270. value={this.state.nameSearch}
  271. style={{ width: 150, marginRight: 10, marginLeft: 10 }}
  272. onChange={(e) => {
  273. this.setState({ nameSearch: e.target.value });
  274. }}
  275. />
  276. <Button
  277. type="primary"
  278. style={{ marginLeft: "10px", marginRight: 10 }}
  279. onClick={()=>{
  280. this.loadData();
  281. }}
  282. >
  283. 搜索
  284. </Button>
  285. <Button onClick={this.reset}>重置</Button>
  286. </div>
  287. <div className="patent-table">
  288. <Spin spinning={this.state.loading}>
  289. <Table
  290. columns={this.state.columns}
  291. dataSource={this.state.dataSource}
  292. pagination={false}
  293. />
  294. </Spin>
  295. </div>
  296. </div>
  297. )
  298. }
  299. }
  300. export default DepartmentStatistics;