departWater.jsx 13 KB

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