From 0d58c560feeddd8409a34ef0bd1e16f0be3f9758 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 01 十一月 2021 21:59:51 +0800
Subject: [PATCH] 2021-11-01

---
 src/templates/sharecomponent/settingcomponent/index.jsx             |   11 +++++
 src/mob/components/menubar/normal-menubar/menucomponent/index.jsx   |    5 ++
 src/templates/zshare/formconfig.jsx                                 |   10 +++-
 src/menu/datasource/verifycard/settingform/index.jsx                |   11 +++--
 src/mob/components/menubar/normal-menubar/index.jsx                 |   18 ++++++++
 src/templates/zshare/verifycard/index.jsx                           |   10 +++++
 src/mob/components/menubar/normal-menubar/menucomponent/options.jsx |   11 +++++
 src/menu/datasource/index.jsx                                       |   12 ++++++
 src/mob/components/menubar/normal-menubar/options.jsx               |   12 ++++++
 src/mob/components/menubar/normal-menubar/index.scss                |    9 ++++
 src/templates/sharecomponent/actioncomponent/dragaction/index.jsx   |    3 -
 src/tabviews/subtable/index.jsx                                     |    3 +
 src/views/mobdesign/index.jsx                                       |    3 +
 13 files changed, 104 insertions(+), 14 deletions(-)

diff --git a/src/menu/datasource/index.jsx b/src/menu/datasource/index.jsx
index 8115d65..96d7a6a 100644
--- a/src/menu/datasource/index.jsx
+++ b/src/menu/datasource/index.jsx
@@ -189,6 +189,8 @@
         })
       }
 
