From 316877c1d9e5b6d92334f30b03d97d7e833cd934 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 02 二月 2021 16:01:57 +0800
Subject: [PATCH] 2021-02-02

---
 src/menu/popview/index.jsx |  129 +++++++++++++++++++++++++-----------------
 1 files changed, 77 insertions(+), 52 deletions(-)

diff --git a/src/menu/popview/index.jsx b/src/menu/popview/index.jsx
index 97061ff..18d2fb6 100644
--- a/src/menu/popview/index.jsx
+++ b/src/menu/popview/index.jsx
@@ -21,7 +21,7 @@
 const { confirm } = Modal
 
 const MenuForm = asyncComponent(() => import('./menuform'))
-const SourceWrap = asyncComponent(() => import('@/menu/modelsource'))
+const SourceWrap = asyncComponent(() => import('@/menu/modulesource'))
 const MenuShell = asyncComponent(() => import('@/menu/menushell'))
 const BgController = asyncComponent(() => import('@/menu/bgcontroller'))
 const PasteController = asyncComponent(() => import('@/menu/pastecontroller'))
@@ -246,37 +246,40 @@
           traversal(item.components)
         } else if (item.type === 'card' || (item.type === 'table' && item.subtype === 'tablecard')) {
           item.action && item.action.forEach(btn => {
+            this.checkBtn(btn)
             buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`)
             _sort++
           })
           item.subcards.forEach(card => {
             card.elements && card.elements.forEach(cell => {
               if (cell.eleType !== 'button') return
-
+              this.checkBtn(cell)
               buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`)
               _sort++
             })
             card.backElements && card.backElements.forEach(cell => {
               if (cell.eleType !== 'button') return
-
+              this.checkBtn(cell)
               buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`)
               _sort++
             })
           })
         } else if (item.type === 'line' || item.type === 'bar') {
           item.action && item.action.forEach(btn => {
+            this.checkBtn(btn)
             buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`)
             _sort++
           })
         } else if (item.type === 'table' && item.subtype === 'normaltable') {
           item.action && item.action.forEach(btn => {
-            if (btn.origin) return
+            this.checkBtn(btn)
             buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`)
             _sort++
           })
           item.cols && item.cols.forEach(col => {
             if (col.type !== 'action') return
             col.elements.forEach(btn => {
+              this.checkBtn(btn)
               buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`)
               _sort++
             })
@@ -288,6 +291,26 @@
     traversal(config.components)
 
     return buttons
+  }
+
+  checkBtn = (btn) => {
+    if (['prompt', 'exec', 'pop'].includes(btn.OpenType) && btn.Ot === 'required' && btn.verify && btn.verify.scripts && btn.verify.scripts.length > 0) {
+      let hascheck = false
+      btn.verify.scripts.forEach(item => {
+        if (item.status === 'false') return
+  
+        if (/\$check@|@check\$/ig.test(item.sql)) {
+          hascheck = true
+        }
+      })
+      if (hascheck) {
+        notification.warning({
+          top: 92,
+          message: `鍙�夋嫨澶氳鐨勬寜閽��${btn.label}銆嬩腑 $check@ 鎴� @check$ 灏嗕笉浼氱敓鏁堬紒`,
+          duration: 5
+        })
+      }
+    }
   }
 
   filterConfig = (components) => {
@@ -321,52 +344,54 @@
       return
     }
 
