From 6092c17b4571e1082d1272fa3104c780af66453d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 17 十二月 2023 11:10:19 +0800
Subject: [PATCH] 2023-12-17

---
 src/tabviews/custom/components/card/prop-card/index.jsx        |    2 
 src/menu/components/card/double-data-card/options.jsx          |   11 ++
 src/tabviews/custom/components/table/base-table/index.jsx      |   21 +++++
 src/menu/components/table/edit-table/columns/tableIn/index.jsx |    4 
 src/menu/components/table/normal-table/options.jsx             |   13 ++
 src/menu/components/card/cardcellcomponent/index.jsx           |    5 
 src/menu/components/card/data-card/options.jsx                 |    4 
 src/menu/components/table/base-table/options.jsx               |   13 ++
 src/tabviews/custom/components/card/double-data-card/index.jsx |   21 +++++
 src/tabviews/custom/components/table/normal-table/index.jsx    |   21 +++++
 src/utils/utils-custom.js                                      |   13 ++
 src/menu/components/card/double-data-card/index.jsx            |   24 +++++
 src/menu/components/card/data-card/index.jsx                   |   24 +++++
 src/menu/components/share/actioncomponent/index.jsx            |    6 +
 src/tabviews/zshare/actionList/excelInbutton/index.jsx         |    1 
 src/menu/components/form/formaction/index.jsx                  |    6 +
 src/menu/components/table/base-table/index.jsx                 |    4 
 src/menu/components/table/normal-table/index.jsx               |    6 
 src/tabviews/custom/components/card/data-card/index.jsx        |   21 +++++
 19 files changed, 196 insertions(+), 24 deletions(-)

diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx
index 5460326..f0249c1 100644
--- a/src/menu/components/card/cardcellcomponent/index.jsx
+++ b/src/menu/components/card/cardcellcomponent/index.jsx
@@ -310,8 +310,9 @@
         supId = ''
       }
     }
+    let menu = window.GLOB.customMenu
 
