trunk/pc4mobx/organization/components/newImport/stepDialog.js

115 lines
3.3 KiB
JavaScript
Raw Normal View History

2022-07-25 17:53:00 +08:00
import {
WeaNewScroll,
WeaSearchGroup,
WeaMoreButton,
2024-06-14 16:25:07 +08:00
WeaDialog,
WeaLocaleProvider
2022-07-25 17:53:00 +08:00
} from 'ecCom'
import {
inject,
observer,
} from 'mobx-react'
import {
Spin,
Button,
Pagination,
Steps
} from 'antd'
import {
WeaSwitch,
WeaTableNew
} from 'comsMobx'
import {
i18n
} from '../../public/i18n';
const Step = Steps.Step;
import StepContent from './stepContent';
2022-10-18 13:58:48 +08:00
import "../../style/common.less";
2024-06-14 16:25:07 +08:00
const getLabel = WeaLocaleProvider.getLabel;
2022-07-25 17:53:00 +08:00
@inject("newImport")
@observer
export default class StepDialog extends React.Component {
constructor(props) {
super(props);
this.state = {
width: 800,
height: 600,
2024-06-11 18:55:29 +08:00
title: i18n.label.dataImport(),
2022-07-25 17:53:00 +08:00
}
}
next() {
const {newImport} = this.props;
let {current,steps} = newImport;
current = current + 1;
if (current === steps.length) {
current = 0;
newImport.init();
}
newImport.current = current;
current === 1 && newImport.getImportForm();
2022-07-27 14:54:59 +08:00
current === steps.length - 1 && newImport.startImport();
2022-07-25 17:53:00 +08:00
}
2024-03-12 18:22:26 +08:00
up() {
const {newImport} = this.props;
let {current,steps} = newImport;
current = current - 1;
newImport.current = current;
}
2022-07-25 17:53:00 +08:00
render() {
const {
newImport
} = this.props, {
current,
visible,
steps
} = newImport,{
width,
height,
title
} = this.state;
2024-06-14 16:25:07 +08:00
2022-07-25 17:53:00 +08:00
const buttons = [
2024-06-14 16:25:07 +08:00
((current === 0 || current === steps.length - 1) ? '' : <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} type="primary" onClick={() => this.up()}>{getLabel(547218,'上一步')}</Button>),
2024-06-11 18:55:29 +08:00
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@jd6baw`} type="primary" onClick={() => this.next()}>{current === steps.length - 1 ? i18n.button.close() : i18n.button.nextStep()}</Button>),
2022-07-25 17:53:00 +08:00
];
2024-06-14 16:25:07 +08:00
const labelSteps = [
{ title: `${getLabel(547216,'设置导入字段')}`},
{ title: `${getLabel(547217,'获取导入模板')}`},
{ title: `${getLabel(547221,'导入结果')}`}
];
2022-07-25 17:53:00 +08:00
return (
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@1txk5f`}
2022-10-18 13:58:48 +08:00
className="new-edit-wrapper"
2022-07-25 17:53:00 +08:00
title={title}
icon="icon-coms-upload"
iconBgcolor="#217346"
visible={visible}
closable={true}
hasScroll={true}
onCancel={() => newImport.init()}
buttons={buttons}
style={{ width: width, height: height }}
2022-10-18 13:58:48 +08:00
initLoadCss
2022-07-25 17:53:00 +08:00
>
<div style={{ marginTop: 24 }}>
<Steps current={current}>
2024-06-14 16:25:07 +08:00
{labelSteps.map((s, i) => <Step key={i} title={s.title} description={s.description} />)}
2022-07-25 17:53:00 +08:00
</Steps>
</div>
<div style={{ padding: 24 }}>
<StepContent ecId={`${this && this.props && this.props.ecId || ''}_StepContent@633i8k`}/>
</div>
</WeaDialog>
)
}
}