From 8d66ff34fae5b048a6b7923cc75d34f13a08be9d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 02 八月 2022 11:42:43 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/views/menudesign/index.jsx |   87 ++++++++++++++++++++-----------------------
 1 files changed, 41 insertions(+), 46 deletions(-)

diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx
index 05c041b..0f24503 100644
--- a/src/views/menudesign/index.jsx
+++ b/src/views/menudesign/index.jsx
@@ -75,7 +75,8 @@
     customComponents: [],
     comloading: false,
     settingshow: true,
-    eyeopen: false
+    eyeopen: false,
+    modalStatus: false       // 寮圭獥鏄惁寮�鍚紝鍒ゆ柇ctrl+s鏄惁鍙敤
   }
 
   UNSAFE_componentWillMount() {
@@ -106,6 +107,7 @@
 
   componentDidMount () {
     MKEmitter.addListener('delButtons', this.delButtons)
+    MKEmitter.addListener('modalStatus', this.modalStatus)
     MKEmitter.addListener('thawButtons', this.thawButtons)
     MKEmitter.addListener('copyButtons', this.copyButtons)
     MKEmitter.addListener('changePopview', this.initPopview)
@@ -138,6 +140,15 @@
       let _shortcut = `${preKey}+${keyCode}`
 
       if (_shortcut === 'ctrl+83') {
+        if (this.state.modalStatus) {
+          notification.warning({
+            top: 92,
+            message: '璇蜂繚瀛�' + this.state.modalStatus,
+            duration: 5
+          })
+          return false
+        }
+
         let node = document.getElementById('save-modal-config')
         if (!node) {
           node = document.getElementById('save-pop-config')
@@ -162,12 +173,17 @@
       return
     }
     MKEmitter.removeListener('delButtons', this.delButtons)
+    MKEmitter.removeListener('modalStatus', this.modalStatus)
     MKEmitter.removeListener('thawButtons', this.thawButtons)
     MKEmitter.removeListener('copyButtons', this.copyButtons)
     MKEmitter.removeListener('changePopview', this.initPopview)
     MKEmitter.removeListener('triggerMenuSave', this.triggerMenuSave)
     MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle)
     MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent)
+  }
+
+  modalStatus = (val) => {
+    this.setState({modalStatus: val})
   }
 
   triggerMenuSave = () => {
@@ -436,9 +452,13 @@
           config.parentId = 'BillPrintTemp'
           config.MenuName = MenuName
           config.MenuNo = MenuNo
-          config.firstCount = config.firstCount || 15
+
+          if (config.everyPCount && !config.printPage) {
+            config.printPage = 'page'
+          }
+
+          config.printPage = config.printPage || 'auto'
           config.everyPCount = config.everyPCount || 15
-          config.lastCount = config.lastCount || ''
         }
 
         config.open_edition = result.open_edition || ''
@@ -593,7 +613,7 @@
     const { MenuType, copyButtons, thawButtons } = this.state
     let config = fromJS(this.state.config).toJS()
 