+      let maxScript = 0
+
       if (window.GLOB.funcs && window.GLOB.funcs.length > 0) {
         window.GLOB.funcs.forEach(m => {
           let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig')
@@ -197,10 +199,20 @@
           }
           res.scripts.forEach(item => {
             item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`)
+
+            if (item.status === 'false') return
+
+            if (/exec\s/ig.test(item.sql)) {
+              maxScript = 100
+            } else if (item.sql.length > maxScript) {
+              maxScript = item.sql.length
+            }
           })
         })
       }
 
+      res.setting.maxScript = maxScript
+
       this.setState({loading: false, visible: false})
       this.props.updateConfig({...config, ...res})
     }, () => {
diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx
index abdd2ad..e61ed99 100644
--- a/src/menu/datasource/verifycard/settingform/index.jsx
+++ b/src/menu/datasource/verifycard/settingform/index.jsx
@@ -59,6 +59,7 @@
     return new Promise((resolve, reject) => {
       this.props.form.validateFieldsAndScroll((err, values) => {
         if (!err) {
+          values.sync = values.sync || 'false'
           // 鏁版嵁婧愬墠绔獙璇�
           if (values.interType === 'system' && values.execute !== 'false' && !values.dataresource) {
             notification.warning({
@@ -369,7 +370,7 @@
                 </Radio.Group>)}
               </Form.Item>
             </Col> : null}
-            {config.type !== 'navbar' && config.type !== 'balcony' ? <Col span={8}>
+            {!['navbar', 'balcony', 'menubar'].includes(config.type) ? <Col span={8}>
               <Form.Item label={
                 <Tooltip placement="topLeft" title={'璇ョ粍浠跺鏋滃彈鍏朵粬缁勪欢鎺у埗锛岃閫夐」鐩稿簲鐨勭粍浠讹紝娌℃湁鏃堕�夆�滄棤鈥濄��'}>
                   <Icon type="question-circle" />
@@ -420,7 +421,7 @@
               </Form.Item>
             </Col> : null}
             {/* 1銆佷笉鍒嗛〉涓斾笉瀛樺湪涓婄骇妯″潡 */}
-            {config.type !== 'navbar' && (!config.pageable || (config.pageable && laypage === 'false')) && (!supModule || supModule.length === 0 || supModule[0] === 'empty') ? <Col span={8}>
+            {!['navbar', 'menubar'].includes(config.type) && (!config.pageable || (config.pageable && laypage === 'false')) && (!supModule || supModule.length === 0 || supModule[0] === 'empty') ? <Col span={8}>
               <Form.Item label={
                 <Tooltip placement="topLeft" title={'鍒濆鍖栧姞杞芥椂锛屾槸鍚︿笌鍏朵粬缁勪欢涓�鍚屽姞杞芥暟鎹紝娉細浠呭湪浣跨敤绯荤粺鍑芥暟锛屼笖鍒濆鍖栧姞杞芥暟鎹椂鏈夋晥锛屽垎椤佃姹傛椂鏃犳晥銆�'}>
                   <Icon type="question-circle" />
@@ -437,7 +438,7 @@
                 )}
               </Form.Item>
             </Col> : null}
-            {config.type !== 'navbar' && config.type !== 'balcony' ? <Col span={8}>
+            {!['navbar', 'balcony', 'menubar'].includes(config.type) ? <Col span={8}>
               <Form.Item label={
                 <Tooltip placement="topLeft" title={'浼樺厛浣跨敤鍚岀骇鐨勬悳绱㈡潯浠剁粍浠讹紝鍚岀骇鎼滅储涓嶅瓨鍦ㄦ椂锛屼緷娆″悜涓婇�夊彇锛屼笌褰撳墠缁勪欢鐨勬悳绱㈡潯浠朵竴鍚岀敤浣滄暟鎹繃婊わ紙褰撳墠缁勪欢鐨勬悳绱㈡潯浠朵紭鍏堬級銆�'}>
                   <Icon type="question-circle" />
@@ -454,7 +455,7 @@
                 )}
               </Form.Item>
             </Col> : null}
-            {config.type !== 'navbar' && config.type !== 'balcony' && useMSearch === 'true' ? <Col span={8}>
+            {!['navbar', 'balcony', 'menubar'].includes(config.type) && useMSearch === 'true' ? <Col span={8}>
               <Form.Item label={
                 <Tooltip placement="topLeft" title={'澶栧眰鎼滅储鏉′欢鏀瑰彉鏃讹紝鏄惁鍒锋柊褰撳墠缁勪欢鏁版嵁銆�'}>
                   <Icon type="question-circle" />
@@ -482,7 +483,7 @@
                 </Radio.Group>)}
               </Form.Item>
             </Col>
-            {config.type !== 'navbar' && config.type !== 'balcony' ? <Col span={8}>
+            {!['navbar', 'balcony', 'menubar'].includes(config.type) ? <Col span={8}>
               <Form.Item label="鍒濆鍖栨暟鎹�">
                 {getFieldDecorator('onload', {
                   initialValue: setting.onload || 'true'
diff --git a/src/mob/components/menubar/normal-menubar/index.jsx b/src/mob/components/menubar/normal-menubar/index.jsx
index 95c3d50..43d1e85 100644
--- a/src/mob/components/menubar/normal-menubar/index.jsx
+++ b/src/mob/components/menubar/normal-menubar/index.jsx
@@ -19,6 +19,7 @@
 const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent'))
 const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent'))
 const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader'))
+const SettingComponent = asyncIconComponent(() => import('@/menu/datasource'))
 
 const { confirm } = Modal
 
@@ -45,10 +46,14 @@
         floor: card.floor,
         tabId: '',
         parentId: '',
+        format: 'object',   // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡
+        pageable: false,    // 缁勪欢灞炴�� - 鏄惁鍙垎椤�
+        switchable: false,  // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹�
         dataName: card.dataName || '',
         width: card.width || 24,
         name: card.name,
         subtype: card.subtype,
+        setting: { interType: 'system' },
         wrap: { name: card.name, width: card.width || 24, title: '' },
         style: { marginLeft: '0px', marginRight: '0px', marginTop: '8px', marginBottom: '8px' },
         headerStyle: { fontSize: '16px', borderBottomWidth: '1px', borderBottomColor: '#e8e8e8' },
@@ -227,7 +232,16 @@
   }
 
   updateWrap = (res) => {
-    this.updateComponent({...this.state.card, wrap: res})
+    let card = {...this.state.card, wrap: res}
+    if (res.datatype === 'dynamic' && !card.format) {
+      card.format = 'object'
+      card.pageable = false
+      card.switchable = false
+      card.setting = { interType: 'system' }
+      card.columns = []
+      card.scripts = []
+    }
+    this.updateComponent(card)
   }
 
   clickComponent = (e) => {
@@ -268,6 +282,8 @@
             <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" />
             <UserComponent config={card}/>
             <Icon className="close" title="鍒犻櫎缁勪欢" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} />
+            {card.wrap.datatype === 'dynamic' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null}
+            {card.wrap.datatype !== 'dynamic' ? <Icon style={{color: '#eeeeee', cursor: 'not-allowed'}} type="setting"/> : null}
           </div>
         } trigger="hover">
           <Icon type="tool" />
diff --git a/src/mob/components/menubar/normal-menubar/index.scss b/src/mob/components/menubar/normal-menubar/index.scss
index 383a40c..0686562 100644
--- a/src/mob/components/menubar/normal-menubar/index.scss
+++ b/src/mob/components/menubar/normal-menubar/index.scss
@@ -41,6 +41,7 @@
       text-overflow: ellipsis;
     }
     .menu-sign {
+      position: relative;
       text-align: center;
       .anticon {
         border-radius: 15%;
@@ -48,6 +49,14 @@
       img {
         border-radius: 15%;
       }
+      .am-badge-text {
+        position: absolute;
+        height: 8px;
+        width: 8px;
+        border-radius: 100%;
+        background: #ff5b05;
+        z-index: 1;
+      }
     }
   }
 }
diff --git a/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx b/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx
index 10225a8..4999373 100644
--- a/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx
+++ b/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx
@@ -80,9 +80,10 @@
   }
 
   getSettingForms = () => {
+    const { cards } = this.props
     const { card } = this.state
 
-    return getSettingForm(card.setting)
+    return getSettingForm(card.setting, cards.columns || [])
   }
 
   updateSetting = (res) => {
@@ -150,8 +151,10 @@
                 color: card.setting.color,
                 borderRadius: card.setting.borderRadius || '15%'
               }} type={card.setting.icon}/>
+              {card.setting.tip ? <sup className="am-badge-text"></sup> : null}
             </div> : <div className="menu-sign">
               <img style={{width: card.setting.imgWidth, height: card.setting.imgWidth, borderRadius: card.setting.borderRadius || '15%'}} src={card.setting.url} alt=""/>
+              {card.setting.tip ? <sup className="am-badge-text"></sup> : null}
             </div>}
             <div className="menu-name">{card.setting.name}</div>
           </div>
diff --git a/src/mob/components/menubar/normal-menubar/menucomponent/options.jsx b/src/mob/components/menubar/normal-menubar/menucomponent/options.jsx
index 79de0e1..00a1b26 100644
--- a/src/mob/components/menubar/normal-menubar/menucomponent/options.jsx
+++ b/src/mob/components/menubar/normal-menubar/menucomponent/options.jsx
@@ -1,7 +1,7 @@
 /**
  * @description Setting琛ㄥ崟閰嶇疆淇℃伅
  */
-export default function (setting) {
+export default function (setting, columns) {
   let menulist = sessionStorage.getItem('appMenus')
 
   if (menulist) {
@@ -180,6 +180,15 @@
       precision: 0,
       required: false
     },
+    {
+      type: 'select',
+      field: 'tip',
+      label: '鎻愮ず',
+      initval: setting.tip || '',
+      tooltip: '缁戝畾鎻愮ず瀛楁鍚庯紝浼氬湪鑿滃崟鍙充笂瑙掓樉绀虹孩鑹叉爣璁般��',
+      required: false,
+      options: columns
+    },
   ]
 
   return menuWrapForm
diff --git a/src/mob/components/menubar/normal-menubar/options.jsx b/src/mob/components/menubar/normal-menubar/options.jsx
index c8d9f80..45e6b8a 100644
--- a/src/mob/components/menubar/normal-menubar/options.jsx
+++ b/src/mob/components/menubar/normal-menubar/options.jsx
@@ -28,6 +28,18 @@
       max: 24,
       precision: 0,
       required: true
+    },
+    {
+      type: 'radio',
+      field: 'datatype',
+      label: '鏁版嵁鏉ユ簮',
+      initval: wrap.datatype || 'static',
+      tooltip: '閫夋嫨闈欐�佸�硷紝鏃犻渶閰嶇疆鏁版嵁婧愩��',
+      required: false,
+      options: [
+        {value: 'dynamic', label: '鍔ㄦ��'},
+        {value: 'static', label: '闈欐��'},
+      ]
     }
   ]
 
diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx
index afe536d..3a843c5 100644
--- a/src/tabviews/subtable/index.jsx
+++ b/src/tabviews/subtable/index.jsx
@@ -916,11 +916,14 @@
 
   changeTableLine = (ContainerId, tableId, id, data) => {
     const { Tab } = this.props
+    const { setting } = this.state
 
     if (!Tab.supMenu || tableId !== Tab.supMenu) return
 
     this.setState({BData: data, BID: id})
 
+    if (!setting) return
+
     if (id !== this.state.BID || id !== '') {
       MKEmitter.emit('resetTable', this.props.Tab.uuid) // 鍒楄〃閲嶇疆
       this.setState({
diff --git a/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx b/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx
index f775300..c956d28 100644
--- a/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx
@@ -55,8 +55,7 @@
     copycard.copyType = 'action'
     copycard.focus = true
 
-    copycard.originCard = card
-    copycard.originCard.appkey = window.GLOB.appkey
+    copycard.originCard = {...card, appkey: window.GLOB.appkey}
 
     if (copycard.OpenType === 'popview') { // 寰呭畬鍠�
       copycard.linkTab = ''
diff --git a/src/templates/sharecomponent/settingcomponent/index.jsx b/src/templates/sharecomponent/settingcomponent/index.jsx
index dfd1ac0..5bb9c2a 100644
--- a/src/templates/sharecomponent/settingcomponent/index.jsx
+++ b/src/templates/sharecomponent/settingcomponent/index.jsx
@@ -120,12 +120,21 @@
 
   resetSetting = (s) => {
     let setting = fromJS(s).toJS()
+    let maxScript = 0
 
     if (window.GLOB.funcs && window.GLOB.funcs.length > 0) {
       window.GLOB.funcs.forEach(m => {
         let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig')
         setting.scripts.forEach(item => {
           item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`)
+
+          if (item.status === 'false') return
+
+          if (/exec\s/ig.test(item.sql)) {
+            maxScript = 100
+          } else if (item.sql.length > maxScript) {
+            maxScript = item.sql.length
+          }
         })
         setting.preScripts.forEach(item => {
           item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`)
@@ -139,6 +148,8 @@
       })
     }
 
+    setting.maxScript = maxScript
+
     return setting
   }
 
diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx
index 469ccd7..fbcc7db 100644
--- a/src/templates/zshare/formconfig.jsx
+++ b/src/templates/zshare/formconfig.jsx
@@ -874,6 +874,10 @@
     })
   }
 
+  if (card.OpenType === 'blank') {
+    card.OpenType = 'tab'
+  }
+
   return [
     {
       type: 'select',
@@ -2739,11 +2743,11 @@
       label: '鍏夋爣',
       initVal: card.cursor || 'left',
       options: [{
-        value: 'right',
-        text: '鍙冲榻�'
-      }, {
         value: 'left',
         text: '宸﹀榻�'
+      }, {
+        value: 'right',
+        text: '鍙冲榻�'
       }],
       forbid: appType !== 'mob'
     },
diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx
index 7d58880..2db3ea3 100644
--- a/src/templates/zshare/verifycard/index.jsx
+++ b/src/templates/zshare/verifycard/index.jsx
@@ -35,6 +35,7 @@
   state = {
     initsql: '',            // sql楠岃瘉鏃跺彉閲忓0鏄庡強璧嬪��
     notes: [],              // 鐭俊妯℃澘
+    setting: null,
     verify: {},
     fields: [],
     usefulfields: '',
@@ -572,6 +573,7 @@
     }
 
     this.setState({
+      setting: config.setting || {},
       verify: _verify
     })
 
@@ -1316,6 +1318,7 @@
 
   handleConfirm = () => {
     const { card } = this.props
+    const { setting } = this.state
     let verify = fromJS(this.state.verify).toJS()
     
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
@@ -1334,6 +1337,13 @@
           duration: 5
         })
         return
+      } else if (verify.invalid === 'true' && setting.maxScript && setting.maxScript >= 100) {
+        notification.warning({
+          top: 92,
+          message: '鏁版嵁婧愪腑鑷畾涔夎剼鏈繃浜庡鏉傦紝涓嶈兘浣跨敤澶辨晥楠岃瘉锛�',
+          duration: 5
+        })
+        return
       }
 
       let msg = ''
diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx
index 3cc66e2..f2cef5a 100644
--- a/src/views/mobdesign/index.jsx
+++ b/src/views/mobdesign/index.jsx
@@ -1135,6 +1135,7 @@
 
         if (['propcard', 'brafteditor', 'sandbox', 'tabbar', 'stepform', 'tabform'].includes(item.subtype) && item.wrap.datatype === 'static') return
         if (['balcony'].includes(item.type) && item.wrap.datatype === 'static') return
+        if (['menubar'].includes(item.type) && item.wrap.datatype !== 'dynamic') return
 
         if (item.setting) {
           if (item.setting.interType === 'system' && item.setting.execute !== 'false' && !item.setting.dataresource) {
@@ -1143,7 +1144,7 @@
             error = `缁勪欢銆�${item.name}銆嬫湭璁剧疆鏁版嵁婧愶紒`
           } else if (!item.setting.primaryKey) {
             error = `缁勪欢銆�${item.name}銆嬫湭璁剧疆涓婚敭锛乣
-          } else if (!item.setting.supModule && item.type !== 'navbar' && item.type !== 'balcony') {
+          } else if (!item.setting.supModule && !['navbar', 'balcony', 'menubar'].includes(item.type)) {
             error = `缁勪欢銆�${item.name}銆嬫湭璁剧疆涓婄骇缁勪欢锛乣
           }
         }

--
Gitblit v1.8.0