From 1af91a055d0de9b2ac3fc94ad68bb7670939410c Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 19 一月 2021 19:21:00 +0800
Subject: [PATCH] 2021-01-19

---
 src/tabviews/zshare/actionList/exceloutbutton/index.jsx |    3 +
 src/tabviews/zshare/actionList/tabbutton/index.jsx      |    3 +
 src/tabviews/zshare/actionList/newpagebutton/index.jsx  |    8 ++
 src/tabviews/zshare/actionList/popupbutton/index.jsx    |    4 +
 src/components/sidemenu/index.jsx                       |   16 ++---
 src/tabviews/zshare/actionList/normalbutton/index.jsx   |    9 +++
 src/components/querylog/index.jsx                       |   80 ++++++++++++++++++++++++++
 src/views/main/index.jsx                                |    3 +
 src/tabviews/zshare/actionList/excelInbutton/index.jsx  |   31 +++++----
 src/tabviews/zshare/actionList/printbutton/index.jsx    |    4 +
 10 files changed, 138 insertions(+), 23 deletions(-)

diff --git a/src/components/querylog/index.jsx b/src/components/querylog/index.jsx
new file mode 100644
index 0000000..13e2293
--- /dev/null
+++ b/src/components/querylog/index.jsx
@@ -0,0 +1,80 @@
+import { Component } from 'react'
+import moment from 'moment'
+
+import Api from '@/api'
+import Utils from '@/utils/utils.js'
+import MKEmitter from '@/utils/events.js'
+
+class QueryLog extends Component {
+  state = {
+    logs: []
+  }
+
+  componentDidMount () {
+    if (window.GLOB.systemType === 'production') {
+      MKEmitter.addListener('queryTrigger', this.queryTrigger)
+      setTimeout(() => {
+        this.sendLog()
+      }, 300000)
+    }
+  }
+
+  /**
+   * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊
+   */
+  componentWillUnmount () {
+    this.setState = () => {
+      return
+    }
+    MKEmitter.removeListener('queryTrigger', this.queryTrigger)
+  }
+
+  sendLog = () => {
+    const { logs } = this.state
+
+    if (logs && logs.length > 0 && sessionStorage.getItem('isEditState') !== 'true') {
+      let logMap = new Map()
+
+      logs.forEach(item => {
+        if (logMap.has(item.menuId)) {
+          let _item = logMap.get(item.menuId)
+          _item.times++
+          logMap.set(item.menuId, _item)
+        } else {
+          item.times = 1
+          logMap.set(item.menuId, item)
+        }
+      })
+      let userid = sessionStorage.getItem('UserID') || ''
+      let LText = [...logMap.values()].map(item => `select '${item.menuId}','${item.times}','${item.name}','${window.GLOB.appkey}','${userid}'`)
+
+      let param = {
+        func: 's_get_users_operation_log',
+        exec_type: 'y', // 鍚庡彴瑙g爜
+        LText: LText.join(' union all ')
+      }
+
+      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+      param.secretkey = Utils.encrypt('', param.timestamp)
+      param.LText = Utils.formatOptions(param.LText)
+
+      Api.getSystemConfig(param)
+
+      this.setState({logs: []})
+    }
+
+    setTimeout(() => {
+      this.sendLog()
+    }, 300000)
+  }
+
+  queryTrigger = (item) => {
+    this.setState({logs: [...this.state.logs, item]})
+  }
+
+  render () {
+    return null
+  }
+}
+
+export default QueryLog
\ No newline at end of file
diff --git a/src/components/sidemenu/index.jsx b/src/components/sidemenu/index.jsx
index 84d18f7..9e348b1 100644
--- a/src/components/sidemenu/index.jsx
+++ b/src/components/sidemenu/index.jsx
@@ -9,6 +9,7 @@
 import { modifyTabview, resetEditLevel, modifyMenuTree, modifyMainMenu } from '@/store/action'
 import { SySMenuList } from './config'
 import options from '@/store/options.js'
+import MKEmitter from '@/utils/events.js'
 import zhCN from '@/locales/zh-CN/main.js'
 import enUS from '@/locales/en-US/main.js'
 import Api from '@/api'
@@ -83,21 +84,16 @@
     })
   }
 
-  changemenu(e) {
+  changemenu(menu) {
     if (this.props.editState && this.props.editLevel !== 'HS') {
-      e.preventDefault()
       return
     }
-    
-    let menu = JSON.parse(e.target.dataset.item)
 
     if (menu.OpenType === 'newpage' || menu.OpenType === 'NewPage') {
-      e.preventDefault()
       window.open(menu.src)
     } else if (menu.OpenType === 'blank') {
       menu.selected = true
       this.props.modifyTabview([menu])
-      e.preventDefault()
     } else {
       let tabs = fromJS(this.props.tabviews).toJS()
       tabs = tabs.filter(tab => {
@@ -114,8 +110,10 @@
         tabs.push(menu)
         this.props.modifyTabview(tabs)
       })
-      
-      e.preventDefault()
+    }
+
+    if (window.GLOB.systemType === 'production') {
+      MKEmitter.emit('queryTrigger', {menuId: menu.MenuID, name: '鑿滃崟'})
     }
   }
 
@@ -306,7 +304,7 @@
                 {item.children.map(cell => {
                   return (
                     <Menu.Item key={cell.MenuID}>
-                      <a href={cell.src} id={cell.MenuID} data-item={JSON.stringify(cell)} onClick={this.changemenu.bind(this)}>{cell.MenuName}</a>
+                      <a href={cell.src} id={cell.MenuID} onClick={() => this.changemenu(cell)}>{cell.MenuName}</a>
                     </Menu.Item>
                   )
                 })}
diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
index 33ecd5d..0ffe673 100644
--- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
@@ -93,25 +93,28 @@
         duration: 5
       })
       return
