From eec619b6e3339e9999a7a1c2c5454cef5d763b24 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 29 四月 2022 18:38:55 +0800 Subject: [PATCH] 2022-04-29 --- src/menu/modalconfig/index.jsx | 41 +++++++++++++++++++++++++++++++++++------ 1 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/menu/modalconfig/index.jsx b/src/menu/modalconfig/index.jsx index 942deba..aba31bb 100644 --- a/src/menu/modalconfig/index.jsx +++ b/src/menu/modalconfig/index.jsx @@ -66,6 +66,7 @@ componentDidMount () { MKEmitter.addListener('completeSave', this.completeSave) + MKEmitter.addListener('submitStyle', this.getStyle) } /** @@ -76,6 +77,7 @@ return } MKEmitter.removeListener('completeSave', this.completeSave) + MKEmitter.removeListener('submitStyle', this.getStyle) } /** @@ -129,17 +131,22 @@ index = i } + let label = item.label || '' + if (item.field && item.field.toLowerCase() !== label.toLowerCase()) { + label = label + ' (' + item.field + ')' + } + if (['text', 'number', 'textarea', 'color'].includes(item.type) && card.field !== item.field) { _inputfields.push({ field: item.field, - label: _inputIndex + '銆�' + item.label + label: _inputIndex + '銆�' + label }) _inputIndex++ } if (card.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) { _tabfields.push({ field: item.field, - label: _tabIndex + '銆�' + item.label + label: _tabIndex + '銆�' + label }) _tabIndex++ } @@ -147,7 +154,7 @@ if (item.type === 'switch') { _linksupFields.push({ field: item.field, - label: _linkIndex + '銆�' + item.label + label: _linkIndex + '銆�' + label }) } @@ -162,7 +169,7 @@ }) _linksupFields.push({ field: item.field, - label: _linkIndex + '銆�' + item.label + label: _linkIndex + '銆�' + label }) _linkIndex++ } @@ -207,6 +214,24 @@ }) } + getStyle = (comIds, style) => { + const { config } = this.state + + if (comIds[0] !== 'form') return + + let Index = config.fields.findIndex(n => n.uuid === comIds[1]) + + if (Index === -1) return + + let _config = fromJS(config).toJS() + + _config.fields[Index].style = style + + this.setState({ + config: _config + }) + } + /** * @description 缂栬緫鍚庢彁浜� * 1銆佽幏鍙栫紪杈戝悗鐨勮〃鍗曚俊鎭� @@ -224,6 +249,9 @@ } if (item.uuid === res.uuid) { + if (item.style) { + res.style = item.style + } return res } else { return item @@ -473,7 +501,7 @@ <div> <Button type="danger" onClick={this.clearConfig}>娓呯┖</Button> <EditComponent dict={dict} options={['form']} config={this.state.config} plusFields={this.plusFields}/> - <Button type="primary" loading={saving} onClick={this.submitConfig}>淇濆瓨</Button> + <Button type="primary" id="save-modal-config" loading={saving} onClick={this.submitConfig}>淇濆瓨</Button> <Button onClick={this.cancelConfig}>杩斿洖</Button> </div> } style={{ width: '100%' }}> @@ -518,7 +546,8 @@ <Modal title={this.state.dict['model.edit']} visible={this.state.visible} - width={850} + width={950} + maskClosable={false} onCancel={this.editModalCancel} onOk={this.handleSubmit} confirmLoading={this.state.sqlVerifing} -- Gitblit v1.8.0