Merge branch 'feature/2.9.42310.01-薪资核算页面重构' into develop

This commit is contained in:
黎永顺 2023-10-11 16:43:01 +08:00
commit afc4ad4d1d
10 changed files with 630 additions and 57 deletions

View File

@ -15,7 +15,8 @@ import CumSituation from "./pages/dataAcquisition/cumSituation";
import Attendance from "./pages/dataAcquisition/attendance";
import SpecialAddDeduction from "./pages/dataAcquisition/specialAddDeduction";
import Ledger from "./pages/ledgerPage";
import Calculate from "./pages/calculate";
// import Calculate from "./pages/calculate";
import Calculate from "./pages/calculate/calculate"; //重构的薪资核算页面
import Payroll from "./pages/payroll";
import PayrollGrant from "./pages/payroll/payrollGrant";
import PayrollDetail from "./pages/payroll/payrollDetail";

View File

@ -0,0 +1,209 @@
/*
* Author: 黎永顺
* name: 薪资核算-重构页面
* Description:
* Date: 2023/10/9
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaLocaleProvider, WeaTop } from "ecCom";
import { Button, message, Modal } from "antd";
import moment from "moment";
import CalculateQuery from "./components/calculateQuery";
import CalculateTablelist from "./components/calculateTablelist";
import CalculateDialog from "./components/calculateDialog";
import { backCalculate, deleteSalaryacct, fileSalaryAcct, reAccounting } from "../../apis/calculate";
import "./index.less";
import ProgressModal from "../../components/progressModal";
const getLabel = WeaLocaleProvider.getLabel;
@inject("calculateStore", "taxAgentStore")
@observer
class Calculate extends Component {
constructor(props) {
super(props);
this.state = {
queryParams: {
name: "",
dateRange: [
moment(new Date()).startOf("year").format("YYYY-MM"),
moment(new Date()).startOf("month").format("YYYY-MM")
]
}, isRefresh: false,
progressModule: { visible: false, progress: 0, title: getLabel(111, "正在归档中请稍后") },
calcDaialog: { visible: false, title: "" }
};
this.timer = null;
this.handleDebounce = null;
}
renderCalculateOpts = () => {
const { taxAgentStore: { showOperateBtn } } = this.props;
const { queryParams, isRefresh } = this.state;
let calculateOpts = [
<Button type="primary" onClick={() => this.setState({
calcDaialog: {
visible: true,
title: getLabel(538780, "核算")
}
})}>{getLabel(538780, "核算")}</Button>,
<CalculateQuery queryParams={queryParams} onChange={v => this.setState({
isRefresh: _.keys(v)[0] === "name" ? isRefresh : !isRefresh,
queryParams: { ...queryParams, ...v }
})} onSearch={() => this.setState({ isRefresh: !isRefresh })}/>
];
return !showOperateBtn ? calculateOpts.slice(1) : calculateOpts;
};
handleCalcOpts = ({ key }, record) => {
const { isRefresh, progressModule } = this.state, { id } = record;
switch (key) {
case "0":
//核算
window.open(`/spa/hrmSalary/static/index.html#/main/hrmSalary/calculate/${id}`);
break;
case "1":
//删除
Modal.confirm({
title: getLabel(131329, "信息确认"),
content: getLabel(543231, "确认删除本条数据吗?"),
onOk: () => {
deleteSalaryacct([id]).then(({ status, errormsg }) => {
if (status) {
message.success(getLabel(502230, "删除成功!"));
this.setState({ isRefresh: !isRefresh });
} else {
message.error(errormsg);
}
});
}
});
break;
case "2":
//归档
if (!this.handleDebounce) {
this.handleDebounce = _.debounce(() => {
if (this.timer) clearInterval(this.timer);
this.setState({ progressModule: { ...progressModule, visible: true } });
this.timer = setInterval(() => {
if (progressModule.progress === 100 && this.timer) {
clearInterval(this.timer);
this.timer = null;
this.setState({
progressModule: { ...progressModule, visible: false, progress: 0 },
isRefresh: !isRefresh
});
}
this.setState({
progressModule: { ...progressModule, progress: progressModule.progress + 1 }
});
}, 800);
fileSalaryAcct({ id }).then(({ status, errormsg }) => {
if (status) {
clearInterval(this.timer);
this.timer = null;
this.setState({
progressModule: { ...progressModule, visible: false, progress: 0 },
isRefresh: !isRefresh
});
message.success(getLabel(503690, "归档成功"));
} else {
clearInterval(this.timer);
this.timer = null;
this.setState({
progressModule: { ...progressModule, visible: false, progress: 0 }
});
message.error(errormsg);
}
});
this.handleDebounce = null;
}, 500);
}
this.handleDebounce();
break;
case "3":
//查看详情
window.open(`/spa/hrmSalary/static/index.html#/main/hrmSalary/placeOnFileDetail?id=${id}`);
break;
case "4":
//重新核算
if (!this.handleDebounce) {
this.handleDebounce = _.debounce(() => {
reAccounting({ salaryAcctRecordId: id }).then(({ status, errormsg }) => {
if (status) {
message.success(getLabel(30700, "操作成功!"));
this.setState({ isRefresh: !isRefresh });
} else {
message.error(errormsg);
}
});
this.handleDebounce = null;
}, 500);
}
this.handleDebounce();
break;
case "5":
//回算
Modal.confirm({
title: getLabel(131329, "信息确认"),
content: getLabel(543538, "确定回算吗?回算后,正常核算的数据会被覆盖,正常核算的工资单不能继续发放或撤回!"),
onOk: () => {
if (!this.handleDebounce) {
this.handleDebounce = _.debounce(() => {
backCalculate({ salaryAcctRecordId: id }).then(({ status, errormsg }) => {
if (status) {
message.success(getLabel(544367, "回算成功!"));
this.setState({ isRefresh: !isRefresh });
} else {
message.error(errormsg);
}
});
this.handleDebounce = null;
}, 500);
}
this.handleDebounce();
}
});
break;
default:
break;
}
};
render() {
const { queryParams, isRefresh, calcDaialog, progressModule } = this.state;
return (
<WeaTop title={getLabel(538011, "薪资核算")} icon={<i className="icon-coms-fa"/>} iconBgcolor="#F14A2D"
buttons={this.renderCalculateOpts()} className="calculate-main-layout"
>
<div className="calculate-body">
<CalculateTablelist queryParams={queryParams} isRefresh={isRefresh} onCalcOpts={this.handleCalcOpts}/>
<CalculateDialog {...calcDaialog}
onCancel={(bool, id) => this.setState({
calcDaialog: { ...calcDaialog, visible: false },
isRefresh: bool === "refresh" ? !isRefresh : isRefresh
}, () => bool === "refresh" && window.open(`/spa/hrmSalary/static/index.html#/main/hrmSalary/calculate/${id}`))}
/>
{/* 归档进度条*/}
{
progressModule.visible &&
<ProgressModal
{...progressModule}
onCancel={() => {
this.setState({
progressModule: {
...progressModule,
visible: false,
progress: 0
}
}, () => clearInterval(this.timer));
}}
/>
}
</div>
</WeaTop>
);
}
}
export default Calculate;

