feature/2.9.42310.02-社保福利档案页面重构
This commit is contained in:
parent
f0f4bfb877
commit
436db457db
|
|
@ -29,29 +29,43 @@ class Index extends Component {
|
|||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
if (nextProps.visible !== this.props.visible && nextProps.visible) {
|
||||
document.querySelector(".salary-welfare-archive").classList.add("zIndex0-welfare-archive");
|
||||
this.getBaseForm(nextProps);
|
||||
const promise = this.getBaseForm(nextProps);
|
||||
} else if (nextProps.visible !== this.props.visible && !nextProps.visible) {
|
||||
const { archivesStore: { initWelfareProfileForm, setHasBeenModify } } = nextProps;
|
||||
document.querySelector(".salary-welfare-archive").classList.remove("zIndex0-welfare-archive");
|
||||
initWelfareProfileForm();
|
||||
}
|
||||
console.log(38, nextProps);
|
||||
}
|
||||
|
||||
getBaseForm = async (props) => {
|
||||
const { data: taxAgentList } = await getTaxAgentSelectList();
|
||||
const {
|
||||
archivesStore: { welfareProfileForm }, socialBase, fundBase, othersBase,
|
||||
archivesStore: { welfareProfileForm }, socialBase, fundBase, otherBase,
|
||||
employeeId, paymentOrganization, socialBaseData, fundBaseData, othersBaseData
|
||||
} = props;
|
||||
const payload = { employeeId, paymentOrganization, welfareTypeEnum: "" };
|
||||
console.log(props);
|
||||
const conditions = _.reduce(welfareConditions, (pre, cur) => {
|
||||
if (cur.title === "social") {
|
||||
return [...pre, cur, ...socialBase.items];
|
||||
} else if (cur.title === "fund") {
|
||||
return [...pre, cur, ...fundBase.items];
|
||||
} else if (cur.title === "others") {
|
||||
return [...pre, cur, ...otherBase.items];
|
||||
}
|
||||
return [...pre, cur];
|
||||
}, []);
|
||||
console.log(conditions, props);
|
||||
API.getBaseForm(payload).then(({ status, data }) => {
|
||||
if (status) {
|
||||
const { data: result } = data;
|
||||
const formData = { ...result, ...socialBaseData, ...fundBaseData, ...othersBaseData };
|
||||
const formData = {
|
||||
...result, ...socialBaseData, ...fundBaseData, ...othersBaseData,
|
||||
...socialBase.data, ...fundBase.data, ...otherBase.data
|
||||
};
|
||||
this.setState({
|
||||
formData,
|
||||
conditions: _.map(welfareConditions, o => {
|
||||
conditions: _.map(conditions, o => {
|
||||
if (o.title === "basic") {
|
||||
return {
|
||||
...o, title: getLabel(542699, "员工基本信息"),
|
||||
|
|
@ -112,10 +126,16 @@ class Index extends Component {
|
|||
});
|
||||
};
|
||||
handleFormChange = (val) => {
|
||||
const changeKey = _.keys(val)[0];
|
||||
const { archivesStore: { setHasBeenModify } } = this.props;
|
||||
const changeKey = _.keys(val)[0], changeVal = val[changeKey].value;
|
||||
const { archivesStore: { setHasBeenModify }, onChangeProgramme, employeeId, paymentOrganization } = this.props;
|
||||
console.log(val, changeKey);
|
||||
setHasBeenModify(true);
|
||||
if (changeKey === "socialSchemeId" || changeKey === "fundSchemeId" || changeKey === "otherSchemeId") {
|
||||
onChangeProgramme(changeKey.slice(0, changeKey.indexOf("SchemeId")), changeVal, {
|
||||
employeeId,
|
||||
paymentOrganization
|
||||
});
|
||||
}
|
||||
};
|
||||
renderTitle = () => {
|
||||
const { loading } = this.state;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class Index extends Component {
|
|||
const [socialItems, fundItems, othersItems] = await Promise.all([
|
||||
this.getProfileTypeForm({ ...payload, welfareTypeEnum: welfareTypeEnum["social"] }),
|
||||
this.getProfileTypeForm({ ...payload, welfareTypeEnum: welfareTypeEnum["fund"] }),
|
||||
this.getProfileTypeForm({ ...payload, welfareTypeEnum: welfareTypeEnum["others"] })
|
||||
this.getProfileTypeForm({ ...payload, welfareTypeEnum: welfareTypeEnum["other"] })
|
||||
]);
|
||||
this.setState({
|
||||
welfareEditSlide: {
|
||||
|
|
@ -106,15 +106,15 @@ class Index extends Component {
|
|||
const { SOCIAL_SECURITY: { socialSchemeId } } = socialBaseData,
|
||||
{ ACCUMULATION_FUND: { fundSchemeId } } = fundBaseData,
|
||||
{ OTHER: { otherSchemeId } } = othersBaseData;
|
||||
const [socialBase, fundBase, othersBase] = await Promise.all([
|
||||
const [socialBase, fundBase, otherBase] = await Promise.all([
|
||||
this.getPaymentForm({ ...payload, welfareTypeEnum: welfareTypeEnum["social"], schemeId: socialSchemeId }),
|
||||
this.getPaymentForm({ ...payload, welfareTypeEnum: welfareTypeEnum["fund"], schemeId: fundSchemeId }),
|
||||
this.getPaymentForm({ ...payload, welfareTypeEnum: welfareTypeEnum["others"], schemeId: otherSchemeId })
|
||||
this.getPaymentForm({ ...payload, welfareTypeEnum: welfareTypeEnum["other"], schemeId: otherSchemeId })
|
||||
]);
|
||||
this.setState({
|
||||
welfareEditSlide: {
|
||||
...this.state.welfareEditSlide, visible: true,
|
||||
socialBase: socialBase.data, fundBase: fundBase.data, othersBase: othersBase.data
|
||||
socialBase: socialBase.data, fundBase: fundBase.data, otherBase: otherBase.data
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -146,9 +146,7 @@ class Index extends Component {
|
|||
return API.getBaseForm(payload);
|
||||
};
|
||||
getPaymentForm = async (props) => {
|
||||
const { employeeId, paymentOrganization, welfareTypeEnum } = props;
|
||||
const payload = { employeeId, paymentOrganization, welfareTypeEnum };
|
||||
return API.getPaymentForm(payload);
|
||||
return API.getPaymentForm({ ...props });
|
||||
};
|
||||
getWelfareList = (props) => {
|
||||
const { pageInfo } = this.state;
|
||||
|
|
@ -235,6 +233,16 @@ class Index extends Component {
|
|||
const childFrameObj = document.getElementById("atdTable");
|
||||
childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*");
|
||||
};
|
||||
handleChangeProgramme = (type, schemeId, payload) => {
|
||||
this.getPaymentForm({ ...payload, welfareTypeEnum: welfareTypeEnum[type], schemeId })
|
||||
.then(({ status, data }) => {
|
||||
if (status) {
|
||||
this.setState({
|
||||
welfareEditSlide: { ...this.state.welfareEditSlide, [`${type}Base`]: data }
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
const { loading, dataSource, welfareEditSlide } = this.state;
|
||||
|
|
@ -257,7 +265,9 @@ class Index extends Component {
|
|||
<WelfareEditArchiveSlide {...welfareEditSlide}
|
||||
onClose={(isFresh) => this.setState({
|
||||
welfareEditSlide: { ...welfareEditSlide, visible: false }
|
||||
})}/>
|
||||
})}
|
||||
onChangeProgramme={this.handleChangeProgramme}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ const getLabel = WeaLocaleProvider.getLabel;
|
|||
export const welfareTypeEnum = {
|
||||
social: "SOCIAL_SECURITY",
|
||||
fund: "ACCUMULATION_FUND",
|
||||
others: "OTHER"
|
||||
other: "OTHER"
|
||||
};
|
||||
export const optTypeEnum = [
|
||||
//批量增员
|
||||
|
|
@ -672,11 +672,11 @@ export const getWelfareSearchsForm = (form, condition, onChange = () => void (0)
|
|||
hide: fields.hide
|
||||
});
|
||||
});
|
||||
group.push(
|
||||
!_.isEmpty(items) && group.push(
|
||||
<WeaSearchGroup col={c.col} needTigger={true} showGroup={c.defaultshow} items={items} center={false}
|
||||
title={c.title}
|
||||
customComponent={c.showPaid ? <CustomComponent type={c.typename}/> : <span></span>}
|
||||
className={c.col === 3 ? "basic-welfare-info-wrapper" : c.col === 2 ? "twoColumns-welfare-info-wrapper" : ""}
|
||||
className={c.col === 3 ? "basic-welfare-info-wrapper" : (c.col === 2 || c.items.length > 1) ? "twoColumns-welfare-info-wrapper" : ""}
|
||||
/>);
|
||||
});
|
||||
return group;
|
||||
|
|
|
|||
Loading…
Reference in New Issue