From bd06958321afa706f32287c71bd219eb0622c86c Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 10 十二月 2019 16:31:45 +0800 Subject: [PATCH] 2019-12-10 --- src/templates/modalconfig/index.jsx | 64 +++++++++++++++++++++++-------- 1 files changed, 47 insertions(+), 17 deletions(-) diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 98df789..86da3d2 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -454,6 +454,19 @@ value: 'false', text: this.state.dict['header.form.false'] }] + }, + { + type: 'radio', + key: 'required', + label: this.state.dict['header.form.field.required'], + initVal: card.required || 'false', + options: [{ + value: 'true', + text: this.state.dict['header.form.true'] + }, { + value: 'false', + text: this.state.dict['header.form.false'] + }] } ] }) @@ -468,7 +481,7 @@ handleSubmit = () => { this.formRef.handleConfirm().then(res => { let _config = JSON.parse(JSON.stringify(this.state.config)) - + console.log(res) if ((res.type === 'select' || res.type === 'link') && res.resourceType === '1') { let sql = 'select ' + res.valueField + ',' + res.valueText + ' from (' + res.dataSource + ')' if (res.orderBy) { @@ -477,13 +490,26 @@ res.dataSourceSql = Utils.formatOptions(sql) } - _config.fields = _config.fields.map(item => { - if (item.uuid === res.uuid) { - return res - } else { - return item - } - }) + 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 + } + }) + } + _config.fields = _config.fields.filter(item => !item.origin) this.setState({ @@ -510,13 +536,15 @@ cancelText: this.state.dict['header.cancel'], onOk() { let _config = JSON.parse(JSON.stringify(_this.state.config)) - _config.fields = _config.fields.filter(item => { - if (item.uuid === card.uuid) { - return false - } else { - return true - } - }) + + if (_config.groups.length > 0) { + _config.groups.forEach(group => { + group.sublist = group.sublist.filter(item => !(item.uuid === card.uuid)) + }) + } else { + _config.fields = _config.fields.filter(item => !(item.uuid === card.uuid)) + } + _this.setState({ config: _config, loading: true @@ -742,7 +770,8 @@ valueText: '', orderBy: '', orderType: 'asc', - readonly: 'false' + readonly: 'false', + required: 'false' } }) _config.groups[_config.groups.length - 1].sublist = [..._config.groups[_config.groups.length - 1].sublist, ..._additems] @@ -786,7 +815,8 @@ valueText: '', orderBy: '', orderType: 'asc', - readonly: 'false' + readonly: 'false', + required: 'false' } items.push(newcard) -- Gitblit v1.8.0