From 4f5f8002496e8b32c1ba83e9d3a0674e61c41c03 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 31 三月 2021 19:01:12 +0800 Subject: [PATCH] 2021-03-31 --- src/tabviews/zshare/mutilform/index.jsx | 6 ++++-- src/tabviews/zshare/mutilform/customTextArea/index.jsx | 24 ++++++++++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/tabviews/zshare/mutilform/customTextArea/index.jsx b/src/tabviews/zshare/mutilform/customTextArea/index.jsx index caed9bf..457e5f2 100644 --- a/src/tabviews/zshare/mutilform/customTextArea/index.jsx +++ b/src/tabviews/zshare/mutilform/customTextArea/index.jsx @@ -14,19 +14,19 @@ state = { value: '', - encryption: 'false' + encryption: false } UNSAFE_componentWillMount () { let value = '' - let encryption = 'false' + let encryption = false if (this.props['data-__meta']) { value = this.props['data-__meta'].initialValue || '' } if (this.props.Item && this.props.Item.encryption === 'true') { - encryption = 'true' + encryption = true if (value) { try { value = window.decodeURIComponent(window.atob(value)) @@ -42,6 +42,22 @@ }) } + UNSAFE_componentWillReceiveProps(nextProps) { + const { value, encryption } = this.state + + if (!encryption && value !== nextProps.value) { + this.setState({ value: nextProps.value || '' }) + } else if (encryption && window.btoa(window.encodeURIComponent(value)) !== nextProps.value) { + let _value = nextProps.value || '' + try { + _value = window.decodeURIComponent(window.atob(_value)) + } catch { + _value = nextProps.value || '' + } + this.setState({ value: _value }) + } + } + onChange = (e) => { const { encryption } = this.state let val = e.target.value @@ -49,7 +65,7 @@ this.setState({ value: val }) let _val = val - if (encryption === 'true') { + if (encryption) { try { _val = window.btoa(window.encodeURIComponent(_val)) } catch { diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index fff93ba..9d228e0 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -232,7 +232,9 @@ formlist }, () => { if (action.setting && action.setting.focus) { - this.selectInput(action.setting.focus) + setTimeout(() => { + this.selectInput(action.setting.focus) + }, 500) } // 鐢ㄦ潵鏇存柊state锛岄槻姝㈠彈鎺ц〃鍗曞垵濮嬫椂涓嶆樉绀� this.setState({ @@ -610,7 +612,7 @@ // 琛ㄥ崟鍒囨崲鏃讹紝鏇存柊鍏宠仈瀛楁 if (_field.linkSubField) { let _data = _field.options.filter(op => op.Value === value)[0] - + if (_data) { _field.linkSubField.forEach(subfield => { if (this.props.form.getFieldValue(subfield) !== undefined) { -- Gitblit v1.8.0