From 936ac9bd3fa4104af36cd1be7d4c647fa9f7a92b Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Tue, 31 May 2022 18:51:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E8=B5=84=E5=8D=95bug=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hrmSalary/pages/ledger/salaryItemForm.js | 5 +- .../pages/ledger/step3/canMoveItem.js | 13 ++- .../pages/payroll/payrollGrant/index.js | 31 ++++++- .../payroll/payrollGrant/payrollGrantModal.js | 83 ++++++++++++++++-- .../payrollGrant/payrollWithdrawModal.js | 86 +++++++++++++++++-- pc4mobx/hrmSalary/stores/payroll.js | 30 +++++-- 6 files changed, 222 insertions(+), 26 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/ledger/salaryItemForm.js b/pc4mobx/hrmSalary/pages/ledger/salaryItemForm.js index 9414cef3..0b583f47 100644 --- a/pc4mobx/hrmSalary/pages/ledger/salaryItemForm.js +++ b/pc4mobx/hrmSalary/pages/ledger/salaryItemForm.js @@ -120,7 +120,10 @@ export default class SalaryItemForm extends React.Component { if(item.items) { item.items && item.items.map(i => {i.key = i.id}) return ( - {this.handleItemDataSourceChange(dataSource, item)}} title={item.name} onGroupDelete={() => {this.handleGroupDelete(item)}} onTitleChange={(value) => {this.handleItemTitleChange(item, value)}} onChange={(dataSource) => {this.handleCanMoveItemChange(dataSource, item)}}/> + {this.handleItemDataSourceChange(dataSource, item)}} title={item.name} + onGroupDelete={() => {this.handleGroupDelete(item)}} + onTitleChange={(value) => {this.handleItemTitleChange(item, value)}} onChange={(dataSource) => {this.handleCanMoveItemChange(dataSource, item)}}/> ) } return "" diff --git a/pc4mobx/hrmSalary/pages/ledger/step3/canMoveItem.js b/pc4mobx/hrmSalary/pages/ledger/step3/canMoveItem.js index b1067402..8513fb91 100644 --- a/pc4mobx/hrmSalary/pages/ledger/step3/canMoveItem.js +++ b/pc4mobx/hrmSalary/pages/ledger/step3/canMoveItem.js @@ -123,7 +123,10 @@ export default class CanMoveItem extends React.Component { onCancel: () => { }, }); - + } + + handleTableDrop = (datas) => { + console.log("datas:", datas); } render() { @@ -156,7 +159,13 @@ export default class CanMoveItem extends React.Component { { - this.state.showContent && + this.state.showContent && } { this.state.addItemVisible && @@ -169,7 +187,7 @@ export default class PayrollGrant extends React.Component { setShowSearchAd={bool => setGrantListShowSearchAd(bool)} //高级搜索面板受控 searchsAd={getSearchs(grantListConditionForm, toJS(grantListCondition), 2)} // 高级搜索内部数据 // buttonsAd={adBtn} // 高级搜索内部按钮 - onSearch={getInfoList} // 点搜索按钮时的回调 + onSearch={() => this.handleSearch()} // 点搜索按钮时的回调 // searchsAdQuick={this.getSearchsAdQuick()} onSearchChange={v => grantListConditionForm.updateFields({ username: v })} // 在搜索框中输入的文字改变时的回调: 这里需要同步高级搜索和外部搜索框的值 searchsBaseValue={grantListConditionForm.getFormParams().username} // 外部input搜索值受控: 这里和高级搜索的requestname同步 @@ -199,7 +217,14 @@ export default class PayrollGrant extends React.Component {
- + {this.handleDataPageChange(value)}, + total: salaryGrantPageInfo.total, + current: salaryGrantPageInfo.pageNum, + showTotal: (total) => `共 ${total} 条`, + }} + />
{ this.state.payrollGrantVisible && { + this.setState({ + selectedRowKeys: value + }) + } + + + // 发放 + fetchGrantPayRoll(payload) { + const { payrollStore: { grantPayroll }} = this.props; + grantPayroll(payload).then(() => { + const { payrollStore: {getInfoList}} = this.props; + getInfoList({ + salarySendId:this.props.sendId + }) + this.props.onCancel && this.props.onCancel() + }) + } + + handleMenuClick(e) { + const { selectedRowKeys } = this.state; + const { payrollStore: { grantPayroll }} = this.props; + if(selectedRowKeys.length == 0) { + message.warning("未选择条目"); + return + } + this.fetchGrantPayRoll({ids: selectedRowKeys, salarySendId: this.props.sendId}) + } + + handleGrantAll() { + this.fetchGrantPayRoll({salarySendId: this.props.sendId}) + } + + handleSearch(value) { + const { payrollStore: { batchSendInfoList } } = this.props; + batchSendInfoList({salarySendId: this.props.sendId, keyword: value, current: this.state.current}) + } + + + // 分页 + handleDataPageChange(value) { + this.setState({current: value}) + const { payrollStore: { batchSendInfoList } } = this.props; + batchSendInfoList({salarySendId: this.props.sendId, current: value}) + } + render() { const menu = ( - + this.handleMenuClick(e)}> 发放所选 ); const {payrollStore} = this.props; - const { salarySendDetailBaseInfo, canGrantDataSource } = payrollStore; + const { salarySendDetailBaseInfo, canGrantDataSource, canGrantPageInfo } = payrollStore; + const { selectedRowKeys } = this.state; + + const rowSelection = { + selectedRowKeys, + onChange: this.onSelectChange.bind(this), + }; return ( {this.props.onCancel()}}>
批量发放
- 全部发放 - + {this.handleGrantAll()}}>全部发放 + {this.setState({searchValue: value})}} onSearch={(value) => {this.handleSearch(value)}}/>
@@ -105,8 +165,15 @@ export default class payrollGrantModal extends React.Component { 工资单模板:{salarySendDetailBaseInfo.template}
-
- +
+ {this.handleDataPageChange(value)}, + total: canGrantPageInfo.total, + current: canGrantPageInfo.pageNum, + showTotal: (total) => `共 ${total} 条`, + }} + />
) diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollWithdrawModal.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollWithdrawModal.js index 8277f3a5..7e8d8f99 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollWithdrawModal.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollWithdrawModal.js @@ -8,6 +8,14 @@ import { inject, observer } from 'mobx-react'; @inject('payrollStore') @observer export default class PayrollWithdrawModal extends React.Component { + constructor(props) { + super(props); + this.state = { + selectedRowKeys: [], + current: 1, + } + } + componentWillMount() { const { payrollStore } = this.props const { batchWithdrawInfoList } = payrollStore @@ -69,21 +77,77 @@ export default class PayrollWithdrawModal extends React.Component { }) } + onSelectChange = (value) => { + this.setState({ + selectedRowKeys: value + }) + } + + // 撤回 + fetchWithdrawPayroll(payload) { + const { payrollStore: { grantPayroll, withdrawPayroll }} = this.props; + withdrawPayroll(payload).then(() => { + const { payrollStore: {getInfoList}} = this.props; + getInfoList({ + salarySendId:this.props.sendId + }) + this.props.onCancel && this.props.onCancel() + }) + } + + + handleMenuClick(e) { + const { selectedRowKeys } = this.state; + const { payrollStore: { grantPayroll }} = this.props; + if(selectedRowKeys.length == 0) { + message.warning("未选择条目"); + return + } + this.fetchWithdrawPayroll({ids: selectedRowKeys, salarySendId: this.props.sendId}) + } + + + handleWithdrawAll() { + this.fetchWithdrawPayroll({salarySendId: this.props.sendId}) + } + + // 分页 + handleDataPageChange(value) { + this.setState({current: value}) + const { payrollStore } = this.props + const { batchWithdrawInfoList } = payrollStore + batchWithdrawInfoList({salarySendId:this.props.sendId, current: value}) + } + + + + handleSearch(value) { + const { payrollStore: { batchWithdrawInfoList } } = this.props; + batchWithdrawInfoList({salarySendId: this.props.sendId, keyword: value, current: this.state.current}) + } + render() { const menu = ( - + this.handleMenuClick(e)}> 撤回所选 ); const {payrollStore} = this.props; - const { salarySendDetailBaseInfo, canWidthdrawColumns, canWithdrawDataSource } = payrollStore; + const { salarySendDetailBaseInfo, canWidthdrawColumns, canWithdrawDataSource, canWithdrawPageInfo } = payrollStore; + const { selectedRowKeys } = this.state; + const rowSelection = { + selectedRowKeys, + onChange: this.onSelectChange.bind(this), + }; + + return ( {this.props.onCancel()}}>
批量撤回
- 全部撤回 - + {this.handleWithdrawAll()}}>全部撤回 + {this.setState({searchValue: value})}} onSearch={(value) => {this.handleSearch(value)}}/>
@@ -105,8 +169,18 @@ export default class PayrollWithdrawModal extends React.Component { 工资单模板:{salarySendDetailBaseInfo.template}
-
- +
+ {this.handleDataPageChange(value)}, + total: canWithdrawPageInfo.total, + current: canWithdrawPageInfo.pageNum, + showTotal: (total) => `共 ${total} 条`, + }} + />
) diff --git a/pc4mobx/hrmSalary/stores/payroll.js b/pc4mobx/hrmSalary/stores/payroll.js index c86cc4da..50c72d7f 100644 --- a/pc4mobx/hrmSalary/stores/payroll.js +++ b/pc4mobx/hrmSalary/stores/payroll.js @@ -4,6 +4,7 @@ import { WeaForm, WeaTableNew } from 'comsMobx'; import * as API from '../apis/payroll'; // 引入API接口文件 import { notNull } from '../util/validate'; +import { removePropertyCondition } from '../util/response'; const { TableStore } = WeaTableNew; @@ -40,14 +41,17 @@ export class payrollStore { // **** 工资单发放页 **** @observable salaryGrantDataSource = []; + @observable salaryGrantPageInfo ={}; @observable salaryGrantTableStore = new TableStore(); @observable grantListConditionForm = new WeaForm(); // 详情页搜索条件 @observable grantListShowSearchAd = false; // 详情页是否展开搜索面板 @observable grantListCondition = []; // 详情页搜索条件 @observable canGrantDataSource = []; // 可以发送的列表 @observable canGrantColumns = []; // 可以发送的列名 + @observable canGrantPageInfo = {}; // 可以发送列表分页对象 @observable canWithdrawDataSource = []; // 可以撤回的列表 @observable canWidthdrawColumns = []; // 可以撤回的列表列名 + @observable canWithdrawPageInfo = {}; // 可以撤回列表分页对象 @action setGrantListShowSearchAd = (grantListShowSearchAd) => this.grantListShowSearchAd = grantListShowSearchAd @@ -76,8 +80,8 @@ export class payrollStore { getCondition = () => { API.getCondition().then(action(res => { if (res.api_status) { // 接口请求成功/失败处理 - this.condition = res.condition; - this.form.initFormFields(res.condition); // 渲染高级搜索form表单 + let condition = removePropertyCondition(res.condition); + this.form.initFormFields(condition); // 渲染高级搜索form表单 } else { message.error(res.msg || '接口调用失败!') } @@ -375,10 +379,13 @@ export class payrollStore { // 工资单发放-工资单发放信息列表 @action getInfoList = (params = {}) => { + let form = this.grantListConditionForm.getFormParams(); + params = {...form, ...params} API.getInfoList(params).then(res => { if(res.status) { this.salaryGrantTableStore.getDatas(res.data.dataKey.datas) this.salaryGrantDataSource = res.data.datas + this.salaryGrantPageInfo = res.data.pageInfo } else { message.error(res.errormsg || "获取失败") } @@ -423,8 +430,9 @@ export class payrollStore { getPaySa = (params = {}) => { API.getPaySa(params).then(res => { if(res.status) { - this.grantListCondition = res.data.condition; - this.grantListConditionForm.initFormFields(res.data.condition); + let condition = removePropertyCondition(res.data.condition) + this.grantListCondition = condition; + this.grantListConditionForm.initFormFields(condition); } else { message.error(res.errormsg || "接口调用失败") } @@ -436,8 +444,13 @@ export class payrollStore { batchSendInfoList = (params = {}) => { API.batchSendInfoList(params).then(res => { if(res.status) { - this.canGrantDataSource = res.data.datas; + let datas = res.data.datas || []; + datas.map(item => { + item.key = item.id + }) + this.canGrantDataSource = datas this.canGrantColumns = res.data.columns; + this.canGrantPageInfo = res.data.pageInfo // alert("this.canGrantColumns:" + JSON.stringify(this.canGrantColumns)) } else { message.error(res.errormsg || "获取失败") @@ -450,8 +463,13 @@ export class payrollStore { batchWithdrawInfoList = (params = {}) => { API.batchWithdrawInfoList(params).then(res => { if(res.status) { - this.canWithdrawDataSource = res.data.datas + let datas = res.data.datas || []; + datas.map(item => { + item.key = item.id + }) + this.canWithdrawDataSource = datas this.canWidthdrawColumns = res.data.columns + this.canWithdrawPageInfo = res.data.pageInfo } else { message.error(res.errormsg || "获取失败"); }