feature/2.16.1.2410.01-薪酬统计报表薪资明细添加模板切换和模板创建功能
This commit is contained in:
parent
0abeee25f3
commit
97a5d37044
|
|
@ -138,3 +138,15 @@ export const exportSalaryList = (params) => {
|
||||||
export const savePageListSetting = (params) => {
|
export const savePageListSetting = (params) => {
|
||||||
return postFetch("/api/bs/hrmsalary/common/pageList/save/setting", params);
|
return postFetch("/api/bs/hrmsalary/common/pageList/save/setting", params);
|
||||||
};
|
};
|
||||||
|
//薪酬统计报表-保存页面模板
|
||||||
|
export const savePageListTemplate = (params) => {
|
||||||
|
return postFetch("/api/bs/hrmsalary/common/pageList/template/save", params);
|
||||||
|
};
|
||||||
|
//薪酬统计报表-获取页面模板
|
||||||
|
export const getPageListTemplatelist = (params) => {
|
||||||
|
return postFetch("/api/bs/hrmsalary/common/pageList/template/list", params);
|
||||||
|
};
|
||||||
|
//薪酬统计报表-切换个体页面模板
|
||||||
|
export const changePageListTemplate = (params) => {
|
||||||
|
return postFetch("/api/bs/hrmsalary/common/pageList/template/change", params);
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class CustomTransferDialog extends Component {
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps, nextContext) {
|
componentWillReceiveProps(nextProps, nextContext) {
|
||||||
if (nextProps.visible !== this.props.visible && nextProps.visible) {
|
if (nextProps.visible !== this.props.visible && nextProps.visible) {
|
||||||
this.getData(true);
|
this.getData(true, nextProps);
|
||||||
if (nextProps.datas) {
|
if (nextProps.datas) {
|
||||||
this.setState({
|
this.setState({
|
||||||
leftListSelectedData: _.values(nextProps.datas), rightDatas: _.values(nextProps.datas)
|
leftListSelectedData: _.values(nextProps.datas), rightDatas: _.values(nextProps.datas)
|
||||||
|
|
@ -49,9 +49,9 @@ class CustomTransferDialog extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getData = (init = false) => {
|
getData = (init = false, props) => {
|
||||||
const { query } = this.state;
|
const { query } = this.state;
|
||||||
const { completeURL, convertDatasource, dataParams = {} } = this.props;
|
const { completeURL, convertDatasource, dataParams = {} } = props || this.props;
|
||||||
let payload = { ...dataParams, ...query };
|
let payload = { ...dataParams, ...query };
|
||||||
this.setState({ loading: true });
|
this.setState({ loading: true });
|
||||||
postFetch(completeURL, payload).then(({ status, data }) => {
|
postFetch(completeURL, payload).then(({ status, data }) => {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import React from "react";
|
|
||||||
import { WeaLocaleProvider } from "ecCom";
|
import { WeaLocaleProvider } from "ecCom";
|
||||||
|
|
||||||
const { getLabel } = WeaLocaleProvider;
|
const { getLabel } = WeaLocaleProvider;
|
||||||
|
|
@ -219,3 +218,47 @@ export const salaryDetailSearchConditions = [
|
||||||
col: 2
|
col: 2
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
export const tempCondition = [
|
||||||
|
{
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
conditionType: "INPUT",
|
||||||
|
domkey: ["name"],
|
||||||
|
fieldcol: 14,
|
||||||
|
label: "模板名称",
|
||||||
|
lanId: 111,
|
||||||
|
labelcol: 6,
|
||||||
|
value: "",
|
||||||
|
rules: "required|string",
|
||||||
|
viewAttr: 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
conditionType: "SELECT",
|
||||||
|
domkey: ["sharedType"],
|
||||||
|
fieldcol: 14,
|
||||||
|
label: "可见性",
|
||||||
|
lanId: 111,
|
||||||
|
labelcol: 6,
|
||||||
|
options: [],
|
||||||
|
rules: "required|string",
|
||||||
|
viewAttr: 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
conditionType: "SELECT",
|
||||||
|
domkey: ["limitIds"],
|
||||||
|
fieldcol: 14,
|
||||||
|
label: "可见性范围",
|
||||||
|
lanId: 111,
|
||||||
|
labelcol: 6,
|
||||||
|
options: [],
|
||||||
|
detailtype: 3,
|
||||||
|
multiple: true,
|
||||||
|
rules: "",
|
||||||
|
viewAttr: 1,
|
||||||
|
hide: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
title: "",
|
||||||
|
defaultshow: true
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ class EmployeeDetails extends Component {
|
||||||
pagination={pagination}
|
pagination={pagination}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
scroll={{ y: `calc(100vh - 174px)` }}
|
scroll={{ y: `calc(100vh - 182px)` }}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,14 @@
|
||||||
* Date: 2024/3/26
|
* Date: 2024/3/26
|
||||||
*/
|
*/
|
||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import { toJS } from "mobx";
|
|
||||||
import { inject, observer } from "mobx-react";
|
import { inject, observer } from "mobx-react";
|
||||||
import { WeaTableNew } from "comsMobx";
|
import { WeaTableNew } from "comsMobx";
|
||||||
import { WeaLoadingGlobal, WeaLocaleProvider } from "ecCom";
|
import { WeaLoadingGlobal, WeaLocaleProvider, WeaSelect } from "ecCom";
|
||||||
import { message, Spin } from "antd";
|
import { message, Spin } from "antd";
|
||||||
import { getIframeParentHeight } from "../../../util";
|
import { getIframeParentHeight } from "../../../util";
|
||||||
import { sysConfCodeRule } from "../../../apis/ruleconfig";
|
import { sysConfCodeRule } from "../../../apis/ruleconfig";
|
||||||
import CustomTransferDialog from "../../../components/CustomBrowser/components/customTransferDialog";
|
import CustomTransferDialog from "../../../components/CustomBrowser/components/customTransferDialog";
|
||||||
|
import SalaryDetailsTempDialog from "./salaryDetailsTempDialog";
|
||||||
import { MonthRangePicker } from "../../reportView/components/statisticalMicroSettingsSlide";
|
import { MonthRangePicker } from "../../reportView/components/statisticalMicroSettingsSlide";
|
||||||
import AdvanceInputBtn from "../components/advanceInputBtn";
|
import AdvanceInputBtn from "../components/advanceInputBtn";
|
||||||
import SearchPannel from "../components/searchPannel";
|
import SearchPannel from "../components/searchPannel";
|
||||||
|
|
@ -29,24 +29,29 @@ class SalaryDetails extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
loading: false, dataSource: [], columns: [], selectedRowKeys: [],
|
loading: false, dataSource: [], columns: [], selectedRowKeys: [], tempPageList: [],
|
||||||
pageInfo: { current: 1, pageSize: 10, total: 0 }, payload: {},
|
pageInfo: { current: 1, pageSize: 10, total: 0 }, payload: {}, templateId: "",
|
||||||
showTotalCell: false, updateSum: true,
|
showTotalCell: false, updateSum: true, tempDialog: { visible: false, setting: [] },
|
||||||
transferDialog: {
|
transferDialog: {
|
||||||
visible: false, searchParamsKey: "name", dataParams: { page: "salary_details_report" }, saveLoading: false,
|
visible: false, searchParamsKey: "name", dataParams: { page: "salary_details_report" }, saveLoading: false,
|
||||||
completeURL: "/api/bs/hrmsalary/common/pageList/get/setting", convertDatasource: datas => {
|
completeURL: "", convertDatasource: datas => {
|
||||||
return {
|
return {
|
||||||
listDatas: _.map(datas.setting, o => ({ id: o.id, name: o.name })),
|
listDatas: _.map(datas.setting, o => ({ id: o.id || o.column, name: o.name || o.text })),
|
||||||
checked: this.converCheckedCol(datas)
|
checked: this.converCheckedCol(datas)
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
|
type: "default"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.getSalaryList(this.props);
|
this.getSalaryList(this.props);
|
||||||
|
this.getPageListTemplatelist();
|
||||||
window.addEventListener("message", this.handleReceive, false);
|
window.addEventListener("message", this.handleReceive, false);
|
||||||
|
window.addEventListener("resize", () => this.setState({
|
||||||
|
transferDialog: { ...this.state.transferDialog, cancel: true }
|
||||||
|
}, () => this.forceUpdate()), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps, nextContext) {
|
componentWillReceiveProps(nextProps, nextContext) {
|
||||||
|
|
@ -57,9 +62,22 @@ class SalaryDetails extends Component {
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
window.removeEventListener("message", this.handleReceive, false);
|
window.removeEventListener("message", this.handleReceive, false);
|
||||||
|
window.removeEventListener("message", () => this.setState({
|
||||||
|
transferDialog: { ...this.state.transferDialog, cancel: true }
|
||||||
|
}, () => this.forceUpdate()), false);
|
||||||
this.setState(({ selectedRowKeys: [] }));
|
this.setState(({ selectedRowKeys: [] }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPageListTemplatelist = () => {
|
||||||
|
API.getPageListTemplatelist({ page: "salary_details_report" }).then(({ status, data }) => {
|
||||||
|
if (status) {
|
||||||
|
this.setState({
|
||||||
|
tempPageList: _.map(data, o => ({ key: String(o.id), showname: o.name })),
|
||||||
|
templateId: String(_.find(data, o => !!o.checked).id)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
handleReceive = ({ data }) => {
|
handleReceive = ({ data }) => {
|
||||||
const { type, payload: { id, params } = {} } = data;
|
const { type, payload: { id, params } = {} } = data;
|
||||||
const { pageInfo } = this.state;
|
const { pageInfo } = this.state;
|
||||||
|
|
@ -103,40 +121,38 @@ class SalaryDetails extends Component {
|
||||||
const [{ data: confCode }] = await Promise.all([sysConfCodeRule({ code: "OPEN_ACCT_RESULT_SUM" })]);
|
const [{ data: confCode }] = await Promise.all([sysConfCodeRule({ code: "OPEN_ACCT_RESULT_SUM" })]);
|
||||||
this.setState({ loading: false });
|
this.setState({ loading: false });
|
||||||
if (status) {
|
if (status) {
|
||||||
const { dataKey, pageInfo: pageparams } = data;
|
const { columns, dataKey, pageInfo: pageparams } = data;
|
||||||
const { list: dataSource, pageNum: current, total, pageSize } = pageparams;
|
const { list: dataSource, pageNum: current, total, pageSize } = pageparams;
|
||||||
this.setState({
|
this.setState({
|
||||||
dataSource, pageInfo: { ...pageInfo, current, total, pageSize }, payload,
|
columns, dataSource, pageInfo: { ...pageInfo, current, total, pageSize }, payload,
|
||||||
showTotalCell: confCode === "1", transferDialog: { ...transferDialog, cancel: false }
|
showTotalCell: confCode === "1", transferDialog: { ...transferDialog, cancel: false }
|
||||||
}, () => tableStore.getDatas(dataKey.datas));
|
}, () => tableStore.getDatas(dataKey.datas));
|
||||||
}
|
}
|
||||||
}).catch(() => this.setState({ loading: false }));
|
}).catch(() => this.setState({ loading: false }));
|
||||||
};
|
};
|
||||||
handleExportSalaryList = (key) => {
|
handleExportSalaryList = (key) => {
|
||||||
const { attendanceStore: { tableStore } } = this.props;
|
let { selectedRowKeys, payload, columns } = this.state;
|
||||||
let { selectedRowKeys, payload } = this.state;
|
|
||||||
if (key === "SELECTED" && selectedRowKeys.length === 0) {
|
if (key === "SELECTED" && selectedRowKeys.length === 0) {
|
||||||
message.warning(getLabel(543345, "请选择需要导出的数据!"));
|
message.warning(getLabel(543345, "请选择需要导出的数据!"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WeaLoadingGlobal.start();
|
WeaLoadingGlobal.start();
|
||||||
const promise = API.exportSalaryList({
|
const promise = API.exportSalaryList({
|
||||||
...payload, ids: key === "SELECTED" ? selectedRowKeys : [],
|
...payload, ids: key === "SELECTED" ? selectedRowKeys : [], columns: _.map(columns, o => o.column)
|
||||||
columns: _.map(_.filter(toJS(tableStore.columns), (item) => item.display === "true" && item.dataIndex !== "acctTimes"), o => o.dataIndex)
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
getColumns = () => {
|
getColumns = () => {
|
||||||
const { attendanceStore: { tableStore } } = this.props;
|
const {
|
||||||
const { dataSource, pageInfo, selectedRowKeys, showTotalCell, payload, updateSum, transferDialog } = this.state;
|
columns, dataSource, pageInfo, selectedRowKeys, showTotalCell, payload, updateSum, transferDialog
|
||||||
const columns = _.filter(toJS(tableStore.columns), (item) => item.display === "true" && item.dataIndex !== "acctTimes");
|
} = this.state;
|
||||||
const sumRowlistUrl = showTotalCell ? "/api/bs/hrmsalary/report/statistics/employee/salaryListSum" : "";
|
const sumRowlistUrl = showTotalCell ? "/api/bs/hrmsalary/report/statistics/employee/salaryListSum" : "";
|
||||||
if (!_.isEmpty(columns) && !transferDialog.visible && !transferDialog.cancel) {
|
if (!_.isEmpty(columns) && !transferDialog.visible && !transferDialog.cancel) {
|
||||||
this.postMessageToChild({
|
this.postMessageToChild({
|
||||||
dataSource, pageInfo, selectedRowKeys, showTotalCell, calcDetail: true, tableScrollHeight: 154,
|
dataSource, pageInfo, selectedRowKeys, showTotalCell, calcDetail: true, tableScrollHeight: 154,
|
||||||
sumRowlistUrl, payload: { ...payload, updateSum },
|
sumRowlistUrl, payload: { ...payload, updateSum },
|
||||||
columns: _.map(columns, (it, idx) => ({
|
columns: _.map(columns, (it, idx) => ({
|
||||||
...it, calcDetail: true,
|
dataIndex: it.column, title: it.text, calcDetail: true,
|
||||||
width: (it.dataIndex === "taxAgent" || it.dataIndex === "salarySob") ? 176 : it.oldWidth,
|
width: (it.dataIndex === "taxAgent" || it.dataIndex === "salarySob") ? 176 : it.width,
|
||||||
fixed: (idx === 1 || idx === 0 || idx === 2) ? "left" : "",
|
fixed: (idx === 1 || idx === 0 || idx === 2) ? "left" : "",
|
||||||
ellipsis: true
|
ellipsis: true
|
||||||
}))
|
}))
|
||||||
|
|
@ -144,15 +160,27 @@ class SalaryDetails extends Component {
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
};
|
};
|
||||||
handleSetDefCols = () => this.setState({ transferDialog: { ...this.state.transferDialog, visible: true } });
|
handleSetDefCols = () => this.setState({
|
||||||
|
transferDialog: {
|
||||||
|
...this.state.transferDialog, completeURL: "/api/bs/hrmsalary/common/pageList/get/setting", visible: true
|
||||||
|
}
|
||||||
|
});
|
||||||
converCheckedCol = (data) => {
|
converCheckedCol = (data) => {
|
||||||
return _.reduce(data.checked, (pre, cur) => {
|
return _.reduce(data.checked || [], (pre, cur) => {
|
||||||
const item = _.find(data.setting, k => k.id === cur);
|
const item = _.find(data.setting, k => k.id === cur);
|
||||||
if (!_.isEmpty(item)) return [...pre, item];
|
if (!_.isEmpty(item)) return [...pre, item];
|
||||||
return pre;
|
return pre;
|
||||||
}, []);
|
}, []);
|
||||||
};
|
};
|
||||||
savePageListSetting = (values) => {
|
savePageListSetting = (values) => {
|
||||||
|
const { transferDialog, tempDialog } = this.state, { type } = transferDialog;
|
||||||
|
if (type === "temp") {
|
||||||
|
this.setState({
|
||||||
|
tempDialog: { ...tempDialog, visible: true, setting: _.map(values, o => o.id) },
|
||||||
|
transferDialog: { ...this.state.transferDialog, visible: false, cancel: true, type: "default" }
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
const payload = {
|
const payload = {
|
||||||
page: "salary_details_report",
|
page: "salary_details_report",
|
||||||
setting: _.map(values, o => o.id)
|
setting: _.map(values, o => o.id)
|
||||||
|
|
@ -162,27 +190,54 @@ class SalaryDetails extends Component {
|
||||||
this.setState({ transferDialog: { ...this.state.transferDialog, saveLoading: false } });
|
this.setState({ transferDialog: { ...this.state.transferDialog, saveLoading: false } });
|
||||||
if (status) {
|
if (status) {
|
||||||
message.success(getLabel(111, "操作成功!"));
|
message.success(getLabel(111, "操作成功!"));
|
||||||
this.setState({ transferDialog: { ...this.state.transferDialog, visible: false } }, () => this.getSalaryList());
|
this.setState({
|
||||||
|
transferDialog: { ...this.state.transferDialog, visible: false, type: "default" }
|
||||||
|
}, () => this.getSalaryList());
|
||||||
} else {
|
} else {
|
||||||
message.error(errormsg);
|
message.error(errormsg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
handelAddTemp = () => this.setState({
|
||||||
|
transferDialog: {
|
||||||
|
...this.state.transferDialog, visible: true, type: "temp",
|
||||||
|
completeURL: "/api/bs/hrmsalary/common/pageList/template/get"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
changePageListTemplate = (templateId) => {
|
||||||
|
this.setState({ templateId }, () => {
|
||||||
|
API.changePageListTemplate({ page: "salary_details_report", templateId }).then(({ status, errormsg }) => {
|
||||||
|
if (status) {
|
||||||
|
message.success(getLabel(111, "操作成功!"));
|
||||||
|
this.getSalaryList();
|
||||||
|
} else {
|
||||||
|
message.error(errormsg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { loading, dataSource, transferDialog } = this.state;
|
const { loading, dataSource, transferDialog, tempDialog, tempPageList, templateId } = this.state;
|
||||||
const { attendanceStore: { tableStore }, dateRange, showSearchAd } = this.props;
|
const { attendanceStore: { tableStore }, dateRange, showSearchAd } = this.props;
|
||||||
return (<React.Fragment>
|
return (<React.Fragment>
|
||||||
<div className="query-div">
|
<div className="query-div">
|
||||||
|
<WeaSelect style={{ width: 200 }} hasAddBtn options={tempPageList} addOnClick={this.handelAddTemp} showSearch
|
||||||
|
optionFilterProp="children" value={templateId} onChange={this.changePageListTemplate}/>
|
||||||
<MonthRangePicker dateRange={dateRange} viewAttr={2} onChange={this.props.onChange}/>
|
<MonthRangePicker dateRange={dateRange} viewAttr={2} onChange={this.props.onChange}/>
|
||||||
<AdvanceInputBtn onOpenAdvanceSearch={this.props.handleOpenAdvanceSearch}
|
<AdvanceInputBtn onOpenAdvanceSearch={() => this.setState({
|
||||||
onAdvanceSearch={this.props.handleAdvanceSearch}/>
|
transferDialog: { ...this.state.transferDialog, cancel: true }
|
||||||
|
}, () => this.props.handleOpenAdvanceSearch())} onAdvanceSearch={this.props.handleAdvanceSearch}/>
|
||||||
</div>
|
</div>
|
||||||
<div className={cs("searchAdvanced-condition-container", { "searchAdvanced-condition-hide": !showSearchAd })}>
|
<div className={cs("searchAdvanced-condition-container", { "searchAdvanced-condition-hide": !showSearchAd })}>
|
||||||
<SearchPannel onCancel={this.props.onCancel} onAdSearch={this.props.onAdSearch}/>
|
<SearchPannel onCancel={() => {
|
||||||
|
this.setState({
|
||||||
|
transferDialog: { ...this.state.transferDialog, cancel: true }
|
||||||
|
}, () => this.props.onCancel());
|
||||||
|
}} onAdSearch={this.props.onAdSearch}/>
|
||||||
</div>
|
</div>
|
||||||
<div className="table-layout"
|
<div className="table-layout"
|
||||||
style={{ height: getIframeParentHeight(".wea-new-top-req-content", dataSource.length, 60) + "px" }}>
|
style={{ height: getIframeParentHeight(".wea-new-top-req-content", dataSource.length, 70) + "px" }}>
|
||||||
<Spin spinning={loading}>
|
<Spin spinning={loading}>
|
||||||
<iframe
|
<iframe
|
||||||
style={{ border: 0, width: "100%", height: "100%" }}
|
style={{ border: 0, width: "100%", height: "100%" }}
|
||||||
|
|
@ -197,11 +252,18 @@ class SalaryDetails extends Component {
|
||||||
needScroll={true}
|
needScroll={true}
|
||||||
columns={this.getColumns()}
|
columns={this.getColumns()}
|
||||||
/>
|
/>
|
||||||
{/*默认显示列*/}
|
{/*默认显示列,薪资模板列表*/}
|
||||||
<CustomTransferDialog {...transferDialog} onChange={this.savePageListSetting}
|
<CustomTransferDialog {...transferDialog} onChange={this.savePageListSetting}
|
||||||
onCancel={() => this.setState({
|
onCancel={() => this.setState({
|
||||||
transferDialog: { ...transferDialog, visible: false, cancel: true }
|
transferDialog: {
|
||||||
|
...transferDialog, completeURL: "", visible: false, cancel: true, type: "default"
|
||||||
|
}
|
||||||
})}/>
|
})}/>
|
||||||
|
{/*薪资明细模板设置*/}
|
||||||
|
<SalaryDetailsTempDialog {...tempDialog} onSuccess={this.getPageListTemplatelist}
|
||||||
|
onCancel={callback => this.setState({
|
||||||
|
tempDialog: { ...tempDialog, visible: false, setting: [] }
|
||||||
|
}, () => callback && callback())}/>
|
||||||
</div>
|
</div>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,125 @@
|
||||||
|
/*
|
||||||
|
* 薪酬统计分析-薪资明细
|
||||||
|
* 列表模板设置
|
||||||
|
* @Author: 黎永顺
|
||||||
|
* @Date: 2024/11/7
|
||||||
|
* @Wechat:
|
||||||
|
* @Email: 971387674@qq.com
|
||||||
|
* @description:
|
||||||
|
*/
|
||||||
|
import React, { Component } from "react";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import { WeaDialog, WeaLocaleProvider, WeaTools } from "ecCom";
|
||||||
|
import { tempCondition } from "./conditions";
|
||||||
|
import { getTaxAgentSelectList } from "../../../apis/taxAgent";
|
||||||
|
import * as API from "../../../apis/statistics";
|
||||||
|
import { Button, message } from "antd";
|
||||||
|
import { getSearchs } from "../../../util";
|
||||||
|
|
||||||
|
const getKey = WeaTools.getKey;
|
||||||
|
const getLabel = WeaLocaleProvider.getLabel;
|
||||||
|
|
||||||
|
@inject("attendanceStore")
|
||||||
|
@observer
|
||||||
|
class SalaryDetailTempDialog extends Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
loading: false, conditions: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps, nextContext) {
|
||||||
|
if (nextProps.visible !== this.props.visible && nextProps.visible) this.getTempForm(nextProps);
|
||||||
|
if (nextProps.visible !== this.props.visible && !nextProps.visible) {
|
||||||
|
this.setState({ loading: false, conditions: [] }, () => nextProps.attendanceStore.initTempForm());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getTempForm = (props) => {
|
||||||
|
getTaxAgentSelectList().then(({ status, data }) => {
|
||||||
|
if (status) {
|
||||||
|
this.setState({
|
||||||
|
conditions: _.map(tempCondition, item => ({
|
||||||
|
...item, items: _.map(item.items, o => {
|
||||||
|
if (getKey(o) === "sharedType") {
|
||||||
|
return {
|
||||||
|
...o, label: getLabel(o.lanId, o.label), value: "0",
|
||||||
|
options: [
|
||||||
|
{ key: "0", showname: getLabel(111, "公共") },
|
||||||
|
{ key: "1", showname: getLabel(111, "私有") }
|
||||||
|
]
|
||||||
|
};
|
||||||
|
} else if (getKey(o) === "limitIds") {
|
||||||
|
return {
|
||||||
|
...o, label: getLabel(o.lanId, o.label),
|
||||||
|
options: _.map(data, o => ({ key: o.id, showname: o.content }))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return { ...o, label: getLabel(o.lanId, o.label) };
|
||||||
|
})
|
||||||
|
}))
|
||||||
|
}, () => {
|
||||||
|
const { attendanceStore: { tempForm } } = props;
|
||||||
|
tempForm.initFormFields(this.state.conditions);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
save = () => {
|
||||||
|
const { attendanceStore: { tempForm }, setting } = this.props;
|
||||||
|
tempForm.validateForm().then(f => {
|
||||||
|
if (f.isValid) {
|
||||||
|
this.setState({ loading: true });
|
||||||
|
const { limitIds, ...formVal } = tempForm.getFormParams();
|
||||||
|
const payload = {
|
||||||
|
page: "salary_details_report", setting, ...formVal,
|
||||||
|
limitIds: !_.isEmpty(limitIds) ? limitIds.split(",") : []
|
||||||
|
};
|
||||||
|
API.savePageListTemplate(payload).then(({ status, errormsg }) => {
|
||||||
|
if (status) {
|
||||||
|
message.success(getLabel(111, "操作成功!"));
|
||||||
|
this.props.onCancel(this.props.onSuccess());
|
||||||
|
} else {
|
||||||
|
message.error(errormsg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
f.showErrors();
|
||||||
|
}
|
||||||
|
}).catch(() => this.setState({ loading: false }));
|
||||||
|
};
|
||||||
|
formFieldChange = (field) => {
|
||||||
|
const key = Object.keys(field)[0], value = field[key].value;
|
||||||
|
this.setState({
|
||||||
|
conditions: _.map(this.state.conditions, item => ({
|
||||||
|
...item, items: _.map(item.items, o => {
|
||||||
|
if (key === "sharedType" && getKey(o) === "limitIds") {
|
||||||
|
return {
|
||||||
|
...o, hide: value !== "1", viewAttr: value === "1" ? 3 : 1,
|
||||||
|
rules: value === "1" ? "required|string" : ""
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return { ...o };
|
||||||
|
})
|
||||||
|
}))
|
||||||
|
}, () => {
|
||||||
|
const { attendanceStore: { tempForm } } = this.props;
|
||||||
|
tempForm.initFormFields(this.state.conditions);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { loading, conditions } = this.state;
|
||||||
|
const { attendanceStore: { tempForm } } = this.props;
|
||||||
|
return (
|
||||||
|
<WeaDialog
|
||||||
|
{...this.props} style={{ width: 480, height: 127 }} initLoadCss title={getLabel(111, "模板保存")}
|
||||||
|
buttons={[<Button type="primary" onClick={this.save} loading={loading}>{getLabel(537558, "保存")}</Button>]}>
|
||||||
|
<div className="form-dialog-layout">{getSearchs(tempForm, conditions, 1, false, this.formFieldChange)}</div>
|
||||||
|
</WeaDialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SalaryDetailTempDialog;
|
||||||
|
|
@ -217,7 +217,7 @@
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
|
|
||||||
.rangePickerBox {
|
.rangePickerBox {
|
||||||
margin-right: 10px;
|
margin: 0 10px 0 40px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ const getLabel = WeaLocaleProvider.getLabel;
|
||||||
|
|
||||||
class Index extends Component {
|
class Index extends Component {
|
||||||
render() {
|
render() {
|
||||||
const { attendCycle, salaryCycle, salaryMonth, socialSecurityCycle } = this.props;
|
const { attendCycle, salaryCycle, taxCycle, salaryMonth, socialSecurityCycle } = this.props;
|
||||||
const { fromDate: attendFromDate, endDate: attendEndDate } = attendCycle,
|
const { fromDate: attendFromDate, endDate: attendEndDate } = attendCycle,
|
||||||
{ fromDate: salaryFromDate, endDate: salaryEndDate } = salaryCycle;
|
{ fromDate: salaryFromDate, endDate: salaryEndDate } = salaryCycle;
|
||||||
return (
|
return (
|
||||||
|
|
@ -23,7 +23,7 @@ class Index extends Component {
|
||||||
</div>
|
</div>
|
||||||
<div className="line">
|
<div className="line">
|
||||||
<div className="lable">{getLabel(542240, "税款所属期")}</div>
|
<div className="lable">{getLabel(542240, "税款所属期")}</div>
|
||||||
<div className="value">{salaryMonth}</div>
|
<div className="value">{taxCycle || salaryMonth}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="line">
|
<div className="line">
|
||||||
<div className="lable">{getLabel(543475, "考勤取值周期")}</div>
|
<div className="lable">{getLabel(543475, "考勤取值周期")}</div>
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@ export class AttendanceStore {
|
||||||
@observable extensionForm = new WeaForm(); //扩展属性
|
@observable extensionForm = new WeaForm(); //扩展属性
|
||||||
@action("报表查看-扩展属性表单初始化")
|
@action("报表查看-扩展属性表单初始化")
|
||||||
initExtensionForm = () => this.extensionForm = new WeaForm();
|
initExtensionForm = () => this.extensionForm = new WeaForm();
|
||||||
|
@observable tempForm = new WeaForm(); //扩展属性
|
||||||
|
@action("薪资明细-模板设置表单初始化")
|
||||||
|
initTempForm = () => this.tempForm = new WeaForm();
|
||||||
|
|
||||||
@action("报表查看-分享报表表单初始化")
|
@action("报表查看-分享报表表单初始化")
|
||||||
initShareForm = () => this.shareForm = new WeaForm();
|
initShareForm = () => this.shareForm = new WeaForm();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue