170 lines
6.4 KiB
JavaScript
170 lines
6.4 KiB
JavaScript
import {
|
|
WeaDialog,
|
|
WeaFormItem,
|
|
WeaNewScroll,
|
|
WeaSearchGroup,
|
|
WeaMoreButton,
|
|
WeaPopoverHrm
|
|
} from 'ecCom'
|
|
|
|
import {
|
|
Spin,
|
|
Button,
|
|
} from 'antd'
|
|
|
|
import {
|
|
WeaSwitch
|
|
} from 'comsMobx'
|
|
|
|
import {
|
|
i18n
|
|
} from '../public/i18n';
|
|
import AttachToNumberField from './NewNumberField';
|
|
import "../style/common.less";
|
|
|
|
export default class NewAndEditDialog extends React.Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
width: 700,
|
|
}
|
|
}
|
|
|
|
|
|
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}`}
|
|
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()} onChange={this.onChange} />}
|
|
{field.domkey[0] == 'subcompanycode' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
|
|
{field.domkey[0] == 'departmentcode' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
|
|
{field.domkey[0] == 'job_no' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
|
|
{field.domkey[0] == 'work_code' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
|
|
</WeaFormItem>)
|
|
})
|
|
})
|
|
return <div style={{"height":"100%","padding":"30px"}} className="wea-form-item-group">{arr}</div>
|
|
}
|
|
|
|
onChange = data => {
|
|
const {
|
|
bindChangeEnvent,
|
|
moduleName
|
|
} = this.props;
|
|
if (moduleName == 'jobGrade' && data.schemeId) {
|
|
bindChangeEnvent(data.schemeId.value);
|
|
}
|
|
if (moduleName == 'staffScheme' && data.planYear) {
|
|
bindChangeEnvent(data.planYear.value);
|
|
}
|
|
if (moduleName == 'staff' && data.planId) {
|
|
bindChangeEnvent(data);
|
|
}
|
|
};
|
|
|
|
onBlur = data => {
|
|
//console.log("onBlur 回调", data);
|
|
};
|
|
|
|
|
|
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}`}
|
|
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} />
|
|
{field.domkey[0] == 'subcompanycode' && field.viewAttr != 1 && <AttachToNumberField field={field} form={form} isEdit={true}/>}
|
|
{field.domkey[0] == 'departmentcode' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
|
|
{field.domkey[0] == 'job_no' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
|
|
{field.domkey[0] == 'work_code' && field.viewAttr != '1' && <AttachToNumberField field={field} form={form} isEdit={true}/>}
|
|
|
|
</WeaFormItem>
|
|
),
|
|
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,
|
|
saveAndSetting
|
|
} = 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>),
|
|
(saveAndSetting && <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} type="primary" onClick={() => saveAndSetting()} disabled={loading}>{i18n.button.saveAndSetting()}</Button>),
|
|
(<WeaMoreButton ecId={`${this && this.props && this.props.ecId || ''}_WeaMoreButton@e4f4n1`} />)
|
|
];
|
|
|
|
return (
|
|
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@1txk5f`}
|
|
className="new-edit-wrapper"
|
|
title={title}
|
|
icon="icon-coms-hrm"
|
|
iconBgcolor="#217346"
|
|
visible={visible}
|
|
closable={true}
|
|
hasScroll={true}
|
|
onCancel={() => onCancel()}
|
|
buttons={isEdit ? buttons : buttons.slice(1, 2)}
|
|
style={{ width: width, height: height }}
|
|
initLoadCss
|
|
>
|
|
{
|
|
loading ? <div className='hrm-loading-center-small'>
|
|
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@4ygl4a`} spinning={loading}></Spin>
|
|
</div>
|
|
: conditionLen > 1 ? this.getSearchGroupForm() : this.getForm()}
|
|
|
|
|
|
</WeaDialog>
|
|
)
|
|
}
|
|
}
|