feature/2.9.9.2312.01-薪资核算列表在线编辑-批量更新薪资项目项
This commit is contained in:
parent
72d02ad754
commit
6e56b436d6
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Author: 黎永顺
|
||||
* name: 批量更新-薪资项目的值
|
||||
* Description:
|
||||
* Date: 2023/12/6
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { WeaDialog, WeaLocaleProvider } from "ecCom";
|
||||
import { Button } from "antd";
|
||||
import { getSearchs } from "../../../../../util";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
|
||||
@inject("calculateStore")
|
||||
@observer
|
||||
class BatchUpdateSalaryItemValDialog extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
loading: false
|
||||
};
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
if (nextProps.visible !== this.props.visibe && !nextProps.visible) nextProps.calculateStore.initBatchUpdateForm();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { loading } = this.state;
|
||||
const { conditions, calculateStore: { batchUpdateForm } } = this.props;
|
||||
return (
|
||||
<WeaDialog
|
||||
{...this.props} title={getLabel(111, "批量更新")} initLoadCss
|
||||
style={{ width: 480, height: 174 }}
|
||||
buttons={[
|
||||
<Button type="primary" onClick={this.save} loading={loading}>{getLabel(537558, "保存")}</Button>
|
||||
]}
|
||||
>
|
||||
<div className="calc-update-dialog-layout">{getSearchs(batchUpdateForm, conditions, 1, false)}</div>
|
||||
</WeaDialog>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default BatchUpdateSalaryItemValDialog;
|
||||
|
|
@ -143,3 +143,34 @@ export const editCalcSearchConditions = [
|
|||
title: "常用条件"
|
||||
}
|
||||
];
|
||||
export const batchUpdateConditions = [
|
||||
{
|
||||
items: [
|
||||
{
|
||||
colSpan: 1,
|
||||
conditionType: "INPUT",
|
||||
domkey: ["salaryItemName"],
|
||||
fieldcol: 14,
|
||||
label: "批量编辑项目",
|
||||
lanId: 111,
|
||||
labelcol: 6,
|
||||
value: "",
|
||||
viewAttr: 1
|
||||
},
|
||||
{
|
||||
colSpan: 1,
|
||||
conditionType: "INPUTNUMBER",
|
||||
domkey: ["value"],
|
||||
fieldcol: 14,
|
||||
label: "批量编辑为",
|
||||
lanId: 111,
|
||||
labelcol: 6,
|
||||
value: "",
|
||||
rules: "required|string",
|
||||
viewAttr: 3
|
||||
}
|
||||
],
|
||||
defaultshow: true,
|
||||
title: ""
|
||||
}
|
||||
];
|
||||
|
|
|
|||
|
|
@ -5,14 +5,17 @@
|
|||
* Date: 2023/9/14
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { WeaLocaleProvider } from "ecCom";
|
||||
import { WeaLocaleProvider, WeaTools } from "ecCom";
|
||||
import { message, Modal, Spin } from "antd";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { acctResultList, updateLockStatus } from "../../../../../apis/calculate";
|
||||
import ProgressModal from "../../../../../components/progressModal";
|
||||
import BatchUpdateSalaryItemValDialog from "./batchUpdateSalaryItemValDialog";
|
||||
import EditSalaryCalcSlide from "./editSalaryCalcSlide";
|
||||
import { batchUpdateConditions } from "./condition";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
const getKey = WeaTools.getKey;
|
||||
|
||||
@inject("calculateStore")
|
||||
@observer
|
||||
|
|
@ -22,7 +25,12 @@ class EditCalcTable extends Component {
|
|||
this.state = {
|
||||
loading: false, pageInfo: { current: 1, pageSize: 10, total: 0 },
|
||||
selectedRowKeys: [], progressVisible: false, progress: 0,
|
||||
salaryCalcSlide: { visible: false, id: "" }, originPayloadData: {}
|
||||
salaryCalcSlide: { visible: false, id: "" }, originPayloadData: {},
|
||||
batchUpdateDialog: {
|
||||
visible: false, salaryAcctRecordId: "", salaryAcctEmpIdList: [], salaryItemId: "",
|
||||
conditions: []
|
||||
},
|
||||
editable: false
|
||||
};
|
||||
this.timerLock = null;
|
||||
}
|
||||
|
|
@ -50,7 +58,31 @@ class EditCalcTable extends Component {
|
|||
this.props.onShowFormulaTd(dataIndex);
|
||||
break;
|
||||
case "LOCKING":
|
||||
const { salaryItemId, lockType: lockStatus } = params;
|
||||
const { salaryItemId, salaryItemName, inputNode, pattern, lockType: lockStatus } = params;
|
||||
if (lockStatus === "BATCHUPDATE") {
|
||||
const { routeParams: { salaryAcctRecordId }, calculateStore: { batchUpdateForm } } = this.props;
|
||||
const { selectedRowKeys: salaryAcctEmpIdList } = this.state;
|
||||
this.setState({
|
||||
batchUpdateDialog: {
|
||||
...this.state.batchUpdateDialog, visible: true, salaryAcctRecordId, salaryItemId,
|
||||
salaryAcctEmpIdList, conditions: _.map(batchUpdateConditions, item => ({
|
||||
...item, items: _.map(item.items, o => {
|
||||
if (getKey(o) === "value") {
|
||||
const otherParams = inputNode === "number" ? { precision: pattern } : {};
|
||||
return {
|
||||
...o, ...otherParams, conditionType: inputNode === "number" ? "INPUTNUMBER" : "INPUT"
|
||||
};
|
||||
}
|
||||
return { ...o };
|
||||
})
|
||||
}))
|
||||
}
|
||||
}, () => {
|
||||
batchUpdateForm.initFormFields(this.state.batchUpdateDialog.conditions);
|
||||
batchUpdateForm.updateFields({ salaryItemName });
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.updateLockStatus({ lockStatus, salaryItemId });
|
||||
break;
|
||||
case "EDIT":
|
||||
|
|
@ -125,14 +157,14 @@ class EditCalcTable extends Component {
|
|||
"当前状态未锁定,点击锁定": getLabel(111, "当前状态未锁定,点击锁定"),
|
||||
"共": getLabel(18609, "共"), "条": getLabel(18256, "条"),
|
||||
"总计": getLabel(523, "总计"), "批量解锁": getLabel(111, "批量解锁"),
|
||||
"批量锁定": getLabel(111, "批量锁定")
|
||||
"批量锁定": getLabel(111, "批量锁定"), "批量更新": getLabel(111, "批量更新")
|
||||
};
|
||||
this.setState({ originPayloadData: { ...payload, i18n } });
|
||||
const childFrameObj = document.getElementById("atdTable");
|
||||
childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*");
|
||||
};
|
||||
queryCalcResultList = () => {
|
||||
const { pageInfo } = this.state;
|
||||
const { pageInfo, editable } = this.state;
|
||||
const { calculateStore: { ECSearchForm, otherConditions }, routeParams: { salaryAcctRecordId } } = this.props;
|
||||
const { subcompanyIds, departmentIds, positionIds, statuses, ...extra } = ECSearchForm.getFormParams();
|
||||
const payload = {
|
||||
|
|
@ -154,7 +186,7 @@ class EditCalcTable extends Component {
|
|||
this.postMessageToChild({
|
||||
dataSource, pageInfo, selectedRowKeys,
|
||||
showTotalCell: this.props.showTotalCell, sumRowlistUrl,
|
||||
payload, editable: false,
|
||||
payload, editable,
|
||||
columns: _.every(traverse(columns), (it, idx) => !it.fixed) ? _.map(traverse(columns), (it, idx) => ({
|
||||
...it,
|
||||
fixed: idx < 2 ? "left" : false
|
||||
|
|
@ -164,10 +196,13 @@ class EditCalcTable extends Component {
|
|||
}
|
||||
}).catch(() => this.setState({ loading: false }));
|
||||
};
|
||||
handleBatchEditing = (editable) => this.postMessageToChild({ ...this.state.originPayloadData, editable });
|
||||
handleBatchEditing = (editable) => {
|
||||
this.setState({ editable }, () => this.postMessageToChild({ ...this.state.originPayloadData, editable }));
|
||||
};
|
||||
|
||||
|
||||
render() {
|
||||
const { loading, progressVisible, progress, salaryCalcSlide } = this.state;
|
||||
const { loading, progressVisible, progress, salaryCalcSlide, batchUpdateDialog } = this.state;
|
||||
return (
|
||||
<div className="editCalcTable-layout">
|
||||
<Spin spinning={loading}>
|
||||
|
|
@ -177,6 +212,11 @@ class EditCalcTable extends Component {
|
|||
// src="/spa/hrmSalary/hrmSalaryCalculateDetail/index.html#/calcTable"
|
||||
id="atdTable"
|
||||
/>
|
||||
<BatchUpdateSalaryItemValDialog {...batchUpdateDialog}
|
||||
onCancel={() => this.setState({
|
||||
batchUpdateDialog: { ...batchUpdateDialog, visible: false }
|
||||
})}
|
||||
/>
|
||||
<EditSalaryCalcSlide {...salaryCalcSlide}
|
||||
onClose={(isFresh) => this.setState({
|
||||
salaryCalcSlide: {
|
||||
|
|
|
|||
|
|
@ -185,3 +185,25 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.calc-update-dialog-layout {
|
||||
background: #f6f6f6;
|
||||
|
||||
.wea-search-group {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ export class calculateStore {
|
|||
@observable ECSearchForm = new WeaForm(); //薪资核算-form
|
||||
@observable otherConditions = []; //薪资核算-其他查询条件
|
||||
@observable calculateForm = new WeaForm(); //薪资核算重构-核算form
|
||||
|
||||
@observable batchUpdateForm = new WeaForm(); //批量更新薪资项目-批量更新form
|
||||
@action initBatchUpdateForm = () => this.batchUpdateForm = new WeaForm();
|
||||
|
||||
@observable tableStore = new TableStore(); // new table
|
||||
@observable form = new WeaForm(); // nrew 一个form
|
||||
|
|
|
|||
|
|
@ -117,17 +117,10 @@ export const padding0 = (num, length) => {
|
|||
}
|
||||
return "0." + num;
|
||||
};
|
||||
export const toDecimal_n = (x, num) => {
|
||||
if (isNaN(parseFloat(x))) return false;
|
||||
let f = Math.round(x * 100) / 100;
|
||||
let s = f.toString();
|
||||
let rs = s.indexOf(".");
|
||||
if (rs < 0) {
|
||||
rs = s.length;
|
||||
s += ".";
|
||||
}
|
||||
while (s.length <= rs + num) {
|
||||
s += "0";
|
||||
}
|
||||
return s;
|
||||
export const toDecimal_n = (num, decimalPlaces) => {
|
||||
if (num === null || !isFinite(num)) return null
|
||||
if (decimalPlaces < 0) return null;
|
||||
const multiplier = Math.pow(10, decimalPlaces);
|
||||
const roundedNum = Math.round(num * multiplier) / multiplier;
|
||||
return roundedNum.toFixed(decimalPlaces);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue