From 137fb8ea6af2789b3238b22bac31d80bced41dfe Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 28 七月 2021 11:39:39 +0800
Subject: [PATCH] 2021-07-28

---
 src/menu/modalconfig/index.jsx |   51 +++++++++++++++++++--------------------------------
 1 files changed, 19 insertions(+), 32 deletions(-)

diff --git a/src/menu/modalconfig/index.jsx b/src/menu/modalconfig/index.jsx
index 6f3cd48..cf6bab2 100644
--- a/src/menu/modalconfig/index.jsx
+++ b/src/menu/modalconfig/index.jsx
@@ -12,7 +12,6 @@
 import enUS from '@/locales/en-US/model.js'
 import { getModalForm } from '@/templates/zshare/formconfig'
 
-import ModalForm from '@/templates/zshare/modalform'
 import SourceElement from '@/templates/modalconfig/dragelement/source'
 import SettingForm from '@/templates/modalconfig/settingform'
 import asyncComponent from '@/utils/asyncComponent'
@@ -22,6 +21,7 @@
 const { Panel } = Collapse
 const { confirm } = Modal
 const CommonDict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
+const ModalForm = asyncComponent(() => import('@/templates/zshare/modalform'))
 const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent'))
 const DragElement = asyncComponent(() => import('@/templates/modalconfig/dragelement'))
 const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent'))
@@ -37,20 +37,11 @@
     dict: CommonDict,      // 瀛楀吀
     config: null,          // 椤甸潰閰嶇疆锛屽寘鎷ā鏉跨被鍨嬨�佹ā鎬佹璁剧疆銆佹坊鍔犺〃鍚嶃�佽〃鍗曞垪琛�
     visible: false,        // 琛ㄥ崟缂栬緫妯℃�佹锛屾樉绀烘帶鍒�
-    tableVisible: false,   // 鏁版嵁琛ㄥ瓧娈靛垪琛ㄦā鎬佹锛屾樉绀烘帶鍒�
-    tableColumns: [],      // 琛ㄦ牸瀛楁鍚嶅垪琛�
-    fields: null,          // 琛ㄥ崟锛屽彲閫夊瓧娈碉紙鍘婚噸鍚庯級
     formlist: null,        // 琛ㄥ崟缂栬緫妯℃�佹锛屽彲缂栬緫瀛楁
     card: null,            // 缂栬緫鍏冪礌
-    closeloading: false,   // 鑿滃崟淇濆瓨涓�
     settingVisible: false, // 鍏ㄥ眬閰嶇疆妯℃�佹
-    closeVisible: false,   // 鍏抽棴妯℃�佹
-    tables: [],            // 鍙敤琛ㄥ悕
-    selectedTables: [],    // 宸查�夎〃鍚�
     originConfig: null,    // 鍘熷鑿滃崟
-    sources: null,         // 琛ㄥ崟绫诲瀷
     sqlVerifing: false,    // sql楠岃瘉
-    openEdition: '',       // 缂栬緫鐗堟湰鏍囪锛岄槻姝㈠浜烘搷浣�
     showField: false,      // 鏄剧ず琛ㄥ崟瀛楁鍊�
     standardform: null
   }
@@ -132,7 +123,7 @@
       if (card.uuid === item.uuid) {
         index = i
       }
-      if (item.type !== 'select' && item.type !== 'link' && item.type !== 'radio') return
+      if (!['select', 'link', 'radio', 'checkcard'].includes(item.type)) return
       if (item.field && !uniq.has(item.field)) {
         uniq.set(item.field, true)
 
@@ -227,7 +218,7 @@
 
       _config.fields = _config.fields.filter(item => !item.origin)
 
-      if ((res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && res.resourceType === '1' && /\s/.test(res.dataSource)) {
+      if (['select', 'multiselect', 'link', 'checkbox', 'radio', 'checkcard'].includes(res.type) && res.resourceType === '1' && /\s/.test(res.dataSource)) {
         this.setState({
           sqlVerifing: true
         })
@@ -297,15 +288,26 @@
   submitConfig = () => {
     const { config } = this.state
 
+    this.setState({originConfig: fromJS(config).toJS()})
     this.props.handleSave(config)
+    notification.success({
+      top: 92,
+      message: '淇濆瓨鎴愬姛銆�',
+      duration: 2
+    })
   }
 
   cancelConfig = () => {
     const { config, originConfig } = this.state
 
     if (!is(fromJS(config), fromJS(originConfig))) {
-      this.setState({
-        closeVisible: true
+      let _this = this
+      confirm({
+        content: '閰嶇疆淇℃伅鏈繚瀛橈紝纭畾杩斿洖鍚楋紵',
+        onOk() {
+          _this.props.handleBack()
+        },
+        onCancel() {}
       })
     } else {
       this.props.handleBack()
@@ -423,8 +425,8 @@
             <Card title={dict['header.menu.form.configurable']} bordered={false} extra={
               <div>
                 <EditComponent dict={dict} options={['form']} config={this.state.config} refresh={(res) => this.updateConfig(res.config)}/>
-                <Button type="primary" onClick={this.submitConfig}>{dict['model.confirm']}</Button>
-                <Button onClick={this.cancelConfig}>{dict['model.cancel']}</Button>
+                <Button type="primary" onClick={this.submitConfig}>淇濆瓨</Button>
+                <Button onClick={this.cancelConfig}>杩斿洖</Button>
               </div>
             } style={{ width: '100%' }}>
               <Icon type="setting" onClick={this.changeSetting} />
@@ -486,7 +488,7 @@
         <Modal
           title={this.state.dict['model.edit']}
           visible={this.state.settingVisible}
-          width={700}
+          width={850}
           maskClosable={false}
           onOk={this.settingSave}
           onCancel={() => { this.setState({ settingVisible: false }) }}
@@ -499,21 +501,6 @@
             inputSubmit={this.settingSave}
             wrappedComponentRef={(inst) => this.settingRef = inst}
           />
-        </Modal>
-        <Modal
-          bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}}
-          closable={false}
-          maskClosable={false}
-          visible={this.state.closeVisible}
-          onCancel={() => { this.setState({closeVisible: false}) }}
-          footer={[
-            <Button key="save" className="mk-btn mk-green" loading={this.state.closeloading} onClick={this.submitConfig}>{this.state.dict['model.save']}</Button>,
-            <Button key="confirm" className="mk-btn mk-yellow" onClick={this.props.handleBack}>{this.state.dict['model.notsave']}</Button>,
-            <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{this.state.dict['model.cancel']}</Button>
-          ]}
-          destroyOnClose
-        >
-          {this.state.dict['header.menu.config.placeholder']}
         </Modal>
       </div>
     )

--
Gitblit v1.8.0