index.jsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. import React,{ Component } from 'react';
  2. import {AutoComplete, Button, DatePicker, Input, message, Select, Spin, Table, Tabs} from "antd";
  3. import {
  4. ShowModal,
  5. } from "@/tools";
  6. import {ChooseList} from "../../../order/orderNew/chooseList";
  7. import $ from "jquery/src/ajax";
  8. import './index.less';
  9. import moment from "moment";
  10. import TabelContent from '../../../../common/tabelContent'
  11. import DetailedList from './detailedList';
  12. const {TabPane} = Tabs;
  13. const { RangePicker } = DatePicker;
  14. class SignatureStatistics extends Component{
  15. constructor(props) {
  16. super(props);
  17. this.state={
  18. pageNo:1,
  19. loading:false,
  20. changeList:[],
  21. columns: [
  22. {
  23. title: "序号",
  24. dataIndex: "key",
  25. key: "key",
  26. },
  27. {
  28. title: "排名",
  29. dataIndex: "name",
  30. key: "name",
  31. },
  32. {
  33. title: "省份",
  34. dataIndex: "tg",
  35. key: "tg",
  36. className: 'projectTable',
  37. onCellClick :(record, event)=>{
  38. event.stopPropagation();
  39. this.setState({
  40. status:2,
  41. visible:true,
  42. aid:record.aid
  43. })
  44. }
  45. },
  46. {
  47. title: "签单人数(人)",
  48. dataIndex: "duration",
  49. key: "duration",
  50. className: 'projectTable',
  51. onCellClick :(record, event)=>{
  52. event.stopPropagation();
  53. this.setState({
  54. status:2,
  55. visible:true,
  56. aid:record.aid
  57. })
  58. }
  59. },
  60. {
  61. title: "总单量(个)",
  62. dataIndex: "wsh",
  63. key: "wsh",
  64. className: 'projectTable',
  65. onCellClick :(record, event)=>{
  66. event.stopPropagation();
  67. this.setState({
  68. status:1,
  69. visible:true,
  70. aid:record.aid
  71. })
  72. }
  73. },
  74. {
  75. title: "总签单额(万元)",
  76. dataIndex: "bh",
  77. key: "bh",
  78. className: 'projectTable',
  79. onCellClick :(record, event)=>{
  80. event.stopPropagation();
  81. this.setState({
  82. status:0,
  83. visible:true,
  84. aid:record.aid
  85. })
  86. }
  87. },
  88. {
  89. title: "时间段",
  90. dataIndex: "dk",
  91. key: "dk",
  92. className: 'projectTable',
  93. onCellClick :(record, event)=>{
  94. event.stopPropagation();
  95. this.setState({
  96. status: undefined,
  97. clockIn:1,
  98. visible:true,
  99. aid:record.aid
  100. })
  101. }
  102. },
  103. {
  104. title: "年度完成率",
  105. dataIndex: "ws",
  106. key: "ws",
  107. },
  108. ],
  109. pagination: {
  110. defaultCurrent: 1,
  111. defaultPageSize: 10,
  112. showQuickJumper: true,
  113. pageSize: 10,
  114. onChange: function(page) {
  115. this.loadData(page);
  116. }.bind(this),
  117. showTotal: function(total) {
  118. return "共" + total + "条数据";
  119. }
  120. },
  121. dataSource: [],
  122. releaseDate:[],
  123. createReleaseDate:[],
  124. superId:undefined,
  125. clockIn:0,
  126. }
  127. this.loadData = this.loadData.bind(this);
  128. this.resetAll = this.resetAll.bind(this);
  129. this.changeList = this.changeList.bind(this);
  130. this.selectSuperId = this.selectSuperId.bind(this);
  131. this.supervisor = this.supervisor.bind(this);
  132. this.httpChange = this.httpChange.bind(this);
  133. this.blurChange = this.blurChange.bind(this);
  134. this.selectAuto = this.selectAuto.bind(this);
  135. this.exportExec = this.exportExec.bind(this);
  136. }
  137. //获取上级组织
  138. selectSuperId() {
  139. $.ajax({
  140. method: "get",
  141. dataType: "json",
  142. crossDomain: false,
  143. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  144. data:{},
  145. success: function (data) {
  146. let theArr = [];
  147. if (data.error && data.error.length === 0) {
  148. for(let i=0;i<data.data.length;i++){
  149. let theData = data.data[i];
  150. theArr.push(
  151. <Select.Option value={theData.id} key={theData.id}>{theData.name}</Select.Option>
  152. );
  153. };
  154. this.setState({
  155. contactsOption: theArr,
  156. });
  157. }else{
  158. message.warning(data.error[0].message);
  159. }
  160. }.bind(this),
  161. }).always(function () {
  162. this.setState({
  163. loading: false
  164. });
  165. }.bind(this));
  166. }
  167. changeList(arr) {
  168. const newArr = [];
  169. this.state.columns.forEach(item => {
  170. arr.forEach(val => {
  171. if (val === item.title) {
  172. newArr.push(item);
  173. }
  174. });
  175. });
  176. this.setState({
  177. changeList: newArr
  178. });
  179. }
  180. loadData(pageNo) {
  181. this.setState({
  182. loading:true
  183. })
  184. $.ajax({
  185. method: "get",
  186. dataType: "json",
  187. crossDomain: false,
  188. url: globalConfig.context + "/api/admin/release/publicReleaseStatistics",
  189. data: {
  190. pageNo: pageNo || 1,
  191. pageSize: this.state.pagination.pageSize,
  192. clockStart:this.state.releaseDate[0] || undefined,
  193. clockEnd:this.state.releaseDate[1] || undefined,
  194. createStart:this.state.createReleaseDate[0] || undefined,
  195. createEnd:this.state.createReleaseDate[1] || undefined,
  196. depId:this.state.superId || undefined,
  197. aid:this.state.theTypes
  198. },
  199. success: function(data) {
  200. ShowModal(this);
  201. this.setState({
  202. loading:false
  203. })
  204. let theArr = [];
  205. if (data.error && data.error.length === 0) {
  206. for (let i = 0; i < data.data.list.length; i++) {
  207. let thisdata = data.data.list[i];
  208. thisdata.key=(data.data.pageNo - 1) * data.data.pageSize + i + 1;
  209. theArr.push(thisdata);
  210. }
  211. this.state.pagination.current = data.data.pageNo;
  212. this.state.pagination.total = data.data.totalCount;
  213. if (data.data && data.data.list && !data.data.list.length) {
  214. this.state.pagination.current = 0;
  215. this.state.pagination.total = 0;
  216. }
  217. this.setState({
  218. dataSource: theArr,
  219. pagination: this.state.pagination,
  220. pageNo:data.data.pageNo
  221. });
  222. }else{
  223. message.warning(data.error[0].message);
  224. }
  225. }.bind(this)
  226. }).always(
  227. function() {
  228. this.setState({
  229. loading: false
  230. });
  231. }.bind(this)
  232. );
  233. }
  234. resetAll() {
  235. this.setState({
  236. releaseDate:[],
  237. createReleaseDate:[],
  238. superId:undefined,
  239. theTypes:undefined,
  240. auto:''
  241. },()=>{
  242. this.loadData();
  243. })
  244. }
  245. supervisor(e) {
  246. $.ajax({
  247. method: "get",
  248. dataType: "json",
  249. crossDomain: false,
  250. url: globalConfig.context + "/api/admin/customer/listAdminByName",
  251. data: {
  252. adminName: e,
  253. },
  254. success: function (data) {
  255. let thedata = data.data;
  256. if (!thedata) {
  257. if (data.error && data.error.length) {
  258. message.warning(data.error[0].message);
  259. }
  260. thedata = {};
  261. }
  262. this.setState({
  263. customerArr: thedata,
  264. });
  265. }.bind(this),
  266. }).always(
  267. function () {
  268. }.bind(this)
  269. );
  270. }
  271. httpChange(e) {
  272. if (e.length >= 1) {
  273. this.supervisor(e);
  274. }
  275. this.setState({
  276. auto: e,
  277. });
  278. }
  279. selectAuto(value, options) {
  280. this.setState({
  281. auto: value,
  282. });
  283. }
  284. blurChange(e) {
  285. let theType = "";
  286. let contactLists = this.state.customerArr || [];
  287. if (e) {
  288. contactLists.map(function (item) {
  289. if (item.name == e.toString()) {
  290. theType = item.id;
  291. }
  292. });
  293. }
  294. this.setState({
  295. theTypes: theType,
  296. });
  297. }
  298. componentWillMount() {
  299. this.loadData();
  300. this.selectSuperId();
  301. }
  302. exportExec(){
  303. let data = {
  304. clockStart:this.state.releaseDate[0],
  305. clockEnd:this.state.releaseDate[1],
  306. createStart:this.state.createReleaseDate[0],
  307. createEnd:this.state.createReleaseDate[1],
  308. depId:this.state.superId,
  309. aid:this.state.theTypes
  310. };
  311. for(let i of Object.keys(data)){
  312. if(!data[i]){
  313. delete data[i]
  314. }
  315. }
  316. window.location.href =
  317. globalConfig.context +
  318. "/api/admin/release/publicReleaseStatistics/export?" +
  319. $.param(data);
  320. }
  321. render() {
  322. const dataSources = this.state.customerArr || [];
  323. const options = dataSources.map((group) => (
  324. <Select.Option key={group.id} value={group.name}>
  325. {group.name}
  326. </Select.Option>
  327. ));
  328. return (
  329. <div className="user-content signatureStatistics">
  330. <div className="content-title">
  331. <span>
  332. 签单统计表
  333. </span>
  334. </div>
  335. <TabelContent
  336. searchList={[
  337. {
  338. type:'departmentSelect',
  339. dataKey:'departmentId',
  340. placeholder:'请选择部门'
  341. },
  342. {
  343. type:'text',
  344. dataKey:'super',
  345. placeholder:'请输入订单编号'
  346. },
  347. {
  348. type:'times',
  349. title:'下单时间',
  350. dataKey:['startTime','endTime'],
  351. },
  352. {
  353. type:'times',
  354. title:'合同时间',
  355. dataKey:['startTime1','endTime1'],
  356. },
  357. {
  358. type:'select',
  359. dataKey:'superId',
  360. selectList:[
  361. {
  362. value:'1',
  363. label:'是'
  364. },
  365. {
  366. value:'0',
  367. label:'否'
  368. }
  369. ]
  370. }
  371. ]}
  372. columns={this.state.columns}
  373. tabelApi={'/api/admin/release/publicReleaseStatistics'}
  374. exportApi={'/api/admin/release/publicReleaseStatistics/export'}
  375. dataProcessing={(data)=>{
  376. let theArr = [];
  377. for (let i = 0; i < data.data.list.length; i++) {
  378. let thisdata = data.data.list[i];
  379. thisdata.key=(data.data.pageNo - 1) * data.data.pageSize + i + 1;
  380. theArr.push(thisdata);
  381. }
  382. return theArr;
  383. }}
  384. />
  385. {/*<Tabs defaultActiveKey="1" className="test">*/}
  386. {/* <TabPane tab="搜索" key="1">*/}
  387. {/* <div className="user-search" style={{*/}
  388. {/* marginTop:'10px',*/}
  389. {/* marginLeft:'10px',*/}
  390. {/* marginRight:'10px'*/}
  391. {/* }}>*/}
  392. {/* <span style={{ marginRight: "10px" }}>*/}
  393. {/* <Select*/}
  394. {/* placeholder="请选择部门"*/}
  395. {/* style={{ width:200,marginLeft:10}}*/}
  396. {/* value={this.state.superId}*/}
  397. {/* onChange={(e) => { this.setState({ superId: e }) }}*/}
  398. {/* notFoundContent="未获取到上级组织列表">*/}
  399. {/* {this.state.contactsOption}*/}
  400. {/* </Select>*/}
  401. {/* </span>*/}
  402. {/* <span style={{ marginRight: "10px" }}>*/}
  403. {/* <AutoComplete*/}
  404. {/* className="certain-category-search"*/}
  405. {/* dropdownClassName="certain-category-search-dropdown"*/}
  406. {/* dropdownMatchSelectWidth={false}*/}
  407. {/* dropdownStyle={{ width: 120 }}*/}
  408. {/* style={{ width: "120px" }}*/}
  409. {/* dataSource={options}*/}
  410. {/* placeholder='输入公出申请人'*/}
  411. {/* value={this.state.auto}*/}
  412. {/* onChange={this.httpChange}*/}
  413. {/* filterOption={true}*/}
  414. {/* onBlur={this.blurChange}*/}
  415. {/* onSelect={this.selectAuto}*/}
  416. {/* >*/}
  417. {/* <Input />*/}
  418. {/* </AutoComplete>*/}
  419. {/* </span>*/}
  420. {/* <span style={{ marginRight: "10px" }}>*/}
  421. {/* <span style={{marginRight:'10px',marginBottom:'10px'}}>打卡时间 :</span>*/}
  422. {/* <RangePicker*/}
  423. {/* style={{marginRight:'10px',marginBottom:'10px'}}*/}
  424. {/* value={[*/}
  425. {/* this.state.releaseDate[0]*/}
  426. {/* ? moment(this.state.releaseDate[0])*/}
  427. {/* : null,*/}
  428. {/* this.state.releaseDate[1]*/}
  429. {/* ? moment(this.state.releaseDate[1])*/}
  430. {/* : null,*/}
  431. {/* ]}*/}
  432. {/* onChange={(data, dataString) => {*/}
  433. {/* this.setState({ releaseDate: dataString });*/}
  434. {/* }}*/}
  435. {/* />*/}
  436. {/* </span>*/}
  437. {/* <span style={{ marginRight: "10px" }}>*/}
  438. {/* <span style={{marginRight:'10px',marginBottom:'10px'}}>创建时间 :</span>*/}
  439. {/* <RangePicker*/}
  440. {/* style={{marginRight:'10px',marginBottom:'10px'}}*/}
  441. {/* value={[*/}
  442. {/* this.state.createReleaseDate[0]*/}
  443. {/* ? moment(this.state.createReleaseDate[0])*/}
  444. {/* : null,*/}
  445. {/* this.state.createReleaseDate[1]*/}
  446. {/* ? moment(this.state.createReleaseDate[1])*/}
  447. {/* : null,*/}
  448. {/* ]}*/}
  449. {/* onChange={(data, dataString) => {*/}
  450. {/* this.setState({ createReleaseDate: dataString });*/}
  451. {/* }}*/}
  452. {/* />*/}
  453. {/* </span>*/}
  454. {/* <Button type="primary" onClick={()=>{*/}
  455. {/* this.loadData();*/}
  456. {/* }} style={{marginRight:'10px',marginBottom:'10px'}}>搜索</Button>*/}
  457. {/* <Button onClick={this.resetAll} style={{marginRight:'10px',marginBottom:'10px'}}>重置</Button>*/}
  458. {/* </div>*/}
  459. {/* </TabPane>*/}
  460. {/* <TabPane tab="更改表格显示数据" key="2">*/}
  461. {/* <div style={{ marginLeft: 10 }}>*/}
  462. {/* <ChooseList*/}
  463. {/* columns={this.state.columns}*/}
  464. {/* changeFn={this.changeList}*/}
  465. {/* changeList={this.state.changeList}*/}
  466. {/* top={55}*/}
  467. {/* margin={11}*/}
  468. {/* />*/}
  469. {/* </div>*/}
  470. {/* </TabPane>*/}
  471. {/* <TabPane tab="导出" key="3">*/}
  472. {/* <div style={{ float: "left" }}>*/}
  473. {/* <Button onClick={this.exportExec} style={{ margin: 10 }}>导出excel</Button>*/}
  474. {/* </div>*/}
  475. {/* </TabPane>*/}
  476. {/*</Tabs>*/}
  477. {/*<div className="patent-table">*/}
  478. {/* <Spin spinning={this.state.loading}>*/}
  479. {/* <Table*/}
  480. {/* bordered*/}
  481. {/* size="middle"*/}
  482. {/* scroll={{ x: 800, y: 0 }}*/}
  483. {/* columns={*/}
  484. {/* this.state.changeList.length > 0*/}
  485. {/* ? this.state.changeList*/}
  486. {/* : this.state.columns*/}
  487. {/* }*/}
  488. {/* dataSource={this.state.dataSource}*/}
  489. {/* pagination={this.state.pagination}*/}
  490. {/* />*/}
  491. {/* </Spin>*/}
  492. {/*</div>*/}
  493. {this.state.visible ? <DetailedList
  494. searchList={[
  495. {
  496. type:'departmentSelect',
  497. dataKey:'departmentId'
  498. },
  499. {
  500. type:'text',
  501. dataKey:'super'
  502. },
  503. {
  504. type:'select',
  505. dataKey:'superId',
  506. selectList:[
  507. {
  508. value:'1',
  509. label:'是'
  510. },
  511. {
  512. value:'0',
  513. label:'否'
  514. }
  515. ]
  516. }
  517. ]}
  518. status={this.state.status}
  519. clockIn={this.state.clockIn || undefined}
  520. visible={this.state.visible}
  521. aid={this.state.aid}
  522. onCancel={()=>{
  523. this.setState({
  524. visible:false,
  525. clockIn:0,
  526. })
  527. }}/> : null}
  528. </div>
  529. )
  530. }
  531. }
  532. export default SignatureStatistics;