followStatistics.jsx 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. import React from 'react';
  2. import ajax from 'jquery/src/ajax/xhr.js';
  3. import $ from 'jquery/src/ajax';
  4. import "./statistics.less";
  5. import { Button, Select, Table, Spin, message, Tabs, DatePicker } from 'antd';
  6. const TabPane = Tabs.TabPane;
  7. import moment from 'moment';
  8. import { intentionalService,newFollow } from '../../../dataDic.js';
  9. import {ChooseList} from "../../order/orderNew/chooseList";
  10. const FollowStatistics = React.createClass({
  11. loadData(pageNo, nub) {
  12. this.state.data = [];
  13. this.setState({
  14. loading: true
  15. });
  16. let urls = '';
  17. switch(nub) {
  18. case "1":
  19. urls = "";
  20. break; //日
  21. case "2":
  22. urls = "daySpan";
  23. break; //日
  24. case "3":
  25. urls = "weekSpan";
  26. break; //周
  27. case "4":
  28. urls = "monthSpan";
  29. break; //月
  30. case "5":
  31. urls = "quarterSpan";
  32. break; //季
  33. case "6":
  34. urls = "yearSpan";
  35. break; //年
  36. default:
  37. urls ='';
  38. }
  39. $.ajax({
  40. method: "get",
  41. dataType: "json",
  42. crossDomain: false,
  43. url: globalConfig.context + "/api/admin/customer/businessStatistic",
  44. data: {
  45. pageNo: pageNo || 1,
  46. pageSize: this.state.pagination.pageSize,
  47. startDate: this.state.releaseDate[0],
  48. endDate: this.state.releaseDate[1],
  49. timeSpan:this.state.releaseDate[0]?'':urls,
  50. depId:this.state.depId,
  51. businessGlossoryId:this.state.followSearch,
  52. depNo:this.state.departmentt
  53. },
  54. success: function(data) {
  55. let theArr = [];
  56. if(!data.data || !data.data.list) {
  57. if(data.error && data.error.length) {
  58. message.warning(data.error[0].message);
  59. };
  60. } else {
  61. for(let i = 0; i < data.data.list.length; i++) {
  62. let thisdata = data.data.list[i];
  63. theArr.push({
  64. key: i,
  65. id: thisdata.id,
  66. adminName: thisdata.adminName,
  67. departmentName: thisdata.departmentName,
  68. sendMaterialNo: thisdata.sendMaterialNo,
  69. interviewNo: thisdata.interviewNo,
  70. sendProspectusNo: thisdata.sendProspectusNo,
  71. quoteNo: thisdata.quoteNo,
  72. sendContractNo: thisdata.sendContractNo ,
  73. signContractNo: thisdata.signContractNo,
  74. onVisaNo: thisdata.onVisaNo,
  75. visaNo: thisdata.visaNo,
  76. });
  77. };
  78. this.state.pagination.current = data.data.pageNo;
  79. this.state.pagination.total = data.data.totalCount;
  80. };
  81. if(!data.data.list.length){
  82. this.state.pagination.current=0;
  83. this.state.pagination.total=0;
  84. }
  85. this.setState({
  86. dataSource: theArr,
  87. pagination: this.state.pagination,
  88. });
  89. }.bind(this),
  90. }).always(function() {
  91. this.setState({
  92. loading: false
  93. });
  94. }.bind(this));
  95. },
  96. getInitialState() {
  97. return {
  98. releaseDate: [],
  99. loading: false,
  100. callnub:'1',
  101. pagination: {
  102. defaultCurrent: 1,
  103. defaultPageSize: 10,
  104. showQuickJumper: true,
  105. pageSize: 10,
  106. onChange: function(page) {
  107. this.call(page)
  108. }.bind(this),
  109. showTotal: function(total) {
  110. return '共' + total + '条数据';
  111. }
  112. },
  113. columns: [{
  114. title: '营销员',
  115. dataIndex: 'adminName',
  116. key: 'adminName',
  117. }, {
  118. title: '部门',
  119. dataIndex: 'departmentName',
  120. key: 'departmentName',
  121. }, {
  122. title: '已发项目介绍资料',
  123. dataIndex: 'sendMaterialNo',
  124. key: 'sendMaterialNo',
  125. }, {
  126. title: '已约面谈',
  127. dataIndex: 'interviewNo',
  128. key: 'interviewNo',
  129. }, {
  130. title: '已发合同计划书',
  131. dataIndex: 'sendProspectusNo',
  132. key: 'sendProspectusNo',
  133. }, {
  134. title: '已报价',
  135. dataIndex: 'quoteNo',
  136. key: 'quoteNo',
  137. }, {
  138. title: '已发合同',
  139. dataIndex: 'sendContractNo',
  140. key: 'sendContractNo',
  141. }, {
  142. title: '已签合同',
  143. dataIndex: 'signContractNo',
  144. key: 'signContractNo',
  145. }, {
  146. title: '面谈中',
  147. dataIndex: 'onVisaNo',
  148. key: 'onVisaNo',
  149. }, {
  150. title: '已面签',
  151. dataIndex: 'visaNo',
  152. key: 'visaNo',
  153. }]
  154. }
  155. },
  156. //部门
  157. departmentList() {
  158. this.setState({
  159. loading: true
  160. });
  161. $.ajax({
  162. method: "get",
  163. dataType: "json",
  164. crossDomain: false,
  165. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  166. data: {
  167. },
  168. success: function(data) {
  169. let thedata = data.data;
  170. let theArr=[];
  171. if(!thedata) {
  172. if(data.error && data.error.length) {
  173. message.warning(data.error[0].message);
  174. };
  175. thedata = {};
  176. }else{
  177. thedata.map(function(item,index){
  178. theArr.push({
  179. key:index,
  180. name:item.name,
  181. id:item.id,
  182. depNo:item.depNo
  183. })
  184. })
  185. }
  186. this.setState({
  187. departmentArr:theArr,
  188. })
  189. }.bind(this),
  190. }).always(function() {
  191. this.setState({
  192. loading: false
  193. });
  194. }.bind(this));
  195. },
  196. callback(e) {
  197. this.setState({
  198. callnub: e,
  199. releaseDate:[]
  200. })
  201. this.loadData(1, e)
  202. },
  203. call(a){
  204. this.loadData(a, this.state.callnub)
  205. },
  206. search() {
  207. if(this.state.releaseDate[0]){
  208. this.setState({
  209. callnub:'1'
  210. })
  211. }else{
  212. this.state.releaseDate=[]
  213. }
  214. this.loadData(1, this.state.callnub)
  215. },
  216. reset() {
  217. this.state.departmentt=undefined;
  218. this.state.releaseDate = [];
  219. this.state.followSearch=undefined;
  220. this.loadData(1, this.state.callnub);
  221. },
  222. changeList(arr) {
  223. const newArr = [];
  224. this.state.columns.forEach(item => {
  225. arr.forEach(val => {
  226. if (val === item.title) {
  227. newArr.push(item);
  228. }
  229. });
  230. });
  231. this.setState({
  232. changeList: newArr
  233. });
  234. },
  235. componentWillMount() {
  236. this.loadData();
  237. this.departmentList()
  238. },
  239. render() {
  240. const { RangePicker } = DatePicker;
  241. let departmentArr = this.state.departmentArr || [];
  242. return <div className="visitContant">
  243. <div className="visitTitle">
  244. <Tabs defaultActiveKey="1" className="test">
  245. <TabPane tab="搜索" key="1">
  246. <div className="user-search" style={{paddingTop:'11px'}}>
  247. <span className="titleTime">起止时间</span>
  248. <RangePicker
  249. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  250. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  251. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  252. <span style={{marginRight:'15px',marginLeft:'15px'}}>业务类型:</span>
  253. <Select placeholder="业务类型" value={this.state.followSearch} onChange={(e) => {
  254. this.setState({followSearch:e})}} style={{width:'150px'}}>
  255. {
  256. intentionalService.map(function (item) {
  257. return <Select.Option key={item.value} >{item.key}</Select.Option>
  258. })
  259. }
  260. </Select>
  261. <span style={{marginRight:'15px',marginLeft:'15px'}}>部门:</span>
  262. <Select placeholder="选择部门" style={{width:'150px'}}
  263. value={this.state.departmentt}
  264. onChange={(e) => { this.setState({ departmentt: e }) }}>
  265. {
  266. departmentArr.map(function (item) {
  267. return <Select.Option key={item.depNo} >{item.name}</Select.Option>
  268. })
  269. }
  270. </Select>
  271. <Button onClick={this.search} className="blue" style={{background:'red',color:'#ffffff',border:'none'}}>统计</Button>
  272. <Button onClick={this.reset} className="green" style={{background:'green',color:'#ffffff',border:'none'}}>重置</Button>
  273. </div>
  274. </TabPane>
  275. <TabPane tab="更改表格显示数据" key="2">
  276. <div style={{ marginLeft: 10 }}>
  277. <ChooseList
  278. columns={this.state.columns}
  279. changeFn={this.changeList}
  280. changeList={this.state.changeList}
  281. top={55}
  282. margin={11}
  283. />
  284. </div>
  285. </TabPane>
  286. </Tabs>
  287. <div className="clearfix" style={{marginTop:'30px',marginLeft:'20px'}}>
  288. <Tabs onChange={this.callback} type="card" activeKey={this.state.callnub}>
  289. <TabPane tab="所有业务跟进进度" key="1"></TabPane>
  290. <TabPane tab="本日业务跟进进度" key="2"></TabPane>
  291. <TabPane tab="本周业务跟进进度" key="3"></TabPane>
  292. <TabPane tab="本月业务跟进进度" key="4"></TabPane>
  293. <TabPane tab="本季业务跟进进度" key="5"></TabPane>
  294. <TabPane tab="本年业务跟进进度" key="6"></TabPane>
  295. </Tabs>
  296. </div>
  297. <div className="clearfix">
  298. <div className="maintitle">业务跟进进度情况统计表</div>
  299. <div className="patent-table">
  300. <Spin spinning={this.state.loading}>
  301. <Table size="middle" columns={
  302. this.state.changeList
  303. ? this.state.changeList
  304. : this.state.columns
  305. }
  306. dataSource={this.state.dataSource}
  307. pagination={this.state.pagination}
  308. onRowClick={this.tableRowClick} />
  309. </Spin>
  310. </div>
  311. </div>
  312. </div>
  313. </div>
  314. }
  315. });
  316. export default FollowStatistics;