| | |
| | | |
| | | if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(item.type) && item.resourceType === '1') { |
| | | deForms.push(item) |
| | | } else if (['select', 'link', 'radio'].includes(item.type) && item.resourceType !== '1') { // 选中第一项 |
| | | if (item.initval.indexOf('$first') > -1) { |
| | | item.initval = item.options[0] ? item.options[0].Value : '' |
| | | } |
| | | } |
| | | |
| | | return item |
| | |
| | | } |
| | | return item |
| | | }) |
| | | let values = [] |
| | | |
| | | this.setState({ |
| | | formlist: _formlist.map(item => { |
| | |
| | | } else if (['select', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(item.type)) { |
| | | item.options = item.oriOptions |
| | | } |
| | | if (['select', 'link', 'radio'].includes(item.type) && item.initval.indexOf('$first') > -1) { // 选中第一项 |
| | | item.initval = item.options[0] ? item.options[0].Value : '' |
| | | values.push({field: item.field, value: item.initval}) |
| | | } |
| | | return item |
| | | }) |
| | | }, () => { |
| | | if (values.length === 0) return |
| | | let fieldsvalue = {} |
| | | values.forEach(item => { |
| | | if (this.props.form.getFieldValue(item.field) !== undefined) { |
| | | fieldsvalue[item.field] = item.value |
| | | } |
| | | }) |
| | | this.props.form.setFieldsValue(fieldsvalue) |
| | | }) |
| | | }) |
| | | } |
| | |
| | | } |
| | | return item |
| | | }) |
| | | let values = [] |
| | | |
| | | this.setState({ |
| | | formlist: _formlist.map(item => { |
| | |
| | | } else if (['select', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(item.type)) { |
| | | item.options = item.oriOptions |
| | | } |
| | | if (['select', 'link', 'radio'].includes(item.type) && item.initval.indexOf('$first') > -1) { // 选中第一项 |
| | | item.initval = item.options[0] ? item.options[0].Value : '' |
| | | values.push({field: item.field, value: item.initval}) |
| | | } |
| | | return item |
| | | }) |
| | | }, () => { |
| | | if (values.length === 0) return |
| | | let fieldsvalue = {} |
| | | values.forEach(item => { |
| | | if (this.props.form.getFieldValue(item.field) !== undefined) { |
| | | fieldsvalue[item.field] = item.value |
| | | } |
| | | }) |
| | | this.props.form.setFieldsValue(fieldsvalue) |
| | | }) |
| | | }) |
| | | } |
| | |
| | | } |
| | | |
| | | if (subfields.length === 0) { |
| | | if (Object.keys(fieldsvalue).length > 0) { |
| | | this.props.form.setFieldsValue(fieldsvalue) |
| | | } |
| | | if (Object.keys(_record).length > 0) { |
| | | this.setState({ |
| | | record: {...record, ..._record} |
| | | }) |
| | | } |
| | | this.props.form.setFieldsValue(fieldsvalue) |
| | | this.setState({ |
| | | record: {...record, ..._record} |
| | | }) |
| | | } else { |
| | | let result = this.resetform(formlist, subfields, 0, fieldsvalue) |
| | | |
| | | if (Object.keys(result.fieldsvalue).length > 0) { |
| | | this.props.form.setFieldsValue(fieldsvalue) |
| | | } |
| | | |
| | | let _param = { |
| | | formlist: result.formlist |
| | | } |
| | | |
| | | if (Object.keys(_record).length > 0) { |
| | | _param.record = {...record, ..._record} |
| | | } |
| | | |
| | | this.setState(_param) |
| | | this.props.form.setFieldsValue(fieldsvalue) |
| | | this.setState({ |
| | | formlist: result.formlist, |
| | | record: {...record, ..._record} |
| | | }) |
| | | } |
| | | |
| | | this.setState({}, () => { |