From 169f6cd29a0d3add4fe2cf35c3579b45fa83c0d4 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 14 十一月 2023 00:02:45 +0800 Subject: [PATCH] 2023-11-14 --- src/tabviews/custom/components/form/simple-form/index.jsx | 53 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/tabviews/custom/components/form/simple-form/index.jsx b/src/tabviews/custom/components/form/simple-form/index.jsx index 1f08786..9f8adb5 100644 --- a/src/tabviews/custom/components/form/simple-form/index.jsx +++ b/src/tabviews/custom/components/form/simple-form/index.jsx @@ -176,11 +176,39 @@ } reloadData = (menuId, id) => { - const { config } = this.state + const { config, group } = this.state if (config.uuid !== menuId) return - this.loadData() + if (id === 'focus-refresh' && config.wrap.refocus) { + let _group = fromJS(group).toJS() + _group.setting.focus = config.wrap.refocus + + if (config.wrap.datatype === 'static') { + this.setState({ + data: null, + group: _group + }, () => { + this.setState({data: {$$empty: true}}) + }) + } else { + this.setState({ + group: _group + }, () => { + this.loadData(true) + }) + } + } else if (id === 'focus-nofresh' && config.wrap.refocus) { + let formId = '' + group.fields.forEach(item => { + if (item.field === config.wrap.refocus) { + formId = item.uuid + } + }) + MKEmitter.emit('mkFC', 'focus', formId) + } else { + this.loadData() + } } /** @@ -197,6 +225,14 @@ if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { MKEmitter.emit('reloadData', config.setting.supModule, BID) } else if (position === 'grid' && config.wrap.datatype === 'static') { + if (config.wrap.refocus && group.setting.focus === config.wrap.refocus) { + let _group = fromJS(group).toJS() + _group.setting.focus = config.wrap.focus + + this.setState({ + group: _group + }) + } this.setState({ data: null }, () => { @@ -253,8 +289,17 @@ } } - async loadData () { - const { config, BID } = this.state + async loadData (refocus) { + const { config, BID, group } = this.state + + if (config.wrap.refocus && !refocus && group.setting.focus === config.wrap.refocus) { + let _group = fromJS(group).toJS() + _group.setting.focus = config.wrap.focus + + this.setState({ + group: _group + }) + } if (config.wrap.datatype === 'public') { MKEmitter.emit('reloadData', config.wrap.publicId) -- Gitblit v1.8.0