-    if (MenuType === 'billPrint' && (!config.firstCount || !config.everyPCount)) {
+    if (MenuType === 'billPrint' && config.printPage === 'page' && !config.everyPCount) {
       notification.warning({
         top: 92,
         message: '璇峰畬鍠勫熀鏈俊鎭紒',
@@ -771,6 +791,12 @@
         if (!res) return
 
         if (res.status) {
+          if (MenuType !== 'billPrint') { // 鍩烘湰淇℃伅鏀瑰彉鏃讹紝閫氱煡鑿滃崟鍒楄〃鏇存柊
+            let ori = this.state.oriConfig
+            if (config.MenuName !== ori.MenuName || config.MenuNo !== ori.MenuNo || config.parentId !== ori.parentId) {
+              localStorage.setItem('menuUpdate', new Date().getTime())
+            }
+          }
           config.open_edition = res.open_edition || ''
           this.setState({
             config,
@@ -906,7 +932,7 @@
         }
         MKEmitter.emit('completeSave')
       })
-    }, 300)
+    }, 300 + (+sessionStorage.getItem('mkDelay')))
   }
 
   getRoleFields = () => {
@@ -959,6 +985,7 @@
     let check = (components) => {
       components.forEach(item => {
         if (error) return
+        
         if (item.type === 'tabs') {
           item.subtabs.forEach(tab => {
             check(tab.components)
@@ -967,46 +994,14 @@
         } else if (item.type === 'group') {
           check(item.components)
           return
-        } else if (item.subtype === 'propcard' && item.subcards.length === 0) {
-          error = `缁勪欢銆�${item.name}銆嬩腑鍗$墖涓嶅彲涓虹┖锛乣
+        } else if (!item.errors || item.errors.length === 0) {
           return
         }
-        
-        if (['voucher'].includes(item.subtype)) return
-        if (['propcard', 'brafteditor', 'sandbox', 'stepform', 'tabform'].includes(item.subtype) && item.wrap.datatype === 'static') return
-        if (['balcony'].includes(item.type) && item.wrap.datatype === 'static') return
-  
-        if (item.setting) {
-          if (item.setting.interType === 'system' && item.setting.execute !== 'false' && !item.setting.dataresource) {
-            error = `缁勪欢銆�${item.name}銆嬫湭璁剧疆鏁版嵁婧愶紒`
-          } else if (item.setting.interType === 'system' && item.setting.execute === 'false' && item.scripts.length === 0) {
-            error = `缁勪欢銆�${item.name}銆嬫湭璁剧疆鏁版嵁婧愶紒`
-          } else if (!item.setting.primaryKey) {
-            error = `缁勪欢銆�${item.name}銆嬫湭璁剧疆涓婚敭锛乣
-          } else if (!item.setting.supModule && item.type !== 'balcony' && (!item.wrap || item.wrap.supType !== 'multi')) {
-            error = `缁勪欢銆�${item.name}銆嬫湭璁剧疆涓婄骇缁勪欢锛乣
-          }
-        }
-        if (item.type === 'bar' || item.type === 'line' || item.type === 'pie') {
-          if (!item.plot.Xaxis) {
-            error = `缁勪欢銆�${item.name}銆嬪浘琛ㄥ瓧娈靛皻鏈缃紒`
-          }
-        } else if (item.type === 'dashboard' && !item.plot.valueField) {
-          error = `缁勪欢銆�${item.name}銆嬫樉绀哄�煎皻鏈缃紒`
-        } else if (item.type === 'scatter' && (!item.plot.Xaxis || !item.plot.Yaxis || !item.plot.gender)) {
-          error = `缁勪欢銆�${item.name}銆嬪潗鏍囪酱灏氭湭璁剧疆锛乣
-        } else if (item.type === 'tree' && (!item.wrap.valueField || !item.wrap.labelField || !item.wrap.parentField)) {
-          error = `缁勪欢銆�${item.name}銆嬪熀鏈俊鎭皻鏈缃紒`
-        } else if (item.type === 'table' && item.wrap.doubleClick) {
-          let _actions = [...item.action]
-          item.cols.forEach(col => {
-            if (col.type !== 'action') return
-            _actions.push(...col.elements)
-          })
-          if (_actions.findIndex((m) => m.uuid === item.wrap.doubleClick) === -1) {
-            error = `缁勪欢銆�${item.name}銆嬬粦瀹氱殑鍙屽嚮鎸夐挳宸插垹闄わ紒`
-          }
-        }
+
+        item.errors.forEach(err => {
+          if (err.level !== 0 || error) return
+          error = `缁勪欢銆�${item.name}銆�${err.detail}`
+        })
       })
     }
 
@@ -1100,7 +1095,7 @@
   }
 
   render () {
-    const { activeKey, comloading, MenuType, popBtn, visible, dict, MenuId, config, settingshow, ParentId, MenuName, MenuNo, menuloading, customComponents, eyeopen } = this.state
+    const { activeKey, comloading, MenuType, popBtn, visible, dict, MenuId, config, settingshow, ParentId, menuloading, customComponents, eyeopen } = this.state
 
     return (
       <ConfigProvider locale={_locale}>
@@ -1121,8 +1116,8 @@
                       config={config}
                       MenuId={MenuId}
                       parentId={ParentId}
-                      MenuName={MenuName}
-                      MenuNo={MenuNo}
+                      MenuName={config.MenuName}
+                      MenuNo={config.MenuNo}
                       updateConfig={this.updateConfig}
                     /> : null}
                     {config && MenuType === 'home' ? <HomeForm

--
Gitblit v1.8.0