From 44adf318fc85408dc1678390956c87d96a0fb104 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 01 六月 2023 17:45:01 +0800
Subject: [PATCH] 2-23-06-01

---
 src/tabviews/custom/components/card/prop-card/index.jsx |   39 +++++++++---
 src/templates/zshare/editTable/index.jsx                |    2 
 src/components/normalform/modalform/index.jsx           |   18 ++++++
 src/menu/components/editor/braft-editor/options.jsx     |   23 +++++++
 src/menu/components/card/data-card/options.jsx          |   47 ++++++++++++++-
 src/menu/components/card/prop-card/index.jsx            |    2 
 src/menu/components/card/balcony/options.jsx            |   22 +++++++
 src/menu/sysinterface/index.jsx                         |    1 
 src/components/normalform/modalform/mkSelect/index.jsx  |   11 +++
 9 files changed, 145 insertions(+), 20 deletions(-)

diff --git a/src/components/normalform/modalform/index.jsx b/src/components/normalform/modalform/index.jsx
index c3e3144..28dc5c9 100644
--- a/src/components/normalform/modalform/index.jsx
+++ b/src/components/normalform/modalform/index.jsx
@@ -239,6 +239,24 @@
           return item || cell
         })
       })
+    } else if (item.reset_source) {
+      let map = new Map()
+      this.state.formlist.forEach(cell => {
+        if (!cell.field) return
+        map.set(cell.field, cell)
+      })
+
+      item.callback(map, this.record)
+
+      this.setState({
+        formlist: this.state.formlist.map(cell => {
+          if (!cell.field) return cell
+
+          let item = map.get(cell.field)
+
+          return item || cell
+        })
+      })
     }
   }
 
diff --git a/src/components/normalform/modalform/mkSelect/index.jsx b/src/components/normalform/modalform/mkSelect/index.jsx
index 92784fe..840dd4a 100644
--- a/src/components/normalform/modalform/mkSelect/index.jsx
+++ b/src/components/normalform/modalform/mkSelect/index.jsx
@@ -31,6 +31,17 @@
     MKEmitter.addListener('mkFC', this.mkFormControl)
   }
 
+  UNSAFE_componentWillReceiveProps (nextProps) {
+    const { config } = this.state
+
+    if (!is(fromJS(config.oriOptions), fromJS(nextProps.config.oriOptions))) {
+      this.setState({
+        config: fromJS(nextProps.config).toJS(),
+        options: fromJS(nextProps.config.options).toJS()
+      })
+    }
+  }
+
   shouldComponentUpdate (nextProps, nextState) {
     return !is(fromJS(this.state), fromJS(nextState))
   }
diff --git a/src/menu/components/card/balcony/options.jsx b/src/menu/components/card/balcony/options.jsx
index 97a6d83..b7dd426 100644
--- a/src/menu/components/card/balcony/options.jsx
+++ b/src/menu/components/card/balcony/options.jsx
@@ -78,7 +78,27 @@
       label: '鏁版嵁婧�',
       initval: wrap.publicId || '',
       required: true,
-      options: interfaces
+      options: interfaces,
+      reset_source: true,
+      callback: (map, record) => {
+        if (!record.publicId) return
+
+        let interfaces = window.GLOB.customMenu.interfaces || []
+
+        let d = interfaces.filter(m => m.uuid === record.publicId && m.status === 'true')[0]
+
+        if (!d || !d.columns) return
+
+        let columns = JSON.parse(JSON.stringify(d.columns))
+
+        let _bgField = map.get('bgField')
+
+        if (_bgField && !_bgField.forbid) {
+          _bgField.options = columns
+          _bgField.oriOptions = columns
+          map.set('bgField', _bgField)
+        }
+      }
     },
     {
       type: 'radio',
diff --git a/src/menu/components/card/data-card/options.jsx b/src/menu/components/card/data-card/options.jsx
index 0deb6b7..9f2edb2 100644
--- a/src/menu/components/card/data-card/options.jsx
+++ b/src/menu/components/card/data-card/options.jsx
@@ -103,10 +103,11 @@
       ],
       linkFields: ['priKeyType'],
       controlFields: [
-        {field: 'goback', values: ['dynamic']},
+        {field: 'goback', values: ['dynamic', 'public']},
         {field: 'empty', values: ['dynamic', 'public']},
-        {field: 'jump', values: ['dynamic']},
-        {field: 'autoExec', values: ['dynamic']},
+        {field: 'jump', values: ['dynamic', 'public']},
+        {field: 'broadcast', values: ['dynamic', 'public']},
+        {field: 'autoExec', values: ['dynamic', 'public']},
         {field: 'supModule', values: ['static']},
         {field: 'publicId', values: ['public']},
       ],
