accountReview.jsx 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. import React from "react";
  2. import $ from "jquery/src/ajax";
  3. import moment from "moment";
  4. import {
  5. Button,
  6. Form,
  7. Input,
  8. Spin,
  9. Table,
  10. Select,
  11. message,
  12. Tabs,
  13. Tag,
  14. Tooltip,
  15. DatePicker,
  16. Modal,
  17. } from "antd";
  18. import { ShowModal } from "@/tools";
  19. import { ChooseList } from "../../order/orderNew/chooseList";
  20. import ShowModalDiv from "@/showModal.jsx";
  21. import { clockState, salesList, accountType, accountStatus } from "@/dataDic";
  22. const FormItem = Form.Item;
  23. const { RangePicker } = DatePicker;
  24. const { TabPane } = Tabs;
  25. const AccountReview = React.createClass({
  26. getInitialState() {
  27. return {
  28. searchValues: {}, // 列表筛选条件
  29. loading: false, //加载动画
  30. changeList: undefined, // 更改后的表格显示数据
  31. dataSource: [], // 列表数据
  32. pagination: {
  33. defaultCurrent: 1,
  34. defaultPageSize: 10,
  35. showQuickJumper: true,
  36. pageSize: 10,
  37. onChange: function (page) {
  38. this.loadData(page);
  39. }.bind(this),
  40. showTotal: function (total) {
  41. return "共" + total + "条数据";
  42. },
  43. },
  44. columns: [
  45. {
  46. title: "类型",
  47. dataIndex: "type",
  48. key: "type",
  49. render: (text, record) => {
  50. return (
  51. <span>
  52. {accountType.find(item => item.value === text).label}
  53. </span>
  54. );
  55. },
  56. },
  57. {
  58. title: "报销金额",
  59. dataIndex: "totalAmount",
  60. key: "totalAmount",
  61. },
  62. {
  63. title: "报销至订单",
  64. dataIndex: "orderName",
  65. key: "orderName",
  66. render: (text, record) => {
  67. return (
  68. <div>
  69. <div>{text || ""}</div>
  70. <div>{record.contractNo || ""}</div>
  71. </div>
  72. );
  73. },
  74. },
  75. {
  76. title: "报销至部门",
  77. dataIndex: "appDepName",
  78. key: "appDepName",
  79. },
  80. {
  81. title: "报销人",
  82. dataIndex: "aname",
  83. key: "aname",
  84. },
  85. {
  86. title: "财务负责人",
  87. dataIndex: "financeName",
  88. key: "financeName",
  89. },
  90. {
  91. title: "状态",
  92. dataIndex: "status",
  93. key: "status",
  94. render: (text, record) => {
  95. return (
  96. <span style={{ color: accountStatus[text].color }}>
  97. {accountStatus[text].label}
  98. </span>
  99. );
  100. },
  101. },
  102. {
  103. title: "报销公司/支付公司",
  104. dataIndex: "payDepName",
  105. key: "payDepName",
  106. render: (text, record) => {
  107. return (
  108. <div>
  109. <div>{record.appDepName || ""}</div>
  110. <div>{text || ""}</div>
  111. </div>
  112. );
  113. },
  114. },
  115. {
  116. title: "报销时间",
  117. dataIndex: "createTimeStr",
  118. key: "createTimeStr",
  119. },
  120. ],
  121. };
  122. },
  123. componentWillMount() {
  124. this.loadData();
  125. },
  126. // 列表接口
  127. loadData(pageNo) {
  128. const { searchValues, pagination } = this.state;
  129. this.setState({
  130. loading: true,
  131. });
  132. let datas = Object.assign(searchValues, {
  133. pageNo: pageNo || 1,
  134. pageSize: pagination.pageSize,
  135. processStatus: 1,
  136. });
  137. $.ajax({
  138. method: "get",
  139. dataType: "json",
  140. crossDomain: false,
  141. url: globalConfig.context + "/api/admin/expenseAccount/pageList",
  142. data: datas,
  143. success: function (data) {
  144. ShowModal(this);
  145. this.setState({
  146. loading: false,
  147. });
  148. if (data.error && data.error.length === 0) {
  149. if (data.data.list) {
  150. pagination.current = data.data.pageNo;
  151. pagination.total = data.data.totalCount;
  152. if (data.data && data.data.list && !data.data.list.length) {
  153. pagination.current = 0;
  154. pagination.total = 0;
  155. }
  156. this.setState({
  157. dataSource: data.data.list,
  158. pagination: this.state.pagination,
  159. pageNo: data.data.pageNo,
  160. });
  161. } else {
  162. this.setState({
  163. dataSource: data.data,
  164. pagination: false,
  165. });
  166. }
  167. } else {
  168. message.warning(data.error[0].message);
  169. }
  170. }.bind(this),
  171. }).always(
  172. function () {
  173. this.setState({
  174. loading: false,
  175. });
  176. }.bind(this)
  177. );
  178. },
  179. // 搜索
  180. search() {
  181. this.loadData();
  182. },
  183. // 重置
  184. reset() {
  185. this.setState({
  186. searchValues: JSON.parse(JSON.stringify({})),
  187. }, () => {
  188. this.loadData();
  189. })
  190. },
  191. changeList(arr) {
  192. const newArr = [];
  193. this.state.columns.forEach((item) => {
  194. arr.forEach((val) => {
  195. if (val === item.title) {
  196. newArr.push(item);
  197. }
  198. });
  199. });
  200. this.setState({
  201. changeList: newArr,
  202. });
  203. },
  204. render() {
  205. const { searchValues } = this.state
  206. return (
  207. <div className="user-content">
  208. <ShowModalDiv ShowModal={this.state.showModal} />
  209. <div className="content-title" style={{ marginBottom: 10 }}>
  210. <span style={{ fontWeight: 900, fontSize: 16 }}>报销审核</span>
  211. </div>
  212. <Tabs defaultActiveKey="2" className="test">
  213. <TabPane tab="搜索" key="2">
  214. <div className="user-search" style={{ marginLeft: 10 }}>
  215. <Select
  216. style={{ width: 120 }}
  217. placeholder="审核状态"
  218. value={this.state.approval}
  219. onChange={(e) => {
  220. this.setState({
  221. approval: e,
  222. });
  223. }}
  224. >
  225. <Option value="1">审核中</Option>
  226. <Option value="2">审核通过</Option>
  227. <Option value="4">已驳回</Option>
  228. </Select>
  229. <span>报销时间:</span>
  230. <RangePicker
  231. style={{ width: 300 }}
  232. value={[
  233. searchValues.startTime ? moment(searchValues.startTime) : null,
  234. searchValues.endTime ? moment(searchValues.endTime) : null,
  235. ]}
  236. onChange={(data, dataString) => {
  237. this.setState({
  238. searchValues: Object.assign(searchValues, {
  239. startTime: dataString[0],
  240. endTime: dataString[1],
  241. }),
  242. });
  243. }}
  244. />
  245. <Button
  246. type="primary"
  247. onClick={this.search}
  248. style={{ marginLeft: 10 }}
  249. >
  250. 搜索
  251. </Button>
  252. <Button onClick={this.reset}>重置</Button>
  253. </div>
  254. </TabPane>
  255. <TabPane tab="更改表格显示数据" key="1">
  256. <div style={{ marginLeft: 10 }}>
  257. <ChooseList
  258. columns={this.state.columns}
  259. changeFn={this.changeList}
  260. changeList={this.state.changeList}
  261. top={55}
  262. margin={11}
  263. />
  264. </div>
  265. </TabPane>
  266. </Tabs>
  267. <div className="patent-table">
  268. <Spin spinning={this.state.loading}>
  269. <Table
  270. bordered
  271. columns={
  272. this.state.changeList == undefined
  273. ? this.state.columns
  274. : this.state.changeList
  275. }
  276. dataSource={this.state.dataSource}
  277. // scroll={{ x: "max-content", y: 0 }}
  278. pagination={this.state.pagination}
  279. // onRowDoubleClick={this.tableRowClick.bind(this)}
  280. size="small"
  281. />
  282. </Spin>
  283. <p
  284. style={{ display: "inline-block", fontSize: "14px", color: "red" }}
  285. >
  286. {
  287. <span style={{ marginRight: 10 }}>
  288. {`金额总计(万元):${"0"}`}
  289. </span>
  290. }
  291. </p>
  292. </div>
  293. {/* 驳回备注 */}
  294. <Modal
  295. visible={this.state.boHuiVisible}
  296. width="400px"
  297. title="驳回备注"
  298. footer=""
  299. onOk={this.boHuiOk}
  300. onCancel={this.boHuiCancel}
  301. >
  302. <Form layout="horizontal" onSubmit={this.boHuiSubmit}>
  303. <Spin spinning={this.state.loading}>
  304. <FormItem
  305. labelCol={{ span: 5 }}
  306. wrapperCol={{ span: 16 }}
  307. label={
  308. <span>
  309. <strong style={{ color: "#f00" }}>*</strong>驳回原因
  310. </span>
  311. }
  312. >
  313. <Input
  314. type="textarea"
  315. rows={4}
  316. placeholder="请输入驳回原因"
  317. value={this.state.content}
  318. onChange={(e) => {
  319. this.setState({ content: e.target.value });
  320. }}
  321. />
  322. </FormItem>
  323. <FormItem wrapperCol={{ span: 12, offset: 5 }}>
  324. <Button
  325. type="primary"
  326. htmlType="submit"
  327. style={{ marginRight: 20 }}
  328. >
  329. 驳回
  330. </Button>
  331. <Button
  332. type="default"
  333. onClick={() => {
  334. this.boHuiCancel();
  335. }}
  336. >
  337. 取消
  338. </Button>
  339. </FormItem>
  340. </Spin>
  341. </Form>
  342. </Modal>
  343. <textarea id="copyText" style={{ opacity: 0 }} />
  344. </div>
  345. );
  346. },
  347. });
  348. export default AccountReview;