社保福利档案新增编辑页面重构

This commit is contained in:
黎永顺 2023-02-14 14:59:55 +08:00
parent 7c4e2f5588
commit e3f4cebe57
1 changed files with 30 additions and 5 deletions

View File

@ -1,5 +1,5 @@
import React from "react";
import { WeaCheckbox, WeaDatePicker, WeaFormItem, WeaInput, WeaSearchGroup, WeaSelect } from "ecCom";
import { WeaCheckbox, WeaDatePicker, WeaFormItem, WeaInput, WeaInputNumber, WeaSearchGroup, WeaSelect } from "ecCom";
import { inject, observer } from "mobx-react";
import { toJS } from "mobx";
import "./index.less";
@ -48,9 +48,8 @@ export default class SocialSecurityForm extends React.Component {
render() {
const { archivesStore: { socialSecurityForm, socialSecurityPaymentForm } } = this.props;
const { items, data: socialData } = socialSecurityForm;
let baseData = socialSecurityForm.data;
let paymentData = socialSecurityPaymentForm.data;
let paymentItems = socialSecurityPaymentForm.items;
const paymentData = socialSecurityPaymentForm.data;
const paymentItems = socialSecurityPaymentForm.items;
// Integer数据转为string
// let socialData = { ...baseData };
// if (!_.isNil(socialData)) {
@ -60,7 +59,10 @@ export default class SocialSecurityForm extends React.Component {
// }
// });
// }
const { nonPayment = "", schemeAccount = "", socialStartTime = "", socialEndTime = "" } = socialData || {};
const {
nonPayment = "", schemeAccount = "", socialStartTime = "", socialEndTime = "",
socialName = ""
} = socialData || {};
const socialItems = !_.isNil(toJS(items)) ? [
..._.map(_.filter(toJS(items)[0].items, it => it.domkey[0] !== "paymentOrganization"),
item => ({
@ -99,6 +101,21 @@ export default class SocialSecurityForm extends React.Component {
title="社保基础信息"
customComponent={<SocialTitle value={nonPayment.toString()} onChange={this.handleFormChange}/>}
items={socialItems} col={2} showGroup needTigger={false}/>
{
!_.isEmpty(socialName) && !_.isEmpty(toJS(paymentItems)) && _.map(toJS(paymentItems), item => {
const { title, items } = item;
return <WeaSearchGroup
items={_.map(items, child => ({
com: SocialInputNumber({
label: child.label,
value: !_.isNil(paymentData[child["domkey"][0]]) ? paymentData[child["domkey"][0]].toString() : "",
onChange: this.handleFormChange
})
}))}
title={title} col={2} showGroup
/>;
})
}
{/*<div style={{ overflow: "hidden" }}>*/}
{/* <WeaCheckbox*/}
{/* style={{ float: "right", marginRight: "10px", marginTop: "10px" }}*/}
@ -226,6 +243,14 @@ const SocialEditInput = (props) => {
</WeaFormItem>
);
};
const SocialInputNumber = (props) => {
const { value, onChange, label, labelColSpan = 12, wrapperColSpan = 12 } = props;
return (
<WeaFormItem label={label} labelCol={{ span: labelColSpan }} wrapperCol={{ span: wrapperColSpan }}>
<WeaInputNumber value={value} onChange={onChange} min={0} precision={2}/>
</WeaFormItem>
);
};
const SocialDatePicker = (props) => {
const { value, onChange, label, format = "YYYY-MM", viewAttr = 2, labelColSpan = 12, wrapperColSpan = 12 } = props;
return (