-    config.components = this.filterConfig(config.components)
-
-    if (config.enabled && this.verifyConfig()) {
-      config.enabled = false
-    }
-
-    let _config = fromJS(config).toJS()
-    delete _config.tableFields
-
-    let _name = (btn.component.name ? btn.component.name + '-' : '') + btn.label
-
-    let param = {
-      func: 'sPC_ButtonParam_AddUpt',
-      ParentID: btn.config.uuid,
-      MenuID: _config.uuid,
-      MenuNo: _config.MenuNo || '',
-      Template: 'CustomPage',
-      MenuName: _name,
-      PageParam: JSON.stringify({Template: 'CustomPage'}),
-      LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(_config)))
-    }
-
-    if (openEdition) { // 鐗堟湰绠$悊
-      param.open_edition = openEdition
-    }
-
-    let btnParam = {             // 娣诲姞鑿滃崟鎸夐挳
-      func: 'sPC_Button_AddUpt',
-      Type: 60,                  // 娣诲姞鑿滃崟涓嬬殑鎸夐挳type涓�40锛屾寜閽笅鐨勬寜閽畉ype涓�60
-      ParentID: _config.uuid,
-      MenuNo: _config.MenuNo,
-      Template: 'CustomPage',
-      PageParam: '',
-      LongParam: '',
-      LText: []
-    }
-
-    btnParam.LText = this.getMenuMessage()
-    btnParam.LText = btnParam.LText.join(' union all ')
-    btnParam.LText = Utils.formatOptions(btnParam.LText)
-    btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-    btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp)
-
     this.setState({
       menuloading: true
-    }, () => {
+    })
+
+    setTimeout(() => {
+      config.components = this.filterConfig(config.components)
+
+      if (config.enabled && this.verifyConfig()) {
+        config.enabled = false
+      }
+
+      let _config = fromJS(config).toJS()
+      delete _config.tableFields
+
+      let _name = (btn.component.name ? btn.component.name + '-' : '') + btn.label
+
+      let param = {
+        func: 'sPC_ButtonParam_AddUpt',
+        ParentID: btn.config.uuid,
+        MenuID: _config.uuid,
+        MenuNo: _config.MenuNo || '',
+        Template: 'CustomPage',
+        MenuName: _name,
+        PageParam: JSON.stringify({Template: 'CustomPage'}),
+        LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(_config)))
+      }
+
+      if (openEdition) { // 鐗堟湰绠$悊
+        param.open_edition = openEdition
+      }
+
+      let btnParam = {             // 娣诲姞鑿滃崟鎸夐挳
+        func: 'sPC_Button_AddUpt',
+        Type: 60,                  // 娣诲姞鑿滃崟涓嬬殑鎸夐挳type涓�40锛屾寜閽笅鐨勬寜閽畉ype涓�60
+        ParentID: _config.uuid,
+        MenuNo: _config.MenuNo,
+        Template: 'CustomPage',
+        PageParam: '',
+        LongParam: '',
+        LText: []
+      }
+
+      btnParam.LText = this.getMenuMessage()
+      btnParam.LText = btnParam.LText.join(' union all ')
+      btnParam.LText = Utils.formatOptions(btnParam.LText)
+      btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+      btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp)
+
       new Promise(resolve => {
         if (delButtons.length === 0) {
           resolve({
@@ -453,7 +478,7 @@
           })
         }
       })
-    })
+    }, 300)
   }
 
   onEnabledChange = () => {
@@ -474,7 +499,7 @@
 
     config.components.forEach(item => {
       if (error) return
-      if (item.subtype === 'propcard' && item.wrap.datatype === 'static') return
+      if (['propcard', 'brafteditor', 'sandbox'].includes(item.subtype) && item.wrap.datatype === 'static') return
 
       if (item.setting) {
         if (item.setting.interType === 'system' && item.setting.execute !== 'false' && !item.setting.dataresource) {
@@ -560,10 +585,10 @@
               {customComponents && customComponents.length ? <Panel header="鑷畾涔夌粍浠�" key="cuscomponent">
                 <SourceWrap components={customComponents} MenuType={MenuType} />
               </Panel> : null}
-              <Panel header={'鑳屾櫙'} key="background">
+              <Panel header={'椤甸潰鑳屾櫙'} key="background">
                 {config ? <BgController config={config} updateConfig={this.updateConfig} /> : null}
               </Panel>
-              <Panel header={'鍐呰竟璺�'} key="padding">
+              <Panel header={'椤甸潰鍐呰竟璺�'} key="padding">
                 {config ? <PaddingController config={config} updateConfig={this.updateConfig} /> : null}
               </Panel>
             </Collapse>

--
Gitblit v1.8.0