feature/2.15.1.2407.01-浮动薪酬

This commit is contained in:
黎永顺 2024-08-08 18:24:45 +08:00
parent 70fe54efb7
commit 86de787ed4
6 changed files with 154 additions and 17 deletions

View File

@ -21,3 +21,11 @@ export const saveVariableSalaryItem = params => {
export const getCreateForm = params => {
return postFetch("/api/bs/hrmsalary/variableSalary/getCreateForm", params);
};
//创建浮动薪酬档案
export const createVariableSalary = params => {
return postFetch("/api/bs/hrmsalary/variableSalary/createData", params);
};
//创建浮动薪酬档案
export const getVariableSalaryList = params => {
return postFetch("/api/bs/hrmsalary/variableSalary/list", params);
};

View File

@ -64,13 +64,23 @@ class Index extends Component {
}, () => VSSalaryFileForm.initFormFields(this.state.conditions));
});
};
convertPayload = (payload) => {
return _.reduce(_.keys(payload), (pre, cur) => {
if (!_.isNaN(parseInt(cur))) {
return { ...pre, itemValueList: [{ variableItemId: cur, itemValue: payload[cur] }] };
}
return { ...pre, [cur]: payload[cur] };
}, {});
};
save = () => {
const { baseTableStore: { VSSalaryFileForm }, onSearch, id } = this.props;
VSSalaryFileForm.validateForm().then(f => {
if (f.isValid) {
const payload = VSSalaryFileForm.getFormParams();
console.log(payload);
return;
this.setState({ loading: true });
API.saveVariableSalaryItem({ ...payload, id })
API.createVariableSalary({ ...payload, id })
.then(({ status, errormsg }) => {
this.setState({ loading: false });
if (status) {

View File

@ -0,0 +1,118 @@
/*
* 浮动薪酬
* 薪资档案列表
* @Author: 黎永顺
* @Date: 2024/8/8
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaLocaleProvider, WeaTable } from "ecCom";
import { message, Modal } from "antd";
import * as API from "../../../../apis/variableSalary";
const getLabel = WeaLocaleProvider.getLabel;
class Index extends Component {
constructor(props) {
super(props);
this.state = {
pageInfo: { current: 1, pageSize: 10, total: 0 }, loading: false, dataSource: [], columns: []
};
}
componentDidMount() {
this.getVariableSalaryList();
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.isQuery !== this.props.isQuery) this.setState({
pageInfo: { ...this.state.pageInfo, current: 1 }
}, () => this.getVariableSalaryList());
}
getVariableSalaryList = () => {
const { baseTableStore: { VSalryForm }, salaryMonth } = this.props;
const { pageInfo } = this.state;
const { departmentIds } = VSalryForm.getFormParams();
console.log(VSalryForm.getFormParams());
this.setState({ loading: true });
API.getVariableSalaryList({
...pageInfo, salaryMonth, ...VSalryForm.getFormParams(),
departmentIds: !_.isEmpty(departmentIds) ? departmentIds.split(",") : []
})
.then(({ status, data }) => {
this.setState({ loading: false });
if (status) {
const { list: dataSource, columns, pageNum: current, pageSize, total } = data;
this.setState({
pageInfo: { ...pageInfo, current, pageSize, total }, dataSource,
columns: [
..._.filter(columns, o => o.dataIndex !== "id"),
{
title: getLabel(111, "操作"), dataIndex: "oprate",
render: (__, record) => (<React.Fragment>
<a href="javascript: void(0)" style={{ marginRight: 10 }}
onClick={() => this.handleEdit(record.id)}>{getLabel(111, "编辑")}</a>
{
record.canDelete && <a href="javascript: void(0)"
onClick={() => this.handleDelete([record.id])}>{getLabel(111, "删除")}</a>
}
</React.Fragment>)
}
]
}
);
}
});
};
handleEdit = (id) => {
API.getVariableSalaryItemDetail({ id }).then(({ status, data }) => {
if (status) this.props.onEditSalaryItem(data);
});
};
handleDelete = (itemIds) => {
Modal.confirm({
title: getLabel(111, "信息确认"),
content: getLabel(111, "确认删除吗?"),
onOk: () => {
API.deleteVariableSalaryItem({ itemIds }).then(({ status, errormsg }) => {
if (status) {
message.success(getLabel(111, "删除成功"));
this.getVariableSalaryItemList();
} else {
message.error(errormsg);
}
});
}
});
};
render() {
const { columns, dataSource, loading, pageInfo } = this.state;
const pagination = {
...pageInfo,
showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`,
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: ["10", "20", "50", "100"],
onShowSizeChange: (current, pageSize) => {
this.setState({
pageInfo: { ...pageInfo, current, pageSize }
}, () => this.getVariableSalaryList());
},
onChange: current => {
this.setState({
pageInfo: { ...pageInfo, current }
}, () => this.getVariableSalaryList());
}
};
return (
<WeaTable columns={columns} dataSource={dataSource} loading={loading} bordered
pagination={pagination} scroll={{ y: `calc(100vh - 202px)` }}/>
);
}
}
export default Index;

View File

@ -22,16 +22,6 @@ export const conditions = [
value: "",
viewAttr: 2
},
{
conditionType: "MONTHPICKER",
domkey: ["salaryMonth"],
fieldcol: 14,
label: "薪资所属月",
lanId: 111,
labelcol: 6,
value: "",
viewAttr: 2
},
{
browserConditionParam: {
completeParams: {},
@ -145,7 +135,7 @@ export const salaryFileConditions = [
quickSearchName: "",
replaceDatas: [],
title: "",
type: "1",
type: "17",
viewAttr: 2
},
conditionType: "BROWSER",

View File

@ -9,12 +9,14 @@
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaLocaleProvider, WeaReqTop } from "ecCom";
import { WeaDatePicker, WeaLocaleProvider, WeaReqTop } from "ecCom";
import AdvanceInputBtn from "./components/advanceInputBtn";
import SearchPannel from "./components/searchPannel";
import SalaryItemDialog from "./components/salaryItemDialog";
import SalaryFileDialog from "./components/salaryFileDialog";
import SalaryItemList from "./components/salaryItemList";
import SalaryFileList from "./components/salaryFileList";
import moment from "moment";
import { Button } from "antd";
import cs from "classnames";
import "./index.less";
@ -28,6 +30,7 @@ class Index extends Component {
super(props);
this.state = {
selectedKey: "salaryFile", isQuery: false, showSearchAd: false,
salaryMonth: moment(new Date()).format("YYYY-MM"),
SIDialog: { visible: false, title: "", id: "" }, //薪资项目薪资编辑弹框
SFDialog: { visible: false, title: "", id: "" } //薪资档案编辑弹框
};
@ -48,7 +51,7 @@ class Index extends Component {
};
render() {
const { selectedKey, SIDialog, SFDialog, showSearchAd, isQuery } = this.state;
const { selectedKey, SIDialog, SFDialog, showSearchAd, isQuery, salaryMonth } = this.state;
const { taxAgentStore: { showOperateBtn }, baseTableStore: { VSSalaryItemForm } } = this.props;
const tabs = [
{
@ -57,11 +60,15 @@ class Index extends Component {
<Button type="primary" onClick={() => this.handleOperate("create")}>{getLabel(111, "新建")}</Button>,
<Button type="ghost" onClick={() => this.handleOperate("import")}>{getLabel(111, "导入")}</Button>,
<Button type="primary" onClick={() => this.handleOperate("export")}>{getLabel(111, "导出")}</Button>,
<WeaDatePicker format="YYYY-MM" value={salaryMonth} onChange={val => this.setState({ salaryMonth: val })}/>,
<AdvanceInputBtn searchType="advance" onOpenAdvanceSearch={() => this.openAdvanceSearch()}
onAdvanceSearch={this.handleAdvanceSearch}/>
] : [<AdvanceInputBtn searchType="advance" onOpenAdvanceSearch={() => this.openAdvanceSearch()}
onAdvanceSearch={this.handleAdvanceSearch}/>],
children: null
] : [
<WeaDatePicker format="YYYY-MM" value={salaryMonth} onChange={val => this.setState({ salaryMonth: val })}/>,
<AdvanceInputBtn searchType="advance" onOpenAdvanceSearch={() => this.openAdvanceSearch()}
onAdvanceSearch={this.handleAdvanceSearch}/>
],
children: <SalaryFileList {...this.props} salaryMonth={salaryMonth} isQuery={isQuery}/>
},
{
title: getLabel(111, "薪资项目"), key: "salaryItem",

View File

@ -57,6 +57,10 @@
}
.variable_salary_file_dialog {
.scroller {
background: #f6f6f6 !important;
}
.wea-slide-modal-title {
border-bottom: 1px solid #e5e5e5 !important;
}