From bc4ee6130db80f8f2020bb3bb7248b6e55ae90cc Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 20 三月 2020 17:47:01 +0800
Subject: [PATCH] 2020-03-20

---
 src/templates/formtabconfig/index.jsx |  157 +++++++++++++++++++++++++++-------------------------
 1 files changed, 81 insertions(+), 76 deletions(-)

diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx
index 42bf32c..cf0047c 100644
--- a/src/templates/formtabconfig/index.jsx
+++ b/src/templates/formtabconfig/index.jsx
@@ -260,6 +260,12 @@
             }
           })
         })
+      } else {
+        notification.warning({
+          top: 92,
+          message: res.message,
+          duration: 10
+        })
       }
     })
   }
@@ -271,6 +277,46 @@
     this.setState = () => {
       return
     }
+  }
+  
+  /**
+   * @description 鍔犺浇鎴栧埛鏂版爣绛句俊鎭�
+   */
+  reloadTab = () => {
+    this.setState({
+      loading: true,
+      tabviews: []
+    })
+    Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => {
+      if (res.status) {
+        this.setState({
+          loading: false,
+          tabviews: res.UserTemp.map(temp => {
+            return {
+              uuid: temp.MenuID,
+              value: temp.MenuID,
+              text: temp.MenuName,
+              type: temp.Template,
+              MenuNo: temp.MenuNo
+            }
+          })
+        })
+        notification.success({
+          top: 92,
+          message: '鍒锋柊鎴愬姛銆�',
+          duration: 2
+        })
+      } else {
+        this.setState({
+          loading: false
+        })
+        notification.warning({
+          top: 92,
+          message: res.message,
+          duration: 10
+        })
+      }
+    })
   }
 
   // 椤甸潰杩斿洖
@@ -755,86 +801,40 @@
         return
       }
 
-      new Promise(resolve => {
-        // 寮圭獥锛堣〃鍗曪級绫绘寜閽紝鍏堣幏鍙栨寜閽厤缃俊鎭紝濡傛灉灏氭湭閰嶇疆鎸夐挳鍒欎細鎶ラ敊骞剁粓姝€��
-        // 鑾峰彇淇℃伅鍚庣敓鎴愬垹闄ゅ拰鍒涘缓瀛樺偍杩囩▼鐨勮鍙�
-        if (btn.OpenType === 'pop') {
-          Api.getSystemConfig({
-            func: 'sPC_Get_LongParam',
-            MenuID: btn.uuid
-          }).then(res => {
-            let _LongParam = ''
-            if (res.status && res.LongParam) {
-              try {
-                _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam)))
-              } catch (e) {
-                console.warn('Parse Failure')
-                _LongParam = ''
-              }
-            }
+      let fields = []
+      _config.groups.forEach(group => {
+        fields = [...fields, ...group.sublist]
+      })
 
-            if (_LongParam) {
-              let fields = []
-              if (_LongParam.groups.length > 0) {
-                _LongParam.groups.forEach(group => {
-                  fields = [...fields, ...group.sublist]
-                })
-              } else {
-                fields = _LongParam.fields
-              }
+      let _param = {
+        funcName: btn.innerFunc,
+        name: _config.setting.tableName || '',
+        fields: fields,
+        menuNo: menu.MenuNo
+      }
 
-              let _param = {
-                funcName: btn.innerFunc,
-                name: _config.setting.tableName || '',
-                fields: fields,
-                menuNo: menu.MenuNo
-              }
-              newLText = Utils.formatOptions(Utils.getfunc(_param, btn, menu, _config))
-              DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName))
-              resolve(true)
-            } else {
-              notification.warning({
-                top: 92,
-                message: '寮圭獥锛堣〃鍗曪級鎸夐挳锛岃鍏堥厤缃〃鍗曚俊鎭紒',
-                duration: 10
-              })
-              resolve(false)
-            }
-          })
-        } else {
-          let _param = {
-            funcName: btn.innerFunc,
-            name: _config.setting.tableName || '',
-            fields: '',
-            menuNo: menu.MenuNo
+      newLText = Utils.formatOptions(Utils.getfunc(_param, btn, menu, _config))
+      DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName))
+
+      this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText).then(result => {
+        if (result !== 'success') return
+
+        let isupdate = false
+        _config.action = _config.action.map(item => {
+          if (item.uuid === btn.uuid) {
+            isupdate = true
+            return btn
+          } else {
+            return item
           }
-          newLText = Utils.formatOptions(Utils.getfunc(_param, btn, menu, _config))
-          DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName))
-          resolve(true)
+        })
+
+        if (!isupdate) { // 鎿嶄綔涓嶆槸淇敼锛屾坊鍔犲厓绱犺嚦鍒楄〃
+          _config.action.push(btn)
         }
-      }).then(res => {
-        if (!res) return
 
-        this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText).then(result => {
-          if (result !== 'success') return
-
-          let isupdate = false
-          _config.action = _config.action.map(item => {
-            if (item.uuid === btn.uuid) {
-              isupdate = true
-              return btn
-            } else {
-              return item
-            }
-          })
-
-          if (!isupdate) { // 鎿嶄綔涓嶆槸淇敼锛屾坊鍔犲厓绱犺嚦鍒楄〃
-            _config.action.push(btn)
-          }
-
-          this.setState({
-            config: _config
-          })
+        this.setState({
+          config: _config
         })
       })
     })
@@ -1965,7 +1965,12 @@
             </Collapse>
           </div>
           <div className="setting">
-            <Card title={this.state.dict['header.menu.page.configurable']} bordered={false} extra={
+            <Card title={
+              <div>
+                {this.state.dict['header.menu.page.configurable']} 
+                <Icon type="redo" style={{marginLeft: '10px'}} title="鍒锋柊鏍囩鍒楄〃" onClick={this.reloadTab} />
+              </div>
+            } bordered={false} extra={
               <div>
                 <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} />
                 <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button>

--
Gitblit v1.8.0