From a24beb36feaa46f39cbb26ce5277e84f91241ce8 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 26 三月 2020 01:30:05 +0800 Subject: [PATCH] 2020-03-26 --- src/templates/comtableconfig/index.jsx | 62 ++++++++++++++++++++++++++----- 1 files changed, 52 insertions(+), 10 deletions(-) diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 6058e1a..0c3dc10 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -33,6 +33,7 @@ import TransferForm from '@/components/transferform' import SourceElement from '@/templates/zshare/dragelement/source' import CreateFunc from '@/templates/zshare/createfunc' +import CreateInterface from '@/templates/zshare/createinterface' import Source from './source' import './index.scss' @@ -77,7 +78,8 @@ optionLibs: null, // 鑷畾涔変笅鎷夐�夐」搴� thawBtnVisible: false, // 瑙e喕鎸夐挳寮圭獥 thawbtnlist: null, // 瑙e喕鎸夐挳鍒楄〃 - thawButtons: [] // 宸查�夋嫨瑕佽В鍐荤殑鎸夐挳 + thawButtons: [], // 宸查�夋嫨瑕佽В鍐荤殑鎸夐挳 + activeKey: '0' // 榛樿灞曞紑鍩烘湰淇℃伅 } /** @@ -165,6 +167,7 @@ this.setState({ config: _config, + activeKey: menu.activeKey || '0', optionLibs: optionLibs, originActions: _oriActions, originMenu: JSON.parse(JSON.stringify(menu)), @@ -1047,10 +1050,10 @@ */ tableCreatFunc = () => { const { menu } = this.props - let config = JSON.parse(JSON.stringify(this.state.config)) + const { config } = this.state - this.settingRef.handleConfirm().then(res => { - const setting = res + this.settingRef.handleConfirm().then(setting => { + if (!(setting.interType === 'inner') || !setting.innerFunc) { notification.warning({ top: 92, @@ -1074,16 +1077,51 @@ Api.getLocalConfig(param) } - let newLText = Utils.formatOptions(Utils.getTableFunc(setting, menu, config)) // 鍒涘缓瀛樺偍杩囩▼sql + let _config = {...config, setting: setting} + let newLText = Utils.formatOptions(Utils.getTableFunc(setting, menu, _config)) // 鍒涘缓瀛樺偍杩囩▼sql let DelText = Utils.formatOptions(Utils.dropfunc(setting.innerFunc)) // 鍒犻櫎瀛樺偍杩囩▼sql this.refs.tableCreatFunc.exec(setting.innerFunc, newLText, DelText).then(result => { if (result === 'success') { this.setState({ - config: {...config, setting: setting} + config: _config }) } }) + }) + } + + /** + * @description 鍒涘缓琛ㄦ牸鎺ュ彛 + */ + tableCreatInterface = () => { + const { menu } = this.props + const { config } = this.state + + this.settingRef.handleConfirm().then(setting => { + if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) { + let param = { + func: 's_DataSrc_Save', + LText: setting.dataresource, + MenuID: menu.MenuID + } + + param.LText = Utils.formatOptions(param.LText) + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + Api.getLocalConfig(param) + } + + // let _config = {...config, setting: setting} + + // this.refs.tableCreatInterface.exec(setting.innerFunc, newLText, DelText).then(result => { + // if (result === 'success') { + // this.setState({ + // config: {...config, setting: setting} + // }) + // } + // }) }) } @@ -2243,7 +2281,7 @@ */ setSubConfig = (item, type) => { const { menu } = this.props - const { config, originMenu, optionLibs } = this.state + const { config, originMenu, optionLibs, activeKey } = this.state if (!originMenu.MenuID) { // menuID涓嶅瓨鍦ㄦ椂锛屼负鏂板缓鑿滃崟锛屾彁绀鸿彍鍗曞皻鏈繚瀛� notification.warning({ @@ -2294,6 +2332,9 @@ uuid = item.linkTab isbutton = false } + + // 淇濆瓨褰撳墠鎵撳紑椤电 + _originMenu.activeKey = activeKey let param = { optionLibs: optionLibs, @@ -2618,7 +2659,7 @@ } render () { - const { modaltype } = this.state + const { modaltype, activeKey } = this.state const configAction = this.state.config.action.filter(_action => !_action.origin && (_action.OpenType === 'pop' || _action.OpenType === 'popview' || _action.OpenType === 'blank' || _action.OpenType === 'tab') ) @@ -2633,9 +2674,9 @@ <DndProvider backend={HTML5Backend}> {/* 宸ュ叿鏍� */} <div className="tools"> - <Collapse accordion defaultActiveKey="0" bordered={false}> + <Collapse accordion defaultActiveKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> {/* 鍩烘湰淇℃伅 */} - <Panel header={this.state.dict['header.menu.basedata']} key="0" id="common-basedata"> + <Panel forceRender={true} header={this.state.dict['header.menu.basedata']} key="0" id="common-basedata"> {/* 鑿滃崟淇℃伅 */} <MenuForm dict={this.state.dict} @@ -3051,6 +3092,7 @@ }) }} footer={[ + <CreateInterface key="interface" dict={this.state.dict} ref="tableCreatInterface" trigger={this.tableCreatInterface}/>, <CreateFunc key="create" dict={this.state.dict} ref="tableCreatFunc" trigger={this.tableCreatFunc}/>, <Button key="cancel" onClick={() => { this.setState({ settingVisible: false }) }}>{this.state.dict['header.cancel']}</Button>, <Button key="confirm" type="primary" onClick={this.settingSave}>{this.state.dict['header.confirm']}</Button> -- Gitblit v1.8.0