From 1b0fd0a20d54068f0f4716177780e00a75b860ef Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 10 一月 2020 17:12:34 +0800 Subject: [PATCH] 2020-01-10 --- src/templates/formtabconfig/index.jsx | 181 +++++--------------------------------------- 1 files changed, 23 insertions(+), 158 deletions(-) diff --git a/src/templates/modalviewconfig/index.jsx b/src/templates/formtabconfig/index.jsx similarity index 94% rename from src/templates/modalviewconfig/index.jsx rename to src/templates/formtabconfig/index.jsx index 98489b1..365fc19 100644 --- a/src/templates/modalviewconfig/index.jsx +++ b/src/templates/formtabconfig/index.jsx @@ -33,12 +33,11 @@ class ComTableConfig extends Component { static propTpyes = { - type: PropTypes.string, menu: PropTypes.any, - reloadmenu: PropTypes.func, + editAction: PropTypes.object, + config: PropTypes.any, handleConfig: PropTypes.func, - handleSubConfig: PropTypes.func, - supMenuList: PropTypes.array + handleSubConfig: PropTypes.func } state = { @@ -66,7 +65,6 @@ tables: [], // 鍙敤琛ㄥ悕 selectedTables: [], // 宸查�夎〃鍚� originMenu: null, // 鍘熷鑿滃崟 - originActions: null, // 鍘熷鎸夐挳淇℃伅锛屼娇鐢ㄥ凡鏈夌敤鎴锋ā鏉� delActions: [], // 鍒犻櫎鎸夐挳鍒楄〃 funcLoading: false, // 瀛樺偍杩囩▼鍒涘缓涓� showColumnName: false, // 鏄剧ず鍒楀瓧娈靛悕鎺у埗 @@ -80,90 +78,42 @@ * 2銆佽缃搷浣滅被鍨嬨�佸師濮嬭彍鍗曚俊鎭紙姣忔淇濆瓨鍚庨噸缃級銆佸凡浣跨敤琛ㄥ強鍩烘湰淇℃伅琛ㄥ崟 */ UNSAFE_componentWillMount () { - const { menu } = this.props + const { menu, editAction, config } = this.props - let _LongParam = menu.LongParam + console.log(menu) + console.log(editAction) + console.log(config) let _config = '' - if (!_LongParam) { + if (!config) { _config = JSON.parse(JSON.stringify(Source.baseConfig)) - if (!menu.isSubtable) { // 涓嶆槸閫夋嫨涓诲瓙琛ㄦ椂锛岄殣钘忔爣绛鹃〉 - _config.tabs = [] - } } else { - _config = _LongParam + _config = config } - let _oriActions = [] - if (_config.type === 'user') { - _config.action = _config.action.map(item => { - let uuid = Utils.getuuid() - - if (item.OpenType === 'pop') { // 鍚湁瀛愰厤缃」鐨勬寜閽�傘�傘�� - _oriActions.push({ - prebtn: JSON.parse(JSON.stringify(item)), - curuuid: uuid, - Template: 'Modal' - }) - } - - item.uuid = uuid - - return item - }) - } - - _config.tabs = _config.tabs || [] - _config.tabgroups = _config.tabgroups || ['tabs'] - _config.setting.subtabs = _config.setting.subtabs || [] + // _config.action = _config.action.map(item => { + // item.uuid = Utils.getuuid() + // return item + // }) this.setState({ config: _config, - originActions: _oriActions, originMenu: JSON.parse(JSON.stringify(menu)), - selectedTables: _config.tables || [], + selectedTables: _config.tables, menuformlist: [ - { - type: 'select', - key: 'parentId', - label: this.state.dict['header.menu.supMenu'], - initVal: menu.ParentID, - required: true, - readonly: false, - options: this.props.supMenuList - }, { type: 'text', key: 'menuName', label: this.state.dict['header.menu.menuName'], initVal: menu.MenuName, - required: true, - readonly: false + readonly: true }, { type: 'text', - key: 'menuNo', - label: this.state.dict['header.menu.menuNo'], - initVal: menu.MenuNo, - required: true, - readonly: false - }, - { - type: 'select', - key: 'opentype', - label: this.state.dict['header.menu.openType'], - initVal: menu.PageParam.OpenType, - required: true, - options: [{ - MenuID: 'newtab', - text: this.state.dict['header.form.tab'] - }, { - MenuID: 'newpage', - text: this.state.dict['header.form.newpage'] - }, { - MenuID: 'currenttab', - text: this.state.dict['header.form.currenttab'] - }] + key: 'actionName', + label: '鎸夐挳鍚嶇О', + initVal: editAction.label, + readonly: true } ] }) @@ -289,7 +239,7 @@ * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ componentWillUnmount () { - this.setState = (state, callback) => { + this.setState = () => { return } } @@ -2022,7 +1972,6 @@ * @description 淇濆瓨鎴栦慨鏀硅彍鍗曟寜閽� */ submitAction = (btnParam, tabParam) => { - const { config } = this.state new Promise(resolve => { // 鍐呴儴璇锋眰 if (this.state.delActions.length > 0) { @@ -2079,13 +2028,13 @@ if (btnParam.LText) { return Api.getSystemConfig(btnParam) } else { - return 'copy' + return 'true' } }).then(response => { - if (response === false || response === 'copy') return response + if (response === false || response === 'true') return response if (response.status) { - return 'copy' + return 'true' } else { notification.warning({ top: 92, @@ -2094,57 +2043,6 @@ }) return false } - }).then(response => { - if (response === false) return response - - let oriActions = [] - this.state.originActions.forEach(item => { - let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 鏌ョ湅鍒濆鍖栨寜閽槸鍚﹀瓨鍦� - if (!curBtn) return - if (curBtn.OpenType !== item.prebtn.OpenType) return - - oriActions.push({ - prebtn: item.prebtn, - curBtn: curBtn - }) - }) - - if (oriActions.length === 0) return 'true' - - oriActions.forEach(action => { - Api.getSystemConfig({ - func: 'sPC_Get_LongParam', - MenuID: action.prebtn ? action.prebtn.uuid : '' - }).then(result => { - if (result.status && result.LongParam) { - let _LongParam = '' - - if (result.LongParam) { - _LongParam = window.decodeURIComponent(window.atob(result.LongParam)) - try { - _LongParam = JSON.parse(_LongParam) - } catch (e) { - _LongParam = '' - } - } - - if (_LongParam) { - let param = { - func: 'sPC_ButtonParam_AddUpt', - ParentID: this.props.menu.MenuID, - MenuID: action.curBtn.uuid, - MenuNo: this.props.menu.MenuNo, - Template: _LongParam.type, - MenuName: action.curBtn.label, - PageParam: JSON.stringify({Template: _LongParam.type}), - LongParam: result.LongParam - } - Api.getSystemConfig(param).then(() => {}) - } - } - }) - }) - return 'true' }).then(response => { if (response === 'true') { notification.success({ @@ -2732,10 +2630,6 @@ } render () { - const configAction = this.state.config.action.filter(_action => - !_action.origin && (_action.OpenType === 'pop' || _action.OpenType === 'popview' || _action.OpenType === 'blank' || _action.OpenType === 'tab') - ) - let configTabs = [] this.state.config.tabgroups.forEach(group => { configTabs.push(...this.state.config[group]) @@ -2809,35 +2703,6 @@ return (<SourceElement key={index} content={item}/>) })} </div> - {configAction.length > 0 ? - <p className="config-btn-title"> - <Tooltip placement="topLeft" title="鐐瑰嚮鎸夐挳锛屽彲瀹屾垚鎴栨煡鐪嬫寜閽厤缃俊鎭��"> - <Icon type="question-circle" /> - </Tooltip> - {this.state.dict['header.menu.action.configurable']} - </p> : null - } - {configAction.map((item, index) => { - return ( - <div key={index}> - <Button - icon={item.icon} - style={{marginBottom: '10px'}} - className={'config-button mk-btn mk-' + item.class} - onClick={() => this.setSubConfig(item, 'button')} - >{item.label}</Button> - </div> - ) - })} - </Panel> - {/* 娣诲姞鏄剧ず鍒� */} - <Panel header={this.state.dict['header.menu.column']} key="3"> - <div className="search-element"> - {Source.columnItems.map((item, index) => { - return (<SourceElement key={index} content={item}/>) - })} - </div> - <Button type="primary" block onClick={() => this.queryField('columns')}>{this.state.dict['header.menu.column.add']}</Button> </Panel> {/* 娣诲姞鏍囩 */} <Panel header={this.state.dict['header.menu.tab']} key="4"> -- Gitblit v1.8.0