From 06404e701a89955958cbf56213e2eec618d8644d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 16 十二月 2020 18:36:16 +0800
Subject: [PATCH] 2020-12-16

---
 src/tabviews/zshare/actionList/normalbutton/index.jsx |  114 ++++++++++++++++++++-------------------------------------
 1 files changed, 40 insertions(+), 74 deletions(-)

diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index 6a8abe7..35ea599 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -20,9 +20,9 @@
 class NormalButton extends Component {
   static propTpyes = {
     show: PropTypes.any,              // 鎸夐挳鏄剧ず鏍峰紡鎺у埗
+    position: PropTypes.any,          // 鎸夐挳浣嶇疆锛屽伐鍏锋爮涓簍oolbar
     BID: PropTypes.string,            // 涓昏〃ID
     BData: PropTypes.any,             // 涓昏〃鏁版嵁
-    MenuName: PropTypes.any,          // 鑿滃崟鍚嶇О
     style: PropTypes.any,             // 鎸夐挳鏍峰紡
     selectedData: PropTypes.any,      // 瀛愯〃涓�夋嫨鏁版嵁
     Tab: PropTypes.any,               // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭�
@@ -49,9 +49,9 @@
   }
 
   componentDidMount () {
-    const { show } = this.props
+    const { position } = this.props
 
-    if (show === 'actionList') {
+    if (position === 'toolbar') {
       MKEmitter.addListener('triggerBtnId', this.actionTrigger)
     }
   }
@@ -82,7 +82,7 @@
   /**
    * @description 瑙﹀彂鎸夐挳鎿嶄綔
    */
-  actionTrigger = (triggerId) => {
+  actionTrigger = (triggerId, record) => {
     const { setting, Tab, BID, btn, selectedData } = this.props
     const { loading } = this.state
 
@@ -98,7 +98,7 @@
     }
 
     let _this = this
-    let data = selectedData || []
+    let data = record || selectedData || []
 
     if (btn.Ot !== 'notRequired' && data.length === 0) {
       // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹�
@@ -191,7 +191,7 @@
    * @description 鎸夐挳鎻愪氦鎵ц
    */
   execSubmit = (data, _resolve, formdata) => {
-    const { setting, columns, btn, MenuName } = this.props
+    const { setting, columns, btn } = this.props
     if (btn.intertype === 'inner' || btn.intertype === 'system') {
       // 鎵ц鏂瑰紡涓哄琛屾嫾鎺ワ紝涓旀墦寮�鏂瑰紡涓鸿〃鍗曟椂锛屼細杞负寰幆鍙戦�佽姹�
       // 鎵撳紑鏂瑰紡涓烘ā鎬佹锛屼娇鐢ㄥ唴閮ㄥ嚱鏁版坊鍔�(鏈夋壒閲忔坊鍔犲満鏅紝宸插幓闄�)
@@ -226,21 +226,17 @@
             param.ID = primaryId
             param.LText = Utils.getSysDefaultSql(btn, setting, '', param, data[0], columns, this.props.Tab) // 鏁版嵁婧�
 
-            if (this.props.dataManager) { // 鏁版嵁鏉冮檺
+            if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
               param.LText = param.LText.replace(/\$@/ig, '/*')
               param.LText = param.LText.replace(/@\$/ig, '*/')
             } else {
               param.LText = param.LText.replace(/@\$|\$@/ig, '')
             }
 
-            let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText)
-
-            param.LText2 = LText2
-            param.LText1 = LText1
-            param.LText = LText
-
+            param.exec_type = 'y' // 鍚庡彴瑙g爜
             param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-            param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+            param.secretkey = Utils.encrypt('', param.timestamp)
+            param.LText = Utils.formatOptions(param.LText)
           }
         } else if (btn.OpenType === 'pop') { // 琛ㄥ崟
           if (btn.innerFunc) {
@@ -267,40 +263,32 @@
             param.ID = primaryId || Utils.getguid()
             param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], columns, this.props.Tab) // 鏁版嵁婧�
             
-            if (this.props.dataManager) { // 鏁版嵁鏉冮檺
+            if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
               param.LText = param.LText.replace(/\$@/ig, '/*')
               param.LText = param.LText.replace(/@\$/ig, '*/')
             } else {
               param.LText = param.LText.replace(/@\$|\$@/ig, '')
             }
 
-            let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText)
-
-            param.LText2 = LText2
-            param.LText1 = LText1
-            param.LText = LText
-
+            param.exec_type = 'y' // 鍚庡彴瑙g爜
             param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-            param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+            param.secretkey = Utils.encrypt('', param.timestamp)
+            param.LText = Utils.formatOptions(param.LText)
           } else if (btn.sql) {
             param.ID = primaryId
             param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], columns, this.props.Tab) // 鏁版嵁婧�
             
-            if (this.props.dataManager) { // 鏁版嵁鏉冮檺
+            if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
               param.LText = param.LText.replace(/\$@/ig, '/*')
               param.LText = param.LText.replace(/@\$/ig, '*/')
             } else {
               param.LText = param.LText.replace(/@\$|\$@/ig, '')
             }
 
-            let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText)
-
-            param.LText2 = LText2
-            param.LText1 = LText1
-            param.LText = LText
-            
+            param.exec_type = 'y' // 鍚庡彴瑙g爜
             param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-            param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+            param.secretkey = Utils.encrypt('', param.timestamp)
+            param.LText = Utils.formatOptions(param.LText)
           }
         }
 
