From 06a670976e2145a10ea05207041d3cf3164cd380 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 03 二月 2024 18:13:25 +0800 Subject: [PATCH] Merge branch 'positec' into dms --- src/tabviews/zshare/mutilform/index.jsx | 41 +++++++++++++++++++++++++++++------------ 1 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index 3050350..2736082 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -47,7 +47,8 @@ send_type: '', timestamp: '', n_id: '', - focusId: '' + focusId: '', + reFocusId: '' } record = {} @@ -691,14 +692,24 @@ focusItem = fieldMap.get(action.setting.focus) } - this.setState({ formlist, ID, focusId: focusItem ? focusItem.uuid : '' }, () => { + let reFocusItem = null + if (action.setting.refocus && fieldMap.has(action.setting.refocus)) { + reFocusItem = fieldMap.get(action.setting.refocus) + } + + this.setState({ + formlist, + ID, + focusId: focusItem ? focusItem.uuid : '', + reFocusId: reFocusItem ? reFocusItem.uuid : '' + }, () => { if (unload) return if (focusItem) { if (focusItem.type === 'text' || focusItem.type === 'number') { setTimeout(() => { MKEmitter.emit('mkFC', 'focus', focusItem.uuid) - }, 50) + }, 20) } else { setTimeout(() => { MKEmitter.emit('mkFC', 'focus', focusItem.uuid) @@ -733,9 +744,9 @@ MKEmitter.removeListener('resetForms', this.resetForms) } - resetForms = (id) => { + resetForms = (id, data) => { const { action } = this.props - const { focusId } = this.state + const { focusId, reFocusId } = this.state if (id !== action.uuid) return @@ -746,8 +757,14 @@ if (item.type !== 'text' && item.type !== 'number') return item if (resetForms.includes(item.field)) { - item.initval = item.orgval - this.record[item.field] = item.orgval + let key = item.field.toLowerCase() + if (typeof(data[key]) !== 'undefined') { + item.initval = data[key] + this.record[item.field] = data[key] + } else { + item.initval = item.orgval + this.record[item.field] = item.orgval + } } return item @@ -771,10 +788,10 @@ }) }) - if (focusId || this.submitId) { + if (reFocusId || focusId || this.submitId) { setTimeout(() => { - MKEmitter.emit('mkFC', 'focus', this.submitId || focusId) - }, 50) + MKEmitter.emit('mkFC', 'focus', this.submitId || reFocusId || focusId) + }, 20) } } @@ -1243,9 +1260,9 @@ className = 'checkcard' content = (<MKCheckCard config={item} onChange={(val, other) => this.recordChange({[item.field]: val, ...other}, item)}/>) } else if (item.type === 'switch') { - content = (<MKSwitch config={item} onChange={(val, other) => this.recordChange({[item.field]: val, ...other}, item)}/>) + content = (<MKSwitch config={item} onChange={(val, other) => this.recordChange({[item.field]: val, ...other}, item)} onSubmit={this.props.inputSubmit}/>) } else if (item.type === 'check') { - content = (<MKCheck config={item} onChange={(val) => this.recordChange({[item.field]: val}, item)}/>) + content = (<MKCheck config={item} onChange={(val) => this.recordChange({[item.field]: val}, item)} onSubmit={this.props.inputSubmit}/>) } else if (item.type === 'checkbox') { content = (<MKCheckbox config={item} onChange={(val) => this.recordChange({[item.field]: val})}/>) } else if (item.type === 'radio') { -- Gitblit v1.8.0