| | |
| | | visible: false, |
| | | editform: null, |
| | | formlist: null, |
| | | sqlVerifing: false, |
| | | standardform: null |
| | | sqlVerifing: false |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | * @description 表单编辑 |
| | | */ |
| | | handleForm = (_item) => { |
| | | const { card, appType } = this.state |
| | | const { card } = this.state |
| | | let _form = fromJS(_item).toJS() |
| | | let _inputfields = [] |
| | | let _tabfields = [] |
| | | let _linkableFields = [] |
| | | let _linksupFields = [] |
| | | let standardform = null |
| | | let index = null |
| | | |
| | | card.subcards[0].fields.forEach((item, i) => { |
| | | if (_form.uuid === item.uuid) { |
| | | index = i |
| | | } |
| | | |
| | | if (!item.field || _form.field === item.field) return |
| | | |
| | | if (['text', 'number', 'textarea', 'color'].includes(item.type)) { |
| | | if (['text', 'number', 'textarea', 'select'].includes(item.type)) { |
| | | _inputfields.push({ |
| | | field: item.field, |
| | | label: item.label |
| | |
| | | }) |
| | | }) |
| | | |
| | | if (index !== null) { |
| | | if (index === 0) { |
| | | standardform = card.subcards[0].fields[index + 1] || null |
| | | } else { |
| | | standardform = card.subcards[0].fields[index - 1] || null |
| | | } |
| | | } |
| | | |
| | | let _fields = _linkableFields.map(cell => cell.field) |
| | | card.columns.forEach(col => { |
| | | if (col.field && !_fields.includes(col.field)) { |
| | |
| | | _form.linkSubField = _form.linkSubField.filter(item => fields.includes(item)) |
| | | } |
| | | |
| | | if (appType !== 'mob' && !_form.span && standardform && standardform.span) { |
| | | _form.span = standardform.span |
| | | _form.labelwidth = standardform.labelwidth |
| | | } |
| | | |
| | | this.setState({ |
| | | standardform, |
| | | visible: true, |
| | | editform: _form, |
| | | formlist: getModalForm(_form, _inputfields, _tabfields, _linkableFields, _linksupFields, card.columns) |
| | |
| | | handleSubmit = () => { |
| | | let _config = fromJS(this.state.card).toJS() |
| | | |
| | | this.formRef.handleConfirm(_config.subcards[0].fields).then(res => { |
| | | this.formRef.handleConfirm().then(res => { |
| | | _config.subcards[0].fields = _config.subcards[0].fields.map(item => { |
| | | delete item.focus |
| | | |
| | |
| | | card={this.state.editform} |
| | | formlist={this.state.formlist} |
| | | inputSubmit={this.handleSubmit} |
| | | standardform={this.state.standardform} |
| | | fields={card.subcards[0].fields} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | /> |
| | | </Modal> |