@@ -313,7 +301,7 @@
         }
 
         if (param.func === 'sPC_TableData_InUpDe') {
-          param.menuname = `${MenuName ? MenuName + '-' : ''}${btn.label}`
+          param.menuname = btn.logLabel
         }
 
         Api.genericInterface(param).then((res) => {
@@ -358,20 +346,17 @@
               param.ID = primaryId
               param.LText = Utils.getSysDefaultSql(btn, setting, '', param, cell, columns, this.props.Tab) // 鏁版嵁婧�
               
-              if (this.props.dataManager) { // 鏁版嵁鏉冮檺
+              if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
                 param.LText = param.LText.replace(/\$@/ig, '/*')
                 param.LText = param.LText.replace(/@\$/ig, '*/')
               } else {
                 param.LText = param.LText.replace(/@\$|\$@/ig, '')
               }
 
-              let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText)
-
-              param.LText2 = LText2
-              param.LText1 = LText1
-              param.LText = LText
+              param.exec_type = 'y' // 鍚庡彴瑙g爜
               param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-              param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+              param.secretkey = Utils.encrypt('', param.timestamp)
+              param.LText = Utils.formatOptions(param.LText)
             }
           } else if (btn.OpenType === 'pop') { // 琛ㄥ崟
             if (index !== 0) {
@@ -397,40 +382,32 @@
               param.ID = _formPrimaryId || Utils.getguid()
               param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, cell, columns, this.props.Tab) // 鏁版嵁婧�
               
-              if (this.props.dataManager) { // 鏁版嵁鏉冮檺
+              if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
                 param.LText = param.LText.replace(/\$@/ig, '/*')
                 param.LText = param.LText.replace(/@\$/ig, '*/')
               } else {
                 param.LText = param.LText.replace(/@\$|\$@/ig, '')
               }
 
-              let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText)
-
-              param.LText2 = LText2
-              param.LText1 = LText1
-              param.LText = LText
-
+              param.exec_type = 'y' // 鍚庡彴瑙g爜
               param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-              param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+              param.secretkey = Utils.encrypt('', param.timestamp)
+              param.LText = Utils.formatOptions(param.LText)
             } else if (btn.sql) {
               param.ID = primaryId
               param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, cell, columns, this.props.Tab) // 鏁版嵁婧�
               
-              if (this.props.dataManager) { // 鏁版嵁鏉冮檺
+              if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
                 param.LText = param.LText.replace(/\$@/ig, '/*')
                 param.LText = param.LText.replace(/@\$/ig, '*/')
               } else {
                 param.LText = param.LText.replace(/@\$|\$@/ig, '')
               }
 
-              let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText)
-
-              param.LText2 = LText2
-              param.LText1 = LText1
-              param.LText = LText
-
+              param.exec_type = 'y' // 鍚庡彴瑙g爜
               param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-              param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+              param.secretkey = Utils.encrypt('', param.timestamp)
+              param.LText = Utils.formatOptions(param.LText)
             }
           }
 
@@ -443,7 +420,7 @@
           }
 
           if (param.func === 'sPC_TableData_InUpDe') {
-            param.menuname = `${MenuName ? MenuName + '-' : ''}${btn.label}`
+            param.menuname = btn.logLabel
           }
 
           return param
@@ -950,6 +927,7 @@
           })
           this.updateStatus('over')
         } else {
+          let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID
           if (_LongParam.groups.length > 0) {
             _LongParam.groups.forEach(group => {
               group.sublist = group.sublist.map(cell => {
@@ -957,7 +935,7 @@
                 if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') {
                   let _option = Utils.getSelectQueryOptions(cell)
 
-                  if (this.props.dataManager) { // 鏁版嵁鏉冮檺
+                  if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
                     _option.sql = _option.sql.replace(/\$@/ig, '/*')
                     _option.sql = _option.sql.replace(/@\$/ig, '*/')
                   } else {
@@ -975,12 +953,7 @@
 
                 // 瀛楁鏉冮檺榛戝悕鍗�
                 if (!cell.blacklist || cell.blacklist.length === 0) return cell
-
-                let _black = cell.blacklist.filter(v => {
-                  return this.props.permRoles.indexOf(v) !== -1
-                })
-
-                if (_black.length > 0) {
+                if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
                   cell.hidden = 'true'
                 }
 
@@ -993,7 +966,7 @@
               if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') {
                 let _option = Utils.getSelectQueryOptions(cell)
 
-                if (this.props.dataManager) { // 鏁版嵁鏉冮檺
+                if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
                   _option.sql = _option.sql.replace(/\$@/ig, '/*')
                   _option.sql = _option.sql.replace(/@\$/ig, '*/')
                 } else {
@@ -1007,12 +980,7 @@
 
               // 瀛楁鏉冮檺榛戝悕鍗�
               if (!cell.blacklist || cell.blacklist.length === 0) return cell
-
-              let _black = cell.blacklist.filter(v => {
-                return this.props.permRoles.indexOf(v) !== -1
-              })
-
-              if (_black.length > 0) {
+              if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
                 cell.hidden = 'true'
               }
 
@@ -1182,7 +1150,7 @@
     const { btn, show, style } = this.props
     const { loadingNumber, loading } = this.state
 
-    if (show === 'actionList' || show === 'button') {
+    if (show === 'actionList') {
       return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}>
         <Button
           style={style}
@@ -1208,8 +1176,8 @@
       return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}>
         <Button
           type="link"
-          style={style}
           loading={loading}
+          style={btn.btnstyle || style}
           icon={show === 'text' ? '' : (btn.icon || '')}
           onClick={() => {this.actionTrigger()}}
         >{show === 'icon' && btn.icon ? '' : btn.label}</Button>
@@ -1222,9 +1190,7 @@
 const mapStateToProps = (state) => {
   return {
     tabviews: state.tabviews,
-    menuType: state.editLevel,
-    permRoles: state.permRoles,
-    dataManager: state.dataManager
+    menuType: state.editLevel
   }
 }
 

--
Gitblit v1.8.0