diff --git a/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/employeeDeclareDetailSchemaEditDialog.js b/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/employeeDeclareDetailSchemaEditDialog.js index 7099560a..a76fecfa 100644 --- a/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/employeeDeclareDetailSchemaEditDialog.js +++ b/pc4mobx/hrmSalary/pages/employeedeclareDetail/components/employeeDeclareDetailSchemaEditDialog.js @@ -22,12 +22,15 @@ class EmployeeDeclareDetailSchemaEditDialog extends Component { super(props); this.state = { loading: false, - eConditions: [] + eConditions: [], + employeeInfo: {} }; + this.employeeChangeInfo = {}; } componentWillReceiveProps(nextProps, nextContext) { if (nextProps.visible !== this.props.visible && nextProps.visible) this.employeedeclareGetForm(nextProps); + if (nextProps.visible !== this.props.visible && !nextProps.visible) this.employeeChangeInfo = {}; } employeedeclareGetForm = (props) => { @@ -86,7 +89,8 @@ class EmployeeDeclareDetailSchemaEditDialog extends Component { return { ...child }; }) }; - }) + }), + employeeInfo: data.data }, () => { const { data: result, columns } = data; const { employeeDeclareStore: { declareForm } } = this.props; @@ -129,7 +133,12 @@ class EmployeeDeclareDetailSchemaEditDialog extends Component { const { employeeDeclareStore: { declareForm } } = this.props; const key = Object.keys(res)[0]; const value = res[key].value; - console.log(132, res, declareForm.getFormParams()); + if (key === "employeeType") { + const [v1, v2] = value; + this.employeeChangeInfo = { + employee: [{ _entityType: v1, name: v2[1], id: v2[0] }] + }; + } switch (key) { case "employmentStatus": this.setState({ @@ -148,8 +157,17 @@ class EmployeeDeclareDetailSchemaEditDialog extends Component { }; }) }, () => { - console.log(150, this.state.eConditions); declareForm.initFormFields(this.state.eConditions); + const [employeeData] = this.state.employeeInfo["employee"] || this.employeeChangeInfo["employee"] || []; + !_.isEmpty(employeeData) && declareForm.updateFields({ + employeeType: { + value: [employeeData._entityType, [employeeData.id, employeeData.name, [{ + id: employeeData.id, + lastname: employeeData.name + }]]], + valueSpan: ["employeeId"] + } + }); }); break; case "employmentType": @@ -170,6 +188,16 @@ class EmployeeDeclareDetailSchemaEditDialog extends Component { }) }, () => { declareForm.initFormFields(this.state.eConditions); + const [employeeData] = this.state.employeeInfo["employee"] || this.employeeChangeInfo["employee"] || []; + !_.isEmpty(employeeData) && declareForm.updateFields({ + employeeType: { + value: [employeeData._entityType, [employeeData.id, employeeData.name, [{ + id: employeeData.id, + lastname: employeeData.name + }]]], + valueSpan: ["employeeId"] + } + }); }); break; default: