release/2.15.2.2409.01
This commit is contained in:
parent
0754316e77
commit
5b3a645dfc
|
|
@ -134,3 +134,7 @@ export const getSalaryListSum = (params) => {
|
|||
export const exportSalaryList = (params) => {
|
||||
return postExportFetch("/api/bs/hrmsalary/report/statistics/employee/exportSalaryList", params);
|
||||
};
|
||||
//薪酬统计报表-保存全局自定义列配置
|
||||
export const savePageListSetting = (params) => {
|
||||
return postFetch("/api/bs/hrmsalary/common/pageList/save/setting", params);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ class CustomTransferDialog extends Component {
|
|||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
loading: false, listDatas: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, selectedRowKeys: [],
|
||||
query: { [props.searchParamsKey]: "" }, singleFilterVal: "",
|
||||
loading: false, listDatas: [],
|
||||
query: { [props.searchParamsKey]: "" },
|
||||
leftListSelectedKeys: [], // 左侧table选择的keys
|
||||
leftListSelectedData: [], // 左侧table选择的数据
|
||||
rightCheckedKeys: [], //右侧选择的keys
|
||||
|
|
@ -40,9 +40,9 @@ class CustomTransferDialog extends Component {
|
|||
leftListSelectedData: _.values(nextProps.datas), rightDatas: _.values(nextProps.datas)
|
||||
});
|
||||
}
|
||||
} else {
|
||||
} else if (nextProps.visible !== this.props.visible && !nextProps.visible) {
|
||||
this.setState({
|
||||
pageInfo: { current: 1, pageSize: 10, total: 0 }, query: { [this.props.searchParamsKey]: "" },
|
||||
query: { [this.props.searchParamsKey]: "" },
|
||||
rightDatas: [], rightCheckedKeys: [], leftListSelectedData: [], leftListSelectedKeys: []
|
||||
});
|
||||
this.selectedData = {};
|
||||
|
|
@ -50,7 +50,7 @@ class CustomTransferDialog extends Component {
|
|||
}
|
||||
|
||||
getData = (init = false) => {
|
||||
const { pageInfo, query } = this.state;
|
||||
const { query } = this.state;
|
||||
const { completeURL, convertDatasource, dataParams = {} } = this.props;
|
||||
let payload = { ...dataParams, ...query };
|
||||
this.setState({ loading: true });
|
||||
|
|
@ -59,37 +59,20 @@ class CustomTransferDialog extends Component {
|
|||
if (status && data.list) {
|
||||
const { pageNum: current, pageSize, total } = data;
|
||||
this.setState({
|
||||
listDatas: convertDatasource ? convertDatasource(data.list) : data.list,
|
||||
pageInfo: { ...pageInfo, current, pageSize, total }
|
||||
listDatas: convertDatasource ? convertDatasource(data.list) : data.list
|
||||
});
|
||||
} else {
|
||||
console.log(64, data);
|
||||
this.setState({
|
||||
listDatas: convertDatasource ? convertDatasource(data) : [],
|
||||
leftListSelectedData: init ? _.values(nextProps.datas) : [],
|
||||
rightDatas: init ? _.values(nextProps.datas) : []
|
||||
listDatas: convertDatasource ? convertDatasource(data).listDatas : [],
|
||||
leftListSelectedData: (init && convertDatasource) ? convertDatasource(data).checked : this.state.leftListSelectedData,
|
||||
rightDatas: (init && convertDatasource) ? convertDatasource(data).checked : this.state.rightDatas
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
handleOk = () => {
|
||||
const { selectedRowKeys, rightDatas } = this.state, { dialogType } = this.props;
|
||||
const convertSelectedRowKeys = dialogType !== "table" ? rightDatas.map((v) => v.id) : selectedRowKeys;
|
||||
convertSelectedRowKeys.forEach((v) => {
|
||||
let item = this.getItemById(v);
|
||||
if (item) this.selectedData[v] = item;
|
||||
});
|
||||
this.props.onChange && this.props.onChange(convertSelectedRowKeys, this.selectedData);
|
||||
this.props.onCancel && this.props.onCancel();
|
||||
};
|
||||
getItemById = (id) => {
|
||||
const { listDatas } = this.state;
|
||||
if (this.selectedData[id]) return this.selectedData[id];
|
||||
if (!_.isEmpty(listDatas)) {
|
||||
for (let i = 0; i < listDatas.length; i++) {
|
||||
if (String(id) === String(listDatas[i].id)) return listDatas[i];
|
||||
}
|
||||
}
|
||||
const { rightDatas } = this.state;
|
||||
this.props.onChange && this.props.onChange(rightDatas);
|
||||
};
|
||||
onLeftListCheck = (keys, datas) => {
|
||||
const { leftListSelectedData } = this.state;
|
||||
|
|
@ -155,14 +138,11 @@ class CustomTransferDialog extends Component {
|
|||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
loading, listDatas, query, leftListSelectedKeys, rightDatas, rightCheckedKeys,
|
||||
singleFilterVal
|
||||
} = this.state;
|
||||
const { dialogType, isSingle, searchParamsKey } = this.props;
|
||||
const { loading, listDatas, query, leftListSelectedKeys, rightDatas, rightCheckedKeys } = this.state;
|
||||
const { searchParamsKey, saveLoading } = this.props;
|
||||
const buttons = [
|
||||
<Button type="primary" onClick={this.handleOk}
|
||||
disabled={dialogType !== "table" && _.isEmpty(rightDatas)}>{getLabel(111, "确 定")}</Button>,
|
||||
<Button type="primary" loading={saveLoading} onClick={this.handleOk}
|
||||
disabled={_.isEmpty(rightDatas)}>{getLabel(111, "确 定")}</Button>,
|
||||
<Button type="ghost" onClick={this.props.onCancel}>{getLabel(111, "取 消")}</Button>];
|
||||
let rightActive = false, leftActive = false, rightAllActive = false;
|
||||
if (leftListSelectedKeys && leftListSelectedKeys.length > 0) rightActive = true;
|
||||
|
|
@ -173,7 +153,7 @@ class CustomTransferDialog extends Component {
|
|||
<div className="wea-hr-muti-input-left">
|
||||
<Row style={{ height: 35 }}>
|
||||
<Col span="24">
|
||||
<WeaInputSearch value={query[searchParamsKey]} onSearch={this.getData}
|
||||
<WeaInputSearch value={query[searchParamsKey]} onSearch={() => this.getData()}
|
||||
onChange={value => this.setState({ query: { ...query, [searchParamsKey]: value } })}
|
||||
/>
|
||||
</Col>
|
||||
|
|
|
|||
|
|
@ -29,8 +29,13 @@ class SalaryDetails extends Component {
|
|||
pageInfo: { current: 1, pageSize: 10, total: 0 }, payload: {},
|
||||
showTotalCell: false, updateSum: true,
|
||||
transferDialog: {
|
||||
visible: false, searchParamsKey: "name", dataParams: { page: "salary_details_report" },
|
||||
completeURL: "/api/bs/hrmsalary/common/pageList/get/setting", convertDatasource: null
|
||||
visible: false, searchParamsKey: "name", dataParams: { page: "salary_details_report" }, saveLoading: false,
|
||||
completeURL: "/api/bs/hrmsalary/common/pageList/get/setting", convertDatasource: datas => {
|
||||
return {
|
||||
listDatas: _.map(datas.setting, o => ({ id: o.id, name: o.name })),
|
||||
checked: this.converCheckedCol(datas)
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -78,10 +83,10 @@ class SalaryDetails extends Component {
|
|||
childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*");
|
||||
};
|
||||
getSalaryList = (props) => {
|
||||
const { attendanceStore: { salaryDetailSearchForm, tableStore }, dateRange } = props;
|
||||
const { attendanceStore: { salaryDetailSearchForm, tableStore }, dateRange } = props || this.props;
|
||||
const [startDateStr, endDateStr] = dateRange;
|
||||
const { taxAgentIds, subcompanyIds, departmentIds, ...extra } = salaryDetailSearchForm.getFormParams();
|
||||
const { pageInfo } = this.state;
|
||||
const { pageInfo, transferDialog } = this.state;
|
||||
const payload = {
|
||||
taxAgentIds: taxAgentIds ? taxAgentIds.split(",") : [],
|
||||
departmentIds: departmentIds ? departmentIds.split(",") : [],
|
||||
|
|
@ -98,7 +103,7 @@ class SalaryDetails extends Component {
|
|||
const { list: dataSource, pageNum: current, total, pageSize } = pageparams;
|
||||
this.setState({
|
||||
dataSource, pageInfo: { ...pageInfo, current, total, pageSize }, payload,
|
||||
showTotalCell: confCode === "1"
|
||||
showTotalCell: confCode === "1", transferDialog: { ...transferDialog, cancel: false }
|
||||
}, () => tableStore.getDatas(dataKey.datas));
|
||||
}
|
||||
}).catch(() => this.setState({ loading: false }));
|
||||
|
|
@ -121,7 +126,7 @@ class SalaryDetails extends Component {
|
|||
const { dataSource, pageInfo, selectedRowKeys, showTotalCell, payload, updateSum, transferDialog } = this.state;
|
||||
const columns = _.filter(toJS(tableStore.columns), (item) => item.display === "true" && item.dataIndex !== "acctTimes");
|
||||
const sumRowlistUrl = showTotalCell ? "/api/bs/hrmsalary/report/statistics/employee/salaryListSum" : "";
|
||||
if (!_.isEmpty(columns) && !transferDialog.visible) {
|
||||
if (!_.isEmpty(columns) && !transferDialog.visible && !transferDialog.cancel) {
|
||||
this.postMessageToChild({
|
||||
dataSource, pageInfo, selectedRowKeys, showTotalCell, calcDetail: true, tableScrollHeight: 154,
|
||||
sumRowlistUrl, payload: { ...payload, updateSum },
|
||||
|
|
@ -135,11 +140,27 @@ class SalaryDetails extends Component {
|
|||
}
|
||||
return [];
|
||||
};
|
||||
handleSetDefCols = () => {
|
||||
this.setState({
|
||||
transferDialog: {
|
||||
...this.state.transferDialog, visible: true,
|
||||
convertDatasource: datas => _.map(datas.setting, o => ({ id: o.id, name: o.name }))
|
||||
handleSetDefCols = () => this.setState({ transferDialog: { ...this.state.transferDialog, visible: true } });
|
||||
converCheckedCol = (data) => {
|
||||
return _.reduce(data.checked, (pre, cur) => {
|
||||
const item = _.find(data.setting, k => k.id === cur);
|
||||
if (!_.isEmpty(item)) return [...pre, item];
|
||||
return pre;
|
||||
}, []);
|
||||
};
|
||||
savePageListSetting = (values) => {
|
||||
const payload = {
|
||||
page: "salary_details_report",
|
||||
setting: _.map(values, o => o.id)
|
||||
};
|
||||
this.setState({ transferDialog: { ...this.state.transferDialog, saveLoading: true } });
|
||||
API.savePageListSetting(payload).then(({ status, errormsg }) => {
|
||||
this.setState({ transferDialog: { ...this.state.transferDialog, saveLoading: false } });
|
||||
if (status) {
|
||||
message.success(getLabel(111, "操作成功!"));
|
||||
this.setState({ transferDialog: { ...this.state.transferDialog, visible: false } }, () => this.getSalaryList());
|
||||
} else {
|
||||
message.error(errormsg);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
@ -165,9 +186,9 @@ class SalaryDetails extends Component {
|
|||
columns={this.getColumns()}
|
||||
/>
|
||||
{/*默认显示列*/}
|
||||
<CustomTransferDialog {...transferDialog}
|
||||
<CustomTransferDialog {...transferDialog} onChange={this.savePageListSetting}
|
||||
onCancel={() => this.setState({
|
||||
transferDialog: { ...transferDialog, visible: false }
|
||||
transferDialog: { ...transferDialog, visible: false, cancel: true }
|
||||
})}/>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue