feature/2.15.1.2407.01-薪资项目以及字段管理页面改造
This commit is contained in:
parent
6ec8cb76ce
commit
a101de8355
|
|
@ -2,6 +2,7 @@ import React from "react";
|
|||
import { inject, observer } from "mobx-react";
|
||||
import { Button, Dropdown, Menu, message, Modal, Switch } from "antd";
|
||||
import { WeaInputSearch, WeaLocaleProvider, WeaSlideModal, WeaTop } from "ecCom";
|
||||
import * as API from "../../apis/item";
|
||||
import SalaryItemsTable from "./salaryItemsTable";
|
||||
import { toDecimal_n } from "../../util";
|
||||
import SystemSalaryItemModal from "./systemSalaryItemModal";
|
||||
|
|
@ -68,28 +69,29 @@ export default class SalaryItem extends React.Component {
|
|||
});
|
||||
};
|
||||
|
||||
// 删除列表项
|
||||
handleDeleteItem(record) {
|
||||
const { salaryItemStore: { deleteItemRequest, getTableDatas } } = this.props;
|
||||
handleDeleteItem = () => {
|
||||
const { selectedRowKeys, isQuery } = this.state;
|
||||
if (_.isEmpty(selectedRowKeys)) {
|
||||
message.warning(getLabel(111, "请勾选数据!"));
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: "信息确认",
|
||||
content: "确认删除该条数据吗?",
|
||||
title: getLabel(131329, "信息确认"),
|
||||
content: getLabel(111, "确认删除吗?"),
|
||||
onOk: () => {
|
||||
deleteItemRequest([record.id]).then(() => {
|
||||
getTableDatas({ ...this.state.searchParams }).then(res => {
|
||||
this.setState({
|
||||
searchParams: {
|
||||
...this.state.searchParams,
|
||||
total: res.total
|
||||
}
|
||||
});
|
||||
});
|
||||
API.deleteItem(selectedRowKeys).then(({ status, errormsg }) => {
|
||||
if (status) {
|
||||
message.success(getLabel(111, "操作成功!"));
|
||||
this.setState({ isQuery: !isQuery });
|
||||
} else {
|
||||
message.error(errormsg);
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel: () => {
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
getColumns = () => {
|
||||
const { salaryItemStore, taxAgentStore: { showSalaryItemBtn, showOperateBtn } } = this.props;
|
||||
|
|
@ -241,7 +243,7 @@ export default class SalaryItem extends React.Component {
|
|||
let buttons = [
|
||||
<Dropdown.Button overlay={menu} type="primary"
|
||||
onClick={() => handleMenuClick({ key: "1" })}>{getLabel(111, "新增自定义薪资项")}</Dropdown.Button>,
|
||||
<Button type="ghost">{getLabel(32136, "批量删除")}</Button>,
|
||||
<Button type="ghost" onClick={this.handleDeleteItem}>{getLabel(32136, "批量删除")}</Button>,
|
||||
<WeaInputSearch value={name} onChange={val => this.setState({ name: val })}
|
||||
placeholder={getLabel(111, "请输入名称")} onSearch={() => this.setState({ isQuery: !isQuery })}/>
|
||||
];
|
||||
|
|
@ -326,6 +328,7 @@ export default class SalaryItem extends React.Component {
|
|||
className="salaryProjectManagement">
|
||||
<div className="salaryItems_content"><SalaryItemsTable {...this.props} name={name} isQuery={isQuery}
|
||||
selectedRowKeys={selectedRowKeys}
|
||||
onDropMenuClick={this.onDropMenuClick}
|
||||
onChange={val => this.setState({ selectedRowKeys: val })}/>
|
||||
{/*<WeaNewScroll height="100%">*/}
|
||||
{/* <CustomPaginationTable*/}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
import React, { Component } from "react";
|
||||
import { WeaCheckbox, WeaLocaleProvider, WeaTable } from "ecCom";
|
||||
import { Dropdown, Menu, message, Modal } from "antd";
|
||||
import * as API from "../../apis/item";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
|
|
@ -17,7 +18,7 @@ class SalaryItemsTable extends Component {
|
|||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
loading: false, columns: [], dataSource: [], selectedRowKeys: [],
|
||||
loading: false, columns: [], dataSource: [],
|
||||
pageInfo: { current: 1, pageSize: 10, total: 0 }
|
||||
};
|
||||
}
|
||||
|
|
@ -27,7 +28,9 @@ class SalaryItemsTable extends Component {
|
|||
}
|
||||
|
||||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
if (nextProps.isQuery !== this.props.isQuery) this.getItemList(nextProps);
|
||||
if (nextProps.isQuery !== this.props.isQuery) this.setState({
|
||||
pageInfo: { ...this.state.pageInfo, current: 1 }
|
||||
}, () => this.getItemList(nextProps));
|
||||
}
|
||||
|
||||
getItemList = (props) => {
|
||||
|
|
@ -51,10 +54,30 @@ class SalaryItemsTable extends Component {
|
|||
}
|
||||
});
|
||||
};
|
||||
handleDeleteItem = (record) => {
|
||||
Modal.confirm({
|
||||
title: getLabel(131329, "信息确认"),
|
||||
content: getLabel(111, "确认删除吗?"),
|
||||
onOk: () => {
|
||||
API.deleteItem(selectedRowKeys).then(({ status, errormsg }) => {
|
||||
if (status) {
|
||||
message.success(getLabel(111, "操作成功!"));
|
||||
this.getItemList(this.props);
|
||||
} else {
|
||||
message.error(errormsg);
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel: () => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
const { dataSource, columns, pageInfo, selectedRowKeys } = this.state;
|
||||
// const { selectedRowKeys, onChange } = this.props;
|
||||
const { dataSource, columns, pageInfo, loading } = this.state;
|
||||
const {
|
||||
selectedRowKeys, onChange, onDropMenuClick, taxAgentStore: { showOperateBtn, showSalaryItemBtn }
|
||||
} = this.props;
|
||||
const pagination = {
|
||||
...pageInfo,
|
||||
showTotal: total => `${getLabel(111, "共")} ${total} ${getLabel(111, "条")}`,
|
||||
|
|
@ -71,17 +94,38 @@ class SalaryItemsTable extends Component {
|
|||
}
|
||||
};
|
||||
const rowSelection = {
|
||||
selectedRowKeys,
|
||||
onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }),
|
||||
getCheckboxProps: record => {
|
||||
console.log(record)
|
||||
return ({
|
||||
disabled: !record.canDelete
|
||||
})
|
||||
}
|
||||
selectedRowKeys, onChange,
|
||||
getCheckboxProps: record => ({
|
||||
disabled: !record.canDelete
|
||||
})
|
||||
};
|
||||
return (<WeaTable dataSource={dataSource} columns={columns} pagination={pagination} rowSelection={rowSelection}
|
||||
scroll={{ y: `calc(100vh - 155px)` }}/>);
|
||||
return (
|
||||
<WeaTable rowKey="id" dataSource={dataSource} rowSelection={rowSelection} pagination={pagination}
|
||||
loading={loading} scroll={{ y: `calc(100vh - 155px)` }}
|
||||
columns={[
|
||||
...columns, {
|
||||
dataIndex: "opt", title: getLabel(111, "操作"), width: 140,
|
||||
render: (__, record) => (<React.Fragment>
|
||||
<a style={{ marginRight: 8 }}
|
||||
href="javascript:void(0);">{(showOperateBtn || showSalaryItemBtn) ? getLabel(111, "编辑") : getLabel(111, "查看")}</a>
|
||||
{
|
||||
(showOperateBtn || showSalaryItemBtn) && record.canDelete &&
|
||||
<a style={{ marginRight: 8 }} href="javascript:void(0);"
|
||||
onClick={() => this.handleDeleteItem(record)}>{getLabel(111, "删除")}</a>
|
||||
}
|
||||
<Dropdown overlay={
|
||||
<Menu>
|
||||
<Menu.Item>
|
||||
<a href="javascript:void(0);"
|
||||
onClick={() => onDropMenuClick("log", record.id)}>{getLabel(545781, "操作日志")}</a>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
}>
|
||||
<a href="javascript:void(0)"><i className="icon-coms-more"/></a>
|
||||
</Dropdown>
|
||||
</React.Fragment>)
|
||||
}
|
||||
]}/>);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue