| | |
| | | dict: CommonDict, // 字典 |
| | | config: null, // 页面配置,包括模板类型、模态框设置、添加表名、表单列表 |
| | | visible: false, // 表单编辑模态框,显示控制 |
| | | modalType: null, // 表单编辑类型,编辑或复制 |
| | | tableVisible: false, // 数据表字段列表模态框,显示控制 |
| | | tableColumns: [], // 表格字段名列表 |
| | | fields: null, // 表单,可选字段(去重后) |
| | |
| | | * 2、保存编辑项-card |
| | | * 3、设置编辑参数项-formlist |
| | | */ |
| | | handleForm = (card) => { |
| | | handleForm = (_card, type) => { |
| | | const {menu, tabConfig, subTabConfig} = this.props |
| | | let card = JSON.parse(JSON.stringify(_card)) |
| | | |
| | | if (type === 'copy') { |
| | | card.originUuid = card.uuid |
| | | card.uuid = Utils.getuuid() |
| | | card.focus = true |
| | | } |
| | | |
| | | const { config } = this.state |
| | | let _inputfields = [] |
| | |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | modalType: type, |
| | | card: card, |
| | | formlist: getModalForm(card, _inputfields, _linkableFields, !!this.props.editTab) |
| | | }) |
| | |
| | | */ |
| | | handleSubmit = () => { |
| | | const {editAction, optionLibs} = this.props |
| | | const { card, modalType } = this.state |
| | | |
| | | this.formRef.handleConfirm().then(res => { |
| | | let _config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | if (_config.groups.length > 0) { |
| | | _config.groups.forEach(group => { |
| | | group.sublist = group.sublist.map(item => { |
| | | if (modalType === 'copy' && card.originUuid) { |
| | | if (_config.groups.length > 0) { |
| | | _config.groups = _config.groups.map(group => { |
| | | let _index = null |
| | | group.sublist.forEach((item, index) => { |
| | | if (item.uuid === card.originUuid) { |
| | | _index = index |
| | | } |
| | | }) |
| | | |
| | | if (_index !== null) { |
| | | group.sublist.splice(_index + 1, 0, res) |
| | | } |
| | | |
| | | return group |
| | | }) |
| | | } else { |
| | | let _index = null |
| | | _config.fields.forEach((item, index) => { |
| | | if (item.uuid === card.originUuid) { |
| | | _index = index |
| | | } |
| | | }) |
| | | |
| | | _config.fields.splice(_index + 1, 0, res) |
| | | } |
| | | } else { |
| | | if (_config.groups.length > 0) { |
| | | _config.groups.forEach(group => { |
| | | group.sublist = group.sublist.map(item => { |
| | | if (item.uuid === res.uuid) { |
| | | return res |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | | _config.fields = _config.fields.map(item => { |
| | | if (item.uuid === res.uuid) { |
| | | return res |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | | _config.fields = _config.fields.map(item => { |
| | | if (item.uuid === res.uuid) { |
| | | return res |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | _config.fields = _config.fields.filter(item => !item.origin) |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | modalType: null, |
| | | card: null, |
| | | optionLibs: optionLibs, |
| | | visible: false |
| | | }) |
| | |
| | | return |
| | | } |
| | | |
| | | // if (config.setting.display === 'prompt') { // 有需要置空的场景 |
| | | // let _fields = [] |
| | | // if (config.groups.length > 0) { |
| | | // config.groups.forEach(group => { |
| | | // _fields = [..._fields, ...group.sublist] |
| | | // }) |
| | | // } else { |
| | | // _fields = config.fields |
| | | // } |
| | | |
| | | // let readfields = _fields.filter(item => item.initval || item.initval === 0) |
| | | // if (readfields.length < _fields.length) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '以《是否框》显示的弹框,所有表单必须含有默认值!', |
| | | // duration: 10 |
| | | // }) |
| | | // return |
| | | // } |
| | | // } |
| | | |
| | | let _LongParam = '' |
| | | let _config = {...config, tables: this.state.selectedTables} |
| | | |
| | |
| | | this.setState({ |
| | | menuloading: false, |
| | | closeloading: false, |
| | | closeVisible: false, |
| | | originConfig: _config, |
| | | config: _config |
| | | }) |
| | |
| | | </div> |
| | | </DndProvider> |
| | | <Modal |
| | | title={this.state.dict['header.edit']} |
| | | title={this.state.modalType !== 'copy' ? this.state.dict['header.edit'] : this.state.dict['header.modal.form.copy']} |
| | | visible={this.state.visible} |
| | | width={700} |
| | | onCancel={this.editModalCancel} |