departWater.jsx 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. import React from 'react';
  2. import $ from 'jquery/src/ajax';
  3. import moment from 'moment';
  4. import '../distribute/public.less';
  5. import { Button, Input, Spin, Table,Select, Switch, message, DatePicker,Tabs } from 'antd';
  6. import { getTransactionProject, ShowModal } from "@/tools";
  7. import WaterDesc from './waterDetail';
  8. import ShowModalDiv from "@/showModal.jsx";
  9. import {ChooseList} from "../../order/orderNew/chooseList";
  10. const {TabPane} = Tabs
  11. const MyWater = React.createClass({
  12. departmentList() {
  13. this.setState({
  14. loading: true
  15. });
  16. $.ajax({
  17. method: "get",
  18. dataType: "json",
  19. crossDomain: false,
  20. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  21. data: {},
  22. success: function(data) {
  23. let thedata = data.data;
  24. let theArr=[];
  25. if(!thedata) {
  26. if(data.error && data.error.length) {
  27. message.warning(data.error[0].message);
  28. };
  29. thedata = {};
  30. }else{
  31. thedata.map(function(item,index){
  32. theArr.push({
  33. key:index,
  34. name:item.name,
  35. id:item.id,
  36. })
  37. })
  38. }
  39. this.setState({
  40. departmentArr:theArr,
  41. })
  42. }.bind(this),
  43. }).always(function() {
  44. this.setState({
  45. loading: false
  46. });
  47. }.bind(this));
  48. },
  49. loadData(pageNo) {
  50. this.state.data = [];
  51. this.setState({
  52. selectedRowKeys:[],
  53. selectedRowKey:[],
  54. page:pageNo,
  55. loading: true
  56. });
  57. $.ajax({
  58. method: "get",
  59. dataType: "json",
  60. crossDomain: false,
  61. url: globalConfig.context + "/api/admin/financial/deptBillList",
  62. data: {
  63. pageNo: pageNo || 1,
  64. pageSize: this.state.pagination.pageSize,
  65. departmentId:this.state.departmentId,
  66. payeeName: this.state.payeeNameSearch,
  67. payerName:this.state.payerNameSearch,
  68. startTime: this.state.releaseDate[0],
  69. endTime: this.state.releaseDate[1],
  70. orderNo:this.state.orderNo,
  71. },
  72. success: function (data) {
  73. ShowModal(this);
  74. let theArr = [];
  75. if (!data.data || !data.data.list) {
  76. if (data.error && data.error.length) {
  77. message.warning(data.error[0].message);
  78. };
  79. } else {
  80. for (let i = 0; i < data.data.list.length; i++) {
  81. let thisdata = data.data.list[i];
  82. theArr.push({
  83. key: i,
  84. orderNo: thisdata.orderNo,
  85. billNo:thisdata.billNo,
  86. transactionAmount:thisdata.transactionAmount,
  87. payeeName:thisdata.payeeName,
  88. payerName:thisdata.payerName,
  89. transactionSubject:thisdata.transactionSubject,
  90. transactionChannel:thisdata.transactionChannel,
  91. financialPayTimes:thisdata.financialPayTimes?(new Date(thisdata.financialPayTimes)).toLocaleDateString():'',
  92. financialPayNo:thisdata.financialPayNo,
  93. createrName:thisdata.createrName,
  94. saleName:thisdata.saleName,
  95. createTimes:thisdata.createTimes
  96. });
  97. };
  98. }
  99. this.state.pagination.current = data.data.pageNo;
  100. this.state.pagination.total = data.data.totalCount;
  101. if(data.data&&data.data.list&&!data.data.list.length){
  102. this.state.pagination.current=0
  103. this.state.pagination.total=0
  104. }
  105. this.setState({
  106. dataSource: theArr,
  107. pagination: this.state.pagination
  108. });
  109. }.bind(this),
  110. }).always(function () {
  111. this.setState({
  112. loading: false
  113. });
  114. }.bind(this));
  115. },
  116. getInitialState() {
  117. return {
  118. searchMore: true,
  119. releaseDate: [],
  120. RowData:{},
  121. selectedRowKeys: [],
  122. selectedRows: [],
  123. loading: false,
  124. pagination: {
  125. defaultCurrent: 1,
  126. defaultPageSize: 10,
  127. showQuickJumper: true,
  128. pageSize: 10,
  129. onChange: function (page) {
  130. this.loadData(page);
  131. }.bind(this),
  132. showTotal: function (total) {
  133. return '共' + total + '条数据';
  134. }
  135. },
  136. columns: [
  137. {
  138. title: '平台流水编号',
  139. dataIndex: 'billNo',
  140. key: 'billNo'
  141. },
  142. {
  143. title: '金额(万元)',
  144. dataIndex: 'transactionAmount',
  145. key: 'transactionAmount',
  146. },
  147. {
  148. title: '收款方',
  149. dataIndex: 'payeeName',
  150. key: 'payeeName',
  151. },
  152. {
  153. title: '付款方',
  154. dataIndex: 'payerName',
  155. key: 'payerName',
  156. },
  157. {
  158. title: '流水科目',
  159. dataIndex: 'transactionSubject',
  160. key: 'transactionSubject',
  161. render: text => { return getTransactionProject(text)}
  162. },
  163. {
  164. title: '财务流水时间',
  165. dataIndex: 'financialPayTimes',
  166. key: 'financialPayTimes',
  167. }, {
  168. title: '财务流水号',
  169. dataIndex: 'financialPayNo',
  170. key: 'financialPayNo'
  171. },
  172. {
  173. title: '订单编号',
  174. dataIndex: 'orderNo',
  175. key: 'orderNo'
  176. },{
  177. title: '订单负责人',
  178. dataIndex: 'saleName',
  179. key: 'saleName'
  180. },{
  181. title: '流水创建人',
  182. dataIndex: 'createrName',
  183. key: 'createrName'
  184. },{
  185. title: '创建时间',
  186. dataIndex: 'createTimes',
  187. key: 'createTimes'
  188. }
  189. ],
  190. dataSource: [],
  191. searchTime: [,]
  192. }
  193. },
  194. //导出exec
  195. export(){
  196. let departmentName='',
  197. depart =this.state.departmentArr || [];
  198. depart.map(item=>{
  199. if(this.state.departmentId==item.id){
  200. departmentName=item.name;
  201. return;
  202. }
  203. });
  204. let data = {
  205. departmentId:this.state.departmentId,
  206. departmentName:departmentName,
  207. payeeName: this.state.payeeNameSearch,
  208. payerName:this.state.payerNameSearch,
  209. startTime: this.state.releaseDate[0],
  210. endTime: this.state.releaseDate[1],
  211. whoType: 1
  212. }
  213. window.location.href =
  214. globalConfig.context +
  215. "/api/admin/receivables/exportMyBill?" +
  216. $.param(data);
  217. },
  218. componentWillMount() {
  219. this.loadData();
  220. this.departmentList();
  221. },
  222. tableRowClick(record) {
  223. this.state.RowData = record;
  224. this.setState({
  225. showDesc: true,
  226. });
  227. },
  228. closeDesc(e, s) {
  229. this.state.RowData={};
  230. this.state.showDesc = e;
  231. if (s) {
  232. this.loadData(this.state.page);
  233. };
  234. },
  235. search() {
  236. this.loadData();
  237. },
  238. reset() {
  239. this.state.payeeNameSearch='';
  240. this.state.releaseDate = [];
  241. this.state.orderNo='';
  242. this.state.payerNameSearch='';
  243. this.state.departmentId=undefined;
  244. this.loadData();
  245. },
  246. searchSwitch() {
  247. this.setState({
  248. searchMore: !this.state.searchMore
  249. });
  250. },
  251. changeList(arr) {
  252. const newArr = [];
  253. this.state.columns.forEach(item => {
  254. arr.forEach(val => {
  255. if (val === item.title) {
  256. newArr.push(item);
  257. }
  258. });
  259. });
  260. this.setState({
  261. changeList: newArr
  262. });
  263. },
  264. render() {
  265. const { RangePicker } = DatePicker;
  266. let departmentArr = this.state.departmentArr || [];
  267. return (
  268. <div className="user-content">
  269. <ShowModalDiv ShowModal={this.state.showModal} />
  270. <div className="content-title">
  271. <span>部门流水订单</span>
  272. </div>
  273. <Tabs
  274. defaultActiveKey="1"
  275. onChange={this.callback}
  276. className="test">
  277. <TabPane tab="搜索" key="1">
  278. <div className="user-search">
  279. <Select
  280. placeholder="订单部门"
  281. style={{ width: 150, marginRight: 10,marginLeft:10 }}
  282. value={this.state.departmentId}
  283. onChange={e => {
  284. this.setState({ departmentId: e });
  285. }}
  286. >
  287. {departmentArr.map(function(item) {
  288. return (
  289. <Select.Option key={item.id}>{item.name}</Select.Option>
  290. );
  291. })}
  292. </Select>
  293. <Input
  294. placeholder="订单编号"
  295. value={this.state.orderNo}
  296. onChange={e => {
  297. this.setState({ orderNo: e.target.value });
  298. }}
  299. />
  300. <Input
  301. placeholder="收款方"
  302. value={this.state.payeeNameSearch}
  303. onChange={e => {
  304. this.setState({ payeeNameSearch: e.target.value });
  305. }}
  306. />
  307. <Input
  308. placeholder="付款方"
  309. value={this.state.payerNameSearch}
  310. onChange={e => {
  311. this.setState({ payerNameSearch: e.target.value });
  312. }}
  313. />
  314. <Button type="primary" onClick={this.search}>
  315. 搜索
  316. </Button>
  317. <Button onClick={this.reset}>重置</Button>
  318. <span>
  319. 更多搜索
  320. <Switch
  321. defaultChecked={false}
  322. onChange={this.searchSwitch.bind(this)}
  323. />
  324. </span>
  325. <div
  326. className="search-more"
  327. style={this.state.searchMore ? { display: "none" } : {}}
  328. >
  329. <span style={{marginLeft:10}}>流水时间 :</span>
  330. <RangePicker
  331. value={[
  332. this.state.releaseDate[0]
  333. ? moment(this.state.releaseDate[0])
  334. : null,
  335. this.state.releaseDate[1]
  336. ? moment(this.state.releaseDate[1])
  337. : null
  338. ]}
  339. onChange={(data, dataString) => {
  340. this.setState({ releaseDate: dataString });
  341. }}
  342. />
  343. </div>
  344. </div>
  345. </TabPane>
  346. <TabPane tab="导出" key="2">
  347. <Button style={{ float: "left",margin:10 }} onClick={this.export}>
  348. 导出excel
  349. </Button>
  350. </TabPane>
  351. <TabPane tab="更改表格显示数据" key="3">
  352. <div style={{ marginLeft: 10 }}>
  353. <ChooseList
  354. columns={this.state.columns}
  355. changeFn={this.changeList}
  356. changeList={this.state.changeList}
  357. top={55}
  358. margin={11}
  359. />
  360. </div>
  361. </TabPane>
  362. </Tabs>
  363. <div className="patent-table">
  364. <Spin spinning={this.state.loading}>
  365. <Table
  366. columns={
  367. this.state.changeList
  368. ? this.state.changeList
  369. : this.state.columns
  370. }
  371. dataSource={this.state.dataSource}
  372. scroll={{ x: 1500, y: 0 }}
  373. rowSelection={false}
  374. pagination={this.state.pagination}
  375. onRowClick={this.tableRowClick}
  376. bordered
  377. size="small"
  378. />
  379. </Spin>
  380. </div>
  381. <WaterDesc
  382. data={this.state.RowData}
  383. showDesc={this.state.showDesc}
  384. closeDesc={this.closeDesc.bind(this)}
  385. />
  386. </div>
  387. );
  388. }
  389. })
  390. export default MyWater;