hotfix/2.9.9.2312.01

导入组件优化
This commit is contained in:
黎永顺 2023-12-12 15:19:59 +08:00
parent 2e38e5a5c6
commit 4acefa765c
4 changed files with 37 additions and 20 deletions

View File

@ -19,7 +19,7 @@ class Index extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
current: 0 current: 0, fileid: ""
}; };
} }
@ -29,7 +29,10 @@ class Index extends Component {
current: this.state.current + 1 current: this.state.current + 1
}); });
} }
if (nextProps.visible !== this.props.visible && !nextProps.visible) this.setState({ current: 0 }); if (nextProps.visible !== this.props.visible && !nextProps.visible) this.setState({
current: 0,
fileid: ""
}, () => this.props.onResetImportResult());
} }
renderChildren = () => { renderChildren = () => {
@ -76,25 +79,36 @@ class Index extends Component {
* Date: 2023/8/11 * Date: 2023/8/11
*/ */
handleNext = () => { handleNext = () => {
const { params, importResult } = this.props; const { params, importResult, excludeKey } = this.props;
const { current } = this.state;
if (_.isEmpty(importResult)) { if (_.isEmpty(importResult)) {
const { fileList } = this.step1Ref.state; if (current === 0) {
if (!_.isEmpty(params)) { const { fileList } = this.step1Ref.state;
if (!Object.values(params).every(o => !!o)) { if (!_.isEmpty(params)) {
Modal.warning({ if (!Object.values(params).every(o => !!o)) {
title: getLabel(131329, "信息确认"), Modal.warning({
content: getLabel(518702, "必要信息不完整,红色*为必填项!") title: getLabel(131329, "信息确认"),
}); content: getLabel(518702, "必要信息不完整,红色*为必填项!")
});
return;
}
}
if (_.isEmpty(fileList)) {
message.warning(getLabel(111, "请先上传EXCEL文件"));
return; return;
} }
const [file] = fileList;
const { response } = file;
this.setState({
current: this.state.current + 1,
fileid: response.data.fileid
}, () => {
!excludeKey && this.props.nextCallback && this.props.nextCallback(this.state.fileid);
excludeKey && this.props.nextUplaodCallback && this.props.nextUplaodCallback(this.state.fileid);
});
} else {
this.props.nextUplaodCallback && this.props.nextUplaodCallback(this.state.fileid);
} }
if (_.isEmpty(fileList)) {
message.warning(getLabel(111, "请先上传EXCEL文件"));
return;
}
const [file] = fileList;
const { response } = file;
this.props.nextCallback(response.data.fileid);
} else { } else {
this.setState({ current: this.state.current + 1 }); this.setState({ current: this.state.current + 1 });
} }

View File

@ -62,7 +62,8 @@ class SalaryCalcOcImport extends Component {
onResetImportResult={() => this.setState(({ onResetImportResult={() => this.setState(({
importDialog: { ...importDialog, importResult: {}, imageId: "" } importDialog: { ...importDialog, importResult: {}, imageId: "" }
}))} }))}
nextCallback={imageId => this.handleImport({ imageId })} nextCallback={imageId => this.setState({ importDialog: { ...importDialog, imageId } })}
nextUplaodCallback={imageId => this.handleImport({ imageId })}
/> />
); );
} }

View File

@ -141,7 +141,8 @@ class Index extends Component {
}} }}
/> />
} }
nextCallback={imageId => this.handleImport({ imageId })} nextCallback={imageId => this.setState({ importDialog: { ...importDialog, imageId } })}
nextUplaodCallback={imageId => this.handleImport({ imageId })}
/> />
<AddHeaderFieldsModal <AddHeaderFieldsModal
{...headerFieldsDialog} {...headerFieldsDialog}

View File

@ -971,7 +971,8 @@ export default class Archives extends React.Component {
}} }}
/> />
} }
nextCallback={imageId => this.handleImport({ imageId })} nextCallback={imageId => this.setState({ importDialog: { ...importDialog, imageId } })}
nextUplaodCallback={imageId => this.handleImport({ imageId })}
/> />
{ {
this.state.importVisible && <ImportModal this.state.importVisible && <ImportModal