index.jsx 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. import React,{ Component } from 'react';
  2. import {message, Select} from "antd";
  3. import {
  4. ShowModal,
  5. } from "@/tools";
  6. import { provinceList} from '@/NewDicProvinceList';
  7. import $ from "jquery/src/ajax";
  8. import './index.less';
  9. import TabelContent from '../../../../common/tabelContent'
  10. import DetailedList from './detailedList';
  11. class SignatureStatistics extends Component{
  12. constructor(props) {
  13. super(props);
  14. this.state={
  15. pageNo:1,
  16. loading:false,
  17. changeList:[],
  18. columns: [
  19. {
  20. title: "序号",
  21. dataIndex: "key",
  22. key: "key",
  23. },
  24. {
  25. title: "排名",
  26. dataIndex: "name",
  27. key: "name",
  28. },
  29. {
  30. title: "省份",
  31. dataIndex: "tg",
  32. key: "tg",
  33. className: 'projectTable',
  34. onCellClick :(record, event)=>{
  35. event.stopPropagation();
  36. this.setState({
  37. status:2,
  38. visible:true,
  39. aid:record.aid
  40. })
  41. }
  42. },
  43. {
  44. title: "签单人数(人)",
  45. dataIndex: "duration",
  46. key: "duration",
  47. className: 'projectTable',
  48. onCellClick :(record, event)=>{
  49. event.stopPropagation();
  50. this.setState({
  51. status:2,
  52. visible:true,
  53. aid:record.aid
  54. })
  55. }
  56. },
  57. {
  58. title: "总单量(个)",
  59. dataIndex: "wsh",
  60. key: "wsh",
  61. className: 'projectTable',
  62. onCellClick :(record, event)=>{
  63. event.stopPropagation();
  64. this.setState({
  65. status:1,
  66. visible:true,
  67. aid:record.aid
  68. })
  69. }
  70. },
  71. {
  72. title: "总签单额(万元)",
  73. dataIndex: "bh",
  74. key: "bh",
  75. className: 'projectTable',
  76. onCellClick :(record, event)=>{
  77. event.stopPropagation();
  78. this.setState({
  79. status:0,
  80. visible:true,
  81. aid:record.aid
  82. })
  83. }
  84. },
  85. {
  86. title: "时间段",
  87. dataIndex: "dk",
  88. key: "dk",
  89. className: 'projectTable',
  90. onCellClick :(record, event)=>{
  91. event.stopPropagation();
  92. this.setState({
  93. status: undefined,
  94. clockIn:1,
  95. visible:true,
  96. aid:record.aid
  97. })
  98. }
  99. },
  100. {
  101. title: "年度完成率",
  102. dataIndex: "ws",
  103. key: "ws",
  104. },
  105. ],
  106. pagination: {
  107. defaultCurrent: 1,
  108. defaultPageSize: 10,
  109. showQuickJumper: true,
  110. pageSize: 10,
  111. onChange: function(page) {
  112. this.loadData(page);
  113. }.bind(this),
  114. showTotal: function(total) {
  115. return "共" + total + "条数据";
  116. }
  117. },
  118. dataSource: [],
  119. releaseDate:[],
  120. createReleaseDate:[],
  121. superId:undefined,
  122. clockIn:0,
  123. }
  124. this.loadData = this.loadData.bind(this);
  125. this.resetAll = this.resetAll.bind(this);
  126. this.changeList = this.changeList.bind(this);
  127. this.selectSuperId = this.selectSuperId.bind(this);
  128. this.supervisor = this.supervisor.bind(this);
  129. this.httpChange = this.httpChange.bind(this);
  130. this.blurChange = this.blurChange.bind(this);
  131. this.selectAuto = this.selectAuto.bind(this);
  132. this.exportExec = this.exportExec.bind(this);
  133. }
  134. //获取上级组织
  135. selectSuperId() {
  136. $.ajax({
  137. method: "get",
  138. dataType: "json",
  139. crossDomain: false,
  140. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  141. data:{},
  142. success: function (data) {
  143. let theArr = [];
  144. if (data.error && data.error.length === 0) {
  145. for(let i=0;i<data.data.length;i++){
  146. let theData = data.data[i];
  147. theArr.push(
  148. <Select.Option value={theData.id} key={theData.id}>{theData.name}</Select.Option>
  149. );
  150. };
  151. this.setState({
  152. contactsOption: theArr,
  153. });
  154. }else{
  155. message.warning(data.error[0].message);
  156. }
  157. }.bind(this),
  158. }).always(function () {
  159. this.setState({
  160. loading: false
  161. });
  162. }.bind(this));
  163. }
  164. changeList(arr) {
  165. const newArr = [];
  166. this.state.columns.forEach(item => {
  167. arr.forEach(val => {
  168. if (val === item.title) {
  169. newArr.push(item);
  170. }
  171. });
  172. });
  173. this.setState({
  174. changeList: newArr
  175. });
  176. }
  177. loadData(pageNo) {
  178. this.setState({
  179. loading:true
  180. })
  181. $.ajax({
  182. method: "get",
  183. dataType: "json",
  184. crossDomain: false,
  185. url: globalConfig.context + "/api/admin/release/publicReleaseStatistics",
  186. data: {
  187. pageNo: pageNo || 1,
  188. pageSize: this.state.pagination.pageSize,
  189. clockStart:this.state.releaseDate[0] || undefined,
  190. clockEnd:this.state.releaseDate[1] || undefined,
  191. createStart:this.state.createReleaseDate[0] || undefined,
  192. createEnd:this.state.createReleaseDate[1] || undefined,
  193. depId:this.state.superId || undefined,
  194. aid:this.state.theTypes
  195. },
  196. success: function(data) {
  197. ShowModal(this);
  198. this.setState({
  199. loading:false
  200. })
  201. let theArr = [];
  202. if (data.error && data.error.length === 0) {
  203. for (let i = 0; i < data.data.list.length; i++) {
  204. let thisdata = data.data.list[i];
  205. thisdata.key=(data.data.pageNo - 1) * data.data.pageSize + i + 1;
  206. theArr.push(thisdata);
  207. }
  208. this.state.pagination.current = data.data.pageNo;
  209. this.state.pagination.total = data.data.totalCount;
  210. if (data.data && data.data.list && !data.data.list.length) {
  211. this.state.pagination.current = 0;
  212. this.state.pagination.total = 0;
  213. }
  214. this.setState({
  215. dataSource: theArr,
  216. pagination: this.state.pagination,
  217. pageNo:data.data.pageNo
  218. });
  219. }else{
  220. message.warning(data.error[0].message);
  221. }
  222. }.bind(this)
  223. }).always(
  224. function() {
  225. this.setState({
  226. loading: false
  227. });
  228. }.bind(this)
  229. );
  230. }
  231. resetAll() {
  232. this.setState({
  233. releaseDate:[],
  234. createReleaseDate:[],
  235. superId:undefined,
  236. theTypes:undefined,
  237. auto:''
  238. },()=>{
  239. this.loadData();
  240. })
  241. }
  242. supervisor(e) {
  243. $.ajax({
  244. method: "get",
  245. dataType: "json",
  246. crossDomain: false,
  247. url: globalConfig.context + "/api/admin/customer/listAdminByName",
  248. data: {
  249. adminName: e,
  250. },
  251. success: function (data) {
  252. let thedata = data.data;
  253. if (!thedata) {
  254. if (data.error && data.error.length) {
  255. message.warning(data.error[0].message);
  256. }
  257. thedata = {};
  258. }
  259. this.setState({
  260. customerArr: thedata,
  261. });
  262. }.bind(this),
  263. }).always(
  264. function () {
  265. }.bind(this)
  266. );
  267. }
  268. httpChange(e) {
  269. if (e.length >= 1) {
  270. this.supervisor(e);
  271. }
  272. this.setState({
  273. auto: e,
  274. });
  275. }
  276. selectAuto(value, options) {
  277. this.setState({
  278. auto: value,
  279. });
  280. }
  281. blurChange(e) {
  282. let theType = "";
  283. let contactLists = this.state.customerArr || [];
  284. if (e) {
  285. contactLists.map(function (item) {
  286. if (item.name == e.toString()) {
  287. theType = item.id;
  288. }
  289. });
  290. }
  291. this.setState({
  292. theTypes: theType,
  293. });
  294. }
  295. componentWillMount() {
  296. this.loadData();
  297. this.selectSuperId();
  298. }
  299. exportExec(){
  300. let data = {
  301. clockStart:this.state.releaseDate[0],
  302. clockEnd:this.state.releaseDate[1],
  303. createStart:this.state.createReleaseDate[0],
  304. createEnd:this.state.createReleaseDate[1],
  305. depId:this.state.superId,
  306. aid:this.state.theTypes
  307. };
  308. for(let i of Object.keys(data)){
  309. if(!data[i]){
  310. delete data[i]
  311. }
  312. }
  313. window.location.href =
  314. globalConfig.context +
  315. "/api/admin/release/publicReleaseStatistics/export?" +
  316. $.param(data);
  317. }
  318. searchList(){
  319. let arr = [
  320. {
  321. type:'departmentSelect',
  322. dataKey:'departmentId',
  323. placeholder:'请选择部门'
  324. },
  325. {
  326. type:'text',
  327. dataKey:'super',
  328. placeholder:'请输入订单编号'
  329. },
  330. {
  331. type:'times',
  332. title:'下单时间',
  333. dataKey:['startTime','endTime'],
  334. },
  335. {
  336. type:'times',
  337. title:'合同时间',
  338. dataKey:['startTime1','endTime1'],
  339. },
  340. {
  341. type:'select',
  342. dataKey:'superId',
  343. placeholder:'请选择排序',
  344. selectList:[
  345. {
  346. value:'1',
  347. label:'按总签单排序'
  348. },
  349. {
  350. value:'0',
  351. label:'否'
  352. }
  353. ]
  354. },
  355. {
  356. type:'select',
  357. dataKey:'province',
  358. placeholder:'请选择省份',
  359. selectOptionList:()=>{
  360. let Province = [];
  361. provinceList.map(function(item) {
  362. let id = String(item.id)
  363. Province.push(
  364. <Select.Option value={id} key={item.name}>{item.name}</Select.Option>
  365. )
  366. });
  367. return Province
  368. },
  369. }
  370. ]
  371. return arr;
  372. }
  373. render() {
  374. const dataSources = this.state.customerArr || [];
  375. const options = dataSources.map((group) => (
  376. <Select.Option key={group.id} value={group.name}>
  377. {group.name}
  378. </Select.Option>
  379. ));
  380. return (
  381. <div className="user-content signatureStatistics">
  382. <div className="content-title">
  383. <span>
  384. 签单统计表
  385. </span>
  386. </div>
  387. <TabelContent
  388. searchList={this.searchList()}
  389. columns={this.state.columns}
  390. tabelApi={'/api/admin/newOrder/statisticsList'}
  391. exportApi={'/api/admin/newOrder/statisticsListExprot'}
  392. dataProcessing={(data)=>{
  393. let theArr = [];
  394. for (let i = 0; i < data.data.list.length; i++) {
  395. let thisdata = data.data.list[i];
  396. thisdata.key=(data.data.pageNo - 1) * data.data.pageSize + i + 1;
  397. theArr.push(thisdata);
  398. }
  399. return theArr;
  400. }}
  401. />
  402. {this.state.visible ? <DetailedList
  403. status={this.state.status}
  404. clockIn={this.state.clockIn || undefined}
  405. visible={this.state.visible}
  406. aid={this.state.aid}
  407. onCancel={()=>{
  408. this.setState({
  409. visible:false,
  410. clockIn:0,
  411. })
  412. }}/> : null}
  413. </div>
  414. )
  415. }
  416. }
  417. export default SignatureStatistics;