From 79943222ed0edc6bd35ab2858c5eda2bc3246f66 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 28 二月 2022 15:03:45 +0800
Subject: [PATCH] 2022-02-28

---
 src/tabviews/custom/components/chart/antv-scatter/index.jsx       |    4 
 src/tabviews/custom/components/chart/antv-bar-line/index.jsx      |    4 
 src/tabviews/custom/components/code/sand-box/index.jsx            |    4 
 src/tabviews/custom/components/chart/antv-dashboard/index.jsx     |    4 
 src/tabviews/custom/components/editor/braft-editor/index.jsx      |    4 
 src/tabviews/custom/components/tree/antd-tree/index.jsx           |    4 
 src/tabviews/custom/components/card/cardItem/index.jsx            |   22 +
 src/tabviews/custom/components/carousel/data-card/index.jsx       |    4 
 src/tabviews/custom/components/table/edit-table/index.jsx         |    6 
 src/api/index.js                                                  |   11 
 src/tabviews/custom/components/chart/custom-chart/index.jsx       |    4 
 src/tabviews/custom/components/card/data-card/index.jsx           |    4 
 src/index.js                                                      |    2 
 src/tabviews/custom/components/form/tab-form/index.jsx            |    4 
 src/menu/replaceField/settingform/index.jsx                       |  148 +++++++++
 src/tabviews/custom/components/card/table-card/index.jsx          |    4 
 src/tabviews/custom/components/card/prop-card/index.jsx           |    4 
 src/tabviews/custom/components/share/tabtransfer/index.jsx        |    3 
 src/tabviews/custom/components/table/normal-table/index.jsx       |    6 
 src/menu/replaceField/index.jsx                                   |  609 +++++++++++++++++++++++++--------------
 src/tabviews/custom/components/chart/antv-pie/index.jsx           |    4 
 src/tabviews/custom/components/timeline/normal-timeline/index.jsx |    4 
 src/tabviews/custom/components/form/normal-form/index.jsx         |    4 
 src/tabviews/custom/components/carousel/prop-card/index.jsx       |    4 
 src/tabviews/custom/index.jsx                                     |    4 
 src/tabviews/custom/components/card/balcony/index.jsx             |    4 
 src/menu/components/card/cardcomponent/options.jsx                |   13 
 27 files changed, 637 insertions(+), 255 deletions(-)

diff --git a/src/api/index.js b/src/api/index.js
index 01fda72..c47a9cc 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -153,7 +153,8 @@
       func: 's_visitor_login',
       timestamp: moment().format('YYYY-MM-DD HH:mm:ss'), 
       SessionUid: _SessionUid,
-      TypeCharOne: 'pc'
+      TypeCharOne: 'pc',
+      kei_id: window.btoa(window.encodeURIComponent(window.GLOB.host))
     }
     
     param.LText = md5(window.btoa(_SessionUid + param.timestamp))
@@ -195,7 +196,9 @@
       way_no: 'sms_vcode',
       systemType: options.sysType,
       login_city: city,
-      login_id_address: ipAddress
+      login_id_address: ipAddress,
+      kei_id: window.btoa(window.encodeURIComponent(window.GLOB.host)),
+      device_id: localStorage.getItem('SessionUid')
     }
 
     param.appkey = window.GLOB.appkey || ''
@@ -232,7 +235,9 @@
       systemType: options.sysType,
       Type: 'S',
       login_city: city,
-      login_id_address: ipAddress
+      login_id_address: ipAddress,
+      kei_id: window.btoa(window.encodeURIComponent(window.GLOB.host)),
+      device_id: localStorage.getItem('SessionUid')
     }
 
     param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
diff --git a/src/index.js b/src/index.js
index 93ec3e1..c325b21 100644
--- a/src/index.js
+++ b/src/index.js
@@ -190,10 +190,12 @@
         GLOB.linkurl = GLOB.linkurl + 'index.html'
       }
       GLOB.service = _service ? _service + '/' : ''
+      GLOB.host = window.location.host + (_service ? '_' + _service : '')
     } else {
       GLOB.linkurl = ''
       GLOB.location = config.host
       GLOB.service = config.service
+      GLOB.host = config.host.replace(/http(s)?:\/\//ig, '') + (config.service ? '_' + config.service.replace(/\//ig, '') : '')
     }
 
     let mark = sessionStorage.getItem('system_mark')
diff --git a/src/menu/components/card/cardcomponent/options.jsx b/src/menu/components/card/cardcomponent/options.jsx
index b4bdd99..0be70fa 100644
--- a/src/menu/components/card/cardcomponent/options.jsx
+++ b/src/menu/components/card/cardcomponent/options.jsx
@@ -116,6 +116,7 @@
         {field: 'open', values: ['menu', 'link', 'menus']},
         {field: 'joint', values: ['menu', 'link', 'menus']},
         {field: 'linkbtn', values: ['button']},
+        {field: 'clickType', values: ['button']},
         {field: 'menuType', values: ['menus']},
         {field: 'menus', values: ['menus']},
       ]
