工资单bug修复
This commit is contained in:
parent
55f732c1fc
commit
936ac9bd3f
|
|
@ -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 (
|
||||
<CanMoveItem dataSource={item.items} onDataSourceChange={(dataSource) => {this.handleItemDataSourceChange(dataSource, item)}} title={item.name} onGroupDelete={() => {this.handleGroupDelete(item)}} onTitleChange={(value) => {this.handleItemTitleChange(item, value)}} onChange={(dataSource) => {this.handleCanMoveItemChange(dataSource, item)}}/>
|
||||
<CanMoveItem dataSource={item.items}
|
||||
onDataSourceChange={(dataSource) => {this.handleItemDataSourceChange(dataSource, item)}} title={item.name}
|
||||
onGroupDelete={() => {this.handleGroupDelete(item)}}
|
||||
onTitleChange={(value) => {this.handleItemTitleChange(item, value)}} onChange={(dataSource) => {this.handleCanMoveItemChange(dataSource, item)}}/>
|
||||
)
|
||||
}
|
||||
return ""
|
||||
|
|
|
|||
|
|
@ -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 {
|
|||
</span>
|
||||
</div>
|
||||
{
|
||||
this.state.showContent && <WeaTable rowSelection={rowSelection} dataSource={this.props.dataSource} columns={this.state.columns} pagination={false} draggable={true}/>
|
||||
this.state.showContent && <WeaTable
|
||||
rowSelection={rowSelection}
|
||||
dataSource={this.props.dataSource}
|
||||
columns={this.state.columns}
|
||||
pagination={false}
|
||||
onDrop={this.handleTableDrop}
|
||||
draggable={true}/>
|
||||
}
|
||||
{
|
||||
this.state.addItemVisible && <AddSalaryItemModal
|
||||
|
|
|
|||
|
|
@ -149,9 +149,27 @@ export default class PayrollGrant extends React.Component {
|
|||
)
|
||||
}
|
||||
|
||||
// 分页
|
||||
handleDataPageChange(value) {
|
||||
this.setState({current: value})
|
||||
const { payrollStore: { getInfoList } } = this.props;
|
||||
getInfoList({
|
||||
salarySendId:this.state.currentId,
|
||||
current: value
|
||||
})
|
||||
}
|
||||
|
||||
handleSearch() {
|
||||
const { payrollStore: { getInfoList } } = this.props;
|
||||
getInfoList({
|
||||
salarySendId:this.state.currentId,
|
||||
current: this.state.current
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
const {payrollStore} = this.props;
|
||||
const { salarySendDetailBaseInfo, salaryGrantDataSource, getInfoList, grantListShowSearchAd, grantListConditionForm, grantListCondition, setGrantListShowSearchAd } = payrollStore;
|
||||
const { salarySendDetailBaseInfo, salaryGrantDataSource, getInfoList, grantListShowSearchAd, grantListConditionForm, grantListCondition, setGrantListShowSearchAd, salaryGrantPageInfo } = payrollStore;
|
||||
|
||||
return (
|
||||
<div className="payrollGrant">
|
||||
|
|
@ -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 {
|
|||
</div>
|
||||
|
||||
<div className="tableWrapper">
|
||||
<WeaTable dataSource={salaryGrantDataSource} columns={this.getColumns()}/>
|
||||
<WeaTable dataSource={salaryGrantDataSource} columns={this.getColumns()}
|
||||
pagination={{
|
||||
onChange: (value) => {this.handleDataPageChange(value)},
|
||||
total: salaryGrantPageInfo.total,
|
||||
current: salaryGrantPageInfo.pageNum,
|
||||
showTotal: (total) => `共 ${total} 条`,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{
|
||||
this.state.payrollGrantVisible && <PayrollGrantModal
|
||||
|
|
|
|||
|
|
@ -1,12 +1,20 @@
|
|||
import React from 'react'
|
||||
import { WeaInputSearch, WeaHelpfulTip, WeaTable } from "ecCom"
|
||||
import { payrollGrantColumns, dataSource } from "../columns"
|
||||
import { Menu, Button,Table, Modal, Dropdown } from "antd"
|
||||
import { Menu, Button,Table, Modal, Dropdown,message } from "antd"
|
||||
import { inject, observer } from 'mobx-react';
|
||||
|
||||
@inject('payrollStore')
|
||||
@observer
|
||||
export default class payrollGrantModal extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
selectedRowKeys: [],
|
||||
current: 1,
|
||||
searchValue: ""
|
||||
}
|
||||
}
|
||||
// 撤回
|
||||
handleWithdraw(record) {
|
||||
const { payrollStore } = this.props;
|
||||
|
|
@ -66,24 +74,76 @@ export default class payrollGrantModal extends React.Component {
|
|||
return result;
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
onSelectChange = (value) => {
|
||||
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 = (
|
||||
<Menu>
|
||||
<Menu onClick={(e) => this.handleMenuClick(e)}>
|
||||
<Menu.Item key="1">发放所选</Menu.Item>
|
||||
</Menu>
|
||||
);
|
||||
|
||||
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 (
|
||||
<Modal width={800} visible={this.props.visible} onCancel={() => {this.props.onCancel()}}>
|
||||
<div style={{padding: "0px 10px", height: "47px", lineHeight: "47px"}}>
|
||||
<span style={{fontSize: "14px", color: '#666'}}>批量发放</span>
|
||||
<div style={{float: "right", marginRight: "40px"}}>
|
||||
<Dropdown.Button type="primary" style={{marginRight: "10px"}} overlay={menu}>全部发放</Dropdown.Button>
|
||||
<WeaInputSearch />
|
||||
<Dropdown.Button type="primary" style={{marginRight: "10px"}} overlay={menu} onClick={() => {this.handleGrantAll()}}>全部发放</Dropdown.Button>
|
||||
<WeaInputSearch value={this.state.searchValue} onChange={(value) => {this.setState({searchValue: value})}} onSearch={(value) => {this.handleSearch(value)}}/>
|
||||
</div>
|
||||
</div>
|
||||
<div style={{height: "40px", lineHeight: "40px"}}>
|
||||
|
|
@ -105,8 +165,15 @@ export default class payrollGrantModal extends React.Component {
|
|||
<span>工资单模板:{salarySendDetailBaseInfo.template}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div style={{marginTop: "10px"}}>
|
||||
<WeaTable dataSource={canGrantDataSource} columns={this.getColumns()}/>
|
||||
<div style={{marginTop: "10px", height: "500px", overflowY: "scroll"}}>
|
||||
<WeaTable rowSelection={rowSelection} dataSource={canGrantDataSource} columns={this.getColumns()}
|
||||
pagination={{
|
||||
onChange: (value) => {this.handleDataPageChange(value)},
|
||||
total: canGrantPageInfo.total,
|
||||
current: canGrantPageInfo.pageNum,
|
||||
showTotal: (total) => `共 ${total} 条`,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Modal>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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 = (
|
||||
<Menu>
|
||||
<Menu onClick={(e) => this.handleMenuClick(e)}>
|
||||
<Menu.Item key="1">撤回所选</Menu.Item>
|
||||
</Menu>
|
||||
);
|
||||
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 (
|
||||
<Modal width={800} visible={this.props.visible} onCancel={() => {this.props.onCancel()}}>
|
||||
<div style={{padding: "0px 10px", height: "47px", lineHeight: "47px"}}>
|
||||
<span style={{fontSize: "14px", color: '#666'}}>批量撤回</span>
|
||||
<div style={{float: "right", marginRight: "40px"}}>
|
||||
<Dropdown.Button style={{marginRight: "10px"}} overlay={menu}>全部撤回</Dropdown.Button>
|
||||
<WeaInputSearch />
|
||||
<Dropdown.Button style={{marginRight: "10px"}} overlay={menu} onClick={() => {this.handleWithdrawAll()}}>全部撤回</Dropdown.Button>
|
||||
<WeaInputSearch value={this.state.searchValue} onChange={(value) => {this.setState({searchValue: value})}} onSearch={(value) => {this.handleSearch(value)}}/>
|
||||
</div>
|
||||
</div>
|
||||
<div style={{height: "40px", lineHeight: "40px"}}>
|
||||
|
|
@ -105,8 +169,18 @@ export default class PayrollWithdrawModal extends React.Component {
|
|||
<span>工资单模板:{salarySendDetailBaseInfo.template}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div style={{marginTop: "10px"}}>
|
||||
<WeaTable dataSource={canWithdrawDataSource} columns={this.getColumns()}/>
|
||||
<div style={{marginTop: "10px", height: "500px", scrollY: "scroll"}}>
|
||||
<WeaTable
|
||||
rowSelection={rowSelection}
|
||||
dataSource={canWithdrawDataSource}
|
||||
columns={this.getColumns()}
|
||||
pagination={{
|
||||
onChange: (value) => {this.handleDataPageChange(value)},
|
||||
total: canWithdrawPageInfo.total,
|
||||
current: canWithdrawPageInfo.pageNum,
|
||||
showTotal: (total) => `共 ${total} 条`,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Modal>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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 || "获取失败");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue