薪资项目管理bug处理

This commit is contained in:
MustangDeng 2022-05-13 13:33:14 +08:00
parent 7dc2b1d33e
commit 91c1907b1b
3 changed files with 66 additions and 15 deletions

View File

@ -9,36 +9,77 @@ import CustomTable from '../../components/customTable'
@observer
export default class DeleteSalaryItemModal extends React.Component {
constructor(props) {
super(props);
this.state ={
selectedRowKeys: [],
searchValue: ""
}
this.page = 1
}
componentWillMount() {
const { salaryItemStore: {listCanDelete}} = this.props;
listCanDelete()
}
getColumns() {
const { salaryItemStore } = this.props;
const { canDeleteList } = salaryItemStore
let columns = canDeleteList.columns ? canDeleteList.columns : []
columns = [...columns]
return columns
}
// 分页
handleDataPageChange(value) {
const { salaryItemStore: {listCanDelete}} = this.props;
listCanDelete({current: value})
this.page = value;
listCanDelete({name: this.state.searchValue, current: value})
}
// 选择框选中事件
onSelectChange(selectedRowKeys) {
this.setState({ selectedRowKeys });
}
handleSearchChange(value) {
this.setState({searchValue: value})
}
// 搜索
handleSearch(value) {
const { salaryItemStore: {listCanDelete}} = this.props;
listCanDelete({name: value, current: this.page})
}
render() {
const { selectedRowKeys, searchValue } = this.state;
const { salaryItemStore } = this.props;
const { canDeleteList, loading } = salaryItemStore
const { canDeleteList, modalLoading } = salaryItemStore
const rowSelection = {
selectedRowKeys,
onChange: this.onSelectChange.bind(this),
};
const handleDelete = () => {
const { salaryItemStore: { deleteItem } } = this.props;
deleteItem();
deleteItem(this.state.selectedRowKeys);
}
return (
<Modal visible={this.props.visible} onCancel={() => {this.props.onCancel()}} width={800}>
<Modal visible={this.props.visible} onCancel={() => {this.props.onCancel()}} footer={null} width={800}>
<div style={{height: "47px", lineHeight: '47px'}}>
<span style={{marginLeft: "10px", fontSize: '14px'}}>批量删除</span>
<div style={{float: "right", marginRight: "40px"}}>
<Button type="primary" style={{marginRight: '10px'}} onClick={() => {handleDelete()}}>批量删除</Button>
<WeaInputSearch />
<WeaInputSearch value={searchValue} onChange={(value) => {this.handleSearchChange(value)}} onSearch={(value) => {this.handleSearch(value)}}/>
</div>
</div>
<div style={{margin: "10px"}}>
<CustomTable loadding={loading}
<div style={{margin: "10px", height: "500px", overflowY: "scroll"}}>
<CustomTable loadding={modalLoading}
rowSelection={rowSelection}
columns={this.getColumns()}
dataSource={canDeleteList.list ? canDeleteList.list : []}
pagination={{

View File

@ -179,7 +179,7 @@ export default class SalaryItem extends React.Component {
}
const batchDelete = () => {
deleteItemList({})
// deleteItemList({})
setDeleteItemVisible(true)
}

View File

@ -46,6 +46,9 @@ export class SalaryItemStore {
// 公式详情
@observable formulaDetail = {};
// Modal
@observable modalLoading = true;
// 设置字段列表
@action
setSearchFields = (searchFields) => {
@ -185,8 +188,7 @@ export class SalaryItemStore {
//薪资项目-批量删除薪资项目
@action
deleteItem = () => {
let ids = toJS(this.deleteTableStore.selectedRowKeys)
deleteItem = (ids) => {
if(ids.length == 0) {
message.warning("未选择任何条目");
return
@ -316,20 +318,28 @@ export class SalaryItemStore {
}
})
})
}
//
// 获取可以删除的列表
@action
listCanDelete = (params = {}) => {
this.loading = true;
this.modalLoading = true;
API.listCanDelete(params).then(res => {
if(res.status) {
this.canDeleteList = res.data
let data = res.data
if(res.data.list && res.data.list.length > 0) {
data.list = res.data.list.map(item => {
item = {...item}
item.key = item.id
return item
})
}
console.log("this.canDeleteList:", this.canDeleteList)
this.canDeleteList = data
} else {
message.error(res.errormsg || "获取失败")
}
this.loading = false;
this.modalLoading = false;
})
}
}