diff --git a/pc4mobx/hrmSalary/apis/variableSalary.js b/pc4mobx/hrmSalary/apis/variableSalary.js index cdfdde70..2f214881 100644 --- a/pc4mobx/hrmSalary/apis/variableSalary.js +++ b/pc4mobx/hrmSalary/apis/variableSalary.js @@ -4,7 +4,20 @@ import { postFetch } from "../util/request"; export const getVariableSalaryItemList = params => { return postFetch("/api/bs/hrmsalary/variableSalaryItem/listPage", params); }; +//删除浮动薪酬项目 +export const deleteVariableSalaryItem = params => { + return postFetch("/api/bs/hrmsalary/variableSalaryItem/delete", params); +}; +//获取浮动薪酬项目详情 +export const getVariableSalaryItemDetail = params => { + return postFetch("/api/bs/hrmsalary/variableSalaryItem/getDetail", params); +}; //保存/更新 浮动薪酬项目 export const saveVariableSalaryItem = params => { return postFetch("/api/bs/hrmsalary/variableSalaryItem/save", params); }; + +//创建浮动薪酬档案时获取项目信息 +export const getCreateForm = params => { + return postFetch("/api/bs/hrmsalary/variableSalary/getCreateForm", params); +}; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js index 7e981704..9ef6b2d2 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.js @@ -18,9 +18,9 @@ class Index extends Component { render() { const { baseTableStore: { VSalryForm }, searchType } = this.props; return ( -
- VSalryForm.updateFields({ keyword: v })} +
+ VSalryForm.updateFields({ username: v })} onSearch={this.props.onAdvanceSearch} /> { diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less index 9081d39f..ba4f56fc 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/advanceInputBtn/index.less @@ -1,4 +1,4 @@ -.achrive-advance-search { +.salaryItem-advance-search { display: flex; align-items: center; position: relative; @@ -24,6 +24,5 @@ overflow: hidden; white-space: nowrap; text-overflow: ellipsis; - top: 1px; } } diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js new file mode 100644 index 00000000..f29cae1a --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryFileDialog/index.js @@ -0,0 +1,112 @@ +/* + * 浮动薪酬 + * 新建编辑薪资档案 + * @Author: 黎永顺 + * @Date: 2024/8/8 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaLocaleProvider, WeaSlideModal, WeaTools } from "ecCom"; +import { Button, message } from "antd"; +import { getSearchs } from "../../../../util"; +import { salaryFileConditions } from "../../conditions"; +import * as API from "../../../../apis/variableSalary"; + +const getKey = WeaTools.getKey; +const getLabel = WeaLocaleProvider.getLabel; + +@inject("baseTableStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + conditions: [], loading: false + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + document.querySelector(".variable_salary_wrapper").classList.add("zIndex0-weaslide-title"); + this.initForm(nextProps); + } else if (nextProps.visible !== this.props.visible && !nextProps.visible) { + document.querySelector(".variable_salary_wrapper").classList.remove("zIndex0-weaslide-title"); + this.props.baseTableStore.initVSSalaryFileForm(); + } + } + + initForm = (props) => { + const { baseTableStore: { VSSalaryFileForm } } = props; + API.getCreateForm().then(({ status, data }) => { + this.setState({ + conditions: [ + ..._.map(salaryFileConditions, item => ({ + ...item, + items: _.map(item.items, o => ({ ...o, label: getLabel(o.lanId, o.label) })) + })), + { + items: _.map(data, o => ({ + conditionType: "INPUT", + domkey: [String(o.id)], + fieldcol: 14, + label: o.name, + labelcol: 6, + value: "", + viewAttr: 2 + })), + title: "", col: 2, + defaultshow: true + } + ] + }, () => VSSalaryFileForm.initFormFields(this.state.conditions)); + }); + }; + save = () => { + const { baseTableStore: { VSSalaryFileForm }, onSearch, id } = this.props; + VSSalaryFileForm.validateForm().then(f => { + if (f.isValid) { + const payload = VSSalaryFileForm.getFormParams(); + this.setState({ loading: true }); + API.saveVariableSalaryItem({ ...payload, id }) + .then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success(getLabel(30700, "操作成功")); + this.props.onCancel(onSearch()); + } else { + message.error(errormsg); + } + }).catch(() => this.setState({ loading: false })); + } else { + f.showErrors(); + } + }); + }; + renderTitle = () => { + const { loading } = this.state, { title } = this.props; + return
+
+
+
{title}
+
+
+ +
+
; + }; + + render() { + const { conditions, loading } = this.state; + const { baseTableStore: { VSSalaryFileForm }, onClose } = this.props; + return ( onClose()} + top={0} width={800} height={100} measureT="%" measureX="px" measureY="%" title={this.renderTitle()} + content={
{getSearchs(VSSalaryFileForm, conditions)}
} + />); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemDialog/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemDialog/index.js index 71eba98b..cc4d456d 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemDialog/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemDialog/index.js @@ -39,20 +39,21 @@ class Index extends Component { }, () => VSSalaryItemForm.initFormFields(this.state.conditions)); }; save = () => { - const { baseTableStore: { VSSalaryItemForm }, onSearch } = this.props; + const { baseTableStore: { VSSalaryItemForm }, onSearch, id } = this.props; VSSalaryItemForm.validateForm().then(f => { if (f.isValid) { const payload = VSSalaryItemForm.getFormParams(); this.setState({ loading: true }); - API.saveVariableSalaryItem({ ...payload }).then(({ status, errormsg }) => { - this.setState({ loading: false }); - if (status) { - message.success(getLabel(30700, "操作成功")); - this.props.onCancel(onSearch()); - } else { - message.error(errormsg); - } - }).catch(() => this.setState({ loading: false })); + API.saveVariableSalaryItem({ ...payload, id }) + .then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success(getLabel(30700, "操作成功")); + this.props.onCancel(onSearch()); + } else { + message.error(errormsg); + } + }).catch(() => this.setState({ loading: false })); } else { f.showErrors(); } @@ -61,16 +62,16 @@ class Index extends Component { render() { const { conditions, loading } = this.state; - const { baseTableStore: { calculateForm } } = this.props; + const { baseTableStore: { VSSalaryItemForm } } = this.props; return ( {getLabel(111, "取消")}, - + , + ]} > -
{getSearchs(calculateForm, conditions, 1, false)}
+
{getSearchs(VSSalaryItemForm, conditions, 1, false)}
); } diff --git a/pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemList/index.js b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemList/index.js new file mode 100644 index 00000000..210df203 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/variableSalary/components/salaryItemList/index.js @@ -0,0 +1,113 @@ +/* + * 浮动薪酬 + * 薪资项目列表 + * @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.getVariableSalaryItemList(); + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.isQuery !== this.props.isQuery) this.setState({ + pageInfo: { ...this.state.pageInfo, current: 1 } + }, () => this.getVariableSalaryItemList()); + } + + getVariableSalaryItemList = () => { + const { baseTableStore: { VSalryForm } } = this.props; + const { pageInfo } = this.state; + const { username: itemName } = VSalryForm.getFormParams(); + this.setState({ loading: true }); + API.getVariableSalaryItemList({ ...pageInfo, itemName }).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.getVariableSalaryItemList()); + }, + onChange: current => { + this.setState({ + pageInfo: { ...pageInfo, current } + }, () => this.getVariableSalaryItemList()); + } + }; + return ( + + ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/conditions.js b/pc4mobx/hrmSalary/pages/variableSalary/conditions.js index ae943a2d..49ca43de 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/conditions.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/conditions.js @@ -3,13 +3,75 @@ export const conditions = [ items: [ { conditionType: "INPUT", - domkey: ["dimName"], + domkey: ["itemName"], fieldcol: 14, - label: "测试", + label: "项目名称", + lanId: 111, labelcol: 6, value: "", - rules: "required|string", - viewAttr: 3 + hide: true, + viewAttr: 2 + }, + { + conditionType: "INPUT", + domkey: ["username"], + fieldcol: 14, + label: "名称", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 2 + }, + { + conditionType: "MONTHPICKER", + domkey: ["salaryMonth"], + fieldcol: 14, + label: "薪资所属月", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 2 + }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: false, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + icon: "icon-coms-hrm", + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: "", + type: "57", + viewAttr: 2 + }, + conditionType: "BROWSER", + domkey: ["departmentIds"], + fieldcol: 14, + label: "部门", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 2 + }, + { + conditionType: "INPUT", + domkey: ["workcode"], + fieldcol: 14, + label: "工号", + lanId: 111, + labelcol: 6, + value: "", + viewAttr: 2 } ], title: "", @@ -50,3 +112,54 @@ export const salaryItemsConditions = [ defaultshow: true } ]; +export const salaryFileConditions = [ + { + items: [ + { + conditionType: "MONTHPICKER", + domkey: ["salaryMonth"], + fieldcol: 14, + label: "薪资所属月", + lanId: 111, + labelcol: 6, + value: "", + rules: "required|string", + viewAttr: 3 + }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: false, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: true, + icon: "icon-coms-hrm", + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: "", + type: "1", + viewAttr: 2 + }, + conditionType: "BROWSER", + domkey: ["employeeId"], + fieldcol: 14, + label: "人员", + lanId: 111, + labelcol: 6, + value: "", + rules: "required|string", + viewAttr: 3 + } + ], + title: "", col: 1, + defaultshow: true + } +]; diff --git a/pc4mobx/hrmSalary/pages/variableSalary/index.js b/pc4mobx/hrmSalary/pages/variableSalary/index.js index abf682d3..bc73021f 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/index.js +++ b/pc4mobx/hrmSalary/pages/variableSalary/index.js @@ -13,8 +13,11 @@ import { 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 { Button } from "antd"; import cs from "classnames"; +import "./index.less"; const getLabel = WeaLocaleProvider.getLabel; @@ -24,29 +27,55 @@ class Index extends Component { constructor(props) { super(props); this.state = { - selectedKey: "salaryFile", isQuery: false, - SIDialog: { visible: false, title: "" } //薪资项目薪资编辑弹框 + selectedKey: "salaryFile", isQuery: false, showSearchAd: false, + SIDialog: { visible: false, title: "", id: "" }, //薪资项目薪资编辑弹框 + SFDialog: { visible: false, title: "", id: "" } //薪资档案编辑弹框 }; } handleAdvanceSearch = () => this.setState({ isQuery: !this.state.isQuery }); + openAdvanceSearch = () => this.setState({ showSearchAd: !this.state.showSearchAd }); + handleOperate = (type) => { + switch (type) { + case "create": + this.setState({ + SFDialog: { visible: true, id: "", title: getLabel(111, "新增薪资档案") } + }); + break; + default: + break; + } + }; render() { - const { selectedKey, SIDialog } = this.state; - const { taxAgentStore: { showOperateBtn } } = this.props; + const { selectedKey, SIDialog, SFDialog, showSearchAd, isQuery } = this.state; + const { taxAgentStore: { showOperateBtn }, baseTableStore: { VSSalaryItemForm } } = this.props; const tabs = [ { title: getLabel(111, "薪资档案"), key: "salaryFile", - buttons: showOperateBtn ? [] : [] + buttons: showOperateBtn ? [ + , + , + , + this.openAdvanceSearch()} + onAdvanceSearch={this.handleAdvanceSearch}/> + ] : [ this.openAdvanceSearch()} + onAdvanceSearch={this.handleAdvanceSearch}/>], + children: null }, { title: getLabel(111, "薪资项目"), key: "salaryItem", buttons: showOperateBtn ? [ , - ] : [] + ] : [], + children: this.setState({ + SIDialog: { visible: true, id: data.id, title: getLabel(111, "编辑薪资项目") } + }, () => VSSalaryItemForm.updateFields({ + name: data.name, dataType: data.dataType + }))}/> } ]; return ( @@ -60,9 +89,15 @@ class Index extends Component {
this.setState({ showSearchAd: false })} onAdSearch={this.onAdSearch}/>
+ {_.find(tabs, o => selectedKey === o.key).children} + {/*薪资项目*/} this.setState({ SIDialog: { ...SIDialog, visible: false } }, () => callback && callback())}/> + {/*薪资档案*/} + this.setState({ + SFDialog: { ...SFDialog, visible: false } + }, () => callback && callback())}/> ); } diff --git a/pc4mobx/hrmSalary/pages/variableSalary/index.less b/pc4mobx/hrmSalary/pages/variableSalary/index.less index a487afd7..1c1dd906 100644 --- a/pc4mobx/hrmSalary/pages/variableSalary/index.less +++ b/pc4mobx/hrmSalary/pages/variableSalary/index.less @@ -1,4 +1,17 @@ .variable_salary_wrapper { + .wea-new-top-req-title > div:last-child { + right: 16px !important; + } + + .wea-new-top-req-content { + padding: 16px; + + .wea-new-table { + background: #FFF; + } + + } + .searchAdvanced-condition-hide { display: none; } @@ -14,7 +27,7 @@ } .wea-advanced-searchsAd { - height: 155px; + height: 108px; overflow: hidden auto; .formItem-delete { @@ -42,4 +55,53 @@ } } + + .variable_salary_file_dialog { + .wea-slide-modal-title { + border-bottom: 1px solid #e5e5e5 !important; + } + + .titleDialog { + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 46px 0 16px; + + .titleCol { + flex: 1; + display: flex; + align-items: center; + } + + .titleLeftBox { + .titleIcon { + color: #fff; + margin: 0; + width: 40px; + height: 40px; + line-height: 40px; + font-size: 22px; + display: flex; + align-items: center; + justify-content: center; + background: #F14A2D; + border-radius: 50%; + } + + .title { + font-size: 14px; + color: #333; + padding-left: 6px; + } + } + + .titleRightBox { + justify-content: flex-end; + + button:last-child { + margin-left: 10px; + } + } + } + } } diff --git a/pc4mobx/hrmSalary/stores/baseTable.js b/pc4mobx/hrmSalary/stores/baseTable.js index 75106e3a..8598d0cb 100644 --- a/pc4mobx/hrmSalary/stores/baseTable.js +++ b/pc4mobx/hrmSalary/stores/baseTable.js @@ -16,8 +16,11 @@ export class BaseTableStore { // 浮动薪酬相关 @observable VSalryForm = new WeaForm(); // 浮动薪酬查询form - @observable VSSalaryItemForm = new WeaForm(); // 新增浮动薪酬项目form + @observable VSSalaryItemForm = new WeaForm(); // 新增编辑浮动薪酬项目form @action initVSSalaryItemForm = () => this.VSSalaryItemForm = new WeaForm(); + @observable VSSalaryFileForm = new WeaForm(); // 新增编辑薪资档案form + @action initVSSalaryFileForm = () => this.VSSalaryFileForm = new WeaForm(); + // 初始化操作 @action doInit = () => { diff --git a/pc4mobx/hrmSalary/style/index.less b/pc4mobx/hrmSalary/style/index.less index 4ce6ef7a..ea74c23c 100644 --- a/pc4mobx/hrmSalary/style/index.less +++ b/pc4mobx/hrmSalary/style/index.less @@ -83,3 +83,10 @@ } +//公共slide框标题样式 +.zIndex0-weaslide-title { + .wea-new-top-req { + z-index: 0 !important; + } +} +