View File

@ -1,56 +0,0 @@
export const columns = [
{
title: "薪资所属月",
dataIndex: 'title',
key: 'title',
},
{
title: "薪资账套",
dataIndex: 'title',
key: 'title',
},
{
title: "状态",
dataIndex: 'title',
key: 'title',
},
{
title: "税款所属期",
dataIndex: 'title',
key: 'title',
},
{
title: "核算人数",
dataIndex: 'title',
key: 'title',
},
{
title: "核算人",
dataIndex: 'title',
key: 'title',
},
{
title: "最后操作时间",
dataIndex: 'title',
key: 'title',
},
{
title: "备注",
dataIndex: 'title',
key: 'title',
},
{
title: "操作",
dataIndex: 'cz',
key: 'cz',
}
]
export const dataSource = [{
title: "测试"
}];

View File

@ -0,0 +1,43 @@
export const calculateConditions = [
{
items: [
{
colSpan: 1,
conditionType: "MONTHPICKER",
domkey: ["salaryMonthStr"],
fieldcol: 14,
label: "薪资所属月",
lanId: 542604,
labelcol: 6,
value: "",
rules: "required|string",
viewAttr: 3
},
{
colSpan: 1,
conditionType: "SELECT",
domkey: ["salarySobId"],
fieldcol: 14,
label: "核算账套",
lanId: 519146,
labelcol: 6,
options: [],
rules: "required|string",
viewAttr: 3
},
{
colSpan: 1,
conditionType: "INPUT",
domkey: ["description"],
fieldcol: 14,
label: "备注",
lanId: 536726,
labelcol: 6,
value: "",
viewAttr: 2
}
],
defaultshow: true,
title: ""
}
];

View File

