From 063b983daaf51a7f1e8677bde1e9c0e618866c91 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 21 二月 2020 10:30:19 +0800 Subject: [PATCH] 2020-02-21 --- src/templates/comtableconfig/index.jsx | 428 +++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 314 insertions(+), 114 deletions(-) diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 9cfe91e..c150227 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -387,7 +387,10 @@ handleTab = (card) => { const { config } = this.state - let menus = [{value: 'mainTable', text: '涓昏〃'}] + let menus = [ + {value: '', text: '绌�'}, + {value: 'mainTable', text: '涓昏〃'} + ] let equalTabs = [] let supMenu = card.supMenu || '' let equalTab = card.equalTab || [] @@ -584,6 +587,80 @@ PageParam: JSON.stringify({Template: 'Modal'}), LongParam: _LongParam } + Api.getSystemConfig(param).then(response => { + if (!response.status) { + notification.warning({ + top: 92, + message: response.message, + duration: 10 + }) + } else { + this.setState({ + copyActions: [...this.state.copyActions, res.uuid] + }) + } + }) + } + }) + } else if ( + (res.OpenType === 'tab' || res.OpenType === 'blank') && + card.originCard && + (card.originCard.OpenType === 'tab' || card.originCard.OpenType === 'blank') + ) { + Api.getSystemConfig({ + func: 'sPC_Get_LongParam', + MenuID: card.originCard.uuid + }).then(result => { + if (result.status && result.LongParam) { + let _LongParam = '' + + // 瑙f瀽閰嶇疆锛屼慨鏀规ā鎬佹鏍囬鍚嶇О + if (result.LongParam) { + try { + _LongParam = window.decodeURIComponent(window.atob(result.LongParam)) + _LongParam = JSON.parse(_LongParam) + } catch (e) { + _LongParam = '' + } + } + + let _temp = '' + if (_LongParam && _LongParam.type === 'FormTab') { + try { + _LongParam.action = _LongParam.action.map(_btn => { + _btn.uuid = Utils.getuuid() + + return _btn + }) + _LongParam.tabgroups.forEach(_groupId => { + _LongParam[_groupId] = _LongParam[_groupId].map(_tab => { + _tab.uuid = Utils.getuuid() + + return _tab + }) + }) + _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_LongParam))) + _temp = 'FormTab' + } catch { + _LongParam = '' + } + } else { + _LongParam = '' + } + + if (!_temp) return + + let param = { + func: 'sPC_ButtonParam_AddUpt', + ParentID: menu.MenuID, + MenuID: res.uuid, + MenuNo: menu.MenuNo, + Template: _temp, + MenuName: res.label, + PageParam: JSON.stringify({Template: _temp}), + LongParam: _LongParam + } + Api.getSystemConfig(param).then(response => { if (!response.status) { notification.warning({ @@ -1410,63 +1487,72 @@ }) } - // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser - delete _config.type - delete _config.isAdd + _config.funcs = [] // 椤甸潰鍙婂瓙椤甸潰瀛樺偍杩囩▼闆� - try { - _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) - } catch (e) { - notification.warning({ - top: 92, - message: '缂栬瘧閿欒', - duration: 10 + _config.funcs.push({ + type: 'view', + subtype: 'view', + uuid: menu.MenuID, + intertype: _config.setting.interType || 'inner', + interface: _config.setting.interface || '', + tableName: _config.setting.tableName || '', + innerFunc: _config.setting.innerFunc || '', + outerFunc: _config.setting.outerFunc || '' + }) + + _config.action.forEach(item => { + let tablename = item.OpenType === 'excelIn' ? (item.sheet || '') : (item.sql || '') + + if (item.OpenType === 'excelOut' && item.intertype === 'inner' && !item.innerFunc) { + tablename = _config.setting.tableName || '' + } + + if (item.OpenType === 'tab' || item.OpenType === 'blank') { + _config.funcs.push({ + type: 'tab', + subtype: 'btn', + uuid: item.uuid, + label: item.label, + linkTab: item.uuid + }) + } else if (item.OpenType === 'popview') { + _config.funcs.push({ + type: 'tab', + subtype: 'btn', + uuid: item.uuid, + label: item.label, + linkTab: item.linkTab + }) + } else if (['pop', 'prompt', 'exec', 'excelIn', 'excelOut'].includes(item.OpenType)) { + _config.funcs.push({ + type: 'button', + subtype: 'btn', + uuid: item.uuid, + label: item.label, + tablename: tablename, + intertype: item.intertype, + interface: item.interface || '', + innerFunc: item.innerFunc || '', + outerFunc: item.outerFunc || '', + callbackFunc: item.callbackFunc || '' + }) + } + }) + + _config.tabgroups.forEach(groupId => { + if (_config[groupId].length === 0) return + + _config[groupId].forEach(tab => { + _config.funcs.push({ + type: 'tab', + subtype: 'tab', + uuid: tab.uuid, + label: tab.label, + linkTab: tab.linkTab + }) }) - return - } + }) - let btnParam = { // 娣诲姞鑿滃崟鎸夐挳 - func: 'sPC_Button_AddUpt', - Type: 40, // 娣诲姞鑿滃崟涓嬬殑鎸夐挳type涓�40锛屾寜閽笅鐨勬寜閽畉ype涓�60 - ParentID: menu.MenuID, - MenuNo: res.menuNo, - Template: menu.PageParam.Template || '', - PageParam: '', - LongParam: '', - LText: config.action.map((item, index) => { - return `select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort` - }) - } - - btnParam.LText = btnParam.LText.join(' union all ') - btnParam.LText = Utils.formatOptions(btnParam.LText) - btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) - - let tabParam = { // 娣诲姞鑿滃崟tab椤� - func: 'sPC_sMenusTab_AddUpt', - MenuID: menu.MenuID, - LText: config.tabs.map((item, index) => { - return `select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort` - }) - } - tabParam.LText = tabParam.LText.join(' union all ') - tabParam.LText = Utils.formatOptions(tabParam.LText) - tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) - - let param = { - func: 'sPC_TrdMenu_AddUpt', - ParentID: res.parentId, - MenuID: menu.MenuID, - MenuNo: res.menuNo, - Template: menu.PageParam.Template || '', - MenuName: res.menuName, - Sort: (this.props.supMenuList.length + 1) * 10, - PageParam: JSON.stringify(_pageParam), - LongParam: _LongParam - } - if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬� this.setState({ menucloseloading: true @@ -1477,81 +1563,185 @@ }) } - // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣� - // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆 new Promise(resolve => { - if (delActions.length > 0) { - let deffers = delActions.map(item => { - let _param = { - func: 'sPC_MainMenu_Del', - MenuID: item - } - return new Promise(resolve => { - Api.getSystemConfig(_param).then(response => { - resolve(response) + let deffers = [] + _config.funcs.forEach(item => { + if (item.type === 'tab') { + let deffer = new Promise(resolve => { + Api.getSystemConfig({ + func: 'sPC_Get_LongParam', + MenuID: item.linkTab + }).then(result => { + if (result.status && result.LongParam) { + let _LongParam = '' + + if (result.LongParam) { + try { + _LongParam = window.decodeURIComponent(window.atob(result.LongParam)) + _LongParam = JSON.parse(_LongParam) + } catch (e) { + _LongParam = '' + } + } + + if (_LongParam) { + item.menuNo = _LongParam.tabNo || '' + item.subfuncs = _LongParam.funcs || [] + } + } + resolve() }) }) + + deffers.push(deffer) + } + }) + + if (deffers.length === 0) { + resolve() + } else { + Promise.all(deffers).then(() => { + resolve() }) - Promise.all(deffers).then(result => { - let error = null - result.forEach(response => { - if (!response.status) { - error = response + } + }).then(() => { + // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser + delete _config.type + delete _config.isAdd + + try { + _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) + } catch (e) { + notification.warning({ + top: 92, + message: '缂栬瘧閿欒', + duration: 10 + }) + this.setState({ + menucloseloading: false, + menuloading: false + }) + return + } + + let btnParam = { // 娣诲姞鑿滃崟鎸夐挳 + func: 'sPC_Button_AddUpt', + Type: 40, // 娣诲姞鑿滃崟涓嬬殑鎸夐挳type涓�40锛屾寜閽笅鐨勬寜閽畉ype涓�60 + ParentID: menu.MenuID, + MenuNo: res.menuNo, + Template: menu.PageParam.Template || '', + PageParam: '', + LongParam: '', + LText: config.action.map((item, index) => { + return `select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort` + }) + } + + btnParam.LText = btnParam.LText.join(' union all ') + btnParam.LText = Utils.formatOptions(btnParam.LText) + btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) + + let tabParam = { // 娣诲姞鑿滃崟tab椤� + func: 'sPC_sMenusTab_AddUpt', + MenuID: menu.MenuID, + LText: config.tabs.map((item, index) => { + return `select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort` + }) + } + tabParam.LText = tabParam.LText.join(' union all ') + tabParam.LText = Utils.formatOptions(tabParam.LText) + tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) + + let param = { + func: 'sPC_TrdMenu_AddUpt', + ParentID: res.parentId, + MenuID: menu.MenuID, + MenuNo: res.menuNo, + Template: menu.PageParam.Template || '', + MenuName: res.menuName, + Sort: (this.props.supMenuList.length + 1) * 10, + PageParam: JSON.stringify(_pageParam), + LongParam: _LongParam + } + + // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣� + // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆 + new Promise(resolve => { + if (delActions.length > 0) { + let deffers = delActions.map(item => { + let _param = { + func: 'sPC_MainMenu_Del', + MenuID: item + } + return new Promise(resolve => { + Api.getSystemConfig(_param).then(response => { + resolve(response) + }) + }) + }) + Promise.all(deffers).then(result => { + let error = null + result.forEach(response => { + if (!response.status) { + error = response + } + }) + + if (error) { + this.setState({ + menuloading: false, + menucloseloading: false + }) + notification.warning({ + top: 92, + message: error.message, + duration: 10 + }) + resolve(false) + } else { + this.setState({ + delActions: [] + }) + resolve(true) } }) - - if (error) { + } else if (delActions.length === 0) { + resolve(true) + } + }).then(resp => { + if (resp === false) return + + Api.getSystemConfig(param).then(response => { + if (response.status) { + this.setState({ + config: _config, + originMenu: { + ...originMenu, + LongParam: _config, + PageParam: _pageParam, + MenuName: res.menuName, + MenuNo: res.menuNo, + ParentID: res.parentId + } + }) + + this.props.reloadmenu() + + this.submitAction(btnParam, tabParam) + } else { this.setState({ menuloading: false, menucloseloading: false }) notification.warning({ top: 92, - message: error.message, + message: response.message, duration: 10 }) - resolve(false) - } else { - this.setState({ - delActions: [] - }) - resolve(true) } }) - } else if (delActions.length === 0) { - resolve(true) - } - }).then(resp => { - if (resp === false) return - - Api.getSystemConfig(param).then(response => { - if (response.status) { - this.setState({ - config: _config, - originMenu: { - ...originMenu, - LongParam: _config, - PageParam: _pageParam, - MenuName: res.menuName, - MenuNo: res.menuNo, - ParentID: res.parentId - } - }) - - this.props.reloadmenu() - - this.submitAction(btnParam, tabParam) - } else { - this.setState({ - menuloading: false, - menucloseloading: false - }) - notification.warning({ - top: 92, - message: response.message, - duration: 10 - }) - } }) }) }, () => { @@ -2543,6 +2733,7 @@ title={this.state.dict['header.modal.search.edit']} visible={modaltype === 'search'} width={700} + maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} destroyOnClose @@ -2559,6 +2750,7 @@ title={modaltype === 'actionEdit' ? this.state.dict['header.modal.action.edit'] : this.state.dict['header.modal.action.copy']} visible={modaltype === 'actionEdit' || modaltype === 'actionCopy'} width={800} + maskClosable={false} onCancel={this.editModalCancel} footer={[ modaltype === 'actionEdit' ? <Button key="delete" className="mk-btn mk-purple" onClick={this.creatFunc} loading={this.state.funcLoading}>{this.state.dict['header.menu.func.create']}</Button> : null, @@ -2581,6 +2773,7 @@ title={this.state.dict['header.modal.column.edit']} visible={modaltype === 'columns'} width={700} + maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} destroyOnClose @@ -2597,6 +2790,7 @@ title={this.state.dict['header.modal.colspan.edit']} visible={modaltype === 'colspan'} width={700} + maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} destroyOnClose @@ -2613,6 +2807,7 @@ title={this.state.dict['header.modal.gridbtn.edit']} visible={modaltype === 'gridbtn'} width={700} + maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} destroyOnClose @@ -2628,6 +2823,7 @@ title={this.state.dict['header.modal.tabs.edit']} visible={modaltype === 'tabs'} width={700} + maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} destroyOnClose @@ -2647,6 +2843,7 @@ title={this.state.dict['header.edit']} visible={this.state.tableVisible} width={'65vw'} + maskClosable={false} style={{minWidth: '900px', maxWidth: '1200px'}} cancelText={this.state.dict['header.close']} onOk={this.addFieldSubmit} @@ -2669,6 +2866,7 @@ <Modal wrapClassName="common-table-fields-modal" title={'楠岃瘉淇℃伅'} + maskClosable={false} visible={this.state.profileVisible} width={'75vw'} style={{minWidth: '900px', maxWidth: '1200px'}} @@ -2704,6 +2902,7 @@ title={this.state.dict['header.edit']} visible={this.state.settingVisible} width={700} + maskClosable={false} // onOk={this.settingSave} onCancel={() => { // 鍙栨秷淇敼 this.setState({ @@ -2729,6 +2928,7 @@ <Modal bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} closable={false} + maskClosable={false} visible={this.state.closeVisible} onCancel={() => { this.setState({closeVisible: false}) }} footer={[ -- Gitblit v1.8.0