diff --git a/pc4mobx/hrmSalary/apis/variableSalary.js b/pc4mobx/hrmSalary/apis/variableSalary.js index 2f214881..04bbeb02 100644 --- a/pc4mobx/hrmSalary/apis/variableSalary.js +++ b/pc4mobx/hrmSalary/apis/variableSalary.js @@ -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); +}; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js index f29cae1a..6297a558 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js @@ -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) { diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js new file mode 100644 index 00000000..6ec040bb --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileList/index.js @@ -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) => ( + this.handleEdit(record.id)}>{getLabel(111, "编辑")} + { + record.canDelete && this.handleDelete([record.id])}>{getLabel(111, "删除")} + } + ) + } + ] + } + ); + } + }); + }; + 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 ( + + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/conditions.js b/pc4mobx/hrmSalary/pages/variableSalary/conditions.js index 49ca43de..98ecd684 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/conditions.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/conditions.js @@ -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", diff --git a/pc4mobx/hrmSalary/pages/variableSalary/index.js b/pc4mobx/hrmSalary/pages/variableSalary/index.js index bc73021f..5035381c 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/index.js @@ -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 { , , , + this.setState({ salaryMonth: val })}/>, this.openAdvanceSearch()} onAdvanceSearch={this.handleAdvanceSearch}/> - ] : [ this.openAdvanceSearch()} - onAdvanceSearch={this.handleAdvanceSearch}/>], - children: null + ] : [ + this.setState({ salaryMonth: val })}/>, + this.openAdvanceSearch()} + onAdvanceSearch={this.handleAdvanceSearch}/> + ], + children: }, { title: getLabel(111, "薪资项目"), key: "salaryItem", diff --git a/pc4mobx/hrmSalary/pages/variableSalary/index.less b/pc4mobx/hrmSalary/pages/variableSalary/index.less index 1c1dd906..26e8d09d 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/index.less +++ b/pc4mobx/hrmSalary/pages/variableSalary/index.less @@ -57,6 +57,10 @@ } .variable_salary_file_dialog { + .scroller { + background: #f6f6f6 !important; + } + .wea-slide-modal-title { border-bottom: 1px solid #e5e5e5 !important; }