From e8edfdadb561cd83bf6e1c3e00d55b8cc2aee6d5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 17 十月 2022 17:57:34 +0800
Subject: [PATCH] 2022-10-17

---
 src/templates/sharecomponent/settingcomponent/index.jsx |   51 ++++++++++++++++++++++++++++-----------------------
 1 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/src/templates/sharecomponent/settingcomponent/index.jsx b/src/templates/sharecomponent/settingcomponent/index.jsx
index 51f4216..85be0a7 100644
--- a/src/templates/sharecomponent/settingcomponent/index.jsx
+++ b/src/templates/sharecomponent/settingcomponent/index.jsx
@@ -5,14 +5,12 @@
 import { SettingOutlined } from '@ant-design/icons'
 
 import Utils, { FuncUtils } from '@/utils/utils.js'
-import zhCN from '@/locales/zh-CN/model.js'
-import enUS from '@/locales/en-US/model.js'
-
+import MKEmitter from '@/utils/events.js'
 import SettingForm from './settingform'
 import CreateFunc from '@/templates/zshare/createfunc'
 import CreateInterface from '@/templates/zshare/createinterface'
 
-import './index.scss'
+// import './index.scss'
 
 class SettingComponent extends Component {
   static propTpyes = {
@@ -23,7 +21,6 @@
   }
 
   state = {
-    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     menu: null,          // 鑿滃崟淇℃伅
     search: null,        // 鎼滅储鏉′欢锛屽寘鎷富琛ㄦ悳绱�
     formlist: null,      // 琛ㄥ崟淇℃伅
@@ -51,6 +48,8 @@
       search: _search,
       menu: menu
     })
+
+    MKEmitter.emit('modalStatus', '鏁版嵁婧�')
   }
 
   /**
@@ -63,15 +62,16 @@
       loading: true
     })
     this.settingRef.handleConfirm().then(setting => {
-      let res = this.resetSetting(setting)
+      let res = this.resetSetting(setting, config.setting)
       this.setState({
         visible: false,
         loading: false
       })
       res.actionfixed = res.actionfixed === 'true'
-      res.columnfixed = res.columnfixed === 'true'
 
       this.props.updatesetting({...config, setting: res})
+
+      MKEmitter.emit('modalStatus', false)
     }, () => {
       this.setState({
         loading: false
@@ -87,7 +87,7 @@
     const { menu } = this.state
 
     this.settingRef.handleConfirm('loading').then(setting => {
-      let res = this.resetSetting(setting)
+      let res = this.resetSetting(setting, config.setting)
       let _config = {...config, setting: res}
       let newLText = Utils.formatOptions(FuncUtils.getTableFunc(setting, menu, _config)) // 鍒涘缓瀛樺偍杩囩▼sql
       let DelText = Utils.formatOptions(FuncUtils.dropfunc(setting.innerFunc))          // 鍒犻櫎瀛樺偍杩囩▼sql
@@ -104,7 +104,7 @@
     const { menu } = this.state
 
     this.settingRef.handleConfirm('loading').then(setting => {
-      let res = this.resetSetting(setting)
+      let res = this.resetSetting(setting, config.setting)
       let _config = {...config, setting: res}
       let _menu = {
         type: config.Template === 'CommonTable' ? 'main' : 'subtable',
@@ -117,9 +117,16 @@
     })
   }
 
-  resetSetting = (s) => {
+  resetSetting = (s, ori) => {
     let setting = fromJS(s).toJS()
     let maxScript = 0
+
+    setting.show = ori.show || 'true'
+    setting.advanceType = ori.advanceType || 'modal'
+    setting.advanceWidth = ori.advanceWidth || 1000
+    setting.drawerPlacement = ori.drawerPlacement || 'right'
+    setting.searchRatio = ori.searchRatio || 6
+    setting.searchLwidth = ori.searchLwidth !== undefined ? ori.searchLwidth : 33.3
 
     if (window.GLOB.funcs && window.GLOB.funcs.length > 0) {
       window.GLOB.funcs.forEach(m => {
@@ -167,29 +174,27 @@
 
   render() {
     const { config } = this.props
-    const { dict, visible, search, menu, record } = this.state
+    const { visible, search, menu, record } = this.state
 
     return (
-      <div className="model-menu-setting">
-        <SettingOutlined onClick={this.changeSetting} />
+      <>
+        <SettingOutlined style={{position: 'absolute', fontSize: '18px', right: '7px', top: '5px', padding: '10px', zIndex: 1}} onClick={this.changeSetting} />
         {/* 璁剧疆鍏ㄥ眬閰嶇疆鍙婂垪琛ㄦ暟鎹簮 */}
         <Modal
-          wrapClassName="model-table-setting-verify-modal"
-          title={dict['model.edit']}
+          wrapClassName="mk-pop-modal"
           visible={visible}
-          width={900}
+          width={'75vw'}
           maskClosable={false}
-          onCancel={() => { this.setState({ visible: false, loading: false })}}
+          onCancel={() => { MKEmitter.emit('modalStatus', false); this.setState({ visible: false, loading: false })}}
           footer={[
-            record && record.interType === 'system' ? <CreateInterface key="interface" loading={this.state.interloading} dict={dict} ref="tableCreatInterface" trigger={this.tableCreatInterface}/> : null,
-            record && record.interType === 'inner' ? <CreateFunc key="create" dict={dict} ref="funcCreatComponent" trigger={this.tableCreatFunc}/> : null,
-            <Button key="cancel" onClick={() => { this.setState({ visible: false, loading: false }) }}>{this.state.dict['model.cancel']}</Button>,
-            <Button key="confirm" type="primary" loading={this.state.loading} onClick={this.settingSave}>{this.state.dict['model.confirm']}</Button>
+            record && record.interType === 'system' ? <CreateInterface key="interface" loading={this.state.interloading} ref="tableCreatInterface" trigger={this.tableCreatInterface}/> : null,
+            record && record.interType === 'inner' ? <CreateFunc key="create" ref="funcCreatComponent" trigger={this.tableCreatFunc}/> : null,
+            <Button key="cancel" onClick={() => { MKEmitter.emit('modalStatus', false); this.setState({ visible: false, loading: false }) }}>鍙栨秷</Button>,
+            <Button key="confirm" type="primary" loading={this.state.loading} onClick={this.settingSave}>纭畾</Button>
           ]}
           destroyOnClose
         >
           <SettingForm
-            dict={dict}
             menu={menu}
             config={config}
             search={search}
@@ -197,7 +202,7 @@
             wrappedComponentRef={(inst) => this.settingRef = inst}
           />
         </Modal>
-      </div>
+      </>
     )
   }
 }

--
Gitblit v1.8.0