2022-05-10 18:02:06 +08:00
|
|
|
import {
|
|
|
|
|
WeaDialog,
|
|
|
|
|
WeaFormItem,
|
|
|
|
|
WeaNewScroll,
|
|
|
|
|
WeaSearchGroup,
|
|
|
|
|
WeaMoreButton,
|
|
|
|
|
} from 'ecCom'
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
Spin,
|
|
|
|
|
Button,
|
|
|
|
|
} from 'antd'
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
WeaSwitch
|
|
|
|
|
} from 'comsMobx'
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
i18n
|
|
|
|
|
} from '../public/i18n';
|
|
|
|
|
|
|
|
|
|
export default class NewAndEditDialog extends React.Component {
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
this.state = {
|
|
|
|
|
width: 700,
|
2022-05-13 16:56:52 +08:00
|
|
|
enable: props.enable
|
|
|
|
|
|
2022-05-10 18:02:06 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getForm() {
|
|
|
|
|
const {
|
|
|
|
|
condition,
|
|
|
|
|
form,
|
|
|
|
|
isFormInit,
|
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
|
|
let arr = [];
|
|
|
|
|
isFormInit && condition.map(c => {
|
|
|
|
|
c.items.map((field, index) => {
|
|
|
|
|
arr.push(<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@jacv6v@${index}`}
|
2022-05-13 16:56:52 +08:00
|
|
|
label={`${field.label}`}
|
|
|
|
|
labelCol={{ span: `${field.labelcol}` }}
|
|
|
|
|
error={form.getError(field)}
|
|
|
|
|
tipPosition="bottom"
|
|
|
|
|
wrapperCol={{ span: `${field.fieldcol}` }}>
|
|
|
|
|
{<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@7vxyfr@${index}`} fieldConfig={field} form={form} formParams={form.getFormParams()} />}
|
|
|
|
|
</WeaFormItem>)
|
2022-05-10 18:02:06 +08:00
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
return <div className="wea-form-item-group">{arr}</div>
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-13 16:56:52 +08:00
|
|
|
onChange = data => {
|
2022-06-23 11:53:57 +08:00
|
|
|
const {
|
|
|
|
|
bindChangeEnvent,
|
|
|
|
|
} = this.props;
|
2022-05-13 16:56:52 +08:00
|
|
|
if(this.state.enable && data.schemeId) {
|
|
|
|
|
bindChangeEnvent(data.schemeId.value);
|
|
|
|
|
}
|
2022-06-23 11:53:57 +08:00
|
|
|
if(this.state.enable && data.planYear){
|
|
|
|
|
bindChangeEnvent(data.planYear.value);
|
|
|
|
|
}
|
2022-05-13 16:56:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onBlur = data => {
|
|
|
|
|
//console.log("onBlur 回调", data);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2022-05-10 18:02:06 +08:00
|
|
|
getSearchGroupForm() {
|
|
|
|
|
const {
|
|
|
|
|
condition,
|
|
|
|
|
form,
|
|
|
|
|
isFormInit,
|
|
|
|
|
isEdit
|
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
|
|
let arr = [];
|
|
|
|
|
isFormInit && condition.map((c, i) => {
|
|
|
|
|
let _arr = [];
|
|
|
|
|
c.items.map((field, index) => {
|
|
|
|
|
_arr.push({
|
|
|
|
|
com: (
|
|
|
|
|
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@merei2@${index}`}
|
2022-05-13 16:56:52 +08:00
|
|
|
label={`${field.label}`}
|
|
|
|
|
labelCol={{ span: `${field.labelcol}` }}
|
|
|
|
|
error={form.getError(field)}
|
|
|
|
|
tipPosition="bottom"
|
|
|
|
|
wrapperCol={{ span: `${field.fieldcol}` }}
|
|
|
|
|
underline={isEdit ? false : true}
|
|
|
|
|
>
|
|
|
|
|
<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@5r6c5a@${index}`} fieldConfig={field} form={form} formParams={form.getFormParams()} onChange={this.onChange}
|
|
|
|
|
onBlur={this.onBlur} />
|
|
|
|
|
</WeaFormItem>
|
2022-05-10 18:02:06 +08:00
|
|
|
),
|
|
|
|
|
colSpan: 1
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
arr.push(<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@qaih5l@${i}`} needTigger={true} title={c.title} showGroup={c.defaultshow} items={_arr} col={1} />)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
return arr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const {
|
|
|
|
|
title,
|
|
|
|
|
visible,
|
|
|
|
|
save,
|
|
|
|
|
onCancel,
|
|
|
|
|
loading,
|
|
|
|
|
isEdit,
|
|
|
|
|
height,
|
|
|
|
|
conditionLen,
|
2022-06-23 11:53:57 +08:00
|
|
|
saveAndSetting
|
2022-05-10 18:02:06 +08:00
|
|
|
} = this.props, {
|
|
|
|
|
width,
|
|
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
|
|
const buttons = [
|
|
|
|
|
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} type="primary" onClick={() => save()} disabled={loading}>{i18n.button.save()}</Button>),
|
2022-06-23 11:53:57 +08:00
|
|
|
(saveAndSetting && <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} type="primary" onClick={() => save()} disabled={loading}>{i18n.button.saveAndSetting()}</Button>),
|
2022-05-10 18:02:06 +08:00
|
|
|
(<WeaMoreButton ecId={`${this && this.props && this.props.ecId || ''}_WeaMoreButton@e4f4n1`} />)
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@1txk5f`}
|
|
|
|
|
title={title}
|
|
|
|
|
icon="icon-coms-hrm"
|
|
|
|
|
iconBgcolor="#217346"
|
|
|
|
|
visible={visible}
|
|
|
|
|
closable={true}
|
|
|
|
|
hasScroll={true}
|
2022-05-13 16:56:52 +08:00
|
|
|
onCancel={() => onCancel()}
|
|
|
|
|
buttons={isEdit ? buttons : buttons.slice(1, 2)}
|
|
|
|
|
style={{ width: width, height: height }}
|
2022-05-10 18:02:06 +08:00
|
|
|
>
|
|
|
|
|
{
|
2022-05-13 16:56:52 +08:00
|
|
|
loading ? <div className='hrm-loading-center-small'>
|
|
|
|
|
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4ygl4a`} spinning={loading}></Spin>
|
|
|
|
|
</div>
|
|
|
|
|
: <div className={conditionLen > 1 ? '' : 'hrm-dialog-form'}>
|
|
|
|
|
{conditionLen > 1 ? this.getSearchGroupForm() : this.getForm()}
|
|
|
|
|
</div>
|
2022-05-10 18:02:06 +08:00
|
|
|
}
|
|
|
|
|
</WeaDialog>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|