@ -0,0 +1,92 @@
/*
* Author: 黎永顺
* name: 薪资核算重构-核算弹框
* Description:
* Date: 2023/10/9
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaDialog, WeaLocaleProvider, WeaTools } from "ecCom";
import { Button, message } from "antd";
import { getSearchs } from "../../../../util";
import { salaryacctGetForm, saveBasic } from "../../../../apis/calculate";
import { calculateConditions } from "./condition";
const getKey = WeaTools.getKey;
const getLabel = WeaLocaleProvider.getLabel;
@inject("calculateStore")
@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) this.salaryacctGetForm(nextProps);
if (nextProps.visible !== this.props.visible && !nextProps.visible) this.props.calculateStore.initCalcForm();
}
salaryacctGetForm = (props) => {
const { calculateStore: { calculateForm } } = props;
salaryacctGetForm().then(({ status, data }) => {
if (status) {
const { salarySobs } = data;
this.setState({
conditions: _.map(calculateConditions, item => ({
...item,
items: _.map(item.items, o => {
if (getKey(o) === "salarySobId") {
return {
...o,
options: _.map(salarySobs, g => ({ key: g.id.toString(), showname: g.name }))
};
}
return { ...o };
})
}))
}, () => calculateForm.initFormFields(this.state.conditions));
}
});
};
save = () => {
const { calculateStore: { calculateForm } } = this.props;
calculateForm.validateForm().then(f => {
if (f.isValid) {
const payload = calculateForm.getFormParams();
this.setState({ loading: true });
saveBasic({ ...payload }).then(({ status, data, errormsg }) => {
this.setState({ loading: false });
if (status) {
message.success(getLabel(30700, "操作成功"));
this.props.onCancel("refresh", data);
} else {
message.error(errormsg);
}
}).catch(() => this.setState({ loading: false }));
} else {
f.showErrors();
}
});
};
render() {
const { conditions, loading } = this.state;
const { calculateStore: { calculateForm } } = this.props;
return (
<WeaDialog
{...this.props} style={{ width: 480 }} initLoadCss
buttons={[
<Button type="primary" onClick={this.save} loading={loading}>{getLabel(543233, "保存并进入核算")}</Button>
]}
>
<div className="calculate-dialog-layout">{getSearchs(calculateForm, conditions, 1, false)}</div>
</WeaDialog>
);
}
}
export default Index;

View File

@ -0,0 +1,34 @@
/*
* Author: 黎永顺
* name: 薪资核算-查询
* Description:
* Date: 2023/10/9
*/
import React, { Component } from "react";
import { WeaInputSearch, WeaLocaleProvider } from "ecCom";
import { MonthRangePicker } from "../../../reportView/components/statisticalMicroSettingsSlide";
const getLabel = WeaLocaleProvider.getLabel;
class Index extends Component {
render() {
const { queryParams } = this.props;
const { dateRange, name } = queryParams;
return (
<div className="salary-btn-flex">
<div className="mounth-range">
<span className="label">{getLabel(543549, "薪资所属月:")}</span>
<MonthRangePicker dateRange={dateRange} viewAttr={2}
onChange={v => this.props.onChange({ dateRange: v })}/>
</div>
<WeaInputSearch value={name}
placeholder={getLabel(543431, "请输入薪资账套名称")}
onChange={v => this.props.onChange({ name: v })}
onSearch={this.props.onSearch}
/>
</div>
);
}
}
export default Index;

View File

