myWater.jsx 11 KB

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