-    let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, cards.uuid, supId, true)
+    let modules = MenuUtils.getSubModules(menu.components, cards.uuid, supId, menu.interfaces || null)
 
     if (cards.subtype === 'basetable') {
       this.setState({
@@ -320,7 +321,7 @@
         formlist: getBaseTableActionForm(card, functip, cards, usefulFields, modules)
       })
     } else {
-      let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, cards.uuid) || []
+      let anchors = MenuUtils.getAnchors(menu.components, cards.uuid) || []
 
       this.setState({
         actvisible: true,
diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx
index 5822912..b16fec5 100644
--- a/src/menu/components/card/data-card/index.jsx
+++ b/src/menu/components/card/data-card/index.jsx
@@ -341,8 +341,30 @@
 
   getWrapForms = () => {
     const { card } = this.state
+
+    let buttons = []
+
+    card.action && card.action.forEach(n => {
+      buttons.push({
+        value: n.uuid,
+        label: n.label
+      })
+    })
+
+    card.subcards.forEach(m => {
+      if (m.$cardType !== 'extendCard') return
+
+      m.elements.forEach(n => {
+        if (n.eleType === 'button') {
+          buttons.push({
+            value: n.uuid,
+            label: n.label
+          })
+        }
+      })
+    })
     
-    return getWrapForm(card.wrap, card.subtype, card.columns, card.uuid, card.supNodes, card.setting)
+    return getWrapForm(card.wrap, card.subtype, card.columns, card.uuid, card.supNodes, card.setting, buttons)
   }
 
   updateWrap = (res) => {
diff --git a/src/menu/components/card/data-card/options.jsx b/src/menu/components/card/data-card/options.jsx
index 0140681..705d3c7 100644
--- a/src/menu/components/card/data-card/options.jsx
+++ b/src/menu/components/card/data-card/options.jsx
@@ -413,10 +413,10 @@
       field: 'autoExec',
       label: '鑷姩鎵ц',
       initval: wrap.autoExec || '',
-      tooltip: '鏁版嵁鏇存柊鏃惰嚜鍔ㄦ墽琛屾寜閽�傛敞锛氭鎸夐挳鎵ц鎴愬姛鍚庤皑鎱庨�夋嫨鍒锋柊椤癸紝閬垮厤閫犳垚寰幆鎵ц銆�',
+      tooltip: subtype === 'propcard' ? '鏁版嵁鏇存柊鏃惰嚜鍔ㄦ墽琛屾寜閽�傛敞锛氭鎸夐挳鎵ц鎴愬姛鍚庤皑鎱庨�夋嫨鍒锋柊椤癸紝閬垮厤閫犳垚寰幆鎵ц銆�' : '鍒濆鍖栬嚜鍔ㄦ墽琛屾寜閽��',
       required: false,
       options: buttons,
-      forbid: subtype !== 'propcard',
+      forbid: subtype !== 'propcard' && subtype !== 'datacard',
       controlFields: [
         {field: 'emptyExec', notNull: true},
       ]
diff --git a/src/menu/components/card/double-data-card/index.jsx b/src/menu/components/card/double-data-card/index.jsx
index 81cf755..a55e943 100644
--- a/src/menu/components/card/double-data-card/index.jsx
+++ b/src/menu/components/card/double-data-card/index.jsx
@@ -331,8 +331,30 @@
 
   getWrapForms = () => {
     const { card } = this.state
+
+    let buttons = []
+
+    card.action && card.action.forEach(n => {
+      buttons.push({
+        value: n.uuid,
+        label: n.label
+      })
+    })
+
+    card.subcards.forEach(m => {
+      if (m.$cardType !== 'extendCard') return
+
+      m.elements.forEach(n => {
+        if (n.eleType === 'button') {
+          buttons.push({
+            value: n.uuid,
+            label: n.label
+          })
+        }
+      })
+    })
     
-    return getWrapForm(card.wrap, card.columns, card.setting)
+    return getWrapForm(card.wrap, card.columns, card.setting, buttons)
   }
 
   updateWrap = (res) => {
diff --git a/src/menu/components/card/double-data-card/options.jsx b/src/menu/components/card/double-data-card/options.jsx
index 942b421..591c305 100644
--- a/src/menu/components/card/double-data-card/options.jsx
+++ b/src/menu/components/card/double-data-card/options.jsx
@@ -1,7 +1,7 @@
 /**
  * @description Wrap琛ㄥ崟閰嶇疆淇℃伅
  */
-export default function (wrap, columns = [], setting) {
+export default function (wrap, columns = [], setting, buttons = []) {
   let appType = sessionStorage.getItem('appType')
   let laypage = setting && setting.laypage !== 'false'
   let roleList = sessionStorage.getItem('sysRoles')
@@ -183,6 +183,15 @@
       required: false
     },
     {
+      type: 'select',
+      field: 'autoExec',
+      label: '鑷姩鎵ц',
+      initval: wrap.autoExec || '',
+      tooltip: '鍒濆鍖栬嚜鍔ㄦ墽琛屾寜閽��',
+      required: false,
+      options: buttons
+    },
+    {
       type: 'number',
       field: 'minWidth',
       label: '鏈�灏忓搴�',
diff --git a/src/menu/components/form/formaction/index.jsx b/src/menu/components/form/formaction/index.jsx
index dc697e0..3ca3fb7 100644
--- a/src/menu/components/form/formaction/index.jsx
+++ b/src/menu/components/form/formaction/index.jsx
@@ -100,8 +100,10 @@
       supId = config.wrap.supModule[config.wrap.supModule.length - 1]
     }
 
-    let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, config.uuid, supId)
-    let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, config.uuid) || []
+    let menu = window.GLOB.customMenu
+
+    let modules = MenuUtils.getSubModules(menu.components, config.uuid, supId, menu.interfaces || null)
+    let anchors = MenuUtils.getAnchors(menu.components, config.uuid) || []
 
     if (card.type === 'submit' && !card.Ot) {
       card.Ot = config.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl'
diff --git a/src/menu/components/share/actioncomponent/index.jsx b/src/menu/components/share/actioncomponent/index.jsx
index 0109542..f0c909a 100644
--- a/src/menu/components/share/actioncomponent/index.jsx
+++ b/src/menu/components/share/actioncomponent/index.jsx
@@ -206,8 +206,10 @@
         supId = ''
       }
     }
+
+    let menu = window.GLOB.customMenu
     
-    let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, config.uuid, supId, config.subtype !== 'basetable')
+    let modules = MenuUtils.getSubModules(menu.components, config.uuid, supId, menu.interfaces || null)
 
     if (config.subtype === 'basetable') {
       delete card.eleType // 鍖哄垎鎸夐挳浣嶇疆
@@ -218,7 +220,7 @@
         formlist: getBaseTableActionForm(card, functip, config, usefulFields, modules)
       })
     } else {
-      let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, config.uuid) || []
+      let anchors = MenuUtils.getAnchors(menu.components, config.uuid) || []
   
       this.setState({
         visible: true,
diff --git a/src/menu/components/table/base-table/index.jsx b/src/menu/components/table/base-table/index.jsx
index 95759e2..4b4394e 100644
--- a/src/menu/components/table/base-table/index.jsx
+++ b/src/menu/components/table/base-table/index.jsx
@@ -219,7 +219,7 @@
   getWrapForms = () => {
     const { wrap, action, columns, cols } = this.state.card
 
-    let _actions = [...action]
+    let _actions = []
 
     cols.forEach(col => {
       if (col.type === 'custom') {
@@ -231,7 +231,7 @@
       }
     })
 
-    return getWrapForm(wrap, _actions, columns)
+    return getWrapForm(wrap, _actions, columns, action)
   }
 
   updateWrap = (res) => {
diff --git a/src/menu/components/table/base-table/options.jsx b/src/menu/components/table/base-table/options.jsx
index 775a39c..38d54a9 100644
--- a/src/menu/components/table/base-table/options.jsx
+++ b/src/menu/components/table/base-table/options.jsx
@@ -1,7 +1,7 @@
 /**
  * @description Wrap琛ㄥ崟閰嶇疆淇℃伅
  */
-export default function (wrap, action = [], columns = []) {
+export default function (wrap, action = [], columns = [], toolBtns = []) {
   const wrapForm = [
     {
       type: 'radio',
@@ -167,7 +167,16 @@
       tooltip: '鍙屽嚮琛ㄦ牸涓锛岃Е鍙戠殑鎸夐挳銆�',
       required: false,
       allowClear: true,
-      options: action.map(item => ({value: item.uuid, label: item.label})),
+      options: [...toolBtns, ...action].map(item => ({value: item.uuid, label: item.label})),
+    },
+    {
+      type: 'select',
+      field: 'autoExec',
+      label: '鑷姩鎵ц',
+      initval: wrap.autoExec || '',
+      tooltip: '鍒濆鍖栬嚜鍔ㄦ墽琛屾寜閽��',
+      required: false,
+      options: toolBtns.map(item => ({value: item.uuid, label: item.label}))
     },
     {
       type: 'select',
diff --git a/src/menu/components/table/edit-table/columns/tableIn/index.jsx b/src/menu/components/table/edit-table/columns/tableIn/index.jsx
index 5908fa2..3518c0c 100644
--- a/src/menu/components/table/edit-table/columns/tableIn/index.jsx
+++ b/src/menu/components/table/edit-table/columns/tableIn/index.jsx
@@ -196,8 +196,10 @@
         supId = ''
       }
     }
+
+    let menu = window.GLOB.customMenu
     
-    let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, uuid, supId)
+    let modules = MenuUtils.getSubModules(menu.components, uuid, supId, menu.interfaces || null)
 
     this.setState({
       fields: fromJS(columns).toJS().filter(item => item.field !== setting.primaryKey),
diff --git a/src/menu/components/table/normal-table/index.jsx b/src/menu/components/table/normal-table/index.jsx
index 5a6fd01..6bdefb2 100644
--- a/src/menu/components/table/normal-table/index.jsx
+++ b/src/menu/components/table/normal-table/index.jsx
@@ -280,7 +280,7 @@
   getWrapForms = () => {
     const { wrap, action, columns, cols } = this.state.card
 
-    let _actions = [...action]
+    let _actions = []
 
     cols.forEach(col => {
       if (col.type === 'custom') {
@@ -292,7 +292,7 @@
       }
     })
 
-    return getWrapForm(wrap, _actions, columns)
+    return getWrapForm(wrap, _actions, columns, action)
   }
 
   updateWrap = (res) => {
@@ -374,7 +374,7 @@
             <PlusOutlined className="plus" title="娣诲姞鍒�" onClick={() => this.addColumns()}/>
             {appType !== 'mob' ? <PlusCircleOutlined className="plus" title="娣诲姞鎼滅储" onClick={this.addSearch}/> : null}
             <PlusSquareOutlined className="plus" title="娣诲姞鎸夐挳" onClick={this.addButton}/>
-            <NormalForm title="琛ㄦ牸璁剧疆" width={800} update={this.updateWrap} getForms={this.getWrapForms}>
+            <NormalForm title="琛ㄦ牸璁剧疆" width={850} update={this.updateWrap} getForms={this.getWrapForms}>
               <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/>
             </NormalForm>
             <CopyComponent type="normaltable" card={card}/>
diff --git a/src/menu/components/table/normal-table/options.jsx b/src/menu/components/table/normal-table/options.jsx
index 8b1eae1..4c8ba91 100644
--- a/src/menu/components/table/normal-table/options.jsx
+++ b/src/menu/components/table/normal-table/options.jsx
@@ -1,7 +1,7 @@
 /**
  * @description Wrap琛ㄥ崟閰嶇疆淇℃伅
  */
-export default function (wrap, action = [], columns = []) {
+export default function (wrap, action = [], columns = [], toolBtns) {
   let roleList = sessionStorage.getItem('sysRoles')
   let appType = sessionStorage.getItem('appType')
   let isprint = sessionStorage.getItem('MenuType') === 'billPrint'
@@ -209,11 +209,20 @@
       tooltip: '鍙屽嚮琛ㄦ牸涓锛岃Е鍙戠殑鎸夐挳銆�',
       required: false,
       allowClear: true,
-      options: action.map(item => ({value: item.uuid, label: item.label})),
+      options: [...toolBtns, ...action].map(item => ({value: item.uuid, label: item.label})),
       forbid: appType === 'mob'
     },
     {
       type: 'select',
+      field: 'autoExec',
+      label: '鑷姩鎵ц',
+      initval: wrap.autoExec || '',
+      tooltip: '鍒濆鍖栬嚜鍔ㄦ墽琛屾寜閽��',
+      required: false,
+      options: toolBtns.map(item => ({value: item.uuid, label: item.label}))
+    },
+    {
+      type: 'select',
       field: 'tipField',
       label: '淇℃伅鎻愮ず',
       initval: wrap.tipField || '',
diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx
index 1e3d074..4315f80 100644
--- a/src/tabviews/custom/components/card/data-card/index.jsx
+++ b/src/tabviews/custom/components/card/data-card/index.jsx
@@ -236,6 +236,8 @@
     }
 
     this.initExec()
+
+    this.autoExec()
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -330,6 +332,25 @@
     }
   }
 
+  autoExec = (times) => {
+    const { config } = this.state
+
+    if (!config.wrap.autoExec) return
+
+    let btn = document.getElementById('button' + config.wrap.autoExec)
+
+    this.autoTimer && clearTimeout(this.autoTimer)
+
+    if (btn) {
+      MKEmitter.emit('triggerBtnId', config.wrap.autoExec, [])
+    } else if (!times || times < 20) {
+      times = times ? times + 1 : 1
+      this.autoTimer = setTimeout(() => {
+        this.autoExec(times)
+      }, 1000)
+    }
+  }
+
   transferSyncData = (syncId) => {
     const { config } = this.state
 
diff --git a/src/tabviews/custom/components/card/double-data-card/index.jsx b/src/tabviews/custom/components/card/double-data-card/index.jsx
index e65fe19..eabc964 100644
--- a/src/tabviews/custom/components/card/double-data-card/index.jsx
+++ b/src/tabviews/custom/components/card/double-data-card/index.jsx
@@ -229,6 +229,8 @@
     if (config.setting.onload === 'true') {
       this.initExec()
     }
+
+    this.autoExec()
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -322,6 +324,25 @@
     }
   }
 
+  autoExec = (times) => {
+    const { config } = this.state
+
+    if (!config.wrap.autoExec) return
+
+    let btn = document.getElementById('button' + config.wrap.autoExec)
+
+    this.autoTimer && clearTimeout(this.autoTimer)
+
+    if (btn) {
+      MKEmitter.emit('triggerBtnId', config.wrap.autoExec, [])
+    } else if (!times || times < 20) {
+      times = times ? times + 1 : 1
+      this.autoTimer = setTimeout(() => {
+        this.autoExec(times)
+      }, 1000)
+    }
+  }
+
   searchRefresh = (searchId) => {
     const { config } = this.state
 
diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx
index 93ab97e..82064c3 100644
--- a/src/tabviews/custom/components/card/prop-card/index.jsx
+++ b/src/tabviews/custom/components/card/prop-card/index.jsx
@@ -377,7 +377,7 @@
 
     let btn = document.getElementById('button' + config.wrap.autoExec)
 
-    clearTimeout(this.autoTimer)
+    this.autoTimer && clearTimeout(this.autoTimer)
 
     if (btn) {
       MKEmitter.emit('triggerBtnId', config.wrap.autoExec, data.$$empty ? [] : [data])
diff --git a/src/tabviews/custom/components/table/base-table/index.jsx b/src/tabviews/custom/components/table/base-table/index.jsx
index 0693483..7f975c1 100644
--- a/src/tabviews/custom/components/table/base-table/index.jsx
+++ b/src/tabviews/custom/components/table/base-table/index.jsx
@@ -606,6 +606,25 @@
     })
   }
 
+  autoExec = (times) => {
+    const { config } = this.state
+
+    if (!config.wrap.autoExec) return
+
+    let btn = document.getElementById('button' + config.wrap.autoExec)
+
+    this.autoTimer && clearTimeout(this.autoTimer)
+
+    if (btn) {
+      MKEmitter.emit('triggerBtnId', config.wrap.autoExec, [])
+    } else if (!times || times < 20) {
+      times = times ? times + 1 : 1
+      this.autoTimer = setTimeout(() => {
+        this.autoExec(times)
+      }, 1000)
+    }
+  }
+
   shouldComponentUpdate (nextProps, nextState) {
     return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState))
   }
@@ -621,6 +640,8 @@
     if (config.setting.useMSearch) {
       MKEmitter.addListener('searchRefresh', this.searchRefresh)
     }
+
+    this.autoExec()
   }
 
   /**
diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx
index a1492a3..595c5e5 100644
--- a/src/tabviews/custom/components/table/normal-table/index.jsx
+++ b/src/tabviews/custom/components/table/normal-table/index.jsx
@@ -199,6 +199,8 @@
     }
 
     this.initExec()
+
+    this.autoExec()
   }
 
   /**
@@ -301,6 +303,25 @@
     }
   }
 
+  autoExec = (times) => {
+    const { config } = this.state
+
+    if (!config.wrap.autoExec) return
+
+    let btn = document.getElementById('button' + config.wrap.autoExec)
+
+    this.autoTimer && clearTimeout(this.autoTimer)
+
+    if (btn) {
+      MKEmitter.emit('triggerBtnId', config.wrap.autoExec, [])
+    } else if (!times || times < 20) {
+      times = times ? times + 1 : 1
+      this.autoTimer = setTimeout(() => {
+        this.autoExec(times)
+      }, 1000)
+    }
+  }
+
   transferSyncData = (syncId) => {
     const { config } = this.state
 
diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
index df4b7d4..ea19291 100644
--- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
@@ -582,6 +582,7 @@
     return <>
       <Button
         type={type}
+        id={'button' + btn.uuid}
         title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')}
         loading={loading}
         disabled={disabled}
diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index 44a9750..8f7fa33 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -6,7 +6,7 @@
    * @description 鑾峰彇涓嬬骇妯″潡
    * @return {String}  selfId  褰撳墠缁勪欢id
    */
-  static getSubModules (components, selfId, supId, has) {
+  static getSubModules (components, selfId, supId, interfaces) {
     let modules = []
     components.forEach(item => {
       if (item.uuid === selfId || item.type === 'navbar') {
@@ -49,7 +49,7 @@
                 type: 'tab',
                 value: f_tab.uuid,
                 label: f_tab.label,
-                children: this.getSubModules(f_tab.components, selfId, supId, has)
+                children: this.getSubModules(f_tab.components, selfId, supId)
               }
   
               if (subItem.children.length === 0) {
@@ -95,6 +95,15 @@
       }
     })
 
+    if (interfaces && interfaces.length > 0) {
+      interfaces.forEach(item => {
+        modules.push({
+          value: item.uuid,
+          label: item.name
+        })
+      })
+    }
+
     return modules
   }
 

--
Gitblit v1.8.0