departWater.jsx 12 KB

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