From de516477e7c11d667b3d77f6a37b5df8e893bd29 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 22 二月 2022 09:50:45 +0800
Subject: [PATCH] 2022-02-22

---
 src/views/menudesign/index.jsx |  114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 109 insertions(+), 5 deletions(-)

diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx
index 1fe7fc1..dcc8745 100644
--- a/src/views/menudesign/index.jsx
+++ b/src/views/menudesign/index.jsx
@@ -3,7 +3,7 @@
 import { is, fromJS } from 'immutable'
 import moment from 'moment'
 import HTML5Backend from 'react-dnd-html5-backend'
-import { ConfigProvider, notification, Modal, Collapse, Card, Switch, Button } from 'antd'
+import { ConfigProvider, notification, Modal, Collapse, Card, Switch, Button, Typography } from 'antd'
 import html2canvas from 'html2canvas'
 
 import Api from '@/api'
@@ -21,6 +21,7 @@
 
 const { Panel } = Collapse
 const { confirm } = Modal
+const { Paragraph } = Typography
 const _locale = sessionStorage.getItem('lang') !== 'en-US' ? antdZhCN : antdEnUS
 
 const MenuForm = asyncComponent(() => import('./menuform'))
@@ -111,8 +112,43 @@
     setTimeout(() => {
       this.updateCustomComponent()
       this.getAppPictures()
+      this.getPrintTemp()
       setGLOBFuncs()
     }, 1000)
+
+    document.onkeydown = (event) => {
+      let e = event || window.event
+      let keyCode = e.keyCode || e.which || e.charCode
+      let preKey = ''
+
+      if (e.ctrlKey) {
+        preKey = 'ctrl'
+      }
+      if (e.shiftKey) {
+        preKey = 'shift'
+      } else if (e.altKey) {
+        preKey = 'alt'
+      }
+      
+      if (!preKey || !keyCode) return
+      
+      let _shortcut = `${preKey}+${keyCode}`
+
+      if (_shortcut === 'ctrl+83') {
+        let node = document.getElementById('save-modal-config')
+        if (!node) {
+          node = document.getElementById('save-pop-config')
+        }
+        if (!node) {
+          node = document.getElementById('save-config')
+        }
+
+        if (node) {
+          node.click()
+        }
+        return false
+      }
+    }
   }
 
   /**
@@ -135,6 +171,50 @@
     if (this.state.visible) return
 
     this.submitConfig()
+  }
+
+  getPrintTemp = () => {
+    if (!sessionStorage.getItem('printTemps')) {
+      let _sql = `select ID,Images,PrintTempNO+PrintTempName as PN from sPrintTemplate 
+      where appkey= @appkey@ and Deleted=0 and typechartwo='web_print'
+      union select ID,Images,a.PrintTempNO+PrintTempName as PN 
+      from (select * from sPrintTemplate where appkey= '' and Deleted=0 and typechartwo='web_print') a 
+      left join (select PrintTempNO from sPrintTemplate where appkey= @appkey@ and Deleted=0 ) b 
+      on a.PrintTempNO=b.PrintTempNO 
+      left join (select Srcid from sPrintTemplate_Log where appkey='' and apicode= @appkey@ and Deleted=0 ) c 
+      on a.ID=c.Srcid where b.PrintTempNO is null and c.Srcid is null`
+  
+      let param = {
+        func: 'sPC_Get_SelectedList',
+        LText: Utils.formatOptions(_sql),
+        obj_name: 'data',
+        arr_field: 'PN,ID,Images'
+      }
+  
+      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+      param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+  
+      param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉
+  
+      Api.getSystemConfig(param).then(res => {
+        if (res.status) {
+          let temps = res.data.map(temp => {
+            return {
+              value: temp.ID,
+              text: temp.PN
+            }
+          })
+  
+          sessionStorage.setItem('printTemps', JSON.stringify(temps))
+        } else {
+          notification.warning({
+            top: 92,
+            message: res.message,
+            duration: 5
+          })
+        }
+      })
+    }
   }
 
   getAppPictures = () => {
@@ -409,7 +489,7 @@
               _sort++
             })
           })
-        } else if (item.type === 'carousel') {
+        } else if (item.type === 'carousel' || item.type === 'timeline') {
           item.subcards.forEach(card => {
             card.elements && card.elements.forEach(cell => {
               if (cell.eleType !== 'button') return
@@ -425,13 +505,13 @@
             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') {
+        } else if (item.type === 'line' || item.type === 'bar' || item.type === 'chart') {
           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') {
+        } else if (item.type === 'table' && (item.subtype === 'normaltable' || item.subtype === 'editable')) {
           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`)
@@ -721,6 +801,7 @@
                       _conf.uuid = item.uuid
                       _conf.MenuID = item.uuid
                       _conf.Template = 'CustomPage'
+                      _conf.enabled = false
                     } else {
                       resolve({
                         status: true
@@ -850,7 +931,12 @@
         } else if (item.type === 'group') {
           check(item.components)
           return
+        } else if (item.subtype === 'propcard' && item.subcards.length === 0) {
+          error = `缁勪欢銆�${item.name}銆嬩腑鍗$墖涓嶅彲涓虹┖锛乣
+          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
   
@@ -861,6 +947,8 @@
             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') {
@@ -873,6 +961,15 @@
           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}銆嬬粦瀹氱殑鍙屽嚮鎸夐挳宸插垹闄わ紒`
+          }
         }
       })
     }
@@ -917,6 +1014,12 @@
 
     this.setState({config})
     window.GLOB.customMenu = config
+
+    notification.success({
+      top: 92,
+      message: '绮樿创鎴愬姛锛�',
+      duration: 2
+    })
   }
 
   render () {
@@ -958,6 +1061,7 @@
                     /> : null}
                     {/* 琛ㄥ悕娣诲姞 */}
                     {config ? <TableComponent config={config} updatetable={this.updateConfig}/> : null}
+                    {config ? <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>鑿滃崟ID</Paragraph> : null}
                   </Panel>
                   {/* 缁勪欢娣诲姞 */}
                   <Panel header={dict['mob.component']} key="component">
@@ -986,7 +1090,7 @@
                     <StyleCombControlButton menu={config} />
                     <PasteController insert={this.insert} />
                     <Switch className="big" checkedChildren={dict['mob.enable']} unCheckedChildren={dict['mob.disable']} checked={config && config.enabled} onChange={this.onEnabledChange} />
-                    <Button type="primary" onClick={this.submitConfig} loading={menuloading}>{dict['mob.save']}</Button>
+                    <Button type="primary" id="save-config" onClick={this.submitConfig} loading={menuloading}>{dict['mob.save']}</Button>
                     <Button type="default" onClick={this.closeView}>鍏抽棴</Button>
                   </div>
                 } style={{ width: '100%' }}>

--
Gitblit v1.8.0