feature/2.9.42308.02-薪资项目同步到薪资账套

This commit is contained in:
黎永顺 2023-08-31 14:23:51 +08:00
parent a22f3ade1f
commit a058242d35
6 changed files with 276 additions and 123 deletions

View File

@ -1,4 +1,4 @@
import { WeaTools } from 'ecCom';
import { WeaTools } from "ecCom";
/**
* 薪资项目api
@ -7,171 +7,171 @@ import { WeaTools } from 'ecCom';
// 薪资项目-获取列表
export const getItemList = params => {
return fetch('/api/bs/hrmsalary/salaryitem/list', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
return fetch("/api/bs/hrmsalary/salaryitem/list", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(params)
}).then(res => res.json());
};
//薪资项目的高级搜索
export const getSaCondition = params => {
return WeaTools.callApi('/api/bs/hrmsalary/salaryitem/getSearchCondition', 'GET', params);
return WeaTools.callApi("/api/bs/hrmsalary/salaryitem/getSearchCondition", "GET", params);
};
//数据源列表字典项
export const formulaDatasourceList = params => {
return WeaTools.callApi('/api/bs/hrmsalary/formula/datasource/list', 'GET', params);
return WeaTools.callApi("/api/bs/hrmsalary/formula/datasource/list", "GET", params);
};
//薪资项目-系统薪资项目列表
export const getSysItemList = params => {
return fetch('/api/bs/hrmsalary/salaryitem/sysList', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
return fetch("/api/bs/hrmsalary/salaryitem/sysList", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(params)
}).then(res => res.json());
};
//系统薪资项目的高级搜索
export const getSysSaCondition = params => {
return WeaTools.callApi('/api/bs/hrmsalary/salaryitem/getSysSearchCondition', 'GET', params);
}
return WeaTools.callApi("/api/bs/hrmsalary/salaryitem/getSysSearchCondition", "GET", params);
};
//薪资项目-批量删除薪资项目
export const deleteItem = params => {
return fetch('/api/bs/hrmsalary/salaryitem/delete', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
return fetch("/api/bs/hrmsalary/salaryitem/delete", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(params)
}).then(res => res.json());
};
//薪资项目-批量删除列表
export const deleteItemList = params => {
return fetch('/api/bs/hrmsalary/salaryitem/listCanDelete', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
return fetch("/api/bs/hrmsalary/salaryitem/listCanDelete", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(params)
}).then(res => res.json());
};
//薪资项目-新增薪资项目
export const saveItem = params => {
delete params.formulaContent
return fetch('/api/bs/hrmsalary/salaryitem/save', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
delete params.formulaContent;
return fetch("/api/bs/hrmsalary/salaryitem/save", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(params)
}).then(res => res.json());
};
//薪资项目-更新薪资项目
export const updateItem = params => {
return WeaTools.callApi('/api/bs/hrmsalary/salaryitem/update', 'POST', params);
}
return WeaTools.callApi("/api/bs/hrmsalary/salaryitem/update", "POST", params);
};
//薪资项目-薪资项目详情
export const getItemForm = params => {
return WeaTools.callApi('/api/bs/hrmsalary/salaryitem/getSalaryForm', 'GET', params);
}
return WeaTools.callApi("/api/bs/hrmsalary/salaryitem/getSalaryForm", "GET", params);
};
//薪资项目-添加系统薪资项目
export const saveSysItem = params => {
return fetch('/api/bs/hrmsalary/salaryitem/saveSys', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
return fetch("/api/bs/hrmsalary/salaryitem/saveSys", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(params)
}).then(res => res.json());
};
//获取薪资项目可选的类型(与属性有联动)
export const getItemTypeOption = params => {
return WeaTools.callApi('/api/bs/hrmsalary/salaryitem/listSalaryItemTypeOption', 'GET', params);
}
return WeaTools.callApi("/api/bs/hrmsalary/salaryitem/listSalaryItemTypeOption", "GET", params);
};
//获取公式描述
export const getFormulaDes = params => {
return WeaTools.callApi('/api/bs/hrmsalary/formula/des', 'GET', params);
}
return WeaTools.callApi("/api/bs/hrmsalary/formula/des", "GET", params);
};
// *** 公式 start ***
// 获取公式变量类型
export const formualSearchGroup = params => {
return fetch('/api/bs/hrmsalary/formula/search/group', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
return fetch("/api/bs/hrmsalary/formula/search/group", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(params)
}).then(res => res.json());
};
//获取公式变量字段
export const formualSearchField = params => {
return fetch('/api/bs/hrmsalary/formula/search/field', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
return fetch("/api/bs/hrmsalary/formula/search/field", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(params)
}).then(res => res.json());
};
// /api/bs/hrmsalary/formula/save
// 保存公式
export const saveFormual = params => {
return fetch('/api/bs/hrmsalary/formula/save', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
return fetch("/api/bs/hrmsalary/formula/save", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(params)
}).then(res => res.json());
};
// 公式测试
export const testFormual = params => {
return fetch('/api/bs/hrmsalary/formula/mock', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
return fetch("/api/bs/hrmsalary/formula/mock", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(params)
}).then(res => res.json());
};
// 根据id获取formual
export const detailFormual = params => {
return fetch('/api/bs/hrmsalary/formula/detail', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
return fetch("/api/bs/hrmsalary/formula/detail", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(params)
}).then(res => res.json());
};
// *** 公式 end ***
@ -179,14 +179,28 @@ export const detailFormual = params => {
// 列出可以删除的薪资项目
export const listCanDelete = params => {
return fetch('/api/bs/hrmsalary/salaryitem/listCanDelete', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
}
return fetch("/api/bs/hrmsalary/salaryitem/listCanDelete", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(params)
}).then(res => res.json());
};
//获取哪些账套中使用了该薪资项目
export const getSalarySobBySalaryItem = params => {
return WeaTools.callApi("/api/bs/hrmsalary/salaryitem/getSalarySobBySalaryItem", "GET", params);
};
// 同步到薪资账套
export const syncSalaryItemToSalarySobItem = params => {
return fetch("/api/bs/hrmsalary/salaryitem/syncSalaryItemToSalarySobItem ", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(params)
}).then(res => res.json());
};

View File

@ -155,6 +155,27 @@ export const valTakeOptions = [
{ key: "2", showname: "公式" },
{ key: "3", showname: "SQL" }
];
export const salarySetConditions = [
{
items: [{
colSpan: 1,
checkbox: false,
checkboxValue: false,
conditionType: "SELECT",
domkey: ["salarySobIds"],
fieldcol: 18,
label: "薪资账套",
lanId: 538010,
labelcol: 6,
options: [],
rules: "required|string",
multiple: true,
viewAttr: 3
}],
title: "",
defaultshow: true
}
];

View File

@ -9,6 +9,7 @@ import { columns } from "./columns";
import SlideModalTitle from "../../components/slideModalTitle";
import CustomSalaryItemSlide from "./customSalaryItemSlide";
import CustomPaginationTable from "../../components/customPaginationTable";
import SyncToSalaryAccountSetDialog from "./syncToSalaryAccountSetDialog";
import "../socialSecurityBenefits/programme/index.less";
const { getLabel } = WeaLocaleProvider;
@ -25,7 +26,8 @@ export default class SalaryItem extends React.Component {
searchValue: "",
formalModalVisible: false,
searchParams: { current: 1, pageSize: 10, total: 0 },
selectedRowKeys: []
selectedRowKeys: [],
syncSalarySetDialog: { visible: false, title: "", id: "" }
};
columns.map(item => {
if (item.dataIndex == "refere") {
@ -69,7 +71,10 @@ export default class SalaryItem extends React.Component {
onEditItem = (record, isedit) => {
this.record = record;
const { salaryItemStore: { getItemForm, setEditSlideVisible } } = this.props;
this.setState({ editable: isedit, isAdd: false });
this.setState({
editable: isedit, isAdd: false,
syncSalarySetDialog: { ...this.state.syncSalarySetDialog, id: record.id }
});
getItemForm(record.id).then(() => {
setEditSlideVisible(true);
}).catch(({ errormsg }) => {
@ -308,6 +313,15 @@ export default class SalaryItem extends React.Component {
];
} else if (this.state.editable) {
arrList = [
<Button type="ghost"
onClick={() => this.setState({
syncSalarySetDialog: {
...this.state.syncSalarySetDialog,
visible: true,
title: getLabel(111, "请选择薪资账套")
}
})}
>{getLabel(111, "同步到薪资账套")}</Button>,
<Button type="primary" onClick={() => {
handleSlideSave(false);
}}>保存</Button>
@ -365,6 +379,15 @@ export default class SalaryItem extends React.Component {
</WeaNewScroll>
</div>
</WeaTop>
<SyncToSalaryAccountSetDialog
{...this.state.syncSalarySetDialog}
onCancel={() => this.setState({
syncSalarySetDialog: {
...this.state.syncSalarySetDialog,
visible: false, id: "", title: ""
}
})}
/>
{
systemItemVisible &&

View File

@ -102,3 +102,11 @@
}
}
}
.salarySetDialog {
.salarySetDialogContent {
.wea-select, .ant-select-selection, .ant-select {
width: 100%;
}
}
}

View File

@ -0,0 +1,85 @@
/*
* Author: 黎永顺
* name: 同步到薪资账套
* Description:
* Date: 2023/8/31
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaDialog, WeaLocaleProvider } from "ecCom";
import { Button } from "antd";
import { getSearchs } from "../../util";
import { getSalarySobBySalaryItem } from "../../apis/item";
import { salarySetConditions } from "./columns";
const getLabel = WeaLocaleProvider.getLabel;
@inject("salaryItemStore")
@observer
class SyncToSalaryAccountSetDialog extends Component {
constructor(props) {
super(props);
this.state = {
loading: false,
conditions: []
};
}
componentWillReceiveProps(nextProps, nextContext) {
const { salaryItemStore: { salarySetform } } = nextProps;
if (nextProps.visible !== this.props.visible && nextProps.visible) this.getSalarySobBySalaryItem(nextProps);
if (nextProps.visible !== this.props.visible && !nextProps.visible) salarySetform.resetForm();
}
getSalarySobBySalaryItem = (props) => {
const { id, salaryItemStore: { salarySetform } } = props;
getSalarySobBySalaryItem({ id }).then(({ status, data }) => {
if (status) {
this.setState({
conditions: _.map(salarySetConditions, item => {
return {
...item,
items: _.map(item.items, o => ({
...o,
options: _.map(data, it => ({ key: it.id, showname: it.content }))
}))
};
})
}, () => {
salarySetform.initFormFields(this.state.conditions);
});
}
});
};
save = () => {
const { salaryItemStore: { salarySetform } } = this.props;
salarySetform.validateForm().then(f => {
console.log(salarySetform.getFormParams());
if (f.isValid) {
this.setState({ loading: true });
} else {
f.showErrors();
}
});
};
render() {
const { salaryItemStore: { salarySetform } } = this.props;
const { conditions } = this.state;
return (
<WeaDialog
{...this.props} className="salarySetDialog" initLoadCss
style={{ width: 550 }}
buttons={[<Button type="primary" onClick={this.save}
loading={this.state.loading}>{getLabel(537558, "确定")}</Button>]}
>
<div className="salarySetDialogContent">
{getSearchs(salarySetform, conditions, 1)}
</div>
</WeaDialog>
);
}
}
export default SyncToSalaryAccountSetDialog;

View File

@ -8,6 +8,8 @@ import { notNull } from "../util/validate";
const { TableStore } = WeaTableNew;
export class SalaryItemStore {
@observable salarySetform = new WeaForm(); //同步薪资账套form
@observable tableStore = new TableStore(); // new table
@observable sysListTableStore = new TableStore();
@observable form = new WeaForm(); // nrew 一个form