From a6be5cfd9c6fb084af584b77f79100fe32b385c1 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 30 十一月 2023 16:20:54 +0800 Subject: [PATCH] 2023-11-30 --- src/tabviews/custom/components/form/simple-form/index.jsx | 64 +++++++++++++++++++++++++++---- 1 files changed, 55 insertions(+), 9 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..2968377 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() + } } /** @@ -192,7 +220,16 @@ refreshByButtonResult = (menuId, position, btn, id) => { const { config, group, BID } = this.state - if (group.uuid !== menuId) return + if (config.uuid !== menuId) return + + if (position === 'grid' && config.wrap.refocus) { + let _group = fromJS(group).toJS() + _group.setting.focus = config.wrap.refocus + + this.setState({ + group: _group + }) + } if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { MKEmitter.emit('reloadData', config.setting.supModule, BID) @@ -203,7 +240,7 @@ this.setState({data: {$$empty: true}}) }) } else { - this.loadData() + this.loadData(position === 'grid') } if (id) { @@ -253,8 +290,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) @@ -338,12 +384,12 @@ } } - mkFormSubmit = (btnId, callback) => { + mkFormSubmit = (btnId, callback, formId) => { const { group } = this.state if (group.uuid !== btnId) return - this.formRef.handleConfirm().then(res => { + this.formRef.handleConfirm(formId).then(res => { MKEmitter.emit('triggerFormSubmit', {menuId: btnId, form: res}) }, () => { callback && callback() @@ -387,7 +433,7 @@ data={data} action={group} unload={config.setting.supModule && !BID} - inputSubmit={() => this.mkFormSubmit(group.uuid)} + inputSubmit={(id) => this.mkFormSubmit(group.uuid, null, id)} wrappedComponentRef={(inst) => this.formRef = inst} /> : null} {data ? <div className={'mk-form-action ' + (group.$button || '')}> -- Gitblit v1.8.0