departWater.jsx 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  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. fixed: 'left'
  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. render() {
  252. const { RangePicker } = DatePicker;
  253. let departmentArr = this.state.departmentArr || [];
  254. return (
  255. <div className="user-content">
  256. <ShowModalDiv ShowModal={this.state.showModal} />
  257. <div className="content-title">
  258. <span>部门流水订单</span>
  259. </div>
  260. <Tabs
  261. defaultActiveKey="1"
  262. onChange={this.callback}
  263. className="test">
  264. <TabPane tab="搜索" key="1">
  265. <div className="user-search">
  266. <Select
  267. placeholder="订单部门"
  268. style={{ width: 150, marginRight: 10,marginLeft:10 }}
  269. value={this.state.departmentId}
  270. onChange={e => {
  271. this.setState({ departmentId: e });
  272. }}
  273. >
  274. {departmentArr.map(function(item) {
  275. return (
  276. <Select.Option key={item.id}>{item.name}</Select.Option>
  277. );
  278. })}
  279. </Select>
  280. <Input
  281. placeholder="订单编号"
  282. value={this.state.orderNo}
  283. onChange={e => {
  284. this.setState({ orderNo: e.target.value });
  285. }}
  286. />
  287. <Input
  288. placeholder="收款方"
  289. value={this.state.payeeNameSearch}
  290. onChange={e => {
  291. this.setState({ payeeNameSearch: e.target.value });
  292. }}
  293. />
  294. <Input
  295. placeholder="付款方"
  296. value={this.state.payerNameSearch}
  297. onChange={e => {
  298. this.setState({ payerNameSearch: e.target.value });
  299. }}
  300. />
  301. <Button type="primary" onClick={this.search}>
  302. 搜索
  303. </Button>
  304. <Button onClick={this.reset}>重置</Button>
  305. <span>
  306. 更多搜索
  307. <Switch
  308. defaultChecked={false}
  309. onChange={this.searchSwitch.bind(this)}
  310. />
  311. </span>
  312. <div
  313. className="search-more"
  314. style={this.state.searchMore ? { display: "none" } : {}}
  315. >
  316. <span style={{marginLeft:10}}>流水时间 :</span>
  317. <RangePicker
  318. value={[
  319. this.state.releaseDate[0]
  320. ? moment(this.state.releaseDate[0])
  321. : null,
  322. this.state.releaseDate[1]
  323. ? moment(this.state.releaseDate[1])
  324. : null
  325. ]}
  326. onChange={(data, dataString) => {
  327. this.setState({ releaseDate: dataString });
  328. }}
  329. />
  330. </div>
  331. </div>
  332. </TabPane>
  333. <TabPane tab="导出" key="2">
  334. <Button style={{ float: "left",margin:10 }} onClick={this.export}>
  335. 导出excel
  336. </Button>
  337. </TabPane>
  338. </Tabs>
  339. <div className="patent-table">
  340. <Spin spinning={this.state.loading}>
  341. <Table
  342. columns={this.state.columns}
  343. dataSource={this.state.dataSource}
  344. scroll={{ x: 1500, y: 0 }}
  345. rowSelection={false}
  346. pagination={this.state.pagination}
  347. onRowClick={this.tableRowClick}
  348. bordered
  349. size="small"
  350. />
  351. </Spin>
  352. </div>
  353. <WaterDesc
  354. data={this.state.RowData}
  355. showDesc={this.state.showDesc}
  356. closeDesc={this.closeDesc.bind(this)}
  357. />
  358. </div>
  359. );
  360. }
  361. })
  362. export default MyWater;