From 31ec63f0419895876cbaba99637a884a32d33d0d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 01 九月 2021 10:31:45 +0800 Subject: [PATCH] 2021-09-01 --- src/templates/comtableconfig/index.jsx | 76 ++++++++++++------------------------- 1 files changed, 25 insertions(+), 51 deletions(-) diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 2c00e6f..93f8c2d 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -25,6 +25,8 @@ const { Panel } = Collapse const { confirm } = Modal +const UrlFieldComponent = asyncComponent(() => import('@/menu/urlfieldcomponent')) +const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent')) const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) @@ -42,9 +44,8 @@ } state = { - dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, config: null, // 椤甸潰閰嶇疆 - tableFields: [], // 宸查�夌殑甯哥敤琛� formlist: null, // 鎼滅储鏉′欢銆佹寜閽�佹樉绀哄垪琛ㄥ崟瀛楁 menuloading: false, // 鑿滃崟淇濆瓨涓� menucloseloading: false, // 鑿滃崟鍏抽棴鏃讹紝閫夋嫨淇濆瓨 @@ -101,17 +102,17 @@ item.linkTab = '' } - if (item.OpenType === 'pop') { // 鍚湁瀛愰厤缃」鐨勬寜閽�(琛ㄥ崟) + if (item.OpenType === 'pop' || item.execMode === 'pop') { // 鍚湁瀛愰厤缃」鐨勬寜閽�(琛ㄥ崟) _oriActions.push({ prebtn: fromJS(item).toJS(), curuuid: uuid, Template: 'Modal' }) - } else if (item.OpenType === 'tab' || item.OpenType === 'blank') { // 鍚湁瀛愰厤缃」鐨勬寜閽�(鏍囩鍚庡綋鍓嶉〉鎵撳紑) + } else if (item.OpenType === 'tab' && item.tabTemplate === 'FormTab') { // 鍚湁瀛愰厤缃」鐨勬寜閽�(鏍囩椤垫墦寮�) _oriActions.push({ prebtn: fromJS(item).toJS(), curuuid: uuid, - Template: item.tabTemplate + Template: 'FormTab' }) } @@ -401,7 +402,7 @@ EasyCode: _config.easyCode || '', Template: _config.Template || '', MenuName: _config.MenuName, - PageParam: JSON.stringify({...menu.PageParam, Template: _config.Template, OpenType: _config.OpenType}), + PageParam: JSON.stringify({...menu.PageParam, Template: _config.Template, OpenType: _config.OpenType, hidden: _config.hidden || 'false'}), LongParam: _LongParam, LText: _vals.func.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`), LTexttb: _vals.table.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`) @@ -616,6 +617,8 @@ let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 鏌ョ湅鍒濆鍖栨寜閽槸鍚﹀瓨鍦� if (!curBtn) return if (curBtn.OpenType !== item.prebtn.OpenType) return + if (curBtn.OpenType === 'tab' && curBtn.tabTemplate !== 'FormTab') return + if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return oriActions.push({ prebtn: item.prebtn, @@ -679,7 +682,7 @@ }) }) _subconfig = window.btoa(window.encodeURIComponent(JSON.stringify(_subconfig))) - } catch { + } catch (e) { console.warn('Stringify Failure') _subconfig = '' } @@ -775,16 +778,6 @@ duration: 5 }) } else { - // 鍩烘湰淇℃伅楠岃瘉 - if (!config.fstMenuId || !config.ParentId || !config.MenuName || !config.MenuNo) { - notification.warning({ - top: 92, - message: this.state.dict['model.menu.basemsg'], - duration: 5 - }) - this.setState({activeKey: '0'}) - return - } if (!is(fromJS(originMenu), fromJS(config))) { // 鑿滃崟淇℃伅鍙樺寲鏃讹紝鎻愮ず淇濆瓨 notification.warning({ top: 92, @@ -794,7 +787,7 @@ return } - let submenu = menu.fstMenuList.filter(item => item.MenuID === config.fstMenuId)[0] + let submenu = menu.fstMenuList.filter(_menu => _menu.MenuID === config.fstMenuId)[0] let _Menu = { ...menu, @@ -813,17 +806,17 @@ let isbutton = true let _btnTab = null - if (type === 'button' && item.OpenType === 'pop') { - _view = 'Modal' // 琛ㄥ崟椤甸潰 - } else if (type === 'button' && (item.OpenType === 'tab' || item.OpenType === 'blank')) { - _view = item.tabTemplate // 鏂版爣绛鹃〉妯℃澘 + if (type === 'button' && (item.OpenType === 'pop' || item.execMode === 'pop')) { + _view = 'Modal' // 琛ㄥ崟椤甸潰 + } else if (type === 'button' && item.OpenType === 'tab') { + _view = 'FormTab' // 琛ㄥ崟鏍囩椤垫ā鏉� _btnTab = item } else if (type === 'button' && item.OpenType === 'popview') { - _view = item.tabType || 'SubTable' // 鏂板脊绐楁爣绛炬ā鏉� tabType 灞炴�у凡鍘婚櫎 + _view = 'SubTable' // 鏂板脊绐楁爣绛炬ā鏉� tabType 灞炴�у凡鍘婚櫎 uuid = item.linkTab isbutton = false } else if (type === 'tab') { - _view = item.type // 鏍囩妯℃澘 + _view = 'SubTable' // 鏍囩妯℃澘 uuid = item.linkTab isbutton = false } @@ -1082,28 +1075,6 @@ } /** - * @description 鏇存柊甯哥敤琛ㄤ俊鎭紝蹇嵎娣诲姞鍚庢洿鏂伴厤缃俊鎭� - */ - updatetable = (config, fields) => { - const { tableFields } = this.state - - this.setState({ - config: config, - tableFields: fields ? fields : tableFields - }) - } - - /** - * @description 鏇存柊鏍囩閰嶇疆淇℃伅 - */ - updatetabs = (config) => { - - this.setState({ - config: config - }) - } - - /** * @description 鏇存柊閰嶇疆淇℃伅 */ updateconfig = (config) => { @@ -1116,7 +1087,7 @@ const { menu } = this.props const { activeKey, config, chartview } = this.state - const confActions = config.action.filter(_action => !_action.origin && (['pop', 'popview', 'blank'].includes(_action.OpenType) || (_action.OpenType === 'tab' && _action.tabTemplate === 'FormTab'))) + const confActions = config.action.filter(_action => !_action.origin && (['pop', 'popview'].includes(_action.OpenType) || (_action.OpenType === 'tab' && _action.tabTemplate === 'FormTab') || (_action.OpenType === 'funcbutton' && _action.execMode === 'pop'))) let configTabs = [] config.tabgroups.forEach(group => { @@ -1138,11 +1109,15 @@ dict={this.state.dict} updatemenu={this.updateconfig} /> + {config ? <UrlFieldComponent + config={config} + updateConfig={this.updateconfig} + /> : null} {/* 琛ㄥ悕娣诲姞 */} <TableComponent config={config} containerId="main-basedata" - updatetable={this.updatetable} + updatetable={this.updateconfig} /> </Panel> {/* 鎼滅储鏉′欢娣诲姞 */} @@ -1153,7 +1128,6 @@ <FieldsComponent config={config} type="search" - tableFields={this.state.tableFields} updatefield={this.updateconfig} /> </Panel> @@ -1193,7 +1167,6 @@ <FieldsComponent config={config} type="columns" - tableFields={this.state.tableFields} updatefield={this.updateconfig} /> </Panel> @@ -1233,6 +1206,7 @@ </div> } bordered={false} extra={ <div> + <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/> <EditComponent dict={this.state.dict} options={['search', 'action', 'columns']} config={this.state.config} MenuID={this.props.menu.MenuID} thawButtons={this.state.thawButtons} refresh={this.editConfig}/> <Switch className="big" checkedChildren={this.state.dict['model.enable']} unCheckedChildren={this.state.dict['model.disable']} checked={this.state.config.enabled} onChange={this.onEnabledChange} /> <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['model.save']}</Button> @@ -1304,7 +1278,7 @@ config={config} tabs={this.state.tabviews} setSubConfig={(item) => this.setSubConfig(item, 'tab')} - updatetabs={this.updatetabs} + updatetabs={this.updateconfig} /> </Card> </div> -- Gitblit v1.8.0