salary-management-front/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/customNewModal.js

37 lines
1.4 KiB
JavaScript
Raw Normal View History

2022-03-22 16:53:39 +08:00
import React from 'react'
import { getCustomSearchs, getSearchs } from '../../../util';
import { Modal } from 'antd'
import { observable, action, toJS } from 'mobx';
2022-03-28 10:53:19 +08:00
import { inject, observer } from 'mobx-react';
2022-03-22 16:53:39 +08:00
import CustomForm from '../../../components/customForm'
2022-03-28 10:53:19 +08:00
@inject('programmeStore')
@observer
2022-03-22 16:53:39 +08:00
export default class CustomNewModal extends React.Component {
2022-03-28 10:53:19 +08:00
constructor(props) {
super(props)
}
handleOK() {
2022-04-01 15:02:18 +08:00
const { programmeStore: {createSICategory, setCustomRequest, customRequest, updateCustomCategory}} = this.props;
if(!this.props.edit) { // 新增
createSICategory(customRequest).then(() => {
this.props.onCancel()
})
} else {
updateCustomCategory(customRequest).then(() => {
this.props.onCancel()
})
}
2022-03-28 10:53:19 +08:00
}
2022-03-22 16:53:39 +08:00
render() {
2022-04-01 10:39:01 +08:00
const { programmeStore: {customRequest, setCustomRequest}} = this.props;
2022-03-22 16:53:39 +08:00
return (
2022-03-28 10:53:19 +08:00
<Modal visible={this.props.visible} onCancel={() => {this.props.onCancel()}} title="新建自定义福利" onOk={() => {this.handleOK()}}>
2022-03-22 16:53:39 +08:00
{/* {getCustomSearchs(this.props.form, toJS(this.props.condition), 1)} */}
2022-04-01 15:02:18 +08:00
<CustomForm condition={this.props.condition} disable={this.props.edit ? ['paymentScope', 'welfareType'] : null} request={customRequest} onChange={(value) => {setCustomRequest(value)}}/>
2022-03-22 16:53:39 +08:00
</Modal>
)
}
}