@@ -119,7 +120,42 @@
       initval: wrap.publicId || '',
       required: true,
       options: interfaces,
-      forbid: subtype !== 'propcard'
+      reset_source: true,
+      forbid: subtype !== 'propcard',
+      callback: (map, record) => {
+        if (!record.publicId) return
+        
+        let interfaces = window.GLOB.customMenu.interfaces || []
+        
+        let d = interfaces.filter(m => m.uuid === record.publicId && m.status === 'true')[0]
+        
+        if (!d || !d.columns) return
+        let columns = JSON.parse(JSON.stringify(d.columns))
+
+        let _broadcast = map.get('broadcast')
+
+        if (_broadcast && !_broadcast.forbid) {
+          _broadcast.options = columns
+          _broadcast.oriOptions = columns
+          map.set('broadcast', _broadcast)
+        }
+        
+        let _jumpField = map.get('jumpField')
+
+        if (_jumpField && !_jumpField.forbid) {
+          _jumpField.options = columns
+          _jumpField.oriOptions = columns
+          map.set('jumpField', _jumpField)
+        }
+
+        let _link = map.get('link')
+
+        if (_link && !_link.forbid) {
+          _link.options = columns
+          _link.oriOptions = columns
+          map.set('link', _link)
+        }
+      }
     },
     {
       type: 'radio',
@@ -326,7 +362,7 @@
       field: 'broadcast',
       label: '璇煶鎾姤',
       initval: wrap.broadcast || '',
-      tooltip: '璇煶鎾姤鍦ㄧЩ鍔ㄧapp涓湁鏁堛�傛敞锛氫娇鐢ㄨ闊虫挱鎶ユ椂锛屾暟鎹簮涓嶈浣跨敤鍚屾鏌ヨ锛屾坊鍔犲畾鏃跺櫒鏃讹紝鍙惊鐜挱鎶�',
+      tooltip: '璇煶鎾姤鍦ㄧЩ鍔ㄧ鏈夋晥銆傛敞锛氬湪H5涓浣跨敤闊抽閾炬帴锛屾坊鍔犲畾鏃跺櫒鏃讹紝鍙惊鐜挱鎶�',
       required: false,
       options: columns,
       forbid: !columns || appType !== 'mob' || subtype !== 'propcard'
@@ -349,6 +385,7 @@
       field: 'display',
       label: '鏄剧ず鎺у埗',
       initval: wrap.display || 'normal',
+      tooltip: '褰撲娇鐢ㄥ睘鎬у崱杩涜鏌愪簺涓氬姟鎿嶄綔锛屼笖涓嶉渶瑕佸睍绀哄崱鐗囦俊鎭椂锛屽彲璁剧疆涓轰笉鍙銆�',
       required: false,
       options: [
         {value: 'normal', label: '姝e父鏄剧ず'},
diff --git a/src/menu/components/card/prop-card/index.jsx b/src/menu/components/card/prop-card/index.jsx
index b914926..586b01b 100644
--- a/src/menu/components/card/prop-card/index.jsx
+++ b/src/menu/components/card/prop-card/index.jsx
@@ -123,7 +123,7 @@
 
   mkUpdateInter = (inter, split) => {
     const { card } = this.state
-    
+
     if (card.wrap.datatype === 'public' && card.wrap.publicId === inter.uuid) {
       let _card = {...card, columns: fromJS(inter.columns).toJS()}
 
diff --git a/src/menu/components/editor/braft-editor/options.jsx b/src/menu/components/editor/braft-editor/options.jsx
index c746b12..908efea 100644
--- a/src/menu/components/editor/braft-editor/options.jsx
+++ b/src/menu/components/editor/braft-editor/options.jsx
@@ -80,14 +80,33 @@
       label: '鏁版嵁婧�',
       initval: wrap.publicId || '',
       required: true,
-      options: interfaces
+      options: interfaces,
+      reset_source: true,
+      callback: (map, record) => {
+        if (!record.publicId) return
+
+        let interfaces = window.GLOB.customMenu.interfaces || []
+
+        let d = interfaces.filter(m => m.uuid === record.publicId && m.status === 'true')[0]
+
+        if (!d || !d.columns) return
+
+        let columns = JSON.parse(JSON.stringify(d.columns))
+
+        let _field = map.get('field')
+
+        if (_field) {
+          _field.options = columns
+          _field.oriOptions = columns
+          map.set('field', _field)
+        }
+      }
     },
     {
       type: 'select',
       field: 'field',
       label: '鏂囨湰瀛楁',
       initval: wrap.field || '',
-      tooltip: '閫夋嫨鍔ㄦ�佸�兼椂锛岄渶璁剧疆鏂囨湰瀛楁鎵嶅彲鐢熸晥锛屼娇鐢ㄥ叕鍏辨暟鎹簮鏃讹紝闇�鍏堜繚瀛樻暟鎹簮鍚庡啀閫夊彇鏂囨湰瀛楁銆�',
       required: false,
       options: columns
     },
diff --git a/src/menu/sysinterface/index.jsx b/src/menu/sysinterface/index.jsx
index e957516..a486c0e 100644
--- a/src/menu/sysinterface/index.jsx
+++ b/src/menu/sysinterface/index.jsx
@@ -221,6 +221,7 @@
     this.setState({ interfaces })
     this.props.updateConfig({...config, interfaces})
 
+    MKEmitter.emit('editLineId', record.uuid)
     setTimeout(() => {
       MKEmitter.emit('mkUpdateInter', record, {delay: 0})
     }, 10)
diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx
index 651bd23..592322d 100644
--- a/src/tabviews/custom/components/card/prop-card/index.jsx
+++ b/src/tabviews/custom/components/card/prop-card/index.jsx
@@ -135,9 +135,15 @@
       }
 
       if (_config.wrap.datatype === 'dynamic' && this.loaded) {
-        this.autoExec()
+        if (_config.wrap.goback === 'true' && _data.$$empty) {
+          this.timer && this.timer.stop()
+
+          MKEmitter.emit('closeTabView', _config.$pageId)
+        } else {
+          this.autoExec()
+        }
       }
-      if (!_config.wrap.cardType && _data.$$uuid) {
+      if (_data.$$uuid) {
         setTimeout(() => {
           this.transferLine()
         }, 200)
@@ -213,12 +219,18 @@
       this.loaded = true
 
       this.setState({sync: false, data: _data}, () => {
-        if (selected !== 'false') {
-          this.checkTopLine()
-        } else if (!config.wrap.cardType && _data.$$uuid) {
-          this.transferLine()
+        if (config.wrap.goback === 'true' && _data.$$empty) {
+          this.timer && this.timer.stop()
+
+          MKEmitter.emit('closeTabView', config.$pageId)
+        } else {
+          if (selected !== 'false') {
+            this.checkTopLine()
+          } else if (_data.$$uuid) {
+            this.transferLine()
+          }
+          this.autoExec()
         }
-        this.autoExec()
       })
     } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
       this.setState({}, () => {
@@ -240,10 +252,17 @@
       this.loaded = true
 
       this.setState({data: _data}, () => {
-        if (selected !== 'false') {
-          this.checkTopLine()
+        if (config.wrap.goback === 'true' && _data.$$empty) {
+          this.timer && this.timer.stop()
+
+          MKEmitter.emit('closeTabView', config.$pageId)
         } else {
-          this.transferLine()
+          if (selected !== 'false') {
+            this.checkTopLine()
+          } else {
+            this.transferLine()
+          }
+          this.autoExec()
         }
       })
     }
diff --git a/src/templates/zshare/editTable/index.jsx b/src/templates/zshare/editTable/index.jsx
index e4e7d67..028c456 100644
--- a/src/templates/zshare/editTable/index.jsx
+++ b/src/templates/zshare/editTable/index.jsx
@@ -427,7 +427,7 @@
         if (!unique) return
 
         data.unshift(res.data)
-        this.setState({ data, editingKey: '', visible: false }, () => {
+        this.setState({ data, editingKey: '', editLineId: res.data.uuid || '', visible: false }, () => {
           this.props.onChange(data)
         })
       } else if (res.type === 'array') {

--
Gitblit v1.8.0