From c7f79abded9ad2e29f297da4a04a641b96b61c5e Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 12 十月 2019 09:51:22 +0800
Subject: [PATCH] add-datamanage

---
 src/components/tabview/index.jsx |   38 ++++++++++++++++++++++++++++++--------
 1 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/src/components/tabview/index.jsx b/src/components/tabview/index.jsx
index 3699fc6..1fa9c17 100644
--- a/src/components/tabview/index.jsx
+++ b/src/components/tabview/index.jsx
@@ -2,12 +2,14 @@
 import PropTypes from 'prop-types'
 import {connect} from 'react-redux'
 import { is, fromJS } from 'immutable'
-import {Tabs, Icon, ConfigProvider} from 'antd'
+import {Tabs, Icon, Button, ConfigProvider, message} from 'antd'
 import {modifyTabview, toggleIsiframe} from '@/store/action'
 import asyncComponent from '@/utils/asyncComponent'
 import NotFount from '@/components/404'
 import enUS from 'antd/es/locale/en_US'
 import zhCN from 'antd/es/locale/zh_CN'
+import mzhCN from '@/locales/zh-CN/main.js'
+import menUS from '@/locales/en-US/main.js'
 import moment from 'moment'
 import 'moment/locale/zh-cn'
 import './index.scss'
@@ -24,6 +26,7 @@
   state = {
     selectedTabId: '', // 褰撳墠閫変腑tab椤甸潰
     iFrameHeight: 0,
+    dict: (!sessionStorage.getItem('lang') || sessionStorage.getItem('lang') === 'zh-CN') ? mzhCN : menUS,
     locale: (!sessionStorage.getItem('lang') || sessionStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS
   }
 
@@ -55,9 +58,13 @@
 
   selectcomponent (view) {
     // 鏍规嵁tab椤典腑鑿滃崟淇℃伅锛岄�夋嫨鎵�闇�鐨勭粍浠�
-    if (view.Remark === 'CommonTable') {
+    if (view.type === 'CommonTable') {
       return (<Comps.CommonTable MenuNo={view.MenuNo} key={view.MenuID}/>)
-    } else if (view.LinkUrl.split('?')[0] === 'Main/Index') {
+    } else if (view.type === 'DataManage') {
+      return (<Comps.DataManage MenuNo={view.MenuNo} key={view.MenuID}/>)
+    } else if (view.type === 'RoleManage') {
+      return (<Comps.RoleManage MenuNo={view.MenuNo} key={view.MenuID}/>)
+    } else if (view.type === 'iframe') {
       return (<Comps.Iframe key={view.MenuID} title={view.MenuName} url={'http://qingqiumarket.cn/MKWMS/zh-CN/' + view.LinkUrl}/>)
     } else {
       return (<NotFount key={view.MenuID} />)
@@ -68,9 +75,7 @@
     // 绐楀彛鍦╥frame涓庢櫘閫氶〉闈㈠垏鎹㈡椂锛屼慨鏀瑰乏渚ц彍鍗曟爮鏍峰紡
     if (!view) return
     let _isiframe = this.props.isiframe
-    if (view && view.Remark === 'CommonTable') {
-      _isiframe = false
-    } else if (view && view.LinkUrl.split('?')[0] === 'Main/Index') {
+    if (view && view.type === 'iframe') {
       _isiframe = true
     } else {
       _isiframe = false
@@ -79,6 +84,18 @@
     if (_isiframe !== this.props.isiframe) {
       this.props.toggleIsiframe(_isiframe)
     }
+  }
+
+  copyMenuNo = (e) => {
+    e.stopPropagation()
+    let oInput = document.createElement('input')
+    oInput.value = e.target.dataset.menuno || ''
+    document.body.appendChild(oInput)
+    oInput.select()
+    document.execCommand('Copy')
+    oInput.className = 'oInput'
+    oInput.style.display='none'
+    message.success(this.state.dict['main.copy.success'])
   }
 
   UNSAFE_componentWillMount () {
@@ -95,10 +112,14 @@
       if (nextProps.tabviews.length > this.props.tabviews.length) {
         // 鏌ョ湅鏂皌ab椤甸渶瑕佺粍浠舵槸鍚﹀姞杞�
         let newtab = nextProps.tabviews[nextProps.tabviews.length - 1]
-        if (!Comps.CommonTable && newtab.Remark === 'CommonTable') {
+        if (!Comps.CommonTable && newtab.type === 'CommonTable') {
           Comps.CommonTable = asyncComponent(() => import('@/tabviews/commontable'))
-        } else if (!Comps.Iframe && newtab.LinkUrl.split('?')[0] === 'Main/Index') {
+        } else if (!Comps.Iframe && newtab.type === 'iframe') {
           Comps.Iframe = asyncComponent(() => import('@/tabviews/iframe'))
+        } else if (!Comps.DataManage && newtab.type === 'DataManage') {
+          Comps.DataManage = asyncComponent(() => import('@/tabviews/datamanage'))
+        } else if (!Comps.DataManage && newtab.type === 'RoleManage') {
+          Comps.RoleManage = asyncComponent(() => import('@/tabviews/rolemanage'))
         }
       }
 
@@ -138,6 +159,7 @@
                       key={view.MenuID}
                     >
                       {this.selectcomponent(view)}
+                      <Button className={'main-copy ' + (view.type === 'iframe' ? 'ifr-copy' : '')} icon="copy" data-menuno={view.MenuNo} onClick={this.copyMenuNo} shape="circle" />
                     </Tabs.TabPane>
                   )
                 })}

--
Gitblit v1.8.0