@@ -178,6 +179,18 @@
     },
     {
       type: 'radio',
+      field: 'clickType',
+      label: '瑙﹀彂鏂瑰紡',
+      initval: setting.clickType || 'normal',
+      required: false,
+      options: [
+        {value: 'normal', label: '鍗曞嚮'},
+        {value: 'multi', label: '鍙屽嚮'},
+      ],
+      forbid: appType === 'mob'
+    },
+    {
+      type: 'radio',
       field: 'btnControl',
       label: '鎸夐挳鎺у埗',
       initval: setting.btnControl || 'show',
diff --git a/src/menu/replaceField/index.jsx b/src/menu/replaceField/index.jsx
index 74e0380..22ee091 100644
--- a/src/menu/replaceField/index.jsx
+++ b/src/menu/replaceField/index.jsx
@@ -9,6 +9,7 @@
 import Utils from '@/utils/utils.js'
 import SettingForm from './settingform'
 import { queryTableSql } from '@/utils/option.js'
+import MKEmitter from '@/utils/events.js'
 import './index.scss'
 
 class ReplaceField extends Component {
@@ -84,135 +85,127 @@
   }
 
   submit = () => {
-    let config = fromJS(this.props.config).toJS()
-
     this.settingRef.handleConfirm().then(res => {
       this.setState({confirming: true})
 
-      let param = {func: 'sPC_Get_FieldName', TBName: res.table}
-      if (options.cloudServiceApi) { // 涓斿瓨鍦ㄤ簯绔湴鍧�
-        param.rduri = options.cloudServiceApi
-        param.userid = sessionStorage.getItem('CloudUserID') || ''
-        param.LoginUID = sessionStorage.getItem('CloudLoginUID') || ''
-      }
-
-      Api.getSystemCacheConfig(param).then(result => {
-        if (!result.status) {
-          this.setState({
-            confirming: false
-          })
-          notification.warning({
-            top: 92,
-            message: result.message,
-            duration: 5
-          })
-          return
+      if (res.resource === 'custom') {
+        if (res.reType === 'name') {
+          let map = {[res.label]: {
+            FieldDec: res.label,
+            FieldName: res.field,
+            datatype: ''
+          }}
+  
+          this.exec(map)
+        } else {
+          let map = {[res.field]: {
+            FieldDec: res.label,
+            FieldName: res.field,
+            datatype: ''
+          }}
+  
+          this.execLabel(map)
         }
-
-        let map = {}
-
-        result.FDName.forEach(item => {
-          if (/NVARCHAR|INT|Decimal/ig.test(item.FieldType)) {
-            item.datatype = item.FieldType
+      } else {
+        let param = {func: 'sPC_Get_FieldName', TBName: res.table}
+        if (options.cloudServiceApi) { // 涓斿瓨鍦ㄤ簯绔湴鍧�
+          param.rduri = options.cloudServiceApi
+          param.userid = sessionStorage.getItem('CloudUserID') || ''
+          param.LoginUID = sessionStorage.getItem('CloudLoginUID') || ''
+        }
+  
+        Api.getSystemCacheConfig(param).then(result => {
+          if (!result.status) {
+            this.setState({
+              confirming: false
+            })
+            notification.warning({
+              top: 92,
+              message: result.message,
+              duration: 5
+            })
+            return
           }
-          map[item.FieldDec] = item
+  
+          if (res.reType === 'name') {
+            let map = {}
+  
+            result.FDName.forEach(item => {
+              if (/NVARCHAR|INT|Decimal/ig.test(item.FieldType)) {
+                item.datatype = item.FieldType
+              }
+              map[item.FieldDec] = item
+            })
+
+            this.exec(map)
+          } else {
+            let map = {}
+  
+            result.FDName.forEach(item => {
+              map[item.FieldName] = item
+            })
+
+            this.execLabel(map)
+          }
         })
+      }
+    })
+  }
 
-        if (this.props.type === 'custom') {
-          let _replace = (components) => {
-            return components.map(item => {
-              if (item.type === 'tabs') {
-                item.subtabs.forEach(tab => {
-                  tab.components = _replace(tab.components)
-                })
-                return item
-              } else if (item.type === 'group') {
-                item.components = _replace(item.components)
-                return item
+  exec = (map) => {
+    let config = fromJS(this.props.config).toJS()
+
+    if (this.props.type === 'custom') {
+      let _replace = (components) => {
+        return components.map(item => {
+          if (item.type === 'tabs') {
+            item.subtabs.forEach(tab => {
+              tab.components = _replace(tab.components)
+            })
+            return item
+          } else if (item.type === 'group') {
+            item.components = _replace(item.components)
+            return item
+          }
+          
+          if (item.columns) {
+            item.columns = item.columns.map(col => {
+              let cell = map[col.field]
+              if (cell) {
+                col.field = cell.FieldName
+                if (cell.datatype) {
+                  col.datatype = cell.datatype
+                }
               }
-              
-              if (item.columns) {
-                item.columns = item.columns.map(col => {
-                  if (map[col.field]) {
-                    col.field = map[col.field].FieldName
-                    if (map[col.field].datatype) {
-                      col.datatype = map[col.field].datatype
-                    }
-                  }
-                  return col
-                })
+              return col
+            })
+          }
+          if (item.search) {
+            item.search = item.search.map(col => {
+              if (map[col.field]) {
+                col.field = map[col.field].FieldName
               }
-              if (item.search) {
-                item.search = item.search.map(col => {
+              return col
+            })
+          }
+
+          if (item.action) {
+            item.action.forEach(m => {
+              if (m.modal && m.modal.fields) {
+                m.modal.fields = m.modal.fields.map(col => {
                   if (map[col.field]) {
                     col.field = map[col.field].FieldName
                   }
                   return col
                 })
               }
-  
-              if (item.action) {
-                item.action.forEach(m => {
-                  if (m.modal && m.modal.fields) {
-                    m.modal.fields = m.modal.fields.map(col => {
-                      if (map[col.field]) {
-                        col.field = map[col.field].FieldName
-                      }
-                      return col
-                    })
-                  }
-                })
-              }
-  
-              if (item.subcards) {
-                item.subcards.forEach(card => {
-                  if (card.elements) { // 鍗$墖
-                    card.elements = card.elements.map(m => {
-                      if (m.datatype === 'dynamic' && map[m.field]) {
-                        m.field = map[m.field].FieldName
-                      }
-                      if (m.modal && m.modal.fields) {
-                        m.modal.fields = m.modal.fields.map(col => {
-                          if (map[col.field]) {
-                            col.field = map[col.field].FieldName
-                          }
-                          return col
-                        })
-                      }
-                      return m
-                    })
-                  }
-  
-                  if (card.backElements) { // 鍗$墖
-                    card.backElements = card.backElements.map(m => {
-                      if (m.datatype === 'dynamic' && map[m.field]) {
-                        m.field = map[m.field].FieldName
-                      }
-                      if (m.modal && m.modal.fields) {
-                        m.modal.fields = m.modal.fields.map(col => {
-                          if (map[col.field]) {
-                            col.field = map[col.field].FieldName
-                          }
-                          return col
-                        })
-                      }
-                      return m
-                    })
-                  }
+            })
+          }
 
-                  if (card.fields) { // 琛ㄥ崟
-                    card.fields = card.fields.map(m => {
-                      if (map[m.field]) {
-                        m.field = map[m.field].FieldName
-                      }
-                      return m
-                    })
-                  }
-                })
-              }
-  
-              if (item.elements) {
-                item.elements = item.elements.map(m => {
+          if (item.subcards) {
+            item.subcards.forEach(card => {
+              if (card.elements) { // 鍗$墖
+                card.elements = card.elements.map(m => {
                   if (m.datatype === 'dynamic' && map[m.field]) {
                     m.field = map[m.field].FieldName
                   }
@@ -227,131 +220,299 @@
                   return m
                 })
               }
-  
-              if (item.plot) {
-                if (item.plot.Xaxis && map[item.plot.Xaxis]) {
-                  item.plot.Xaxis = map[item.plot.Xaxis].FieldName
-                }
-                // 缁熻鍥�
-                if (item.plot.InfoValue && map[item.plot.InfoValue]) {
-                  item.plot.InfoValue = map[item.plot.InfoValue].FieldName
-                }
-                if (item.plot.InfoType && map[item.plot.InfoType]) {
-                  item.plot.InfoType = map[item.plot.InfoType].FieldName
-                }
-                // 鍗犳瘮鍥�
-                if (item.plot.valueField && map[item.plot.valueField]) {
-                  item.plot.valueField = map[item.plot.valueField].FieldName
-                }
-                if (item.plot.labelField && map[item.plot.labelField]) {
-                  item.plot.labelField = map[item.plot.labelField].FieldName
-                }
-                // 楗煎浘
-                if (item.plot.type && map[item.plot.type]) {
-                  item.plot.type = map[item.plot.type].FieldName
-                }
-                // 鏁g偣鍥�
-                if (item.plot.gender && map[item.plot.gender]) {
-                  item.plot.gender = map[item.plot.gender].FieldName
-                }
-                if (item.Yaxis) {
-                  if (Array.isArray(item.Yaxis)) {
-                    item.Yaxis = item.Yaxis.map(m => {
-                      if (map[m]) {
-                        return map[m].FieldName
-                      }
-                      return m
-                    })
-                  } else {
-                    if (map[item.Yaxis]) {
-                      item.Yaxis = map[item.Yaxis].FieldName
-                    }
+
+              if (card.backElements) { // 鍗$墖
+                card.backElements = card.backElements.map(m => {
+                  if (m.datatype === 'dynamic' && map[m.field]) {
+                    m.field = map[m.field].FieldName
                   }
-                }
-              }
-  
-              if (item.cols) {
-                let _update = (cols) => {
-                  return cols.map(col => {
-                    if (col.type === 'action' && col.elements) {
-                      col.elements = col.elements.map(m => {
-                        if (m.modal && m.modal.fields) {
-                          m.modal.fields = m.modal.fields.map(col => {
-                            if (map[col.field]) {
-                              col.field = map[col.field].FieldName
-                            }
-                            return col
-                          })
-                        }
-    
-                        return m
-                      })
-                    } else if (col.type === 'custom' && col.elements) {
-                      col.elements = col.elements.map(m => {
-                        if (m.datatype === 'dynamic' && map[m.field]) {
-                          m.field = map[m.field].FieldName
-                        }
-    
-                        return m
-                      })
-                    } else if (col.type === 'colspan') {
-                      col.subcols = _update(col.subcols)
-                    } else if (col.field) {
+                  if (m.modal && m.modal.fields) {
+                    m.modal.fields = m.modal.fields.map(col => {
                       if (map[col.field]) {
                         col.field = map[col.field].FieldName
                       }
-                    }
-                    
-                    return col
-                  })
-                }
-    
-                item.cols = _update(item.cols)
+                      return col
+                    })
+                  }
+                  return m
+                })
               }
-  
-              return item
+
+              if (card.fields) { // 琛ㄥ崟
+                card.fields = card.fields.map(m => {
+                  if (map[m.field]) {
+                    m.field = map[m.field].FieldName
+                  }
+                  return m
+                })
+              }
             })
           }
-      
-          config.components = _replace(config.components)
-        } else if (this.props.type === 'table') {
-          config.columns = config.columns.map(col => {
-            if (col.field && map[col.field]) {
-              col.field = map[col.field].FieldName
+
+          if (item.elements) {
+            item.elements = item.elements.map(m => {
+              if (m.datatype === 'dynamic' && map[m.field]) {
+                m.field = map[m.field].FieldName
+              }
+              if (m.modal && m.modal.fields) {
+                m.modal.fields = m.modal.fields.map(col => {
+                  if (map[col.field]) {
+                    col.field = map[col.field].FieldName
+                  }
+                  return col
+                })
+              }
+              return m
+            })
+          }
+
+          if (item.plot) {
+            if (item.plot.Xaxis && map[item.plot.Xaxis]) {
+              item.plot.Xaxis = map[item.plot.Xaxis].FieldName
             }
-            return col
-          })
-          config.search = config.search.map(col => {
-            if (col.field && map[col.field]) {
-              col.field = map[col.field].FieldName
+            // 缁熻鍥�
+            if (item.plot.InfoValue && map[item.plot.InfoValue]) {
+              item.plot.InfoValue = map[item.plot.InfoValue].FieldName
             }
-            if (col.datefield && map[col.datefield]) {
-              col.datefield = map[col.datefield].FieldName
+            if (item.plot.InfoType && map[item.plot.InfoType]) {
+              item.plot.InfoType = map[item.plot.InfoType].FieldName
             }
-            return col
-          })
-        } else if (this.props.type === 'form') {
-          config.fields = config.fields.map(col => {
-            if (col.field && map[col.field]) {
-              col.field = map[col.field].FieldName
+            // 鍗犳瘮鍥�
+            if (item.plot.valueField && map[item.plot.valueField]) {
+              item.plot.valueField = map[item.plot.valueField].FieldName
             }
-            return col
-          })
+            if (item.plot.labelField && map[item.plot.labelField]) {
+              item.plot.labelField = map[item.plot.labelField].FieldName
+            }
+            // 楗煎浘
+            if (item.plot.type && map[item.plot.type]) {
+              item.plot.type = map[item.plot.type].FieldName
+            }
+            // 鏁g偣鍥�
+            if (item.plot.gender && map[item.plot.gender]) {
+              item.plot.gender = map[item.plot.gender].FieldName
+            }
+            if (item.Yaxis) {
+              if (Array.isArray(item.Yaxis)) {
+                item.Yaxis = item.Yaxis.map(m => {
+                  if (map[m]) {
+                    return map[m].FieldName
+                  }
+                  return m
+                })
+              } else {
+                if (map[item.Yaxis]) {
+                  item.Yaxis = map[item.Yaxis].FieldName
+                }
+              }
+            }
+          }
+
+          if (item.cols) {
+            let _update = (cols) => {
+              return cols.map(col => {
+                if (col.type === 'action' && col.elements) {
+                  col.elements = col.elements.map(m => {
+                    if (m.modal && m.modal.fields) {
+                      m.modal.fields = m.modal.fields.map(col => {
+                        if (map[col.field]) {
+                          col.field = map[col.field].FieldName
+                        }
+                        return col
+                      })
+                    }
+
+                    return m
+                  })
+                } else if (col.type === 'custom' && col.elements) {
+                  col.elements = col.elements.map(m => {
+                    if (m.datatype === 'dynamic' && map[m.field]) {
+                      m.field = map[m.field].FieldName
+                    }
+
+                    return m
+                  })
+                } else if (col.type === 'colspan') {
+                  col.subcols = _update(col.subcols)
+                } else if (col.field) {
+                  if (map[col.field]) {
+                    col.field = map[col.field].FieldName
+                  }
+                }
+                
+                return col
+              })
+            }
+
+            item.cols = _update(item.cols)
+          }
+
+          return item
+        })
+      }
+  
+      config.components = _replace(config.components)
+    } else if (this.props.type === 'table') {
+      config.columns = config.columns.map(col => {
+        if (col.field && map[col.field]) {
+          col.field = map[col.field].FieldName
         }
-
-        this.setState({
-          confirming: false,
-          visible: false
-        })
-
-        notification.success({
-          top: 92,
-          message: '鏇存柊宸插畬鎴愩��',
-          duration: 3
-        })
-        this.props.updateConfig(config)
+        return col
       })
+      config.search = config.search.map(col => {
+        if (col.field && map[col.field]) {
+          col.field = map[col.field].FieldName
+        }
+        if (col.datefield && map[col.datefield]) {
+          col.datefield = map[col.datefield].FieldName
+        }
+        return col
+      })
+    } else if (this.props.type === 'form') {
+      config.fields = config.fields.map(col => {
+        if (col.field && map[col.field]) {
+          col.field = map[col.field].FieldName
+        }
+        return col
+      })
+    }
+
+    this.setState({
+      confirming: false,
+      visible: false
     })
+
+    notification.success({
+      top: 92,
+      message: '鏇存柊宸插畬鎴愩��',
+      duration: 3
+    })
+    this.props.updateConfig(config)
+
+    setTimeout(() => {
+      MKEmitter.emit('revert')
+    }, 500)
+  }
+
+  execLabel = (map) => {
+    let config = fromJS(this.props.config).toJS()
+
+    if (this.props.type === 'custom') {
+      let _replace = (components) => {
+        return components.map(item => {
+          if (item.type === 'tabs') {
+            item.subtabs.forEach(tab => {
+              tab.components = _replace(tab.components)
+            })
+            return item
+          } else if (item.type === 'group') {
+            item.components = _replace(item.components)
+            return item
+          }
+          
+          if (item.columns) {
+            item.columns = item.columns.map(col => {
+              if (map[col.field]) {
+                col.label = map[col.field].FieldDec
+              }
+              return col
+            })
+          }
+          if (item.search) {
+            item.search = item.search.map(col => {
+              if (map[col.field]) {
+                col.label = map[col.field].FieldDec
+              }
+              return col
+            })
+          }
+
+          if (item.action) {
+            item.action.forEach(m => {
+              if (m.modal && m.modal.fields) {
+                m.modal.fields = m.modal.fields.map(col => {
+                  if (col.field && map[col.field]) {
+                    col.label = map[col.field].FieldDec
+                  }
+                  return col
+                })
+              }
+            })
+          }
+
+          if (item.cols) {
+            let _update = (cols) => {
+              return cols.map(col => {
+                if (col.type === 'action' && col.elements) {
+                  col.elements = col.elements.map(m => {
+                    if (m.modal && m.modal.fields) {
+                      m.modal.fields = m.modal.fields.map(col => {
+                        if (col.field && map[col.field]) {
+                          col.label = map[col.field].FieldDec
+                        }
+                        return col
+                      })
+                    }
+
+                    return m
+                  })
+                } else if (col.type === 'colspan') {
+                  col.subcols = _update(col.subcols)
+                } else if (col.field) {
+                  if (map[col.field]) {
+                    col.label = map[col.field].FieldDec
+                  }
+                }
+                
+                return col
+              })
+            }
+
+            item.cols = _update(item.cols)
+          }
+
+          return item
+        })
+      }
+
+      config.components = _replace(config.components)
+    } else if (this.props.type === 'table') {
+      config.columns = config.columns.map(col => {
+        if (col.field && map[col.field]) {
+          col.label = map[col.field].FieldDec
+        }
+        return col
+      })
+
+      config.search = config.search.map(col => {
+        if (col.field && map[col.field]) {
+          col.label = map[col.field].FieldDec
+        }
+        return col
+      })
+    } else if (this.props.type === 'form') {
+      config.fields = config.fields.map(col => {
+        if (col.field && map[col.field]) {
+          col.label = map[col.field].FieldDec
+        }
+        return col
+      })
+    }
+
+    this.setState({
+      confirming: false,
+      visible: false
+    })
+
+    notification.success({
+      top: 92,
+      message: '鏇存柊宸插畬鎴愩��',
+      duration: 3
+    })
+    this.props.updateConfig(config)
+    setTimeout(() => {
+      MKEmitter.emit('revert')
+    }, 500)
   }
 
   render() {
diff --git a/src/menu/replaceField/settingform/index.jsx b/src/menu/replaceField/settingform/index.jsx
index ed8d59a..ecf9cce 100644
--- a/src/menu/replaceField/settingform/index.jsx
+++ b/src/menu/replaceField/settingform/index.jsx
@@ -1,22 +1,60 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Tooltip, Select } from 'antd'
-import { QuestionCircleOutlined } from '@ant-design/icons'
+import { Form, Row, Col, Tooltip, Select, Radio, AutoComplete, Modal } from 'antd'
+import { QuestionCircleOutlined, SwapRightOutlined, DeleteOutlined } from '@ant-design/icons'
 
 // import './index.scss'
+const { confirm } = Modal
 
 class SettingForm extends Component {
   static propTpyes = {
     tables: PropTypes.object
   }
 
-  state = {}
+  state = {
+    resource: 'custom',
+    reType: 'field',
+    field: '',
+    label: '',
+    fields: [],
+    labels: []
+  }
+
+  UNSAFE_componentWillMount() {
+    let records = localStorage.getItem('replaceRecord')
+
+    if (records) {
+      records = JSON.parse(records)
+
+      let fields = records.fields || []
+      let labels = records.labels || []
+
+      this.setState({fields, labels, field: fields[0] || '', label: labels[0] || ''})
+    }
+
+  }
 
   handleConfirm = () => {
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
     return new Promise((resolve, reject) => {
       this.props.form.validateFieldsAndScroll((err, values) => {
         if (!err) {
+          if (values.resource === 'custom') {
+            let records = localStorage.getItem('replaceRecord')
+
+            if (records) {
+              records = JSON.parse(records)
+            } else {
+              records = {fields: [], labels: []}
+            }
+
+            records.fields.unshift(values.field)
+            records.labels.unshift(values.label)
+            records.fields = Array.from(new Set(records.fields))
+            records.labels = Array.from(new Set(records.labels))
+
+            localStorage.setItem('replaceRecord', JSON.stringify(records))
+          }
           resolve(values)
         } else {
           reject(err)
@@ -25,9 +63,23 @@
     })
   }
 
+  clear = () => {
+    let _this = this
+    confirm({
+      title: '纭畾娓呴櫎鍘嗗彶璁板綍鍚楋紵',
+      content: '',
+      onOk() {
+        localStorage.removeItem('replaceRecord')
+        _this.setState({fields: [], labels: []})
+      },
+      onCancel() {}
+    })
+  }
+
   render() {
     const { tables } = this.props
     const { getFieldDecorator } = this.props.form
+    const { resource, fields, labels, field, label, reType } = this.state
 
     const formItemLayout = {
       labelCol: {
@@ -40,10 +92,43 @@
       }
     }
 
+    let _fields = fields
+    if (field) {
+      _fields = fields.filter(item => item.toLowerCase().indexOf(field.toLowerCase()) > -1)
+    }
+    let _labels = labels
+    if (label) {
+      _labels = labels.filter(item => item.indexOf(label) > -1)
+    }
+
     return (
       <Form {...formItemLayout}>
         <Row gutter={24}>
           <Col span={20}>
+            <Form.Item label="鏇挎崲鏉ユ簮">
+              {getFieldDecorator('resource', {
+                initialValue: 'custom'
+              })(
+                <Radio.Group onChange={(e) => this.setState({resource: e.target.value})}>
+                  <Radio value="dict">鏁版嵁瀛楀吀</Radio>
+                  <Radio value="custom">鑷畾涔�</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col>
+          <Col span={20}>
+            <Form.Item label="鏇挎崲渚濇嵁">
+              {getFieldDecorator('reType', {
+                initialValue: 'field'
+              })(
+                <Radio.Group onChange={(e) => this.setState({reType: e.target.value})}>
+                  <Radio value="field">瀛楁 <SwapRightOutlined /> 鍚嶇О</Radio>
+                  <Radio value="name">鍘熷瓧娈� <SwapRightOutlined /> 鏂板瓧娈�</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col>
+          {resource === 'dict' ? <Col span={20}>
             <Form.Item label={
               <Tooltip placement="topLeft" title="鐢ㄤ簬瀛楁鏇挎崲鐨勮〃鍚嶃��">
                 <QuestionCircleOutlined className="mk-form-tip" />
@@ -69,7 +154,62 @@
                 </Select>
               )}
             </Form.Item>
-          </Col>
+          </Col> : null}
+          {resource === 'custom' && reType === 'field' ? <Col span={20}>
+            <Form.Item label="瀛楁">
+              {getFieldDecorator('field', {
+                initialValue: field,
+                rules: [
+                  {
+                    required: true,
+                    message: '璇疯緭鍏ュ瓧娈�!'
+                  }
+                ]
+              })(<AutoComplete dataSource={_fields} autoFocus onSearch={(val) => this.setState({ field: val})} placeholder="" />)}
+            </Form.Item>
+          </Col> : null}
+          {resource === 'custom' && reType === 'field' ? <Col span={20}>
+            <Form.Item label="鍚嶇О">
+              {getFieldDecorator('label', {
+                initialValue: label,
+                rules: [
+                  {
+                    required: true,
+                    message: '璇疯緭鍏ュ悕绉�!'
+                  }
+                ]
+              })(<AutoComplete dataSource={_labels} onSearch={(val) => this.setState({ label: val})} placeholder="" />)}
+            </Form.Item>
+          </Col> : null}
+          {resource === 'custom' && reType === 'name' ? <Col span={20}>
+            <Form.Item label="鍘熷瓧娈�">
+              {getFieldDecorator('label', {
+                initialValue: label,
+                rules: [
+                  {
+                    required: true,
+                    message: '璇疯緭鍏ュ悕绉�!'
+                  }
+                ]
+              })(<AutoComplete dataSource={_labels} autoFocus onSearch={(val) => this.setState({ label: val})} placeholder="" />)}
+            </Form.Item>
+          </Col> : null}
+          {resource === 'custom' && reType === 'name' ? <Col span={20}>
+            <Form.Item label="鏇挎崲涓�">
+              {getFieldDecorator('field', {
+                initialValue: field,
+                rules: [
+                  {
+                    required: true,
+                    message: '璇疯緭鍏ュ瓧娈�!'
+                  }
+                ]
+              })(<AutoComplete dataSource={_fields} onSearch={(val) => this.setState({ field: val})} placeholder="" />)}
+            </Form.Item>
+          </Col> : null}
+          {resource === 'custom' && fields.length > 0 ? <Col span={24}>
+            <DeleteOutlined onClick={this.clear} style={{float: 'right', fontSize: '18px', marginTop: '-10px', cursor: 'pointer', color: '#ff4d4f'}} title="娓呯┖鍘嗗彶璁板綍" />
+          </Col> : null}
         </Row>
       </Form>
     )
diff --git a/src/tabviews/custom/components/card/balcony/index.jsx b/src/tabviews/custom/components/card/balcony/index.jsx
index 8fa3869..2383819 100644
--- a/src/tabviews/custom/components/card/balcony/index.jsx
+++ b/src/tabviews/custom/components/card/balcony/index.jsx
@@ -96,7 +96,9 @@
       arr_field: _config.columns.map(col => col.field).join(','),
     }, () => {
       if (_config.wrap.datatype !== 'static' && _config.setting && _config.setting.sync !== 'true') {
-        this.loadData()
+        setTimeout(() => {
+          this.loadData()
+        }, _config.setting.delay || 0)
       }
     })
   }
diff --git a/src/tabviews/custom/components/card/cardItem/index.jsx b/src/tabviews/custom/components/card/cardItem/index.jsx
index 3e03eee..a5a6694 100644
--- a/src/tabviews/custom/components/card/cardItem/index.jsx
+++ b/src/tabviews/custom/components/card/cardItem/index.jsx
@@ -44,6 +44,8 @@
   openView = () => {
     const { card, data, cards } = this.props
 
+    if (!card.setting.click) return
+
     if (card.setting.click === 'menus' && cards.subtype === 'datacard' && card.$cardType !== 'extendCard') {
       let menu = null
       
@@ -131,7 +133,23 @@
       }
 
       window.open(src)
-    } else if (card.setting.click === 'button' && card.setting.linkbtn) {
+    } else if (card.setting.click === 'button' && card.setting.clickType !== 'multi' && card.setting.linkbtn) {
+      if (data.$$type === 'extendCard') {
+        MKEmitter.emit('triggerBtnId', card.setting.linkbtn, [])
+      } else if (cards.subtype === 'datacard') {
+        MKEmitter.emit('triggerBtnId', card.setting.linkbtn, [data], 'linkbtn')
+      } else {
+        MKEmitter.emit('triggerBtnId', card.setting.linkbtn, [data])
+      }
+    }
+  }
+
+  doubleClick = () => {
+    const { card, data, cards } = this.props
+
+    if (card.setting.click !== 'button' || card.setting.clickType !== 'multi') return
+
+    if (card.setting.linkbtn) {
       if (data.$$type === 'extendCard') {
         MKEmitter.emit('triggerBtnId', card.setting.linkbtn, [])
       } else if (cards.subtype === 'datacard') {
@@ -146,7 +164,7 @@
     const { card, data, cards } = this.props
 
     return (
-      <div className={'card-item-box ' + (card.setting.btnControl || '')} style={card.style} onClick={this.openView}>
+      <div className={'card-item-box ' + (card.setting.btnControl || '')} style={card.style} onClick={this.openView} onDoubleClick={this.doubleClick}>
         <CardCellComponent data={data} cards={cards} cardCell={card} elements={card.elements}/>
         {card.setting.type === 'multi' ? <div className={'back-side ' + card.setting.transform} style={card.backStyle}>
           <CardCellComponent data={data} cards={cards} cardCell={card} elements={card.backElements}/>
diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx
index ac76430..66a25b5 100644
--- a/src/tabviews/custom/components/card/data-card/index.jsx
+++ b/src/tabviews/custom/components/card/data-card/index.jsx
@@ -186,7 +186,9 @@
       arr_field: _config.columns.map(col => col.field).join(','),
     }, () => {
       if (_config.setting.sync !== 'true' && _config.setting.onload === 'true') {
-        this.loadData()
+        setTimeout(() => {
+          this.loadData()
+        }, _config.setting.delay || 0)
       }
     })
   }
diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx
index 72391ee..200b8db 100644
--- a/src/tabviews/custom/components/card/prop-card/index.jsx
+++ b/src/tabviews/custom/components/card/prop-card/index.jsx
@@ -126,7 +126,9 @@
       arr_field: _config.columns.map(col => col.field).join(','),
     }, () => {
       if (_config.wrap.datatype !== 'static' && _config.setting.sync !== 'true' && _config.setting.onload === 'true') {
-        this.loadData()
+        setTimeout(() => {
+          this.loadData()
+        }, _config.setting.delay || 0)
       } else if ((!_sync || _config.wrap.priKeyType === 'static') && selected !== 'false') {
         setTimeout(() => {
           this.checkTopLine()
diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx
index 13a46b9..ff08851 100644
--- a/src/tabviews/custom/components/card/table-card/index.jsx
+++ b/src/tabviews/custom/components/card/table-card/index.jsx
@@ -101,7 +101,9 @@
       arr_field: _config.columns.map(col => col.field).join(','),
     }, () => {
       if (_config.setting.sync !== 'true' && _config.setting.onload === 'true') {
-        this.loadData()
+        setTimeout(() => {
+          this.loadData()
+        }, _config.setting.delay || 0)
       }
     })
   }
diff --git a/src/tabviews/custom/components/carousel/data-card/index.jsx b/src/tabviews/custom/components/carousel/data-card/index.jsx
index 63607bf..7154c9e 100644
--- a/src/tabviews/custom/components/carousel/data-card/index.jsx
+++ b/src/tabviews/custom/components/carousel/data-card/index.jsx
@@ -88,7 +88,9 @@
       arr_field: _config.columns.map(col => col.field).join(','),
     }, () => {
       if (_config.setting.sync !== 'true' && _config.setting.onload === 'true') {
-        this.loadData()
+        setTimeout(() => {
+          this.loadData()
+        }, _config.setting.delay || 0)
       }
     })
   }
diff --git a/src/tabviews/custom/components/carousel/prop-card/index.jsx b/src/tabviews/custom/components/carousel/prop-card/index.jsx
index 45bcc40..af669f7 100644
--- a/src/tabviews/custom/components/carousel/prop-card/index.jsx
+++ b/src/tabviews/custom/components/carousel/prop-card/index.jsx
@@ -87,7 +87,9 @@
       arr_field: _config.columns.map(col => col.field).join(','),
     }, () => {
       if (_config.wrap.datatype !== 'static' && _config.setting && _config.setting.sync !== 'true' && _config.setting.onload === 'true') {
-        this.loadData()
+        setTimeout(() => {
+          this.loadData()
+        }, _config.setting.delay || 0)
       }
     })
   }
diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx
index b83a695..2680b42 100644
--- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx
@@ -323,7 +323,9 @@
       transfield
     }, () => {
       if (config.setting.sync !== 'true' && config.setting.onload === 'true') {
-        this.loadData()
+        setTimeout(() => {
+          this.loadData()
+        }, _config.setting.delay || 0)
       } else if (config.setting.sync === 'true' && _data) {
         this.handleData()
       }
diff --git a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx
index 63d21b7..280fa16 100644
--- a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx
@@ -108,7 +108,9 @@
       title: config.plot.title
     }, () => {
       if (config.setting.sync !== 'true' && config.setting.onload === 'true') {
-        this.loadData()
+        setTimeout(() => {
+          this.loadData()
+        }, _config.setting.delay || 0)
       } else if (config.setting.sync === 'true') {
         this.handleData()
       }
diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx
index e5aa7e7..75be8ce 100644
--- a/src/tabviews/custom/components/chart/antv-pie/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx
@@ -76,7 +76,9 @@
       search: Utils.initMainSearch(config.search)
     }, () => {
       if (config.setting.sync !== 'true' && config.setting.onload === 'true') {
-        this.loadData()
+        setTimeout(() => {
+          this.loadData()
+        }, _config.setting.delay || 0)
       } else if (config.setting.sync === 'true' && _data) {
         this.handleData()
       }
diff --git a/src/tabviews/custom/components/chart/antv-scatter/index.jsx b/src/tabviews/custom/components/chart/antv-scatter/index.jsx
index 074d4ea..f5a5c3f 100644
--- a/src/tabviews/custom/components/chart/antv-scatter/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-scatter/index.jsx
@@ -66,7 +66,9 @@
       search: Utils.initMainSearch(config.search),
     }, () => {
       if (config.setting.sync !== 'true' && config.setting.onload === 'true') {
-        this.loadData()
+        setTimeout(() => {
+          this.loadData()
+        }, _config.setting.delay || 0)
       } else if (config.setting.sync === 'true' && _data) {
         this.handleData()
       }
diff --git a/src/tabviews/custom/components/chart/custom-chart/index.jsx b/src/tabviews/custom/components/chart/custom-chart/index.jsx
index f7d88bd..f84f163 100644
--- a/src/tabviews/custom/components/chart/custom-chart/index.jsx
+++ b/src/tabviews/custom/components/chart/custom-chart/index.jsx
@@ -61,7 +61,9 @@
       search: Utils.initMainSearch(config.search)
     }, () => {
       if (config.setting.sync !== 'true' && config.setting.onload === 'true') {
-        this.loadData()
+        setTimeout(() => {
+          this.loadData()
+        }, _config.setting.delay || 0)
       } else if (config.setting.sync === 'true' && _data) {
         this.handleData()
       }
diff --git a/src/tabviews/custom/components/code/sand-box/index.jsx b/src/tabviews/custom/components/code/sand-box/index.jsx
index 508932b..e7c6a74 100644
--- a/src/tabviews/custom/components/code/sand-box/index.jsx
+++ b/src/tabviews/custom/components/code/sand-box/index.jsx
@@ -67,7 +67,9 @@
       arr_field: _config.columns.map(col => col.field).join(','),
     }, () => {
       if (_config.wrap.datatype !== 'static' && _config.setting && _config.setting.sync !== 'true' && _config.setting.onload === 'true') {
-        this.loadData()
+        setTimeout(() => {
+          this.loadData()
+        }, _config.setting.delay || 0)
       }
       this.renderView()
     })
diff --git a/src/tabviews/custom/components/editor/braft-editor/index.jsx b/src/tabviews/custom/components/editor/braft-editor/index.jsx
index c2f8d55..54ee6a6 100644
--- a/src/tabviews/custom/components/editor/braft-editor/index.jsx
+++ b/src/tabviews/custom/components/editor/braft-editor/index.jsx
@@ -68,7 +68,9 @@
       arr_field: _config.columns.map(col => col.field).join(','),
     }, () => {
       if (_config.wrap.datatype !== 'static' && _config.setting && _config.setting.sync !== 'true' && _config.setting.onload === 'true') {
-        this.loadData()
+        setTimeout(() => {
+          this.loadData()
+        }, _config.setting.delay || 0)
       }
     })
   }
diff --git a/src/tabviews/custom/components/form/normal-form/index.jsx b/src/tabviews/custom/components/form/normal-form/index.jsx
index 2b856d0..6876ca4 100644
--- a/src/tabviews/custom/components/form/normal-form/index.jsx
+++ b/src/tabviews/custom/components/form/normal-form/index.jsx
@@ -125,7 +125,9 @@
       arr_field: config.columns.map(col => col.field).join(','),
     }, () => {
       if (config.wrap.datatype !== 'static' && config.setting && config.setting.sync !== 'true' && config.setting.onload === 'true') {
-        this.loadData()
+        setTimeout(() => {
+          this.loadData()
+        }, config.setting.delay || 0)
       }
     })
   }
diff --git a/src/tabviews/custom/components/form/tab-form/index.jsx b/src/tabviews/custom/components/form/tab-form/index.jsx
index 00dd179..c2fb8c6 100644
--- a/src/tabviews/custom/components/form/tab-form/index.jsx
+++ b/src/tabviews/custom/components/form/tab-form/index.jsx
@@ -111,7 +111,9 @@
       arr_field: config.columns.map(col => col.field).join(','),
     }, () => {
       if (config.wrap.datatype !== 'static' && config.setting && config.setting.sync !== 'true' && config.setting.onload === 'true') {
-        this.loadData()
+        setTimeout(() => {
+          this.loadData()
+        }, config.setting.delay || 0)
       }
     })
   }
diff --git a/src/tabviews/custom/components/share/tabtransfer/index.jsx b/src/tabviews/custom/components/share/tabtransfer/index.jsx
index ae8f36b..efd711f 100644
--- a/src/tabviews/custom/components/share/tabtransfer/index.jsx
+++ b/src/tabviews/custom/components/share/tabtransfer/index.jsx
@@ -68,6 +68,7 @@
     }
 
     let params = []
+    let delay = 20
     config.components.forEach(item => {
       if (item.type === 'tabs' || item.type === 'group') return
 
@@ -96,6 +97,8 @@
         }
       } else {
         item.setting.sync = 'false'
+        item.setting.delay = delay
+        delay += 20
       }
     })
 
diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx
index b594372..e598288 100644
--- a/src/tabviews/custom/components/table/edit-table/index.jsx
+++ b/src/tabviews/custom/components/table/edit-table/index.jsx
@@ -121,8 +121,10 @@
       search: Utils.initMainSearch(_config.search) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級
     }, () => {
       if (_config.setting.sync !== 'true' && _config.setting.onload === 'true') {
-        this.loadmaindata()
-        this.getStatFieldsValue()
+        setTimeout(() => {
+          this.loadmaindata()
+          this.getStatFieldsValue()
+        }, _config.setting.delay || 0)
       } else if (_config.setting.onload === 'true') {
         this.getStatFieldsValue()
       }
diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx
index e96e837..e5aff36 100644
--- a/src/tabviews/custom/components/table/normal-table/index.jsx
+++ b/src/tabviews/custom/components/table/normal-table/index.jsx
@@ -156,8 +156,10 @@
       search: Utils.initMainSearch(_config.search) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級
     }, () => {
       if (_config.setting.sync !== 'true' && _config.setting.onload === 'true') {
-        this.loadmaindata()
-        this.getStatFieldsValue()
+        setTimeout(() => {
+          this.loadmaindata()
+          this.getStatFieldsValue()
+        }, _config.setting.delay || 0)
       } else if (_config.setting.onload === 'true') {
         this.getStatFieldsValue()
       }
diff --git a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx
index 56538e6..864e357 100644
--- a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx
+++ b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx
@@ -90,7 +90,9 @@
       arr_field: _config.columns.map(col => col.field).join(','),
     }, () => {
       if (_config.setting.sync !== 'true' && _config.setting.onload === 'true') {
-        this.loadData()
+        setTimeout(() => {
+          this.loadData()
+        }, _config.setting.delay || 0)
       }
     })
   }
diff --git a/src/tabviews/custom/components/tree/antd-tree/index.jsx b/src/tabviews/custom/components/tree/antd-tree/index.jsx
index e9d7bc7..305d461 100644
--- a/src/tabviews/custom/components/tree/antd-tree/index.jsx
+++ b/src/tabviews/custom/components/tree/antd-tree/index.jsx
@@ -62,7 +62,9 @@
       sync: _sync
     }, () => {
       if (config.setting.sync !== 'true' && config.setting.onload === 'true') {
-        this.loadData(null)
+        setTimeout(() => {
+          this.loadData(null)
+        }, config.setting.delay || 0)
       } else if (config.setting.sync === 'true' && _data) {
         this.handleData()
       }
diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index 419377f..4baafcd 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -826,6 +826,7 @@
 
   // 鏍煎紡鍖栭粯璁よ缃�
   formatSetting = (components, params, mainSearch, inherit, regs, balMap) => {
+    let delay = 20
     return components.map(component => {
       if (component.type === 'tabs') {
         component.subtabs = component.subtabs.map(tab => {
@@ -920,8 +921,9 @@
           params.push(getStructDefaultParam(component, searchlist, params.length === 0))
         }
       } else if (params) {
-      // } else if (component.floor === 1) {
         component.setting.sync = 'false'
+        component.setting.delay = delay
+        delay += 20
       }
 
       if (balMap.has(component.uuid)) {

--
Gitblit v1.8.0