-    }
-
-    if (btn.verify && btn.verify.sheet && btn.verify.columns && btn.verify.columns.length > 0) {
-      let primaryId = '' // 瀵煎叆鏃惰Id
-      if (btn.Ot === 'requiredSgl') {
-        primaryId = data[0][setting.primaryKey] || ''
-      }
-
-      this.setState({
-        primaryId: primaryId
-      }, () => {
-        this.refs.excelIn.exceltrigger()
-      })
-    } else {
+    } else if (!btn.verify || !btn.verify.sheet || !btn.verify.columns || btn.verify.columns.length === 0) {
       notification.warning({
         top: 92,
         message: 'excel瀵煎叆楠岃瘉淇℃伅鏈缃紒',
         duration: 5
       })
+      return
+    }
+
+    let primaryId = '' // 瀵煎叆鏃惰Id
+    if (btn.Ot === 'requiredSgl') {
+      primaryId = data[0][setting.primaryKey] || ''
+    }
+
+    this.setState({
+      primaryId: primaryId
+    }, () => {
+      this.refs.excelIn.exceltrigger()
+    })
+
+    if (window.GLOB.systemType === 'production') {
+      MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '瀵煎叆Excel'})
     }
   }
 
diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
index 8da8de9..e99d2dd 100644
--- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
@@ -111,6 +111,9 @@
     }
 
     MKEmitter.emit('getexceloutparam', btn.$menuId, btn.uuid)
+    if (window.GLOB.systemType === 'production') {
+      MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '瀵煎嚭Excel'})
+    }
   }
 
   /**
diff --git a/src/tabviews/zshare/actionList/newpagebutton/index.jsx b/src/tabviews/zshare/actionList/newpagebutton/index.jsx
index f4e8d64..dcf07e8 100644
--- a/src/tabviews/zshare/actionList/newpagebutton/index.jsx
+++ b/src/tabviews/zshare/actionList/newpagebutton/index.jsx
@@ -97,7 +97,10 @@
       Remark = data[0].Remark || ''
     }
 
+    let _name = '鏂伴〉闈�'
+
     if (btn.pageTemplate === 'billprint') {
+      _name = '鍗曟嵁鎵撳嵃'
       if (btn.Ot === 'required' && data && data.length > 0) {
         data.forEach((item, i) => {
           let _id = item[setting.primaryKey] || ''
@@ -118,6 +121,7 @@
     } else if (btn.pageTemplate === 'pay') {
       let _p = `ID=${Id}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID')}&logo=${window.GLOB.doclogo}&name=${sessionStorage.getItem('Full_Name')}&icp=${window.GLOB.ICP}&copyRight=${window.GLOB.copyRight}`
       let url = '#/pay/' +  window.btoa(window.encodeURIComponent(_p))
+      _name = '鏀粯'
       
       confirm({
         title: '璇峰湪浠樻椤甸潰瀹屾垚璁㈠崟鏀粯銆�',
@@ -152,6 +156,10 @@
 
       window.open(url)
     }
+
+    if (window.GLOB.systemType === 'production') {
+      MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: _name})
+    }
   }
 
   render() {
diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index c5cb799..3cf59e8 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -184,6 +184,15 @@
         this.improveAction()
       })
     }
+
+    if (window.GLOB.systemType === 'production') {
+      let _change = {
+        prompt: '鎻愮ず妗�',
+        exec: '鐩存帴鎵ц',
+        pop: '寮圭獥锛堣〃鍗曪級'
+      }
+      MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: _change[btn.OpenType]})
+    }
   }
 
   /**
diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx
index 8baae5f..539e70c 100644
--- a/src/tabviews/zshare/actionList/popupbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/popupbutton/index.jsx
@@ -144,6 +144,10 @@
       primaryId: primaryId,
       visible: true
     })
+
+    if (window.GLOB.systemType === 'production') {
+      MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '寮圭獥锛堟爣绛撅級'})
+    }
   }
 
   /**
diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx
index e80dd27..0b21d94 100644
--- a/src/tabviews/zshare/actionList/printbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/printbutton/index.jsx
@@ -160,6 +160,10 @@
     } else {
       this.triggerPrint(data)
     }
+
+    if (window.GLOB.systemType === 'production') {
+      MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '鏍囩鎵撳嵃'})
+    }
   }
 
   /**
diff --git a/src/tabviews/zshare/actionList/tabbutton/index.jsx b/src/tabviews/zshare/actionList/tabbutton/index.jsx
index 54e43b7..9223ef1 100644
--- a/src/tabviews/zshare/actionList/tabbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/tabbutton/index.jsx
@@ -148,6 +148,9 @@
     })
 
     MKEmitter.emit('openNewTab')
+    if (window.GLOB.systemType === 'production') {
+      MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '鏍囩椤�'})
+    }
   }
 
   render() {
diff --git a/src/views/main/index.jsx b/src/views/main/index.jsx
index 482423a..1e0d7ea 100644
--- a/src/views/main/index.jsx
+++ b/src/views/main/index.jsx
@@ -2,9 +2,11 @@
 import { ConfigProvider } from 'antd'
 import enUS from 'antd/es/locale/en_US'
 import zhCN from 'antd/es/locale/zh_CN'
+
 import Header from '@/components/header'
 import Sidemenu from '@/components/sidemenu'
 import Tabview from '@/components/tabview'
+import QueryLog from '@/components/querylog'
 
 import './index.scss'
 
@@ -18,6 +20,7 @@
           <Header key="header"/>
           <Sidemenu key="sidemenu"/>
           <Tabview key="tabview"/>
+          <QueryLog />
         </ConfigProvider>
       </div>
     )

--
Gitblit v1.8.0