From 0206d8f1a908141a484218b16bd5102663dc71c8 Mon Sep 17 00:00:00 2001 From: liyongshun <971387674@qq.com> Date: Fri, 22 Apr 2022 19:09:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=88=86=E9=A1=B5=E7=9A=84bu?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../standingBook/index.js | 33 ++++- .../components/abnormalList.js | 29 ++++- .../standingBookDetail/components/normal.js | 58 +++++++-- .../standingBookDetail/components/overView.js | 115 ++++++++++-------- pc4mobx/hrmSalary/stores/StandingBook.js | 4 +- 5 files changed, 163 insertions(+), 76 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/index.js index f5c89509..4e3e00e4 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBook/index.js @@ -29,6 +29,7 @@ export default class StandingBook extends React.Component { startTime: moment(new Date()).format("YYYY-MM"), endTime: moment(new Date()).format("YYYY-MM"), }, + current: 1, dialogProps: { title: "", visible: false, @@ -46,12 +47,13 @@ export default class StandingBook extends React.Component { } componentDidMount() { - this.getCommonList({ ...this.state.tableParams }); + const { current } = this.state; + this.getCommonList({ ...this.state.tableParams, current }); } getCommonList = (payload = {}) => { const { getCommonList } = this.props.standingBookStore; - getCommonList({ ...payload }).then(({ list, columns, total }) => { + getCommonList({ ...payload }).then(({ list, columns, total, pageNum }) => { columns = _.map(columns, (it) => { if (it.dataIndex === "billMonth") { it = { @@ -130,6 +132,7 @@ export default class StandingBook extends React.Component { ], total, }, + current: pageNum, }); }); }; @@ -181,7 +184,10 @@ export default class StandingBook extends React.Component { onOk: () => { siaccountDelete({ billMonth }).then(() => { message.success("删除成功"); - this.getCommonList({ ...this.state.tableParams }); + this.getCommonList({ + ...this.state.tableParams, + current: this.state.current, + }); }); }, onCancel: () => {}, @@ -203,7 +209,10 @@ export default class StandingBook extends React.Component { save(payload).then(() => { message.success("核算成功"); this.handleClose(); - this.getCommonList({ ...this.state.tableParams }); + this.getCommonList({ + ...this.state.tableParams, + current: this.state.current, + }); this.handleGoDetail(moment(billMonth).format("YYYY-MM")); }); }; @@ -228,6 +237,7 @@ export default class StandingBook extends React.Component { this.getCommonList({ ...this.state.tableParams, [type]: val, + current: this.state.current, }); }; @@ -319,6 +329,19 @@ export default class StandingBook extends React.Component { return
; }; + const pagination = { + total, + current: this.state.current, + showTotal: (total) => `共 ${total} 条`, + onChange: (current) => { + this.setState({ current }); + this.getCommonList({ + ...this.state.tableParams, + current, + }); + }, + }; + return (
it.dataIndex !== "id")} dataSource={list} loading={loading} - pagination={{ total }} + pagination={pagination} /> {dialogProps.visible && ( { @@ -50,6 +52,15 @@ export default class AbnormalListIndex extends Component { (item) => ({ ...item, width: item.oldWidth }) ); let { list, total } = this.state.tableData; + const pagination = { + total, + current: this.state.current, + showTotal: (total) => `共 ${total} 条`, + onChange: (current) => { + this.setState({ current }); + this.getChangeList({ billMonth, current }); + }, + }; return (
@@ -67,7 +78,15 @@ export default class AbnormalListIndex extends Component {
- + + console.log("多人力", ids, names, datas) + } + isSingle={false} + />
{/* table */}
@@ -76,7 +95,7 @@ export default class AbnormalListIndex extends Component { columns={columns} dataSource={list} loading={loading} - pagination={{ total }} + pagination={pagination} scroll={{ x: 1200 }} />
diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js index 553f32c9..4b196a60 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js @@ -2,13 +2,13 @@ * Author: 黎永顺 * Description: 正常缴纳月份 * Date: 2022-04-20 08:56:08 - * LastEditTime: 2022-04-22 14:05:50 + * LastEditTime: 2022-04-22 19:06:46 */ import React, { Component } from "react"; import { Icon, Tooltip, Button, message, Modal } from "antd"; import { inject, observer } from "mobx-react"; import { toJS } from "mobx"; -import { WeaInputSearch, WeaTable, WeaPopoverHrm, WeaDialog } from "ecCom"; +import { WeaBrowser, WeaTable, WeaPopoverHrm, WeaDialog } from "ecCom"; import { getSearchs } from "../../../../util"; import _ from "lodash"; import "./index.less"; @@ -20,6 +20,7 @@ export default class NormalIndex extends Component { super(props); this.state = { date: "", + current: 1, selectedRowKeys: [], addProps: { title: "", @@ -35,17 +36,19 @@ export default class NormalIndex extends Component { componentDidMount() { const { billMonth, selectedKey } = this.props; + const { current } = this.state; selectedKey === "1" - ? this.getNormalList({ billMonth }) - : this.getSupplementaryList({ billMonth }); + ? this.getNormalList({ billMonth, current }) + : this.getSupplementaryList({ billMonth, current }); } componentWillReceiveProps(nextProps) { if (nextProps.selectedKey != this.props.selectedKey) { const { billMonth } = nextProps; + const { current } = this.state; nextProps.selectedKey === "1" - ? this.getNormalList({ billMonth }) - : this.getSupplementaryList({ billMonth }); + ? this.getNormalList({ billMonth, current }) + : this.getSupplementaryList({ billMonth, current }); } } @@ -54,14 +57,15 @@ export default class NormalIndex extends Component { this.props.standingBookStore; const { billMonth, selectedKey } = this.props; if (selectedKey === "1") { - const { includes } = form.getFormParams(); + const { includes, excludes } = form.getFormParams(); const payload = { billMonth, includes: includes.split(","), + excludes: _.isEmpty(excludes) ? excludes.split(",") : [], }; siaccountCommonSave(payload).then(() => { message.success("添加成功"); - this.getNormalList({ billMonth }); + this.getNormalList({ billMonth, current: this.state.current }); this.setState({ addProps: { ...this.state.addProps, @@ -88,7 +92,10 @@ export default class NormalIndex extends Component { }; siaccountSupplementarySave(payload).then(() => { message.success("添加成功"); - this.getSupplementaryList({ billMonth }); + this.getSupplementaryList({ + billMonth, + current: this.state.current, + }); this.setState({ addProps: { ...this.state.addProps, @@ -216,8 +223,11 @@ export default class NormalIndex extends Component { message.success("删除成功"); this.setState({ selectedRowKeys: [] }); selectedKey === "1" - ? this.getNormalList({ billMonth }) - : this.getSupplementaryList({ billMonth }); + ? this.getNormalList({ billMonth, current: this.state.current }) + : this.getSupplementaryList({ + billMonth, + current: this.state.current, + }); }); }, onCancel: () => {}, @@ -251,6 +261,20 @@ export default class NormalIndex extends Component { selectedRowKeys, onChange: this.onSelectChange, }; + const pagination = { + total, + current: this.state.current, + showTotal: (total) => `共 ${total} 条`, + onChange: (current) => { + this.setState({ current }); + selectedKey === "1" + ? this.getNormalList({ billMonth, current }) + : this.getSupplementaryList({ + billMonth, + current, + }); + }, + }; return (
{selectedKey === "1" && ( @@ -315,7 +339,15 @@ export default class NormalIndex extends Component { {selectedKey === "1" && } - + + console.log("多人力", ids, names, datas) + } + isSingle={false} + />
{/* table */}
@@ -324,7 +356,7 @@ export default class NormalIndex extends Component { columns={columns} dataSource={list} loading={loading} - pagination={{ total }} + pagination={pagination} rowSelection={rowSelection} scroll={{ x: 1200 }} /> diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/overView.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/overView.js index 043384ea..5ef7597b 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/overView.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/overView.js @@ -2,22 +2,15 @@ * Author: 黎永顺 * Description: 总览 * Date: 2022-04-20 20:49:23 - * LastEditTime: 2022-04-20 21:36:46 + * LastEditTime: 2022-04-22 18:35:12 */ -/* - * Author: 黎永顺 - * Description: 总览月份 - * Date: 2022-04-20 08:56:08 - * LastEditTime: 2022-04-20 20:45:54 - */ -import React, { Component } from 'react'; -import { Icon, Tooltip, Button } from 'antd'; -import { inject, observer } from 'mobx-react'; -import { WeaInputSearch, WeaTable } from 'ecCom'; -import './index.less'; +import React, { Component } from "react"; +import { Icon, Tooltip, Button } from "antd"; +import { inject, observer } from "mobx-react"; +import { WeaInputSearch, WeaTable } from "ecCom"; +import "./index.less"; - -@inject('standingBookStore') +@inject("standingBookStore") @observer export default class OverViewIndex extends Component { constructor(props) { @@ -25,75 +18,95 @@ export default class OverViewIndex extends Component { this.state = { selectedRowKeys: [], tableData: { - list: [], columns: [], total: 0 - } - } + list: [], + columns: [], + total: 0, + }, + }; } componentDidMount() { const { billMonth } = this.props; - this.getOverViewList({ billMonth }) + this.getOverViewList({ billMonth }); } getOverViewList = (payload = {}) => { const { getOverViewList } = this.props.standingBookStore; - getOverViewList({ ...payload }).then(({ list, columns = [], total }) => { - columns = _.map(_.filter(columns, it => it.dataIndex !== 'id'), it => { - // if (it.dataIndex === "employeeId") { - // it = { - // ...it, - // width: 150, - // fixed: 'left' - // } - // } - return { - ...it, - title: , - } - }) - this.setState({ - tableData: { - list, - columns, - total - } - }) - }) - } + getOverViewList({ ...payload, current: 1 }).then( + ({ list, columns = [], total }) => { + columns = _.map( + _.filter(columns, (it) => it.dataIndex !== "id"), + (it) => { + // if (it.dataIndex === "employeeId") { + // it = { + // ...it, + // width: 150, + // fixed: 'left' + // } + // } + return { + ...it, + title: ( + + ), + }; + } + ); + this.setState({ + tableData: { + list, + columns, + total, + }, + }); + } + ); + }; render() { const { remarks, billMonth, selectedKey } = this.props; const { selectedRowKeys } = this.state; const { loading } = this.props.standingBookStore; let { list, columns, total } = this.state.tableData; + const pagination = { + total, + showTotal: (total) => `共 ${total} 条`, + onShowSizeChange(current, pageSize) { + console.log("Current: ", current, "; PageSize: ", pageSize); + }, + onChange(current) { + console.log("Current: ", current); + }, + }; return ( -
-
-
+
+
+
账单月份 - + {billMonth}
-
+
{/* table */} -
+
- ) + ); } } - diff --git a/pc4mobx/hrmSalary/stores/StandingBook.js b/pc4mobx/hrmSalary/stores/StandingBook.js index 65f99ed1..d378e2f4 100644 --- a/pc4mobx/hrmSalary/stores/StandingBook.js +++ b/pc4mobx/hrmSalary/stores/StandingBook.js @@ -36,9 +36,9 @@ export class StandingBookStore { if (status) { // 接口请求成功/失败处理 const { - pageInfo: { list, columns, total }, + pageInfo: { list, columns, total, pageNum }, } = data; - resolve({ list, columns, total }); + resolve({ list, columns, total, pageNum }); } else { message.error("接口调用失败!"); reject();