From 46f79b491173d284a4900d19e7aecf7509481438 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 21 一月 2022 17:21:25 +0800
Subject: [PATCH] 2022-01-21

---
 src/templates/subtableconfig/index.jsx |   35 +++++++++++++++++++++++++++++++++--
 1 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx
index b4a6ebc..c7f9293 100644
--- a/src/templates/subtableconfig/index.jsx
+++ b/src/templates/subtableconfig/index.jsx
@@ -133,6 +133,32 @@
    */
   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
+      }
+    }
   }
 
   /**
@@ -192,6 +218,7 @@
     this.setState = () => {
       return
     }
+    document.onkeydown = () => {}
   }
 
   // 椤甸潰杩斿洖
@@ -274,6 +301,10 @@
       if (_config.columns[0] && _config.columns[0].origin) {
         _config.columns = _config.columns.filter(item => !item.origin)
       }
+    }
+
+    if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) {
+      _config.setting.doubleClick = ''
     }
 
     // 鏈缃暟鎹簮鎴栦富閿椂锛屽惎鐢ㄧ姸鎬佷负false
@@ -1023,7 +1054,7 @@
                       <Tooltip placement="topLeft" title="鐐瑰嚮鎸夐挳锛屽彲瀹屾垚鎴栨煡鐪嬫寜閽厤缃俊鎭��">
                         <QuestionCircleOutlined className="mk-form-tip" />
                       </Tooltip>
-                      {this.state.dict['header.menu.action.configurable']}
+                      鎸夐挳閰嶇疆
                     </p> : null
                   }
                 </div>
@@ -1063,7 +1094,7 @@
                 <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/>
                 <EditComponent dict={this.state.dict} type="table" options={['search', 'form', 'action', 'columns']} config={config} MenuID={config.uuid} thawButtons={this.state.thawButtons} refresh={this.updateConfig}/>
                 <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={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