update 完成表单中上传控件的使用

This commit is contained in:
2021-06-22 11:00:21 +08:00
parent f31f79d59d
commit f05f476789
17 changed files with 883 additions and 106 deletions

View File

@@ -15,6 +15,7 @@ export default class index extends Component {
state = {
loading: true,
record: null,
saveDisabled: true,
saving: false,
}
@@ -44,6 +45,13 @@ export default class index extends Component {
*/
componentDidMount() {}
call(child, index) {
this.children[index] = child
if (this.children.filter(p => p).length === tabs.filter(p => p.show).length) {
this.setState({ saveDisabled: false })
}
}
/**
* 提交
* [异步,必要]
@@ -86,7 +94,7 @@ export default class index extends Component {
render() {
const { id } = this.props
const { loading, record, saving } = this.state
const { loading, record, saveDisabled, saving } = this.state
return (
<div className="yo-form-page">
@@ -98,17 +106,17 @@ export default class index extends Component {
<Card className="yo-form-page--body">
{parts.map((item, i) => (
<section key={i} id={`form-${i}-${id}`}>
{item.title && <h5>{parts.title}</h5>}
{item.title && <h5>{item.title}</h5>}
<Spin
spinning={loading}
indicator={<AntIcon type="loading" />}
wrapperClassName="h-400-min"
wrapperClassName={loading && 'h-400-min'}
>
{!loading && (
<ComponentDynamic
is={item.component}
record={record}
onRef={r => this.children.push(r)}
onRef={child => this.call(child, i)}
/>
)}
</Spin>
@@ -143,6 +151,7 @@ export default class index extends Component {
<span>
<Button onClick={() => window.closeContentWindow()}>取消</Button>
<Button
disabled={saveDisabled}
loading={saving}
type="primary"
onClick={() => this.onSubmit()}