Merge branch 'feature/v2-社保福利档案调差退差-1208' into develop

This commit is contained in:
黎永顺 2022-12-08 13:47:16 +08:00
commit 65867fe57c
2 changed files with 41 additions and 16 deletions

View File

@ -89,7 +89,7 @@ class AdjustTable extends Component {
options={targetOptions}
value={record.target}
style={{ width: "100%" }}
viewAttr={3}
viewAttr={record.status ? 1 : 3}
onChange={v => this.handleChangeTableItem("target", v, index)}
/>
);
@ -107,7 +107,7 @@ class AdjustTable extends Component {
<WeaSelect
options={[{ key: "1", showname: "社保" }]}
value={record.welfareType}
viewAttr={3}
viewAttr={record.status ? 1 : 3}
onChange={v => this.handleChangeTableItem("welfareType", v, index)}
/>
)
@ -125,7 +125,7 @@ class AdjustTable extends Component {
multiple
options={record.categoryTypeOptions || []}
value={record.categoryType}
viewAttr={3}
viewAttr={record.status ? 1 : 3}
onChange={v => this.handleChangeTableItem("categoryType", v, index)}
/>
)
@ -142,7 +142,7 @@ class AdjustTable extends Component {
<WeaInputNumber
precision={2}
value={record.countryTotal}
viewAttr={3}
viewAttr={record.status ? 1 : 3}
onChange={v => this.handleChangeTableItem("countryTotal", v, index)}
/>
)
@ -202,7 +202,7 @@ class AdjustTable extends Component {
<WeaSelect
options={record.adjustToOptions || []}
value={record.adjustTo}
viewAttr={3}
viewAttr={record.status ? 1 : 3}
onChange={v => this.handleChangeTableItem("adjustTo", v, index)}
/>
);
@ -334,7 +334,13 @@ class AdjustTable extends Component {
compensationBack(payload).then(({ status, data, errormsg }) => {
if (status) {
message.success(data || "撤回成功");
this.getCompensationList().then(r => {
this.setState({
dataSource: _.map(this.state.dataSource, it => {
if (id === it.id) {
return { ...it, status: false };
}
return { ...it };
})
});
} else {
message.error(errormsg || "撤回失败");
@ -349,10 +355,20 @@ class AdjustTable extends Component {
title: "信息确认",
content: "确定保存吗?保存后数据将即时更新到台账!",
onOk: () => {
const { adjustToOptions, categoryTypeOptions, key, target, ...extraParams } = record;
const {
adjustToOptions, categoryTypeOptions, key, target, status,
originId, targetOptions: targetOption,
...extraParams
} = record;
const month = getQueryString("billMonth");
const paymentOrg = getQueryString("paymentOrganization");
const bool = _.every(Object.keys({ ...extraParams, target }), child => !!{ ...extraParams, target }[child]);
const tmpObj = { ...extraParams, target };
for (let i in tmpObj) {
Object.assign(tmpObj,{[i]:tmpObj[i].toString()})
}
const bool = _.every(Object.keys({ ...extraParams, target }), child => {
return !!tmpObj[child];
});
if (!bool) {
Modal.warning({
title: "信息确认",
@ -369,11 +385,19 @@ class AdjustTable extends Component {
};
compensationSave([payload]).then(({ status, data, errormsg }) => {
if (status) {
const { data: dataMsg, errorMessage = [] } = data;
const { data: dataMsg, errorMessage = [], successIds = [] } = data;
const msg = dataMsg + errorMessage.join(",");
message.success(msg || "保存成功");
this.getCompensationList().then(r => {
});
!_.isEmpty(errorMessage) ? message.error(msg) : message.success(msg || "保存成功");
if (_.isEmpty(errorMessage)) {
this.setState({
dataSource: _.map(this.state.dataSource, it => {
if (record.target === it.target) {
return { ...it, status: true, id: successIds[0] };
}
return { ...it };
})
});
}
} else {
message.error(errormsg || "保存失败");
}

View File

@ -29,13 +29,14 @@ class AdjustmentSlide extends Component {
}
handleSave = () => {
const requireKeys = ["adjustTo", "adjustmentTotal", "categoryType", "companyTotal", "countryTotal", "target", "welfareType"];
let { dataSource, targetOptions } = this.adjustTableRef.state;
dataSource = _.filter(dataSource, it => !it.id);
dataSource = _.filter(dataSource, it => (!it.id || !it.status));
const billMonth = getQueryString("billMonth");
const paymentOrganization = getQueryString("paymentOrganization");
let bool = true;
_.map(dataSource, item => {
bool = _.every(Object.keys(item), child => !!item[child]);
bool = _.every(requireKeys, child => !!item[child]);
});
if (_.isEmpty(dataSource)) {
Modal.warning({
@ -51,7 +52,7 @@ class AdjustmentSlide extends Component {
return;
}
const payload = _.map(dataSource, item => {
const { adjustToOptions, categoryTypeOptions, target, ...extraParams } = item;
const { adjustToOptions, categoryTypeOptions, target, targetOptions: targetOpts, ...extraParams } = item;
return {
...extraParams,
employeeId: target,
@ -66,7 +67,7 @@ class AdjustmentSlide extends Component {
if (status) {
const { data: dataMsg, errorMessage = [] } = data;
const msg = dataMsg + errorMessage.join(",");
message.success(msg || "保存成功");
!_.isEmpty(errorMessage) ? message.error(msg) : message.success(msg || "保存成功");
this.adjustTableRef.getCompensationList().then(r => {
});
} else {