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/subtableconfig/index.jsx | 290 +++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 195 insertions(+), 95 deletions(-) diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 5256d39..d1d9d49 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -1227,50 +1227,49 @@ _config.enabled = false } - // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝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 - }) - return - } + _config.funcs.push({ + type: 'view', + subtype: 'view', + uuid: _config.uuid, + intertype: _config.setting.interType || 'inner', + interface: _config.setting.interface || '', + tableName: _config.setting.tableName || '', + innerFunc: _config.setting.innerFunc || '', + outerFunc: _config.setting.outerFunc || '' + }) - let btnParam = { - func: 'sPC_Button_AddUpt', - Type: 40, - ParentID: _config.uuid, - MenuNo: res.tabNo, - Template: 'SubTable', - PageParam: '', - LongParam: '', - LText: config.action.map((item, index) => { - return `select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort` - }) - } + _config.action.forEach(item => { + let tablename = item.OpenType === 'excelIn' ? (item.sheet || '') : (item.sql || '') - 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) + if (item.OpenType === 'excelOut' && item.intertype === 'inner' && !item.innerFunc) { + tablename = _config.setting.tableName || '' + } - let param = { - func: 'sPC_Tab_AddUpt', - MenuID: _config.uuid, - MenuNo: res.tabNo, - Template: 'SubTable', - MenuName: res.tabName, - Remark: res.Remark, - Sort: 0, - PageParam: JSON.stringify({Template: 'SubTable'}), - LongParam: _LongParam - } + if (item.OpenType === 'popview') { + _config.funcs.push({ + type: 'tab', + subtype: 'btn', + uuid: item.uuid, + label: item.label, + linkTab: item.linkTab + }) + } else { + _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 || '' + }) + } + }) if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬� this.setState({ @@ -1282,77 +1281,170 @@ }) } - - // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣� - // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆 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, + ParentID: _config.uuid, + MenuNo: res.tabNo, + Template: 'SubTable', + 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 param = { + func: 'sPC_Tab_AddUpt', + MenuID: _config.uuid, + MenuNo: res.tabNo, + Template: 'SubTable', + MenuName: res.tabName, + Remark: res.Remark, + Sort: 0, + PageParam: JSON.stringify({Template: 'SubTable'}), + 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) } }) + } else if (delActions.length === 0) { + resolve(true) + } + }).then(resp => { + if (resp === false) return - if (error) { + Api.getSystemConfig(param).then(response => { + if (response.status) { + this.setState({ + config: _config, + originConfig: _config + }, () => { + this.setState({ + menuloading: false, + menucloseloading: false + }) + this.submitAction(btnParam) + }) + } 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, - originConfig: _config - }, () => { - this.setState({ - menuloading: false, - menucloseloading: false - }) - this.submitAction(btnParam) - }) - } else { - this.setState({ - menuloading: false, - menucloseloading: false - }) - notification.warning({ - top: 92, - message: response.message, - duration: 10 - }) - } }) }) }, () => { @@ -2111,6 +2203,7 @@ title={this.state.dict['header.modal.search.edit']} visible={modaltype === 'search'} width={700} + maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} destroyOnClose @@ -2127,6 +2220,7 @@ title={modaltype === 'actionEdit' ? this.state.dict['header.modal.action.edit'] : this.state.dict['header.modal.action.copy']} visible={modaltype === 'actionEdit' || modaltype === 'actionCopy'} width={700} + 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, @@ -2149,6 +2243,7 @@ title={this.state.dict['header.modal.column.edit']} visible={modaltype === 'columns'} width={700} + maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} destroyOnClose @@ -2165,6 +2260,7 @@ title={this.state.dict['header.modal.colspan.edit']} visible={modaltype === 'colspan'} width={700} + maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} destroyOnClose @@ -2181,6 +2277,7 @@ title={this.state.dict['header.modal.gridbtn.edit']} visible={modaltype === 'gridbtn'} width={700} + maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} destroyOnClose @@ -2197,6 +2294,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} @@ -2221,6 +2319,7 @@ title={'楠岃瘉淇℃伅'} visible={this.state.profileVisible} width={'75vw'} + maskClosable={false} style={{minWidth: '900px', maxWidth: '1200px'}} onOk={this.verifySubmit} onCancel={() => { this.setState({ profileVisible: false }) }} @@ -2255,7 +2354,7 @@ title={this.state.dict['header.edit']} visible={this.state.settingVisible} width={700} - // onOk={this.settingSave} + maskClosable={false} onCancel={() => { // 鍙栨秷淇敼 this.setState({ settingVisible: false @@ -2280,6 +2379,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