From 1da6506bf58270bacc2a4345002c6b082835580e Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 21 十月 2021 23:17:08 +0800
Subject: [PATCH] 2021-10-21

---
 src/menu/popview/index.jsx |   54 +++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/src/menu/popview/index.jsx b/src/menu/popview/index.jsx
index bed4339..9f1a385 100644
--- a/src/menu/popview/index.jsx
+++ b/src/menu/popview/index.jsx
@@ -19,6 +19,7 @@
 const { confirm } = Modal
 
 const MenuForm = asyncComponent(() => import('./menuform'))
+const Versions = asyncComponent(() => import('@/menu/versions'))
 const Header = asyncComponent(() => import('@/menu/header'))
 const SourceWrap = asyncComponent(() => import('@/menu/modulesource'))
 const MenuShell = asyncComponent(() => import('@/menu/menushell'))
@@ -39,9 +40,7 @@
 
   state = {
     dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
-    MenuType: '',
     MenuId: '',
-    MenuNo: '',
     delButtons: [],
     activeKey: 'basedata',
     menuloading: false,
@@ -177,6 +176,11 @@
     let param = {
       func: 'sPC_Get_LongParam',
       MenuID: MenuId
+    }
+
+    if (sessionStorage.getItem('appType') === 'pc') {
+      param.TypeCharOne = sessionStorage.getItem('kei_no')
+      param.Typename = 'pc'
     }
 
     Api.getSystemConfig(param).then(result => {
@@ -380,11 +384,18 @@
         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)
+      if (sessionStorage.getItem('appType') === 'pc') {
+        param.TypeCharOne = sessionStorage.getItem('kei_no')
+        param.Typename = 'pc'
+
+        btnParam.LText = ''
+      } else {
+        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) {
@@ -497,6 +508,8 @@
           error = `缁勪欢銆�${item.name}銆嬫湭璁剧疆鏁版嵁婧愶紒`
         } else if (item.setting.interType && !item.setting.primaryKey) {
           error = `缁勪欢銆�${item.name}銆嬫湭璁剧疆涓婚敭锛乣
+        } else if (!item.setting.supModule) {
+          error = `缁勪欢銆�${item.name}銆嬫湭璁剧疆涓婄骇缁勪欢锛乣
         }
       }
       if (item.type === 'bar' || item.type === 'line' || item.type === 'pie') {
@@ -554,11 +567,29 @@
 
     this.setState({config})
     window.GLOB.customMenu = config
+    
+    notification.success({
+      top: 92,
+      message: '绮樿创鎴愬姛锛�',
+      duration: 2
+    })
+  }
+
+  refreshConfig = () => {
+    this.setState({
+      delButtons: [],
+      activeKey: 'basedata',
+      menuloading: false,
+      oriConfig: null,
+      config: null,
+    }, () => {
+      this.getMenuParam()
+    })
   }
 
   render () {
     const { btn } = this.props
-    const { activeKey, MenuType, dict, config, menuloading, customComponents } = this.state
+    const { activeKey, dict, config, menuloading, customComponents, MenuId } = this.state
 
     return (
       <div className="pc-poper-view">
@@ -576,10 +607,10 @@
                 </Panel>
                 {/* 缁勪欢娣诲姞 */}
                 <Panel header={dict['mob.component']} key="component">
-                  <SourceWrap MenuType={MenuType} />
+                  <SourceWrap MenuType="" />
                 </Panel>
                 {customComponents && customComponents.length ? <Panel header="鑷畾涔夌粍浠�" key="cuscomponent">
-                  <SourceWrap components={customComponents} MenuType={MenuType} />
+                  <SourceWrap components={customComponents} MenuType="" />
                 </Panel> : null}
                 <Panel header={'椤甸潰鑳屾櫙'} key="background">
                   {config ? <BgController config={config} updateConfig={this.updateConfig} /> : null}
@@ -594,9 +625,10 @@
                 <div> {config && config.MenuName} </div>
               } bordered={false} extra={
                 <div>
+                  <Versions MenuId={MenuId} open_edition={config ? config.open_edition : ''} updateConfig={this.refreshConfig}/>
                   <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/>
                   <StyleCombControlButton menu={config} />
-                  <PasteController type="menu" Tab={null} insert={this.insert} />
+                  <PasteController insert={this.insert} />
                   {config ? <Switch className="big" checkedChildren={dict['mob.enable']} unCheckedChildren={dict['mob.disable']} checked={config.enabled} onChange={this.onEnabledChange} /> : null}
                   <Button type="primary" onClick={this.submitConfig} loading={menuloading}>{dict['mob.save']}</Button>
                   <Button type="default" onClick={this.closeView}>{dict['mob.return']}</Button>

--
Gitblit v1.8.0