@ -0,0 +1,153 @@
/*
* Author: 黎永顺
* name: 薪资核算-列表
* Description:
* Date: 2023/10/9
*/
import React, { Component } from "react";
import { WeaHelpfulTip, WeaLocaleProvider, WeaTable } from "ecCom";
import { Dropdown, Menu, Tag } from "antd";
import { getSalaryAcctList } from "../../../../apis/calculate";
const getLabel = WeaLocaleProvider.getLabel;
class Index extends Component {
constructor(props) {
super(props);
this.state = {
loading: false, columns: [], dataSource: [],
pageInfo: { current: 1, pageSize: 10, total: 0 }
};
}
componentDidMount() {
this.getSalaryAcctList(this.props);
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.isRefresh !== this.props.isRefresh) this.getSalaryAcctList(nextProps);
}
getSalaryAcctList = (props) => {
const { pageInfo } = this.state;
const { queryParams } = props;
const { dateRange, ...extra } = queryParams;
const [startMonthStr, endMonthStr] = dateRange || [];
const params = { startMonthStr, endMonthStr, ...extra };
const payload = { ...pageInfo, ...params };
this.setState({ loading: true });
getSalaryAcctList(payload).then(({ status, data }) => {
this.setState({ loading: false });
if (status) {
const { columns, list: dataSource, pageNum, pageSize, total } = data;
this.setState({
dataSource, pageInfo: { ...pageInfo, pageNum, pageSize, total },
columns: _.map(_.filter(columns, it => (it.dataIndex !== "backCalcStatus" && it.dataIndex !== "acctTimes")),
o => {
const { dataIndex } = o;
let width = "";
switch (dataIndex) {
case "status":
case "employeeSize":
width = "5%";
break;
case "salarySobName":
width = "20%";
break;
case "description":
width = "15%";
break;
default:
width = "10%";
break;
}
if (dataIndex === "operate") {
return {
...o, width: 170,
title: <span>
<span>{getLabel(30585, "操作")}</span>
<WeaHelpfulTip
placement="topLeft" style={{ marginLeft: 4 }}
title={getLabel(111, "当前账套当次核算的工资单全部撤回才可重新核算")}
/>
</span>,
render: (__, record) => {
const { operate = [] } = record;
return <React.Fragment>
{
_.map(operate.slice(0, 2), f => (
<a href="javascript:void(0);" style={{ marginRight: 10 }}
onClick={() => this.props.onCalcOpts({ key: f.index }, record)}>{f.text}</a>
))
}
{
!_.isEmpty(operate.slice(2)) &&
<Dropdown
overlay={<Menu onClick={(e) => this.props.onCalcOpts(e, record)}>
{
_.map(operate.slice(2), g => (<Menu.Item key={g.index}>{g.text}</Menu.Item>))
}
</Menu>
}
>
<a href="javascript:void(0);"><i className="icon-coms-more"/></a>
</Dropdown>
}
</React.Fragment>;
}
};
} else if (dataIndex === "salarySobName") {
return {
...o, width,
render: (text, record) => {
const { acctTimes, backCalcStatus } = record;
return <div className="salarySobNameWrapper">
<span title={text}>{text}</span>
<div className="salarySobNameTagWrapper">
{
backCalcStatus === 1 &&
<i className="icon-coms-Refresh" title={getLabel(542638, "回算")}/>
}
<Tag color="blue">{`${getLabel(15323, "第")}${acctTimes}${getLabel(18929, "次")}`}</Tag>
</div>
</div>;
}
};
}
return { ...o, width };
})
});
}
}).catch(() => this.setState({ loading: false }));
};
render() {
const { loading, dataSource, columns, 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.getSalaryAcctList(this.props));
},
onChange: current => {
this.setState({
pageInfo: { ...pageInfo, current }
}, () => this.getSalaryAcctList(this.props));
}
};
return (
<WeaTable
rowKey="id"
dataSource={dataSource} loading={loading}
pagination={pagination} columns={columns}
/>
);
}
}
export default Index;

View File

@ -30,6 +30,9 @@
& > span {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.salarySobNameTagWrapper {
@ -43,3 +46,86 @@
}
}
}
//重构薪资核算页
.salary-btn-flex {
display: flex;
align-items: center;
.mounth-range {
display: flex;
align-items: center;
margin-right: 10px;
.label {
color: #999;
}
}
.wea-input-focus {
margin-top: -4px;
}
}
.calculate-main-layout {
.wea-new-top-content {
overflow-y: hidden;
}
.calculate-body {
height: 100%;
width: 100%;
padding: 16px;
overflow-y: auto;
.wea-new-table {
background: #fff;
}
.ant-table-tbody {
td {
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
}
.calculate-dialog-layout {
background: #f6f6f6;
.wea-search-group {
padding: 16px;
}
.wea-select, .ant-select-selection, .ant-select {
width: 100%;
}
.wea-select {
display: inline-block;
position: relative;
}
.ant-select-selection {
height: 30px;
border-radius: 0;
}
.wea-content {
padding: 0;
.wea-form-cell-wrapper {
background: #FFF;
border: 1px solid #e5e5e5;
border-bottom: none;
.wea-form-cell {
border-bottom: 1px solid #e5e5e5;
}
}
}
}

View File

@ -29,6 +29,13 @@ const Home = props => props.children;
class Root extends React.Component {
componentWillMount() {
const src = "/spa/hrmSalary/hrmSalaryCalculateDetail/css/iconfont/iconfont.css"
const link = document.createElement("link")
link.setAttribute('rel','stylesheet');
link.setAttribute('type','text/css');
link.setAttribute('href',src);
let header = document.getElementById("container")
header.appendChild(link)
top.$(".ant-message").remove();
window.location.hash.indexOf("mobilepayroll") === -1 && allStore.taxAgentStore.getPermission();
if (window.location.hash.indexOf("payroll") !== -1) {

View File

@ -11,6 +11,7 @@ export class calculateStore {
@observable PCSearchForm = new WeaForm(); //人员确认-form
@observable ECSearchForm = new WeaForm(); //薪资核算-form
@observable otherConditions = []; //薪资核算-其他查询条件
@observable calculateForm = new WeaForm(); //薪资核算重构-核算form
@observable tableStore = new TableStore(); // new table
@ -71,6 +72,9 @@ export class calculateStore {
// ** 薪资核算-其他条件查询 **
@action
setOtherConditions = (otherConditions) => this.otherConditions = otherConditions;
// ** 薪资核算重构-初始化核算form **
@action
initCalcForm = () => this.calculateForm = new WeaForm();
// ** 设置导入参数 **
@action