From a0fd77abd9cb5bc693cef7c62f5915964c196d2d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 06 一月 2022 14:01:26 +0800 Subject: [PATCH] 2022-01-06 --- src/templates/comtableconfig/index.jsx | 30 +++++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-) diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index c7666fd..8117f1c 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -149,6 +149,33 @@ */ componentDidMount () { this.reloadTab(false) + + document.onkeydown = (event) => { + let e = event || window.event + let keyCode = e.keyCode || e.which || e.charCode + let preKey = '' + + if (e.ctrlKey) { + preKey = 'ctrl' + } + if (e.shiftKey) { + preKey = 'shift' + } else if (e.altKey) { + preKey = 'alt' + } + + if (!preKey || !keyCode) return + + let _shortcut = `${preKey}+${keyCode}` + + if (_shortcut === 'ctrl+83') { + let node = document.getElementById('save-config') + if (node && node.click) { + node.click() + } + return false + } + } } /** @@ -158,6 +185,7 @@ this.setState = () => { return } + document.onkeydown = () => {} } /** @@ -1223,7 +1251,7 @@ <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/> <EditComponent dict={this.state.dict} type="table" options={['search', 'form', '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> + <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['model.save']}</Button> <Button onClick={this.cancelConfig}>{this.state.dict['model.back']}</Button> </div> } style={{ width: '100%' }}> -- Gitblit v1.8.0